From 2f843e6ae21fcfacc93c75bd4d5b5bb1eed3af5e Mon Sep 17 00:00:00 2001 From: HellAholic Date: Sat, 7 Dec 2024 15:46:37 +0100 Subject: [PATCH] Update setter and getter Add a direction variable that changes to -1 if the y axis if flipped in the preferences. --- plugins/Tools/TranslateTool/TranslateTool.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/Tools/TranslateTool/TranslateTool.py b/plugins/Tools/TranslateTool/TranslateTool.py index a75ae5fc58..ba0a9c400f 100644 --- a/plugins/Tools/TranslateTool/TranslateTool.py +++ b/plugins/Tools/TranslateTool/TranslateTool.py @@ -84,7 +84,10 @@ def getY(self) -> float: if Selection.hasSelection(): # Note; The switching of z & y is intentional. We display z as up for the user, # But store the data in openGL space. - return float(Selection.getBoundingBox().center.z) + # direction handles the Y flip axis conversions for the UI if user has it enabled. + direction = -1 if bool( + Application.getInstance().getPreferences().getValue("tool/flip_y_axis_tool_handle")) else 1 + return float(Selection.getBoundingBox().center.z) * direction return 0.0 def getZ(self) -> float: @@ -142,7 +145,10 @@ def setY(self, y: str) -> None: the selection bounding box center. :param y: Location in mm. """ - parsed_y = self._parseFloat(y) + # direction handles the Y flip axis conversions for the UI if user has it enabled. + direction = -1 if bool( + Application.getInstance().getPreferences().getValue("tool/flip_y_axis_tool_handle")) else 1 + parsed_y = self._parseFloat(y) * direction bounding_box = Selection.getBoundingBox() if not Float.fuzzyCompare(parsed_y, float(bounding_box.center.z), DIMENSION_TOLERANCE):