[Bf-blender-cvs] [a72a5809481] master: Cleanup: Simplify Cycles viewport parameters
Sergey Sharybin
noreply at git.blender.org
Wed May 26 11:10:59 CEST 2021
Commit: a72a5809481217de6a6440ed80c7a22bb31a227a
Author: Sergey Sharybin
Date: Wed May 26 11:07:05 2021 +0200
Branches: master
https://developer.blender.org/rBa72a5809481217de6a6440ed80c7a22bb31a227a
Cleanup: Simplify Cycles viewport parameters
Use early output and access shading RNA object only once.
===================================================================
M intern/cycles/blender/blender_viewport.cpp
===================================================================
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();
}
}
More information about the Bf-blender-cvs
mailing list