mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-09 21:53:40 +00:00
Fix #2898. Explicitly check for changed active material in material UI panels.
This commit is contained in:
@@ -59,9 +59,13 @@ class MaterialAttributesData:
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def load(cls):
|
def load(cls):
|
||||||
cls.data = {"attributes": cls.attributes()}
|
cls.data = {"ifc_definition_id": cls.ifc_definition_id(), "attributes": cls.attributes()}
|
||||||
cls.is_loaded = True
|
cls.is_loaded = True
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def ifc_definition_id(cls):
|
||||||
|
return bpy.context.active_object.active_material.BIMObjectProperties.ifc_definition_id
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def attributes(cls):
|
def attributes(cls):
|
||||||
results = []
|
results = []
|
||||||
|
|||||||
@@ -94,4 +94,10 @@ class BIM_PT_material_attributes(Panel):
|
|||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
if not MaterialAttributesData.is_loaded:
|
if not MaterialAttributesData.is_loaded:
|
||||||
MaterialAttributesData.load()
|
MaterialAttributesData.load()
|
||||||
|
elif (
|
||||||
|
context.active_object.active_material.BIMObjectProperties.ifc_definition_id
|
||||||
|
!= MaterialAttributesData.data["ifc_definition_id"]
|
||||||
|
):
|
||||||
|
MaterialAttributesData.load()
|
||||||
|
|
||||||
draw_ui(context, self.layout, "Material", MaterialAttributesData.data["attributes"])
|
draw_ui(context, self.layout, "Material", MaterialAttributesData.data["attributes"])
|
||||||
|
|||||||
@@ -96,7 +96,10 @@ class MaterialPsetsData(Data):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def load(cls):
|
def load(cls):
|
||||||
cls.data = {"psets": cls.psetqtos(tool.Ifc.get_entity(bpy.context.active_object.active_material))}
|
cls.data = {
|
||||||
|
"ifc_definition_id": bpy.context.active_object.active_material.BIMObjectProperties.ifc_definition_id,
|
||||||
|
"psets": cls.psetqtos(tool.Ifc.get_entity(bpy.context.active_object.active_material)),
|
||||||
|
}
|
||||||
cls.is_loaded = True
|
cls.is_loaded = True
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -268,6 +268,11 @@ class BIM_PT_material_psets(Panel):
|
|||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
if not MaterialPsetsData.is_loaded:
|
if not MaterialPsetsData.is_loaded:
|
||||||
MaterialPsetsData.load()
|
MaterialPsetsData.load()
|
||||||
|
elif (
|
||||||
|
context.active_object.active_material.BIMObjectProperties.ifc_definition_id
|
||||||
|
!= MaterialPsetsData.data["ifc_definition_id"]
|
||||||
|
):
|
||||||
|
MaterialPsetsData.load()
|
||||||
|
|
||||||
props = context.active_object.active_material.PsetProperties
|
props = context.active_object.active_material.PsetProperties
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
|
|||||||
@@ -56,9 +56,13 @@ class StyleAttributesData:
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def load(cls):
|
def load(cls):
|
||||||
cls.data = {"attributes": cls.get_attributes()}
|
cls.data = {"ifc_style_id": cls.ifc_style_id(), "attributes": cls.get_attributes()}
|
||||||
cls.is_loaded = True
|
cls.is_loaded = True
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def ifc_style_id(cls):
|
||||||
|
return bpy.context.active_object.active_material.BIMMaterialProperties.ifc_style_id
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_attributes(cls):
|
def get_attributes(cls):
|
||||||
style = tool.Ifc.get().by_id(bpy.context.active_object.active_material.BIMMaterialProperties.ifc_style_id)
|
style = tool.Ifc.get().by_id(bpy.context.active_object.active_material.BIMMaterialProperties.ifc_style_id)
|
||||||
|
|||||||
@@ -115,6 +115,11 @@ class BIM_PT_style_attributes(Panel):
|
|||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
if not StyleAttributesData.is_loaded:
|
if not StyleAttributesData.is_loaded:
|
||||||
StyleAttributesData.load()
|
StyleAttributesData.load()
|
||||||
|
elif (
|
||||||
|
context.active_object.active_material.BIMMaterialProperties.ifc_style_id
|
||||||
|
!= StyleAttributesData.data["ifc_style_id"]
|
||||||
|
):
|
||||||
|
StyleAttributesData.load()
|
||||||
|
|
||||||
obj = context.active_object.active_material
|
obj = context.active_object.active_material
|
||||||
mprops = obj.BIMMaterialProperties
|
mprops = obj.BIMMaterialProperties
|
||||||
|
|||||||
Reference in New Issue
Block a user