Fix T49743: Adding torus in edit mode local mode shows error

The 'local' layers were not correctly set when redoing 'add object'
addons using object_utils.py helper (we always want to restore layers
from view in local view, even if we set 'real' layers from operator
afterwards).
This commit is contained in:
Bastien Montagne 2016-10-27 13:23:29 +02:00
parent 5f0933f07a
commit 216a3a3826
Notes: blender-bot 2023-02-14 07:29:21 +01:00
Referenced by issue #49743, Adding torus in edit mode local mode shows error
1 changed files with 3 additions and 1 deletions

View File

@ -137,12 +137,14 @@ def object_data_add(context, obdata, operator=None, use_active_layer=True, name=
if context.space_data and context.space_data.type == 'VIEW_3D':
v3d = context.space_data
if v3d and v3d.local_view:
base.layers_from_view(context.space_data)
if operator is not None and any(operator.layers):
base.layers = operator.layers
else:
if use_active_layer:
if v3d and v3d.local_view:
base.layers_from_view(context.space_data)
base.layers[scene.active_layer] = True
else:
if v3d and not v3d.lock_camera_and_layers: