diff --git a/src/blenderbim/blenderbim/bim/operator.py b/src/blenderbim/blenderbim/bim/operator.py index 75a8875c5e..5e2fbe31ac 100644 --- a/src/blenderbim/blenderbim/bim/operator.py +++ b/src/blenderbim/blenderbim/bim/operator.py @@ -40,6 +40,21 @@ from mathutils import Vector, Matrix, Euler from math import radians +class SetTab(bpy.types.Operator): + bl_idname = "bim.set_tab" + bl_label = "Set Tab" + bl_options = {"REGISTER", "UNDO"} + bl_description = "Sets the current property tab" + tab: bpy.props.StringProperty() + + def execute(self, context): + if context.area.spaces.active.search_filter: + return {"FINISHED"} + aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)] + aprops.tab = self.tab + return {"FINISHED"} + + class SwitchTab(bpy.types.Operator): bl_idname = "bim.switch_tab" bl_label = "Switch Tab" diff --git a/src/blenderbim/blenderbim/bim/prop.py b/src/blenderbim/blenderbim/bim/prop.py index c51e0611c9..fcd2140ec9 100644 --- a/src/blenderbim/blenderbim/bim/prop.py +++ b/src/blenderbim/blenderbim/bim/prop.py @@ -360,6 +360,8 @@ class BIMAreaProperties(PropertyGroup): tab: EnumProperty(default=0, items=get_tab, name="Tab", update=update_tab) previous_tab: StringProperty(default="PROJECT", name="Previous Tab") alt_tab: StringProperty(default="OBJECT", name="Alt Tab") + active_tab: BoolProperty(default=True, name="Active Tab") + inactive_tab: BoolProperty(default=False, name="Inactive Tab") class BIMProperties(PropertyGroup): diff --git a/src/blenderbim/blenderbim/bim/ui.py b/src/blenderbim/blenderbim/bim/ui.py index 281c86cdfa..0000d17aeb 100644 --- a/src/blenderbim/blenderbim/bim/ui.py +++ b/src/blenderbim/blenderbim/bim/ui.py @@ -281,9 +281,47 @@ class BIM_PT_root(Panel): def draw(self, context): try: aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)] + + row = self.layout.row() + row.scale_y = 0.5 # Yes, we actually do this. + row.operator( + "bim.set_tab", text="", emboss=False, icon_value=blenderbim.bim.icons["IFC"].icon_id + ).tab = "PROJECT" + row.operator("bim.set_tab", text="", emboss=False, icon="FILE_3D").tab = "OBJECT" + row.operator("bim.set_tab", text="", emboss=False, icon="MATERIAL").tab = "MATERIALS" + row.operator("bim.set_tab", text="", emboss=False, icon="DOCUMENTS").tab = "DRAWINGS" + row.operator("bim.set_tab", text="", emboss=False, icon="NETWORK_DRIVE").tab = "SERVICES" + row.operator("bim.set_tab", text="", emboss=False, icon="EDITMODE_HLT").tab = "STRUCTURE" + row.operator("bim.set_tab", text="", emboss=False, icon="NLA").tab = "SCHEDULING" + row.operator("bim.set_tab", text="", emboss=False, icon="PACKAGE").tab = "FM" + row.operator("bim.set_tab", text="", emboss=False, icon="COLLAPSEMENU").tab = "OTHER" + row.operator("bim.set_tab", text="", emboss=False, icon="BLENDER").tab = "BLENDER" + row.operator("bim.switch_tab", text="", emboss=False, icon="UV_SYNC_SELECT") + + # Yes, that's right, we're still doing this. + row = self.layout.row() + row.scale_y = 0.2 + for tab in [ + "PROJECT", + "OBJECT", + "MATERIALS", + "DRAWINGS", + "SERVICES", + "STRUCTURE", + "SCHEDULING", + "FM", + "OTHER", + "BLENDER", + "SWITCH", + ]: + if aprops.tab == tab: + row.prop(aprops, "active_tab", text="", icon="BLANK1") + else: + row.prop(aprops, "inactive_tab", text="", icon="BLANK1", emboss=False) + + aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)] row = self.layout.row(align=True) row.prop(aprops, "tab", text="") - row.operator("bim.switch_tab", text="", icon="UV_SYNC_SELECT") except: pass # Prior to load_post, we may not have any area properties setup