From ed9e45bb7d92f09bbd5907ec90acbc2577a4f645 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Fri, 15 Sep 2023 15:54:56 +0500 Subject: [PATCH] For parametric doors and windows remove "Edit Profile" button from BIM Tool UI to avoid confusion --- .../blenderbim/bim/module/model/workspace.py | 27 +++++++------------ src/blenderbim/blenderbim/tool/model.py | 18 ++++++++++++- 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/src/blenderbim/blenderbim/bim/module/model/workspace.py b/src/blenderbim/blenderbim/bim/module/model/workspace.py index 282f311d3c..f8e3d19c0c 100644 --- a/src/blenderbim/blenderbim/bim/module/model/workspace.py +++ b/src/blenderbim/blenderbim/bim/module/model/workspace.py @@ -24,7 +24,7 @@ import blenderbim.tool as tool import blenderbim.bim.module.type.prop as type_prop from blenderbim.bim.helper import prop_with_search, close_operator_panel from bpy.types import WorkSpaceTool -from blenderbim.bim.module.model.data import AuthoringData, RailingData, RoofData +from blenderbim.bim.module.model.data import AuthoringData from blenderbim.bim.module.drawing.data import DecoratorData from blenderbim.bim.module.model.prop import get_ifc_class @@ -358,9 +358,7 @@ class BimToolUI: row.operator("bim.extend_profile", icon="X", text="").join_type = "" elif ( - (RailingData.is_loaded or not RailingData.load()) - and RailingData.data["pset_data"] - and not context.active_object.BIMRailingProperties.is_editing_path + tool.Model.is_parametric_railing_active() and not context.active_object.BIMRailingProperties.is_editing_path ): # NOTE: should be above "active_representation_type" = "SweptSolid" check # because it could be a SweptSolid too @@ -369,7 +367,8 @@ class BimToolUI: row.operator("bim.enable_editing_railing_path", text="Edit Railing Path") elif AuthoringData.data["active_representation_type"] == "SweptSolid": - add_layout_hotkey_operator(cls.layout, "Edit Profile", "S_E", "") + if not tool.Model.is_parametric_window_active() and not tool.Model.is_parametric_door_active(): + add_layout_hotkey_operator(cls.layout, "Edit Profile", "S_E", "") elif AuthoringData.data["active_class"] in ( "IfcWindow", @@ -390,11 +389,7 @@ class BimToolUI: elif AuthoringData.data["active_class"] in ("IfcSpace",): add_layout_hotkey_operator(cls.layout, "Regen", "S_G", bpy.ops.bim.generate_space.__doc__) - elif ( - (RoofData.is_loaded or not RoofData.load()) - and RoofData.data["pset_data"] - and not context.active_object.BIMRoofProperties.is_editing_path - ): + elif tool.Model.is_parametric_roof_active() and not context.active_object.BIMRoofProperties.is_editing_path: row = cls.layout.row(align=True) row.label(text="", icon=f"EVENT_TAB") row.operator("bim.enable_editing_roof_path", text="Edit Roof Path") @@ -585,22 +580,20 @@ class Hotkey(bpy.types.Operator, tool.Ifc.Operator): # NOTE: placing it before the other operations because railing can also be SweptSolid # and it might conflict with one of the conditions below if ( - (RailingData.is_loaded or not RailingData.load()) - and RailingData.data["pset_data"] + tool.Model.is_parametric_railing_active() and not bpy.context.active_object.BIMRailingProperties.is_editing_path ): bpy.ops.bim.enable_editing_railing_path() return - elif ( - (RoofData.is_loaded or not RoofData.load()) - and RoofData.data["pset_data"] - and not bpy.context.active_object.BIMRoofProperties.is_editing_path - ): + elif tool.Model.is_parametric_roof_active() and not bpy.context.active_object.BIMRoofProperties.is_editing_path: # undo the unselection done above because roof has no usage type bpy.ops.bim.enable_editing_roof_path() return + elif tool.Model.is_parametric_window_active() or tool.Model.is_parametric_door_active(): + return + selected_usages = {} for obj in bpy.context.selected_objects: element = tool.Ifc.get_entity(obj) diff --git a/src/blenderbim/blenderbim/tool/model.py b/src/blenderbim/blenderbim/tool/model.py index 904f7019ed..1c12b9a92a 100644 --- a/src/blenderbim/blenderbim/tool/model.py +++ b/src/blenderbim/blenderbim/tool/model.py @@ -28,8 +28,8 @@ import blenderbim.core.geometry as geometry from mathutils import Matrix, Vector from blenderbim.bim import import_ifc from blenderbim.bim.module.geometry.helper import Helper +from blenderbim.bim.module.model.data import AuthoringData, RailingData, RoofData, WindowData, DoorData import collections -from blenderbim.bim.module.model.data import AuthoringData import json @@ -805,3 +805,19 @@ class Model(blenderbim.core.tool.Model): is_global=True, should_sync_changes_first=False, ) + + @classmethod + def is_parametric_roof_active(cls): + return (RoofData.is_loaded or not RoofData.load()) and RoofData.data["pset_data"] + + @classmethod + def is_parametric_railing_active(cls): + return (RailingData.is_loaded or not RailingData.load()) and RailingData.data["pset_data"] + + @classmethod + def is_parametric_window_active(cls): + return (WindowData.is_loaded or not WindowData.load()) and WindowData.data["pset_data"] + + @classmethod + def is_parametric_door_active(cls): + return (DoorData.is_loaded or not DoorData.load()) and DoorData.data["pset_data"]