Base: improve base python object number protocol

This commit is contained in:
Zheng, Lei
2019-08-25 16:16:18 +08:00
committed by wmayer
parent daf96d29fd
commit 1efadc928e
6 changed files with 233 additions and 123 deletions

View File

@@ -273,6 +273,20 @@ void PlacementPy::setRotation(Py::Object arg)
throw Py::TypeError("either Rotation or tuple of four floats expected");
}
Py::Object PlacementPy::getMatrix(void) const
{
return Py::Matrix(getPlacementPtr()->toMatrix());
}
void PlacementPy::setMatrix(Py::Object arg)
{
Py::Matrix mat;
if (!mat.accepts(arg.ptr()))
throw Py::TypeError("Expect type Matrix");
mat = arg;
getPlacementPtr()->fromMatrix(mat);
}
PyObject *PlacementPy::getCustomAttributes(const char* attr) const
{
// for backward compatibility