Fix 3134 : Flip shortcut is now displayed in the toolbar for doors and windows

This commit is contained in:
Gorgious56
2025-01-02 14:02:00 +01:00
parent fb35e80be0
commit ca90ddc0b4
4 changed files with 24 additions and 10 deletions
@@ -2218,7 +2218,7 @@ class OverrideModeSetObject(bpy.types.Operator, tool.Ifc.Operator):
class FlipObject(bpy.types.Operator):
bl_idname = "bim.flip_object"
bl_label = "Flip Object"
bl_description = "Flip object's local axes, keep the position"
bl_description = "Flip Element about its local axes, keep the position"
bl_options = {"REGISTER", "UNDO"}
flip_local_axes: bpy.props.EnumProperty(
+14 -2
View File
@@ -63,14 +63,14 @@ class AuthoringData:
cls.data["relating_type_description"] = cls.relating_type_description() # only after .relating_type_id()
cls.data["predefined_type"] = cls.predefined_type() # only after .relating_type_id()
# only after .ifc_classes()
# Only after .ifc_classes()
cls.data["total_types"] = cls.total_types()
cls.data["total_pages"] = cls.total_pages()
cls.data["next_page"] = cls.next_page()
cls.data["prev_page"] = cls.prev_page()
cls.data["paginated_relating_types"] = cls.paginated_relating_types()
cls.data["type_thumbnail"] = cls.type_thumbnail() # only after .relating_type_id()
cls.data["type_thumbnail"] = cls.type_thumbnail() # Only after .relating_type_id()
cls.data["is_voidable_element"] = cls.is_voidable_element()
cls.data["has_visible_openings"] = cls.has_visible_openings()
cls.data["has_visible_boundaries"] = cls.has_visible_boundaries()
@@ -81,6 +81,9 @@ class AuthoringData:
cls.data["boundary_class"] = cls.boundary_class()
cls.data["selected_material_usages"] = cls.selected_material_usages()
# Only after .active_material_usage() and .active_class()
cls.data["is_flippable_element"] = cls.is_flippable_element()
@classmethod
def default_container(cls) -> str | None:
props = bpy.context.scene.BIMSpatialDecompositionProperties
@@ -159,6 +162,15 @@ class AuthoringData:
element = tool.Ifc.get_entity(active_object)
return element and element.is_a("IfcElement") and not element.is_a("IfcOpeningElement")
@classmethod
def is_flippable_element(cls):
return cls.data["active_material_usage"] in ("LAYER2", "PROFILE") or cls.data["active_class"] in (
"IfcWindow",
"IfcWindowStandardCase",
"IfcDoor",
"IfcDoorStandardCase",
)
@classmethod
def has_visible_openings(cls):
if active_object := tool.Blender.get_active_object():
+1 -1
View File
@@ -548,7 +548,7 @@ class BIM_PT_door(bpy.types.Panel):
else:
row = self.layout.row()
row.label(text="No Door Found")
row.operator("bim.add_door", icon="ADD", text="").obj = ""
row.operator("bim.add_door", icon="ADD", text="")
class BIM_PT_railing(bpy.types.Panel):
@@ -698,10 +698,6 @@ class EditObjectUI:
)
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
add_layout_hotkey_operator(row, "Rotate 90", "S_R", "Rotate the selected Element by 90 degrees", ui_context)
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
add_layout_hotkey_operator(
row, "Flip", "S_F", "Flip Element about its local axes, keep the position", ui_context
)
elif AuthoringData.data["active_material_usage"] == "LAYER3":
if "LAYER2" in AuthoringData.data["selected_material_usages"]:
@@ -711,8 +707,6 @@ class EditObjectUI:
elif AuthoringData.data["active_material_usage"] == "PROFILE":
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
add_layout_hotkey_operator(row, "Extend", "S_E", "", ui_context)
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
add_layout_hotkey_operator(row, "Flip", "S_F", bpy.ops.bim.flip_object.__doc__, ui_context)
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
if AuthoringData.data["active_class"] in (
@@ -758,6 +752,9 @@ class EditObjectUI:
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
add_layout_hotkey_operator(row, "Rotate 90", "S_R", bpy.ops.bim.rotate_90.__doc__, ui_context)
if AuthoringData.data["is_flippable_element"]:
cls.draw_flip(ui_context, row)
if PortData.data["total_ports"] > 0:
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
row.operator(
@@ -905,6 +902,11 @@ class EditObjectUI:
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else row
add_layout_hotkey_operator(row, "Decomposition", "A_D", "Select decomposition", ui_context)
@classmethod
def draw_flip(cls, ui_context, layout) -> None:
row = cls.layout.row(align=True) if ui_context != "TOOL_HEADER" else layout
add_layout_hotkey_operator(row, "Flip", "S_F", bpy.ops.bim.flip_object.__doc__, ui_context)
class Hotkey(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.hotkey"