diff options
Diffstat (limited to 'release/scripts/modules/bpy_extras/object_utils.py')
-rw-r--r-- | release/scripts/modules/bpy_extras/object_utils.py | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/release/scripts/modules/bpy_extras/object_utils.py b/release/scripts/modules/bpy_extras/object_utils.py index ab32daa9d67..dbb4a376099 100644 --- a/release/scripts/modules/bpy_extras/object_utils.py +++ b/release/scripts/modules/bpy_extras/object_utils.py @@ -121,18 +121,12 @@ def object_data_add(context, obdata, operator=None, name=None): """ scene = context.scene layer = context.view_layer - layer_collection = context.layer_collection + layer_collection = context.layer_collection or layer.active_layer_collection + scene_collection = layer_collection.collection for ob in layer.objects: ob.select_set(action='DESELECT') - if not layer_collection: - # when there is no collection linked to this view_layer create one - scene_collection = scene.master_collection.collections.new("") - layer_collection = layer.collections.link(scene_collection) - else: - scene_collection = layer_collection.collection - if name is None: name = "Object" if obdata is None else obdata.name |