diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2019-10-07 12:31:47 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2019-10-07 13:26:25 +0300 |
commit | d4c452ff3918be8204b7b6bb32fae2cfdc375939 (patch) | |
tree | 3e834054b2a5816642abffff35add9798c0c089c /intern | |
parent | 60f0a94ab21c0120c091b3c0369dfff8fa9e2ca8 (diff) |
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
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/blender/blender_shader.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
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(); |