mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-10 22:16:41 +00:00
Use utilities to fetch collection hierarchy
I don't think this offers a noticeable performance gain but feels more idiomatic since it is available with the API.
This commit is contained in:
@@ -927,16 +927,7 @@ class OverrideOutlinerDelete(bpy.types.Operator):
|
|||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
def get_collection_objects_and_children(self, collection: bpy.types.Collection) -> dict[str, Any]:
|
def get_collection_objects_and_children(self, collection: bpy.types.Collection) -> dict[str, Any]:
|
||||||
objects = set()
|
return {"objects": set(collection.all_objects), "children": set(collection.children_recursive)}
|
||||||
children = set()
|
|
||||||
queue = [collection]
|
|
||||||
while queue:
|
|
||||||
collection = queue.pop()
|
|
||||||
for obj in collection.objects:
|
|
||||||
objects.add(obj)
|
|
||||||
queue.extend(collection.children)
|
|
||||||
children = children.union(collection.children)
|
|
||||||
return {"objects": objects, "children": children}
|
|
||||||
|
|
||||||
def rollback(self, data):
|
def rollback(self, data):
|
||||||
tool.Ifc.set(data["old_file"])
|
tool.Ifc.set(data["old_file"])
|
||||||
|
|||||||
Reference in New Issue
Block a user