Part: fix handling of attachment offset rotation changes in attachment editor

This commit is contained in:
Thomas Gimpel
2020-06-28 19:32:38 +02:00
committed by abdullahtahiriyo
parent d94394bfc2
commit 28dcbc5185
2 changed files with 8 additions and 20 deletions

View File

@@ -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

View File

@@ -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);
}