mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-16 21:42:19 +00:00
Systems UI - move buttons to the header to unclutter UI
This commit is contained in:
@@ -17,6 +17,7 @@
|
|||||||
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
|
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
|
import bonsai.tool as tool
|
||||||
from bonsai.bim.module.system.data import SystemData
|
from bonsai.bim.module.system.data import SystemData
|
||||||
import bonsai.bim.module.system.decorator as decorator
|
import bonsai.bim.module.system.decorator as decorator
|
||||||
from bonsai.bim.prop import StrProperty, Attribute
|
from bonsai.bim.prop import StrProperty, Attribute
|
||||||
@@ -31,7 +32,7 @@ from bpy.props import (
|
|||||||
FloatVectorProperty,
|
FloatVectorProperty,
|
||||||
CollectionProperty,
|
CollectionProperty,
|
||||||
)
|
)
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING, Union
|
||||||
|
|
||||||
|
|
||||||
def get_system_class(self: "BIMSystemProperties", context: bpy.types.Context) -> list[tuple[str, str, str]]:
|
def get_system_class(self: "BIMSystemProperties", context: bpy.types.Context) -> list[tuple[str, str, str]]:
|
||||||
@@ -90,6 +91,10 @@ class BIMSystemProperties(PropertyGroup):
|
|||||||
system_class: str
|
system_class: str
|
||||||
should_draw_decorations: bool
|
should_draw_decorations: bool
|
||||||
|
|
||||||
|
@property
|
||||||
|
def active_system_ui_item(self) -> Union[System, None]:
|
||||||
|
return tool.Blender.get_active_uilist_element(self.systems, self.active_system_index)
|
||||||
|
|
||||||
|
|
||||||
class BIMZoneProperties(PropertyGroup):
|
class BIMZoneProperties(PropertyGroup):
|
||||||
attributes: CollectionProperty(name="Attributes", type=Attribute)
|
attributes: CollectionProperty(name="Attributes", type=Attribute)
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ class BIM_PT_systems(Panel):
|
|||||||
op.system = system_id
|
op.system = system_id
|
||||||
|
|
||||||
self.props = tool.System.get_system_props()
|
self.props = tool.System.get_system_props()
|
||||||
|
active_system_item = self.props.active_system_ui_item
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
row.prop(self.props, "should_draw_decorations")
|
row.prop(self.props, "should_draw_decorations")
|
||||||
|
|
||||||
@@ -103,6 +104,20 @@ class BIM_PT_systems(Panel):
|
|||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
prop_with_search(row, self.props, "system_class", text="")
|
prop_with_search(row, self.props, "system_class", text="")
|
||||||
row.operator("bim.add_system", text="", icon="ADD")
|
row.operator("bim.add_system", text="", icon="ADD")
|
||||||
|
if active_system_item:
|
||||||
|
system_id = active_system_item.ifc_definition_id
|
||||||
|
op = row.operator("bim.select_system_products", text="", icon="RESTRICT_SELECT_OFF")
|
||||||
|
op.system = system_id
|
||||||
|
row.operator("bim.assign_system", text="", icon="KEYFRAME_HLT").system = system_id
|
||||||
|
row.operator("bim.unassign_system", text="", icon="KEYFRAME").system = system_id
|
||||||
|
if self.props.edited_system_id == system_id:
|
||||||
|
row.operator("bim.edit_system", text="", icon="CHECKMARK")
|
||||||
|
row.operator("bim.disable_editing_system", text="", icon="CANCEL")
|
||||||
|
else:
|
||||||
|
op = row.operator("bim.enable_editing_system", text="", icon="GREASEPENCIL")
|
||||||
|
op.system = system_id
|
||||||
|
op = row.operator("bim.remove_system", text="", icon="X")
|
||||||
|
op.system = system_id
|
||||||
else:
|
else:
|
||||||
row.operator("bim.load_systems", text="", icon="IMPORT")
|
row.operator("bim.load_systems", text="", icon="IMPORT")
|
||||||
|
|
||||||
@@ -422,26 +437,10 @@ class BIM_UL_systems(UIList):
|
|||||||
):
|
):
|
||||||
if item:
|
if item:
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
row.label(text=item.name, icon=SYSTEM_ICONS[item.ifc_class])
|
|
||||||
system_id = item.ifc_definition_id
|
system_id = item.ifc_definition_id
|
||||||
row.operator("bim.assign_system", text="", icon="ADD").system = item.ifc_definition_id
|
|
||||||
if data.edited_system_id == system_id:
|
if data.edited_system_id == system_id:
|
||||||
op = row.operator("bim.select_system_products", text="", icon="RESTRICT_SELECT_OFF")
|
row.label(text="", icon="GREASEPENCIL")
|
||||||
op.system = system_id
|
row.label(text=item.name, icon=SYSTEM_ICONS[item.ifc_class])
|
||||||
row.operator("bim.edit_system", text="", icon="CHECKMARK")
|
|
||||||
row.operator("bim.disable_editing_system", text="", icon="CANCEL")
|
|
||||||
elif data.edited_system_id:
|
|
||||||
op = row.operator("bim.select_system_products", text="", icon="RESTRICT_SELECT_OFF")
|
|
||||||
op.system = system_id
|
|
||||||
op = row.operator("bim.remove_system", text="", icon="X")
|
|
||||||
op.system = system_id
|
|
||||||
else:
|
|
||||||
op = row.operator("bim.select_system_products", text="", icon="RESTRICT_SELECT_OFF")
|
|
||||||
op.system = system_id
|
|
||||||
op = row.operator("bim.enable_editing_system", text="", icon="GREASEPENCIL")
|
|
||||||
op.system = system_id
|
|
||||||
op = row.operator("bim.remove_system", text="", icon="X")
|
|
||||||
op.system = system_id
|
|
||||||
|
|
||||||
|
|
||||||
class BIM_UL_zones(UIList):
|
class BIM_UL_zones(UIList):
|
||||||
|
|||||||
Reference in New Issue
Block a user