Part: [skip ci] support of expressions of Euler angles in attachment dialog
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user