From 28dcbc5185c35d697162f51d1bbd60fe4ea34a40 Mon Sep 17 00:00:00 2001 From: Thomas Gimpel Date: Sun, 28 Jun 2020 19:32:38 +0200 Subject: [PATCH] Part: fix handling of attachment offset rotation changes in attachment editor --- .../AttachmentEditor/TaskAttachmentEditor.py | 11 +++-------- src/Mod/Part/Gui/TaskAttacher.cpp | 17 +++++------------ 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/src/Mod/Part/AttachmentEditor/TaskAttachmentEditor.py b/src/Mod/Part/AttachmentEditor/TaskAttachmentEditor.py index 98b13e0a62..3376f8db88 100644 --- a/src/Mod/Part/AttachmentEditor/TaskAttachmentEditor.py +++ b/src/Mod/Part/AttachmentEditor/TaskAttachmentEditor.py @@ -388,15 +388,10 @@ class AttachmentEditorTaskPanel(FrozenClass): if index >= 0 and index <= 2: plm.Base = pos - rot = plm.Rotation; - (yaw, pitch, roll) = rot.toEuler() - if index==3: - yaw = Q(self.form.attachmentOffsetYaw.text()).getValueAs(deg) - if index==4: - pitch = Q(self.form.attachmentOffsetPitch.text()).getValueAs(deg) - if index==5: - roll = Q(self.form.attachmentOffsetRoll.text()).getValueAs(deg) if index >= 3 and index <= 5: + yaw = Q(self.form.attachmentOffsetYaw.text()).getValueAs(deg) + pitch = Q(self.form.attachmentOffsetPitch.text()).getValueAs(deg) + roll = Q(self.form.attachmentOffsetRoll.text()).getValueAs(deg) rot = App.Rotation(yaw,pitch,roll) plm.Rotation = rot diff --git a/src/Mod/Part/Gui/TaskAttacher.cpp b/src/Mod/Part/Gui/TaskAttacher.cpp index 1482596fbb..796ac121c6 100644 --- a/src/Mod/Part/Gui/TaskAttacher.cpp +++ b/src/Mod/Part/Gui/TaskAttacher.cpp @@ -455,19 +455,12 @@ void TaskAttacher::onAttachmentOffsetChanged(double /*val*/, int idx) pl.setPosition(pos); } - Base::Rotation rot = pl.getRotation(); - double yaw, pitch, roll; - rot.getYawPitchRoll(yaw, pitch, roll); - if (idx == 3) { - yaw = ui->attachmentOffsetYaw->value().getValueAs(Base::Quantity::Degree); - } - if (idx == 4) { - pitch = ui->attachmentOffsetPitch->value().getValueAs(Base::Quantity::Degree); - } - if (idx == 5) { - roll = ui->attachmentOffsetRoll->value().getValueAs(Base::Quantity::Degree); - } if (idx >= 3 && idx <= 5){ + double yaw, pitch, roll; + yaw = ui->attachmentOffsetYaw->value().getValueAs(Base::Quantity::Degree); + pitch = ui->attachmentOffsetPitch->value().getValueAs(Base::Quantity::Degree); + roll = ui->attachmentOffsetRoll->value().getValueAs(Base::Quantity::Degree); + Base::Rotation rot; rot.setYawPitchRoll(yaw,pitch,roll); pl.setRotation(rot); }