Fix: Studiolight: Use correct defaults for selected studio light

When selecting Scene World with Cycles, the world background will be missing-texture pink for one frame before showing the correct light.

The issue here appears to be that Cycles queries rna_View3DShading_selected_studio_light_get, which returns the placeholder "Default" value which doesn't have a file path, so the world ends up pink.

Immediately afterwards, the UI code calls rna_View3DShading_studio_light_get, which initializes shading->lookdev_light to the proper default.

The easiest workaround for this is to provide the proper flags when getting the selected studio light, which will not match the placeholder entry and therefore return the proper default.

Pull Request: https://projects.blender.org/blender/blender/pulls/121987
This commit is contained in:
Lukas Stockner
2024-05-23 02:59:56 +02:00
committed by Lukas Stockner
parent de2ec32927
commit 7fbc93faa1

View File

@@ -1309,14 +1309,14 @@ static PointerRNA rna_View3DShading_selected_studio_light_get(PointerRNA *ptr)
View3DShading *shading = (View3DShading *)ptr->data;
StudioLight *sl;
if (shading->type == OB_SOLID && shading->light == V3D_LIGHTING_MATCAP) {
sl = BKE_studiolight_find(shading->matcap, STUDIOLIGHT_FLAG_ALL);
sl = BKE_studiolight_find(shading->matcap, STUDIOLIGHT_TYPE_MATCAP);
}
else if (shading->type == OB_SOLID && shading->light == V3D_LIGHTING_STUDIO) {
sl = BKE_studiolight_find(shading->studio_light, STUDIOLIGHT_FLAG_ALL);
sl = BKE_studiolight_find(shading->studio_light, STUDIOLIGHT_TYPE_STUDIO);
}
else {
/* OB_MATERIAL and OB_RENDER */
sl = BKE_studiolight_find(shading->lookdev_light, STUDIOLIGHT_FLAG_ALL);
sl = BKE_studiolight_find(shading->lookdev_light, STUDIOLIGHT_TYPE_WORLD);
}
return rna_pointer_inherit_refine(ptr, &RNA_StudioLight, sl);
}