7#ifndef PXR_USD_SDF_PY_LIST_OP_H
8#define PXR_USD_SDF_PY_LIST_OP_H
11#include "pxr/usd/sdf/listOp.h"
16#include "pxr/external/boost/python.hpp"
18PXR_NAMESPACE_OPEN_SCOPE
29 typedef typename T::ItemType ItemType;
30 typedef typename T::ItemVector ItemVector;
36 TfPyWrapOnce<T>([name]() { SdfPyWrapListOp::_Wrap(name); });
40 static ItemVector _ApplyOperations1(
const T& listOp, ItemVector input) {
41 ItemVector result = input;
42 listOp.ApplyOperations(&result);
45 static pxr_boost::python::object
46 _ApplyOperations2(
const T& outer,
const T& inner) {
47 if (std::optional<T> r = outer.ApplyOperations(inner)) {
48 return pxr_boost::python::object(*r);
50 return pxr_boost::python::object();
54 static size_t _Hash(
const T &self){
58 static void _Wrap(
const std::string& name)
60 using namespace pxr_boost::python;
62 using ItemVector =
typename T::ItemVector;
64 class_<T>(name.c_str())
65 .def(
"__str__", &This::_GetStr)
66 .def(
"__hash__", &This::_Hash)
68 .def(
"Create", &T::Create,
69 (arg(
"prependedItems") = ItemVector(),
70 arg(
"appendedItems") = ItemVector(),
71 arg(
"deletedItems") = ItemVector()))
72 .staticmethod(
"Create")
74 .def(
"CreateExplicit", &T::CreateExplicit,
75 (arg(
"explicitItems") = ItemVector()))
76 .staticmethod(
"CreateExplicit")
81 .def(
"HasItem", &T::HasItem)
83 .def(
"Clear", &T::Clear)
84 .def(
"ClearAndMakeExplicit", &T::ClearAndMakeExplicit)
85 .def(
"ApplyOperations", &This::_ApplyOperations1)
86 .def(
"ApplyOperations", &This::_ApplyOperations2)
88 .add_property(
"explicitItems",
89 make_function(&T::GetExplicitItems,
90 return_value_policy<return_by_value>()),
92 .add_property(
"addedItems",
93 make_function(&T::GetAddedItems,
94 return_value_policy<return_by_value>()),
96 .add_property(
"prependedItems",
97 make_function(&T::GetPrependedItems,
98 return_value_policy<return_by_value>()),
99 &T::SetPrependedItems)
100 .add_property(
"appendedItems",
101 make_function(&T::GetAppendedItems,
102 return_value_policy<return_by_value>()),
103 &T::SetAppendedItems)
104 .add_property(
"deletedItems",
105 make_function(&T::GetDeletedItems,
106 return_value_policy<return_by_value>()),
108 .add_property(
"orderedItems",
109 make_function(&T::GetOrderedItems,
110 return_value_policy<return_by_value>()),
112 .def(
"GetAddedOrExplicitItems",
114 .def(
"GetAppliedItems",
117 .add_property(
"isExplicit", &T::IsExplicit)
123 static std::string _GetStr(
const T& listOp)
130PXR_NAMESPACE_CLOSE_SCOPE
Miscellaneous Utilities for dealing with script.
Helper class for wrapping SdfListOp objects for Python.
A user-extensible hashing mechanism for use with runtime hash tables.
Demangle C++ typenames generated by the typeid() facility.
std::string TfStringify(const T &v)
Convert an arbitrary type into a string.
Definitions of basic string utilities in tf.