bool IsPyTransformEditable(PyObject * pyobject) { if(!IsPyTransform(pyobject)) return false; PyOCIO_Transform * pyobj = reinterpret_cast<PyOCIO_Transform *> (pyobject); return (!pyobj->isconst); }
PyObject * PyOCIO_GroupTransform_push_back(PyObject * self, PyObject * args) { OCIO_PYTRY_ENTER() PyObject* pytransform = 0; if (!PyArg_ParseTuple(args,"O:push_back", &pytransform)) return NULL; GroupTransformRcPtr transform = GetEditableGroupTransform(self); if(!IsPyTransform(pytransform)) throw Exception("GroupTransform.push_back requires a transform as the first arg."); transform->push_back(GetConstTransform(pytransform, true)); Py_RETURN_NONE; OCIO_PYTRY_EXIT(NULL) }
TransformRcPtr GetEditableTransform(PyObject * pyobject) { if(!IsPyTransform(pyobject)) { throw Exception("PyObject must be an OCIO.Transform."); } PyOCIO_Transform * pytransform = reinterpret_cast<PyOCIO_Transform *> (pyobject); if(!pytransform->isconst && pytransform->cppobj) { return *pytransform->cppobj; } throw Exception("PyObject must be an editable OCIO.Transform."); }
ConstTransformRcPtr GetConstTransform(PyObject * pyobject, bool allowCast) { if(!IsPyTransform(pyobject)) { throw Exception("PyObject must be an OCIO.Transform."); } PyOCIO_Transform * pytransform = reinterpret_cast<PyOCIO_Transform *> (pyobject); if(pytransform->isconst && pytransform->constcppobj) { return *pytransform->constcppobj; } if(allowCast && !pytransform->isconst && pytransform->cppobj) { return *pytransform->cppobj; } throw Exception("PyObject must be a valid OCIO.Transform."); }