diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-03-08 22:50:42 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-03-08 22:50:42 +0400 |
commit | 0f3e1821eae40c7cebfcf199b58370971b57fa35 (patch) | |
tree | aa27b2d484150cd8eff91b2b12792410d370eb36 /release/scripts/modules/bpy_extras/object_utils.py | |
parent | e4253fa2b8aa08b9d185a8cf460a8d68fac7bcb6 (diff) |
Fix #30435: 2.62 Torus Batch building "Bug" or A Experimental Feature?
Python-defined primitives used to be added to all visible layers instead of
adding to active scene layer as it happens with C-defined primitives.
Diffstat (limited to 'release/scripts/modules/bpy_extras/object_utils.py')
-rw-r--r-- | release/scripts/modules/bpy_extras/object_utils.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/release/scripts/modules/bpy_extras/object_utils.py b/release/scripts/modules/bpy_extras/object_utils.py index 66b774e6301..9175d1f9792 100644 --- a/release/scripts/modules/bpy_extras/object_utils.py +++ b/release/scripts/modules/bpy_extras/object_utils.py @@ -86,7 +86,7 @@ def add_object_align_init(context, operator): return location * rotation -def object_data_add(context, obdata, operator=None): +def object_data_add(context, obdata, operator=None, use_active_layer=True): """ Add an object using the view context and preference to to initialize the location, rotation and layer. @@ -111,7 +111,17 @@ def object_data_add(context, obdata, operator=None): base = scene.objects.link(obj_new) base.select = True + v3d = None if context.space_data and context.space_data.type == 'VIEW_3D': + v3d = context.space_data + + if use_active_layer: + if 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 v3d: base.layers_from_view(context.space_data) obj_new.matrix_world = add_object_align_init(context, operator) |