|
SdfSpec Python wrapping utilities. More...
Go to the source code of this file.
Functions | |
template<typename T > | |
Sdf_PySpecDetail::NewVisitor< typename Sdf_PySpecDetail::NewCtor< T > > | SdfMakePySpecConstructor (T *func, const std::string &doc=std::string()) |
Sdf_PySpecDetail::SpecVisitor< false > | SdfPySpec () |
Sdf_PySpecDetail::SpecVisitor< true > | SdfPyAbstractSpec () |
Sdf_PySpecDetail::SpecVisitor< false > | SdfPySpecNoRepr () |
Sdf_PySpecDetail::SpecVisitor< true > | SdfPyAbstractSpecNoRepr () |
SdfSpec Python wrapping utilities.
An SdfSpec subclass is not the representation of scene data. An SdfSpec simply provides an interface to data stored in some internal representation. SdfSpec subclasses are value types and their lifetimes don't reflect the lifetime of the scene data. However, clients still create scene data using the New methods on SdfSpec subclasses.
When wrapping to Python we need to wrap the New methods as the constructors. This used to look like this:
But we can't use TfMakePyConstructor() because an SdfSpec handle is not a weak pointer. Furthermore, we don't have the problem of needing to store a ref pointer in the Python object. But we do still need conversion of spec types to yield the most-derived type in python.
This file introduces a few pxr_boost::python::class_ def visitors to make wrapping specs easy. Spec wrapping should now look like:
If you need a custom repr you can use SdfPySpecNoRepr() or SdfPyAbstractSpecNoRepr() and def("__repr__", ...).
Definition in file pySpec.h.
Sdf_PySpecDetail::NewVisitor< typename Sdf_PySpecDetail::NewCtor< T > > SdfMakePySpecConstructor | ( | T * | func, |
const std::string & | doc = std::string() |
||
) |
|
inline |
|
inline |
|
inline |