diff options
author | Sergey Sharybin <sergey@blender.org> | 2021-05-26 12:07:05 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey@blender.org> | 2021-05-26 12:10:56 +0300 |
commit | a72a5809481217de6a6440ed80c7a22bb31a227a (patch) | |
tree | 279d224ad6b4386f2fa282c8f9f9d2a5c27772e0 /intern/cycles/blender/blender_viewport.cpp | |
parent | e6c0e6c2a93f4fb73988fa0559ba9d88017c36a9 (diff) |
Cleanup: Simplify Cycles viewport parameters
Use early output and access shading RNA object only once.
Diffstat (limited to 'intern/cycles/blender/blender_viewport.cpp')
-rw-r--r-- | intern/cycles/blender/blender_viewport.cpp | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/intern/cycles/blender/blender_viewport.cpp b/intern/cycles/blender/blender_viewport.cpp index 73ef5f94720..aac3d41314a 100644 --- a/intern/cycles/blender/blender_viewport.cpp +++ b/intern/cycles/blender/blender_viewport.cpp @@ -32,17 +32,26 @@ BlenderViewportParameters::BlenderViewportParameters() BlenderViewportParameters::BlenderViewportParameters(BL::SpaceView3D &b_v3d) : BlenderViewportParameters() { + if (!b_v3d) { + return; + } + + BL::View3DShading shading = b_v3d.shading(); + /* We only copy the parameters if we are in look dev mode. otherwise * defaults are being used. These defaults mimic normal render settings */ - if (b_v3d && b_v3d.shading().type() == BL::View3DShading::type_RENDERED) { - use_scene_world = b_v3d.shading().use_scene_world_render(); - use_scene_lights = b_v3d.shading().use_scene_lights_render(); - if (!use_scene_world) { - studiolight_rotate_z = b_v3d.shading().studiolight_rotate_z(); - studiolight_intensity = b_v3d.shading().studiolight_intensity(); - studiolight_background_alpha = b_v3d.shading().studiolight_background_alpha(); - studiolight_path = b_v3d.shading().selected_studio_light().path(); - } + if (shading.type() != BL::View3DShading::type_RENDERED) { + return; + } + + use_scene_world = shading.use_scene_world_render(); + use_scene_lights = shading.use_scene_lights_render(); + + if (!use_scene_world) { + studiolight_rotate_z = shading.studiolight_rotate_z(); + studiolight_intensity = shading.studiolight_intensity(); + studiolight_background_alpha = shading.studiolight_background_alpha(); + studiolight_path = shading.selected_studio_light().path(); } } |