Part: [skip ci] support of expressions of Euler angles in attachment dialog

This commit is contained in:
wmayer
2020-03-21 14:27:53 +01:00
parent 92d005b26f
commit 1cfe6d2cc7
2 changed files with 48 additions and 1 deletions

View File

@@ -385,6 +385,21 @@ PyObject *RotationPy::getCustomAttributes(const char* attr) const
this->getRotationPtr()->getValue(mat);
return new MatrixPy(mat);
}
else if (strcmp(attr, "Yaw") == 0) {
double A,B,C;
this->getRotationPtr()->getYawPitchRoll(A,B,C);
return PyFloat_FromDouble(A);
}
else if (strcmp(attr, "Pitch") == 0) {
double A,B,C;
this->getRotationPtr()->getYawPitchRoll(A,B,C);
return PyFloat_FromDouble(B);
}
else if (strcmp(attr, "Roll") == 0) {
double A,B,C;
this->getRotationPtr()->getYawPitchRoll(A,B,C);
return PyFloat_FromDouble(C);
}
return 0;
}
@@ -409,7 +424,34 @@ int RotationPy::setCustomAttributes(const char* attr, PyObject* obj)
}
}
}
return 0;
else if (strcmp(attr, "Yaw") == 0) {
if (PyNumber_Check(obj)) {
double V = PyFloat_AsDouble(obj);
double A,B,C;
this->getRotationPtr()->getYawPitchRoll(A,B,C);
this->getRotationPtr()->setYawPitchRoll(V,B,C);
return 1;
}
}
else if (strcmp(attr, "Pitch") == 0) {
if (PyNumber_Check(obj)) {
double V = PyFloat_AsDouble(obj);
double A,B,C;
this->getRotationPtr()->getYawPitchRoll(A,B,C);
this->getRotationPtr()->setYawPitchRoll(A,V,C);
return 1;
}
}
else if (strcmp(attr, "Roll") == 0) {
if (PyNumber_Check(obj)) {
double V = PyFloat_AsDouble(obj);
double A,B,C;
this->getRotationPtr()->getYawPitchRoll(A,B,C);
this->getRotationPtr()->setYawPitchRoll(A,B,V);
return 1;
}
}
return 0;
}
PyObject* RotationPy::number_multiply_handler(PyObject *self, PyObject *other)