diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-09-23 18:03:34 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-09-23 18:05:55 +0300 |
commit | c34993160da76b6f84f06dc0aa703d09cdfd45ca (patch) | |
tree | baf1f96e11165527bb7ae848a6f2b5ab34d1c619 | |
parent | 982a06ac2225557f3aa2a59250d45942e19accf2 (diff) |
Fix T46220: Add torus has no 'layers' option
Add layers property for all operators using AddObjectHelper
-rw-r--r-- | release/scripts/modules/bpy_extras/object_utils.py | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/release/scripts/modules/bpy_extras/object_utils.py b/release/scripts/modules/bpy_extras/object_utils.py index 78fb6aa8fa2..c2c306e5145 100644 --- a/release/scripts/modules/bpy_extras/object_utils.py +++ b/release/scripts/modules/bpy_extras/object_utils.py @@ -33,6 +33,7 @@ import bpy from bpy.props import ( BoolProperty, + BoolVectorProperty, FloatVectorProperty, ) @@ -136,16 +137,22 @@ 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 use_active_layer: - if v3d and v3d.local_view: - base.layers_from_view(context.space_data) - base.layers[scene.active_layer] = True - else: - base.layers = [True if i == scene.active_layer - else False for i in range(len(scene.layers))] + if operator is not None and any(operator.layers): + base.layers = operator.layers else: - if v3d: - base.layers_from_view(context.space_data) + if use_active_layer: + if v3d and v3d.local_view: + base.layers_from_view(context.space_data) + base.layers[scene.active_layer] = True + else: + base.layers = [True if i == scene.active_layer + else False for i in range(len(scene.layers))] + else: + if v3d: + base.layers_from_view(context.space_data) + + if operator is not None: + operator.layers = base.layers obj_new.matrix_world = add_object_align_init(context, operator) @@ -209,6 +216,12 @@ class AddObjectHelper: name="Rotation", subtype='EULER', ) + layers = BoolVectorProperty( + name="Layers", + size=20, + subtype='LAYER', + options={'HIDDEN', 'SKIP_SAVE'}, + ) @classmethod def poll(self, context): |