diff --git a/qglview/globject.h b/qglview/globject.h index 9a2f3f2..8e19433 100644 --- a/qglview/globject.h +++ b/qglview/globject.h @@ -143,6 +143,7 @@ public: QMatrix4x4 transform() {return mat_;} void setTransform(const QMatrix4x4 & t); + bool isRawMatrix() {return raw_matrix;} bool isAcceptLight() const {return accept_light;} void setAcceptLight(bool yes) {accept_light = yes;} diff --git a/qglview/globject_editor.cpp b/qglview/globject_editor.cpp index c770009..6be2d39 100644 --- a/qglview/globject_editor.cpp +++ b/qglview/globject_editor.cpp @@ -49,6 +49,7 @@ void GLObjectEditor::setObject(GLObjectBase * o) { ui->groupLight->setEnabled(false); return; } + ui->buttonDiscardRawMatrix->setEnabled(o->isRawMatrix()); active = false; ui->spinPosX->setValue(object->posX()); ui->spinPosY->setValue(object->posY()); @@ -88,15 +89,17 @@ void GLObjectEditor::setObject(GLObjectBase * o) { void GLObjectEditor::objectChanged() { if (!active || object == 0) return; - object->setPosX(ui->spinPosX->value()); - object->setPosY(ui->spinPosY->value()); - object->setPosZ(ui->spinPosZ->value()); - object->setRotationX(ui->spinRotationX->value()); - object->setRotationY(ui->spinRotationY->value()); - object->setRotationZ(ui->spinRotationZ->value()); - object->setScaleX(ui->spinScaleX->value()); - object->setScaleY(ui->spinScaleY->value()); - object->setScaleZ(ui->spinScaleZ->value()); + if (!object->isRawMatrix()) { + object->setPosX(ui->spinPosX->value()); + object->setPosY(ui->spinPosY->value()); + object->setPosZ(ui->spinPosZ->value()); + object->setRotationX(ui->spinRotationX->value()); + object->setRotationY(ui->spinRotationY->value()); + object->setRotationZ(ui->spinRotationZ->value()); + object->setScaleX(ui->spinScaleX->value()); + object->setScaleY(ui->spinScaleY->value()); + object->setScaleZ(ui->spinScaleZ->value()); + } object->setLineWidth(ui->spinLineWidth->value()); object->setVisible(ui->checkVisible->isChecked()); object->setAcceptLight(ui->checkAcceptLight->isChecked()); @@ -131,3 +134,18 @@ void GLObjectEditor::on_spinLightAngleEnd_valueChanged(double v) { if (ui->spinLightAngleStart->value() > v) ui->spinLightAngleStart->setValue(v); } + + +void GLObjectEditor::on_buttonDiscardRawMatrix_clicked() { + if (!active || !object) return; + object->setPosX(ui->spinPosX->value()); + object->setPosY(ui->spinPosY->value()); + object->setPosZ(ui->spinPosZ->value()); + object->setRotationX(ui->spinRotationX->value()); + object->setRotationY(ui->spinRotationY->value()); + object->setRotationZ(ui->spinRotationZ->value()); + object->setScaleX(ui->spinScaleX->value()); + object->setScaleY(ui->spinScaleY->value()); + object->setScaleZ(ui->spinScaleZ->value()); + ui->buttonDiscardRawMatrix->setEnabled(false); +} diff --git a/qglview/globject_editor.h b/qglview/globject_editor.h index abe469c..0b79fe1 100644 --- a/qglview/globject_editor.h +++ b/qglview/globject_editor.h @@ -45,6 +45,7 @@ private slots: void objectChanged(); void on_spinLightAngleStart_valueChanged(double v); void on_spinLightAngleEnd_valueChanged(double v); + void on_buttonDiscardRawMatrix_clicked(); signals: void changed(); diff --git a/qglview/globject_editor.ui b/qglview/globject_editor.ui index 62c2aed..de26c1d 100644 --- a/qglview/globject_editor.ui +++ b/qglview/globject_editor.ui @@ -7,7 +7,7 @@ 0 0 329 - 681 + 707 @@ -26,14 +26,14 @@ 2 - + Position X - + -99999.000000000000000 @@ -43,14 +43,14 @@ - + Position Y - + -99999.000000000000000 @@ -60,14 +60,14 @@ - + Position Z - + -99999.000000000000000 @@ -77,28 +77,28 @@ - + Rotation X - + Rotation Y - + Rotation Z - + -180.000000000000000 @@ -108,7 +108,7 @@ - + -180.000000000000000 @@ -118,7 +118,7 @@ - + -180.000000000000000 @@ -128,28 +128,28 @@ - + Scale X - + Scale Y - + Scale Z - + 4 @@ -168,7 +168,7 @@ - + 4 @@ -187,7 +187,7 @@ - + 4 @@ -206,14 +206,14 @@ - + Render mode - + @@ -237,35 +237,35 @@ - + Visible - + Accept light - + Accept fog - + Line width - + 0.000000000000000 @@ -281,21 +281,21 @@ - + Cast shadows - + Receive shadows - + Light @@ -622,6 +622,16 @@ + + + + false + + + Discard raw transform + + +