Fix bug to prevent users from appending a project library asset twice

This commit is contained in:
Dion Moult
2021-08-07 18:37:45 +10:00
parent bcf82984ce
commit 176e22af8b
3 changed files with 4 additions and 2 deletions
+1 -1
View File
@@ -153,7 +153,7 @@ class IfcImporter:
self.settings_native.set(self.settings_native.INCLUDE_CURVES, True)
self.settings_2d = ifcopenshell.geom.settings()
self.settings_2d.set(self.settings_2d.INCLUDE_CURVES, True)
self.filter_mode = "BLACKLIST"
self.filter_mode = None
self.include_elements = set()
self.exclude_elements = set()
self.project = None
@@ -326,6 +326,8 @@ class AppendLibraryElement(bpy.types.Operator):
library=IfcStore.library_file,
element=IfcStore.library_file.by_id(self.definition),
)
if not element:
return {"FINISHED"}
self.import_type_from_ifc(element, context)
blenderbim.bim.handler.purge_module_data()
return {"FINISHED"}
@@ -11,7 +11,7 @@ class Usecase:
def execute(self):
self.added_elements = set()
if self.settings["element"].is_a("IfcTypeProduct"):
if self.settings["element"].is_a("IfcTypeProduct") and not self.file.by_guid(self.settings["element"].GlobalId):
return self.append_type_product()
def append_type_product(self):