diff options
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/blender/blender_object.cpp | 11 | ||||
-rw-r--r-- | intern/cycles/blender/blender_util.h | 16 |
2 files changed, 22 insertions, 5 deletions
diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp index 432c4aaa078..7dc57c33ed3 100644 --- a/intern/cycles/blender/blender_object.cpp +++ b/intern/cycles/blender/blender_object.cpp @@ -558,11 +558,20 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, float motion_time) bool cancel = false; bool use_portal = false; + uint layer_override = get_layer(b_engine.layer_override()); for(; b_sce && !cancel; b_sce = b_sce.background_set()) { + /* Render layer's scene_layer is affected by local view already, + * which is not a desired behavior here. + */ + uint scene_layers = layer_override ? layer_override : get_layer(b_scene.layers()); for(b_sce.object_bases.begin(b_base); b_base != b_sce.object_bases.end() && !cancel; ++b_base) { BL::Object b_ob = b_base->object(); bool hide = (render_layer.use_viewport_visibility)? b_ob.hide(): b_ob.hide_render(); - uint ob_layer = get_layer(b_base->layers(), b_base->layers_local_view(), render_layer.use_localview, object_is_light(b_ob)); + uint ob_layer = get_layer(b_base->layers(), + b_base->layers_local_view(), + render_layer.use_localview, + object_is_light(b_ob), + scene_layers); hide = hide || !(ob_layer & scene_layer); if(!hide) { diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h index 165242d0dff..bd1c37a7560 100644 --- a/intern/cycles/blender/blender_util.h +++ b/intern/cycles/blender/blender_util.h @@ -196,7 +196,11 @@ static inline uint get_layer(BL::Array<int, 20> array) return layer; } -static inline uint get_layer(BL::Array<int, 20> array, BL::Array<int, 8> local_array, bool use_local, bool is_light = false) +static inline uint get_layer(BL::Array<int, 20> array, + BL::Array<int, 8> local_array, + bool use_local, + bool is_light = false, + uint scene_layers = (1 << 20) - 1) { uint layer = 0; @@ -205,9 +209,13 @@ static inline uint get_layer(BL::Array<int, 20> array, BL::Array<int, 8> local_a layer |= (1 << i); if(is_light) { - /* consider lamps on all local view layers */ - for(uint i = 0; i < 8; i++) - layer |= (1 << (20+i)); + /* Consider light is visible if it was visible without layer + * override, which matches behavior of Blender Internal. + */ + if(layer & scene_layers) { + for(uint i = 0; i < 8; i++) + layer |= (1 << (20+i)); + } } else { for(uint i = 0; i < 8; i++) |