mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-24 22:10:00 +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
|
@classmethod
|
||||||
def get_entity(cls, obj: IFC_CONNECTED_TYPE) -> Union[ifcopenshell.entity_instance, None]:
|
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.
|
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)
|
bpy.msgbus.clear_by_owner(obj)
|
||||||
|
|
||||||
material = cls.get_entity(obj)
|
style = cls.get_entity(obj)
|
||||||
style = tool.Style.get_style(obj)
|
if not style:
|
||||||
if material:
|
continue
|
||||||
IfcStore.id_map[material.id()] = obj
|
|
||||||
if style:
|
|
||||||
IfcStore.id_map[style.id()] = obj
|
|
||||||
|
|
||||||
|
IfcStore.id_map[style.id()] = obj
|
||||||
bonsai.bim.handler.subscribe_to(obj, "name", bonsai.bim.handler.name_callback)
|
bonsai.bim.handler.subscribe_to(obj, "name", bonsai.bim.handler.name_callback)
|
||||||
|
|
||||||
@classmethod
|
@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.
|
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:
|
return tool.Ifc.get_entity(obj)
|
||||||
try:
|
|
||||||
return tool.Ifc.get().by_id(ifc_definition_id)
|
|
||||||
except:
|
|
||||||
return
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_style_elements(
|
def get_style_elements(
|
||||||
|
|||||||
Reference in New Issue
Block a user