mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-16 21:42:19 +00:00
See #5949. Only show material psets and classifications if actually editing in the material manager.
Previously, you could disable editing and it would still show irrelevant psets or classifications.
This commit is contained in:
@@ -313,10 +313,8 @@ class BIM_PT_material_classifications(Panel, ReferenceUI):
|
|||||||
if not tool.Ifc.get():
|
if not tool.Ifc.get():
|
||||||
return False
|
return False
|
||||||
props = context.scene.BIMMaterialProperties
|
props = context.scene.BIMMaterialProperties
|
||||||
if props.materials and props.active_material_index < len(props.materials):
|
if props.is_editing and (material := props.active_material) and material.ifc_definition_id:
|
||||||
material = props.materials[props.active_material_index]
|
return True
|
||||||
if material.ifc_definition_id:
|
|
||||||
return True
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
|
|||||||
@@ -124,6 +124,11 @@ class BIMMaterialProperties(PropertyGroup):
|
|||||||
styles: EnumProperty(items=get_styles, name="Styles")
|
styles: EnumProperty(items=get_styles, name="Styles")
|
||||||
contexts: EnumProperty(items=get_contexts, name="Contexts")
|
contexts: EnumProperty(items=get_contexts, name="Contexts")
|
||||||
|
|
||||||
|
@property
|
||||||
|
def active_material(self):
|
||||||
|
if self.active_material_index < len(self.materials):
|
||||||
|
return self.materials[self.active_material_index]
|
||||||
|
|
||||||
|
|
||||||
class BIMObjectMaterialProperties(PropertyGroup):
|
class BIMObjectMaterialProperties(PropertyGroup):
|
||||||
material_type: EnumProperty(items=get_object_material_type, name="Material Type")
|
material_type: EnumProperty(items=get_object_material_type, name="Material Type")
|
||||||
|
|||||||
@@ -402,10 +402,8 @@ class BIM_PT_material_psets(Panel):
|
|||||||
if not ifc_file or ifc_file.schema == "IFC2X3":
|
if not ifc_file or ifc_file.schema == "IFC2X3":
|
||||||
return False # We don't support material psets in IFC2X3 because they suck
|
return False # We don't support material psets in IFC2X3 because they suck
|
||||||
props = context.scene.BIMMaterialProperties
|
props = context.scene.BIMMaterialProperties
|
||||||
if props.materials and props.active_material_index < len(props.materials):
|
if props.is_editing and (material := props.active_material) and material.ifc_definition_id:
|
||||||
material = props.materials[props.active_material_index]
|
return True
|
||||||
if material.ifc_definition_id:
|
|
||||||
return True
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
|
|||||||
Reference in New Issue
Block a user