mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 23:36:20 +00:00
Small optimization for materials UI
This commit is contained in:
@@ -741,14 +741,15 @@ class ExpandMaterialCategory(bpy.types.Operator):
|
|||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
props = context.scene.BIMMaterialProperties
|
props = context.scene.BIMMaterialProperties
|
||||||
for index, category in [
|
for index, category in (
|
||||||
(i, c)
|
(i, c)
|
||||||
for i, c in enumerate(props.materials)
|
for i, c in enumerate(props.materials)
|
||||||
if c.is_category and (self.expand_all or c.name == self.category)
|
if c.is_category and (self.expand_all or c.name == self.category)
|
||||||
]:
|
):
|
||||||
category.is_expanded = True
|
category.is_expanded = True
|
||||||
if category.name == self.category:
|
if category.name == self.category:
|
||||||
props.active_material_index = index
|
props.active_material_index = index
|
||||||
|
break
|
||||||
core.load_materials(tool.Material, props.material_type)
|
core.load_materials(tool.Material, props.material_type)
|
||||||
# Update UI data as material_styles_data depends on props.materials.
|
# Update UI data as material_styles_data depends on props.materials.
|
||||||
bonsai.bim.handler.refresh_ui_data()
|
bonsai.bim.handler.refresh_ui_data()
|
||||||
@@ -772,14 +773,15 @@ class ContractMaterialCategory(bpy.types.Operator):
|
|||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
props = context.scene.BIMMaterialProperties
|
props = context.scene.BIMMaterialProperties
|
||||||
for index, category in [
|
for index, category in (
|
||||||
(i, c)
|
(i, c)
|
||||||
for i, c in enumerate(props.materials)
|
for i, c in enumerate(props.materials)
|
||||||
if c.is_category and (self.contract_all or c.name == self.category)
|
if c.is_category and (self.contract_all or c.name == self.category)
|
||||||
]:
|
):
|
||||||
category.is_expanded = False
|
category.is_expanded = False
|
||||||
if category.name == self.category:
|
if category.name == self.category:
|
||||||
props.active_material_index = index
|
props.active_material_index = index
|
||||||
|
break
|
||||||
core.load_materials(tool.Material, props.material_type)
|
core.load_materials(tool.Material, props.material_type)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user