[Bf-blender-cvs] [d4c452ff391] master: Fix T70573: Crash on enter Cycles render preview with 'Scene world' disabled and no world assigned to scene
Philipp Oeser
noreply at git.blender.org
Mon Oct 7 12:27:22 CEST 2019
Commit: d4c452ff3918be8204b7b6bb32fae2cfdc375939
Author: Philipp Oeser
Date: Mon Oct 7 11:31:47 2019 +0200
Branches: master
https://developer.blender.org/rBd4c452ff3918be8204b7b6bb32fae2cfdc375939
Fix T70573: Crash on enter Cycles render preview with 'Scene world'
disabled and no world assigned to scene
BlenderSync::sync_world still relied on a blender world (mixes the world
viewport color with the studio light), for now just take black if no
world is present.
Maybe we should we use the theme color in the future here (seems eevee
does this in that case) -- we'd have to pass down `b_userpref` from
`BlenderSession::render` down to `sync_data > sync_shaders > sync_world`
then afaics.
Reviewed By: jbakker, brecht
Maniphest Tasks: T70573
Differential Revision: https://developer.blender.org/D6005
===================================================================
M intern/cycles/blender/blender_shader.cpp
===================================================================
diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp
index 362155f22ac..22dbc3fba79 100644
--- a/intern/cycles/blender/blender_shader.cpp
+++ b/intern/cycles/blender/blender_shader.cpp
@@ -1340,6 +1340,14 @@ void BlenderSync::sync_world(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d,
graph->connect(background->output("Background"), out->input("Surface"));
}
else if (!new_viewport_parameters.use_scene_world) {
+ float3 world_color;
+ if (b_world) {
+ world_color = get_float3(b_world.color());
+ }
+ else {
+ world_color = make_float3(0.0f, 0.0f, 0.0f);
+ }
+
BackgroundNode *background = new BackgroundNode();
graph->add(background);
@@ -1347,7 +1355,7 @@ void BlenderSync::sync_world(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d,
graph->add(light_path);
MixNode *mix_scene_with_background = new MixNode();
- mix_scene_with_background->color2 = get_float3(b_world.color());
+ mix_scene_with_background->color2 = world_color;
graph->add(mix_scene_with_background);
EnvironmentTextureNode *texture_environment = new EnvironmentTextureNode();
@@ -1369,7 +1377,7 @@ void BlenderSync::sync_world(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d,
MixNode *mix_background_with_environment = new MixNode();
mix_background_with_environment->fac = new_viewport_parameters.studiolight_background_alpha;
- mix_background_with_environment->color1 = get_float3(b_world.color());
+ mix_background_with_environment->color1 = world_color;
graph->add(mix_background_with_environment);
ShaderNode *out = graph->output();
More information about the Bf-blender-cvs
mailing list