24 #ifndef INCLUDE_AR_PY_RESOLVER_CONTEXT
25 #error This file should not be included directly. Include pyResolverContext.h instead
28 #ifndef PXR_USD_AR_PY_RESOLVER_CONTEXT_V1_H
29 #define PXR_USD_AR_PY_RESOLVER_CONTEXT_V1_H
37 #include <boost/python/extract.hpp>
38 #include <boost/python/object.hpp>
41 #include "pxr/usd/ar/api.h"
44 #include "pxr/base/tf/pyLock.h"
45 #include "pxr/base/tf/pyObjWrapper.h"
49 PXR_NAMESPACE_OPEN_SCOPE
56 template <
class Context>
64 template <
class Context>
66 Ar_ConvertResolverContextFromPython(
70 boost::python::extract<const Context&> x(obj);
80 template <
class Context>
82 Ar_ConvertResolverContextToPython(
86 if (
const Context* contextObj = context.
Get<Context>()) {
89 *obj = boost::python::object(*contextObj);
96 typedef std::function<bool(PyObject*, ArResolverContext*)>
97 Ar_MakeResolverContextFromPythonFn;
98 typedef std::function<bool(const ArResolverContext&, TfPyObjWrapper*)>
99 Ar_ResolverContextToPythonFn;
103 Ar_RegisterResolverContextPythonConversion(
104 const Ar_MakeResolverContextFromPythonFn& convertFunc,
105 const Ar_ResolverContextToPythonFn& getObjectFunc);
109 Ar_CanConvertResolverContextFromPython(PyObject* pyObj);
113 Ar_ConvertResolverContextFromPython(PyObject* pyObj);
119 template <
class Context>
123 Ar_RegisterResolverContextPythonConversion(
124 Ar_ConvertResolverContextFromPython<Context>,
125 Ar_ConvertResolverContextToPython<Context>);
130 PXR_NAMESPACE_CLOSE_SCOPE
void ArWrapResolverContextForPython()
Register the specified type as a context object that may be converted from a Python into a ArResolver...
Intended to replace a direct include of Python.h, which causes several build problems with certain co...
Boost Python object wrapper.
An asset resolver context allows clients to provide additional data to the resolver for use during re...
const Context * Get() const
Return pointer to the context object held in this asset resolver context if the context is holding an...