mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
Optimise import and editing for files with lots of aggregations
This commit is contained in:
@@ -1308,18 +1308,10 @@ class IfcImporter:
|
||||
except:
|
||||
# Occurs when reloading a project
|
||||
pass
|
||||
for collection in (
|
||||
bpy.context.view_layer.layer_collection.children[self.project["blender"].name]
|
||||
.children[self.aggregate_collection.name]
|
||||
.children
|
||||
):
|
||||
collection.hide_viewport = True
|
||||
bpy.context.view_layer.layer_collection.children[self.project["blender"].name].children[
|
||||
self.opening_collection.name
|
||||
].hide_viewport = True
|
||||
bpy.context.view_layer.layer_collection.children[self.project["blender"].name].children[
|
||||
self.type_collection.name
|
||||
].hide_viewport = True
|
||||
project_collection = bpy.context.view_layer.layer_collection.children[self.project["blender"].name]
|
||||
project_collection.children[self.aggregate_collection.name].hide_viewport = True
|
||||
project_collection.children[self.opening_collection.name].hide_viewport = True
|
||||
project_collection.children[self.type_collection.name].hide_viewport = True
|
||||
|
||||
def create_presentation_layers(self):
|
||||
for assignment in self.file.by_type("IfcPresentationLayerAssignment"):
|
||||
|
||||
@@ -2265,7 +2265,6 @@ class CreateAggregate(bpy.types.Operator):
|
||||
project.collection.children.link(aggregates)
|
||||
for aggregate_collection in [c for c in project.children if "Aggregates" in c.name]:
|
||||
aggregate_collection.collection.children.link(aggregate)
|
||||
aggregate_collection.children[aggregate.name].hide_viewport = True
|
||||
break
|
||||
break
|
||||
for obj in bpy.context.selected_objects:
|
||||
@@ -2296,9 +2295,7 @@ class EditAggregate(bpy.types.Operator):
|
||||
bpy.context.view_layer.objects[obj.name].hide_viewport = True
|
||||
for project in [c for c in bpy.context.view_layer.layer_collection.children if "IfcProject" in c.name]:
|
||||
for aggregate_collection in [c for c in project.children if "Aggregates" in c.name]:
|
||||
for aggregate in [c for c in aggregate_collection.children if c.name == obj.instance_collection.name]:
|
||||
aggregate.hide_viewport = False
|
||||
break
|
||||
aggregate_collection.hide_viewport = False
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -2312,8 +2309,8 @@ class SaveAggregate(bpy.types.Operator):
|
||||
names = [c.name for c in obj.users_collection]
|
||||
for project in [c for c in bpy.context.view_layer.layer_collection.children if "IfcProject" in c.name]:
|
||||
for aggregate_collection in [c for c in project.children if "Aggregates" in c.name]:
|
||||
aggregate_collection.hide_viewport = True
|
||||
for collection in [c for c in aggregate_collection.children if c.name in names]:
|
||||
collection.hide_viewport = True
|
||||
aggregate = collection.collection
|
||||
break
|
||||
if not aggregate:
|
||||
|
||||
Reference in New Issue
Block a user