Skip to content

Commit

Permalink
Update setter and getter
Browse files Browse the repository at this point in the history
Add a direction variable that changes to -1 if the y axis if flipped in the preferences.
  • Loading branch information
HellAholic committed Dec 7, 2024
1 parent 1d021be commit 2f843e6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions plugins/Tools/TranslateTool/TranslateTool.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 2f843e6

Please sign in to comment.