Spatial aggregations are auto assigned when you create them. Neat.

This commit is contained in:
Dion Moult
2021-04-15 19:33:01 +10:00
parent 65d0abd072
commit bcfc97037c
2 changed files with 3 additions and 1 deletions
@@ -39,7 +39,8 @@ class AssignObject(bpy.types.Operator):
self.remove_collection(bpy.context.scene.collection, spatial_collection)
for collection in bpy.data.collections:
if collection == relating_collection:
collection.children.link(spatial_collection)
if not collection.children.get(spatial_collection.name):
collection.children.link(spatial_collection)
continue
self.remove_collection(collection, spatial_collection)
else:
@@ -153,6 +153,7 @@ class AssignClass(bpy.types.Operator):
collection.objects.link(obj)
if parent_collection:
parent_collection.children.link(collection)
bpy.ops.bim.assign_object(related_object=obj.name, relating_object=parent_collection.name)
else:
bpy.context.scene.collection.children.link(collection)