mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Prevent adding name callback to non-ifc blender materials
Also removing one more artifact from #4843
This commit is contained in:
@@ -96,7 +96,7 @@ class Ifc(bonsai.core.tool.Ifc):
|
||||
|
||||
@classmethod
|
||||
def get_entity(cls, obj: IFC_CONNECTED_TYPE) -> Union[ifcopenshell.entity_instance, None]:
|
||||
"""Get linked IFC entity based on obj's BIMObjectProperties.ifc_definition_id.
|
||||
"""Get linked IFC entity based on obj's ifc_definition_id.
|
||||
|
||||
Return None if object is not linked to IFC or it's linked to non-existent element.
|
||||
"""
|
||||
@@ -172,13 +172,11 @@ class Ifc(bonsai.core.tool.Ifc):
|
||||
|
||||
bpy.msgbus.clear_by_owner(obj)
|
||||
|
||||
material = cls.get_entity(obj)
|
||||
style = tool.Style.get_style(obj)
|
||||
if material:
|
||||
IfcStore.id_map[material.id()] = obj
|
||||
if style:
|
||||
IfcStore.id_map[style.id()] = obj
|
||||
style = cls.get_entity(obj)
|
||||
if not style:
|
||||
continue
|
||||
|
||||
IfcStore.id_map[style.id()] = obj
|
||||
bonsai.bim.handler.subscribe_to(obj, "name", bonsai.bim.handler.name_callback)
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -149,11 +149,7 @@ class Style(bonsai.core.tool.Style):
|
||||
|
||||
Return None if material is not linked to IFC or it's linked to non-existent element.
|
||||
"""
|
||||
if ifc_definition_id := obj.BIMStyleProperties.ifc_definition_id:
|
||||
try:
|
||||
return tool.Ifc.get().by_id(ifc_definition_id)
|
||||
except:
|
||||
return
|
||||
return tool.Ifc.get_entity(obj)
|
||||
|
||||
@classmethod
|
||||
def get_style_elements(
|
||||
|
||||
Reference in New Issue
Block a user