Skip to content

Commit

Permalink
Merge pull request #983 from Ultimaker/translatetool_flip_y
Browse files Browse the repository at this point in the history
TranslateTool.py update setter and getter to allow for Y axis flip to show expected values in UI for Y
  • Loading branch information
HellAholic authored Jan 23, 2025
2 parents 1d021be + 2f843e6 commit a986eba
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 a986eba

Please sign in to comment.