Thumbnails auto load when projects are loaded.

This commit is contained in:
Dion Moult
2022-10-13 10:19:09 +11:00
parent cdffeba4cc
commit 19b718cdf5
2 changed files with 10 additions and 0 deletions
@@ -86,6 +86,7 @@ def update_icon_id(self, context, browser=False):
def update_ifc_class(self, context):
bpy.ops.bim.load_type_thumbnails(ifc_class=self.ifc_class)
AuthoringData.data["relating_types_ids"] = AuthoringData.relating_types()
AuthoringData.data["type_thumbnail"] = AuthoringData.type_thumbnail()
@@ -56,6 +56,10 @@ class CreateProject(bpy.types.Operator):
props = context.scene.BIMProjectProperties
template = None if props.template_file == "0" else props.template_file
core.create_project(tool.Ifc, tool.Project, schema=props.export_schema, template=template)
# Load thumbnails for the first time
if tool.Ifc.get().by_type("IfcElementType"):
ifc_class = sorted(tool.Ifc.get().by_type("IfcElementType"), key=lambda e: e.is_a())[0].is_a()
bpy.ops.bim.load_type_thumbnails(ifc_class=ifc_class)
def rollback(self, data):
IfcStore.file = None
@@ -591,6 +595,11 @@ class LoadProjectElements(bpy.types.Operator):
settings.logger.info("Import finished in {:.2f} seconds".format(time.time() - start))
print("Import finished in {:.2f} seconds".format(time.time() - start))
context.scene.BIMProjectProperties.is_loading = False
# Load thumbnails for the first time
if tool.Ifc.get().by_type("IfcElementType"):
ifc_class = sorted(tool.Ifc.get().by_type("IfcElementType"), key=lambda e: e.is_a())[0].is_a()
bpy.ops.bim.load_type_thumbnails(ifc_class=ifc_class)
return {"FINISHED"}
def get_decomposition_elements(self):