mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
New icon tabbed interface so you don't need to click twice to change tab.
This commit is contained in:
@@ -40,6 +40,21 @@ from mathutils import Vector, Matrix, Euler
|
|||||||
from math import radians
|
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):
|
class SwitchTab(bpy.types.Operator):
|
||||||
bl_idname = "bim.switch_tab"
|
bl_idname = "bim.switch_tab"
|
||||||
bl_label = "Switch Tab"
|
bl_label = "Switch Tab"
|
||||||
|
|||||||
@@ -360,6 +360,8 @@ class BIMAreaProperties(PropertyGroup):
|
|||||||
tab: EnumProperty(default=0, items=get_tab, name="Tab", update=update_tab)
|
tab: EnumProperty(default=0, items=get_tab, name="Tab", update=update_tab)
|
||||||
previous_tab: StringProperty(default="PROJECT", name="Previous Tab")
|
previous_tab: StringProperty(default="PROJECT", name="Previous Tab")
|
||||||
alt_tab: StringProperty(default="OBJECT", name="Alt 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):
|
class BIMProperties(PropertyGroup):
|
||||||
|
|||||||
@@ -281,9 +281,47 @@ class BIM_PT_root(Panel):
|
|||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
try:
|
try:
|
||||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
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 = self.layout.row(align=True)
|
||||||
row.prop(aprops, "tab", text="")
|
row.prop(aprops, "tab", text="")
|
||||||
row.operator("bim.switch_tab", text="", icon="UV_SYNC_SELECT")
|
|
||||||
except:
|
except:
|
||||||
pass # Prior to load_post, we may not have any area properties setup
|
pass # Prior to load_post, we may not have any area properties setup
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user