From 998f9c6a1ebae8da8f041d50a240cdd76506c8d1 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Tue, 23 Apr 2024 16:25:29 +0500 Subject: [PATCH] make styles ui more similar to profiles and materials ui before - https://i.imgur.com/bTbyt2t.png after - https://i.imgur.com/U53h8Yh.png --- .../blenderbim/bim/module/style/ui.py | 41 ++++++++++--------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/src/blenderbim/blenderbim/bim/module/style/ui.py b/src/blenderbim/blenderbim/bim/module/style/ui.py index 0804098577b..5c1bdf06a9b 100644 --- a/src/blenderbim/blenderbim/bim/module/style/ui.py +++ b/src/blenderbim/blenderbim/bim/module/style/ui.py @@ -44,19 +44,33 @@ def draw(self, context): self.props = context.scene.BIMStylesProperties - if self.props.is_editing: - row = self.layout.row(align=True) - row.label(text="{} {}s".format(len(self.props.styles), self.props.style_type), icon="SHADING_RENDERED") - if not self.props.is_adding: - row.operator("bim.enable_adding_presentation_style", text="", icon="ADD") - row.operator("bim.disable_editing_styles", text="", icon="CANCEL") - else: + if not self.props.is_editing: row = self.layout.row(align=True) row.label(text="{} Styles".format(StylesData.data["total_styles"]), icon="SHADING_RENDERED") blenderbim.bim.helper.prop_with_search(row, self.props, "style_type", text="") row.operator("bim.load_styles", text="", icon="IMPORT").style_type = self.props.style_type return + active_style = self.props.styles and self.props.active_style_index < len(self.props.styles) + row = self.layout.row(align=True) + row.label(text="{} {}s".format(len(self.props.styles), self.props.style_type), icon="SHADING_RENDERED") + row.operator("bim.disable_editing_styles", text="", icon="CANCEL") + + row = self.layout.row(align=True) + row.alignment = "RIGHT" + if not self.props.is_adding: + row.operator("bim.enable_adding_presentation_style", text="", icon="ADD") + if active_style: + style = self.props.styles[self.props.active_style_index] + material_name = StylesData.data["styles_to_blender_material_names"][self.props.active_style_index] + material = bpy.data.materials[material_name] + + row.operator("bim.duplicate_style", text="", icon="DUPLICATE").style = style.ifc_definition_id + row.operator("bim.select_by_style", text="", icon="RESTRICT_SELECT_OFF").style = style.ifc_definition_id + op = row.operator("bim.enable_editing_style", text="", icon="GREASEPENCIL") + op.style = style.ifc_definition_id + row.operator("bim.remove_style", text="", icon="X").style = style.ifc_definition_id + self.layout.template_list("BIM_UL_styles", "", self.props, "styles", self.props, "active_style_index") # adding a new IfcSurfaceStyle @@ -77,18 +91,7 @@ def draw(self, context): row.operator("bim.disable_adding_presentation_style", text="", icon="CANCEL") # style ui tools - if self.props.styles and self.props.active_style_index < len(self.props.styles): - row = self.layout.row(align=True) - style = self.props.styles[self.props.active_style_index] - material_name = StylesData.data["styles_to_blender_material_names"][self.props.active_style_index] - material = bpy.data.materials[material_name] - - op = row.operator("bim.enable_editing_style", text="Edit Style", icon="GREASEPENCIL") - op.style = style.ifc_definition_id - row.operator("bim.duplicate_style", text="", icon="DUPLICATE").style = style.ifc_definition_id - row.operator("bim.select_by_style", text="", icon="RESTRICT_SELECT_OFF").style = style.ifc_definition_id - row.operator("bim.remove_style", text="", icon="X").style = style.ifc_definition_id - + if active_style: row = self.layout.row(align=True) row.prop(material.BIMStyleProperties, "active_style_type", icon="SHADING_RENDERED", text="") op = row.operator("bim.update_current_style", icon="FILE_REFRESH", text="")