From fba23029ff5a79e1e703d98b3daf1cff5a41e271 Mon Sep 17 00:00:00 2001 From: Roy-043 Date: Fri, 26 Jan 2024 10:43:42 +0100 Subject: [PATCH] Arch: BuildingPart fix setEdit and unsetEdit The Transform option from the Tree view context menu did not work. --- src/Mod/Arch/ArchBuildingPart.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Mod/Arch/ArchBuildingPart.py b/src/Mod/Arch/ArchBuildingPart.py index c7fa948cf0..7a1cf4a71d 100644 --- a/src/Mod/Arch/ArchBuildingPart.py +++ b/src/Mod/Arch/ArchBuildingPart.py @@ -883,8 +883,12 @@ class ViewProviderBuildingPart: return True def setEdit(self, vobj, mode): - # For some reason mode is always 0. - # Using FreeCADGui.getUserEditMode() as a workaround. + # mode == 1 if Transform is selected in the Tree view contex menu. + # mode == 2 has been added for consistency. + if mode == 1 or mode == 2: + return None + # For some reason mode is always 0 if the object is double-clicked in + # the Tree view. Using FreeCADGui.getUserEditMode() as a workaround. if FreeCADGui.getUserEditMode() in ("Transform", "Cutting"): return None @@ -892,8 +896,8 @@ class ViewProviderBuildingPart: return False # Return `False` as we don't want to enter edit mode. def unsetEdit(self, vobj, mode): - # For some reason mode is always 0. - # Using FreeCADGui.getUserEditMode() as a workaround. + if mode == 1 or mode == 2: + return None if FreeCADGui.getUserEditMode() in ("Transform", "Cutting"): return None