HDK
|
#include "pxr/pxr.h"
#include "pxr/usd/sdf/api.h"
#include <hboost/python/def_visitor.hpp>
#include <hboost/python/dict.hpp>
#include <hboost/python/errors.hpp>
#include <hboost/python/raw_function.hpp>
#include <hboost/python/pointee.hpp>
#include <hboost/python/to_python_converter.hpp>
#include <hboost/python/tuple.hpp>
#include "pxr/base/tf/pyError.h"
#include "pxr/base/tf/pyUtils.h"
#include "pxr/usd/sdf/declareHandles.h"
#include "pxr/base/tf/tf.h"
#include "pxr/base/tf/diagnostic.h"
#include "pxr/base/tf/stringUtils.h"
#include "pxr/base/arch/demangle.h"
#include <string>
#include <type_traits>
Go to the source code of this file.
Namespaces | |
hboost | |
hboost::python | |
Sdf_PySpecDetail | |
Typedefs | |
typedef PyObject *(* | Sdf_PySpecDetail::_HolderCreator )(const SdfSpec &) |
Functions | |
SDF_API bp::object | Sdf_PySpecDetail::_DummyInit (bp::tuple const &, bp::dict const &) |
template<typename T > | |
Sdf_PySpecDetail::NewVisitor < typename Sdf_PySpecDetail::NewCtor< T > > | SdfMakePySpecConstructor (T *func, const std::string &doc=std::string()) |
SDF_API std::string | Sdf_PySpecDetail::_SpecRepr (const bp::object &, const SdfSpec *) |
SDF_API void | Sdf_PySpecDetail::_RegisterHolderCreator (const std::type_info &, _HolderCreator) |
SDF_API PyObject * | Sdf_PySpecDetail::_CreateHolder (const std::type_info &, const SdfSpec &) |
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 hboost::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 |
|
inline |