Skip to content

Commit

Permalink
Leave the connections intact
Browse files Browse the repository at this point in the history
Removing elements leads to unstable behavior, so rather have a solid base that just resets to 0 than a flaky front
  • Loading branch information
HellAholic committed Dec 7, 2024
1 parent a23e5e8 commit ad5366c
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 7 deletions.
11 changes: 10 additions & 1 deletion plugins/Tools/RotateTool/RotateTool.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,15 @@ def setRZ(self, rz: str) -> None:
self._rotateModel(angle, Vector.Unit_Z)
self.propertyChanged.emit()

def getRX(self) -> float:
return 0

def getRY(self) -> float:
return 0

def getRZ(self) -> float:
return 0

def _onSelectedFaceChanged(self):
if not self._select_face_mode:
return
Expand Down Expand Up @@ -422,7 +431,7 @@ def _rotateModel(self, angle, vector_unit) -> None:
for node in self._getSelectedObjectsWithoutSelectedAncestors():
self._saved_node_positions.append((node, node.getPosition()))

# Rotate around the saved centeres of all selected nodes
# Rotate around the saved centers of all selected nodes
if len(self._saved_node_positions) > 1:
op = GroupedOperation()
for node, position in self._saved_node_positions:
Expand Down
77 changes: 71 additions & 6 deletions plugins/Tools/RotateTool/RotateTool.qml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ Item
height: childrenRect.height
UM.I18nCatalog { id: catalog; name: "uranium"}

property string xText
property string yText
property string zText
property string snapText

//Rounds a floating point number to 4 decimals. This prevents floating
Expand Down Expand Up @@ -209,15 +212,28 @@ Item
width: UM.Theme.getSize("setting_control").width
height: UM.Theme.getSize("setting_control").height
unit: "degrees"
text: ""
text: xText

validator: UM.FloatValidator
{
maxBeforeDecimal: 3
maxAfterDecimal: 2
}
onEditingFinished:
{
var modified_text = text.replace(",", ".") // User convenience. We use dots for decimal values
if(text !="")
{
UM.Controller.setProperty("RX", modified_text)
text =""
text = "0"
}
}
onActiveFocusChanged:
{
if(!activeFocus && text =="")
{
xText = 0.1; // Need to change it to something else so we can force it to getvalue
xText = 0
}
}
}
Expand All @@ -228,16 +244,30 @@ Item
width: UM.Theme.getSize("setting_control").width
height: UM.Theme.getSize("setting_control").height
unit: "degrees"
text: ""
text: yText

validator: UM.FloatValidator
{
maxBeforeDecimal: 3
maxAfterDecimal: 2
}
onEditingFinished:
{
var modified_text = text.replace(",", ".") // User convenience. We use dots for decimal values
if(text !="")
{
// Yes this is intentional. Y & Z are flipped between model axes and build plate axes
UM.Controller.setProperty("RZ", modified_text)
text =""
text = "0"
}
}
onActiveFocusChanged:
{
if(!activeFocus && text =="")
{
yText = 0.1; // Need to change it to something else so we can force it to getvalue
// Yes this is intentional. Y & Z are flipped between model axes and build plate axes
yText = 0
}
}
}
Expand All @@ -248,16 +278,30 @@ Item
width: UM.Theme.getSize("setting_control").width
height: UM.Theme.getSize("setting_control").height
unit: "degrees"
text: ""
text: zText

validator: UM.FloatValidator
{
maxBeforeDecimal: 3
maxAfterDecimal: 2
}
onEditingFinished:
{
var modified_text = text.replace(",", ".") // User convenience. We use dots for decimal values
if(text !="")
{
// Yes this is intentional. Y & Z are flipped between model axes and build plate axes
UM.Controller.setProperty("RY", modified_text)
text = ""
text = "0"
}
}
onActiveFocusChanged:
{
if(!activeFocus && text =="")
{
zText = 0.1; // Need to change it to something else so we can force it to getvalue
// Yes this is intentional. Y & Z are flipped between model axes and build plate axes
zText = 0
}
}
}
Expand All @@ -284,4 +328,25 @@ Item
property: "snapText"
value: base.roundFloat(UM.Controller.properties.getValue("RotationSnapAngle"), 2)
}

Binding
{
target: base
property: "xText"
value: base.roundFloat(UM.Controller.properties.getValue("RX"), 2)
}

Binding
{
target: base
property: "zText"
value: base.roundFloat(UM.Controller.properties.getValue("RY"), 2)
}

Binding
{
target: base
property: "yText"
value: base.roundFloat(UM.Controller.properties.getValue("RZ"), 2)
}
}

0 comments on commit ad5366c

Please sign in to comment.