mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +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():
|
||||
return False
|
||||
props = context.scene.BIMMaterialProperties
|
||||
if props.materials and props.active_material_index < len(props.materials):
|
||||
material = props.materials[props.active_material_index]
|
||||
if material.ifc_definition_id:
|
||||
return True
|
||||
if props.is_editing and (material := props.active_material) and material.ifc_definition_id:
|
||||
return True
|
||||
return False
|
||||
|
||||
def draw(self, context):
|
||||
|
||||
@@ -124,6 +124,11 @@ class BIMMaterialProperties(PropertyGroup):
|
||||
styles: EnumProperty(items=get_styles, name="Styles")
|
||||
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):
|
||||
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":
|
||||
return False # We don't support material psets in IFC2X3 because they suck
|
||||
props = context.scene.BIMMaterialProperties
|
||||
if props.materials and props.active_material_index < len(props.materials):
|
||||
material = props.materials[props.active_material_index]
|
||||
if material.ifc_definition_id:
|
||||
return True
|
||||
if props.is_editing and (material := props.active_material) and material.ifc_definition_id:
|
||||
return True
|
||||
return False
|
||||
|
||||
def draw(self, context):
|
||||
|
||||
Reference in New Issue
Block a user