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
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user