7 #ifndef PXR_USD_SDF_PY_LIST_EDITOR_PROXY_H
8 #define PXR_USD_SDF_PY_LIST_EDITOR_PROXY_H
24 #include "pxr/external/boost/python.hpp"
30 template <
class T,
class V>
42 using namespace pxr_boost::python;
45 object result = _callback(_owner, value, op);
49 return std::optional<V>(e());
53 "incorrect return type.");
56 return std::optional<V>();
75 using namespace pxr_boost::python;
78 object result = _callback(value);
82 return std::optional<V>(e());
86 "incorrect return type.");
89 return std::optional<V>();
111 TfPyWrapOnce<Type>(&This::_Wrap);
118 using namespace pxr_boost::python;
120 class_<Type>(_GetName().c_str(), no_init)
121 .def(
"__str__", &This::_GetStr)
122 .add_property(
"isExpired", &Type::IsExpired)
123 .add_property(
"explicitItems",
124 &Type::GetExplicitItems,
125 &This::_SetExplicitProxy)
126 .add_property(
"addedItems",
127 &Type::GetAddedItems,
128 &This::_SetAddedProxy)
129 .add_property(
"prependedItems",
130 &Type::GetPrependedItems,
131 &This::_SetPrependedProxy)
132 .add_property(
"appendedItems",
133 &Type::GetAppendedItems,
134 &This::_SetAppendedProxy)
135 .add_property(
"deletedItems",
136 &Type::GetDeletedItems,
137 &This::_SetDeletedProxy)
138 .add_property(
"orderedItems",
139 &Type::GetOrderedItems,
140 &This::_SetOrderedProxy)
141 .def(
"GetAddedOrExplicitItems", &Type::GetAppliedItems,
142 return_value_policy<TfPySequenceToTuple>())
143 .def(
"GetAppliedItems", &Type::GetAppliedItems,
144 return_value_policy<TfPySequenceToTuple>())
145 .add_property(
"isExplicit", &Type::IsExplicit)
146 .add_property(
"isOrderedOnly", &Type::IsOrderedOnly)
147 .def(
"ApplyEditsToList",
148 &This::_ApplyEditsToList,
149 return_value_policy<TfPySequenceToList>())
150 .def(
"ApplyEditsToList",
151 &This::_ApplyEditsToList2,
152 return_value_policy<TfPySequenceToList>())
154 .def(
"CopyItems", &Type::CopyItems)
155 .def(
"ClearEdits", &Type::ClearEdits)
156 .def(
"ClearEditsAndMakeExplicit", &Type::ClearEditsAndMakeExplicit)
157 .def(
"ContainsItemEdit", &Type::ContainsItemEdit,
158 (
arg(
"item"),
arg(
"onlyAddOrExplicit")=
false))
159 .def(
"RemoveItemEdits", &Type::RemoveItemEdits)
160 .def(
"ReplaceItemEdits", &Type::ReplaceItemEdits)
161 .def(
"ModifyItemEdits", &This::_ModifyEdits)
165 .def(
"Prepend", &Type::Prepend)
166 .def(
"Append", &Type::Append)
167 .def(
"Remove", &Type::Remove)
168 .def(
"Erase", &Type::Erase)
172 static std::string _GetName()
174 std::string
name =
"ListEditorProxy_" +
175 ArchGetDemangled<TypePolicy>();
184 static std::string _GetStr(
const Type&
x)
189 static void _SetExplicitProxy(
Type& x,
const value_vector_type&
v)
191 x.GetExplicitItems() =
v;
194 static void _SetAddedProxy(
Type& x,
const value_vector_type& v)
196 x.GetAddedItems() =
v;
199 static void _SetPrependedProxy(
Type& x,
const value_vector_type& v)
201 x.GetPrependedItems() =
v;
204 static void _SetAppendedProxy(
Type& x,
const value_vector_type& v)
206 x.GetAppendedItems() =
v;
209 static void _SetDeletedProxy(
Type& x,
const value_vector_type& v)
211 x.GetDeletedItems() =
v;
214 static void _SetOrderedProxy(
Type& x,
const value_vector_type& v)
216 x.GetOrderedItems() =
v;
219 static value_vector_type _ApplyEditsToList(
const Type& x,
220 const value_vector_type& v)
222 value_vector_type tmp =
v;
223 x.ApplyEditsToList(&tmp);
227 static value_vector_type _ApplyEditsToList2(
const Type& x,
228 const value_vector_type& v,
231 value_vector_type tmp =
v;
232 x.ApplyEditsToList(&tmp,
245 #endif // PXR_USD_SDF_PY_LIST_EDITOR_PROXY_H
SdfListProxy< TypePolicy > ListProxy
GLsizei const GLchar *const * string
GLsizei const GLfloat * value
Type::ApplyCallback ApplyCallback
SdfPyWrapListEditorProxy()
**But if you need a result
auto arg(const Char *name, const T &arg) -> detail::named_arg< Char, T >
Type::value_vector_type value_vector_type
Type::value_type value_type
TF_API bool TfPyIsNone(pxr_boost::python::object const &obj)
Return true iff obj is None.
SdfPyWrapListEditorProxy< Type > This
std::string TfStringify(const T &v)
Type::TypePolicy TypePolicy
GLuint const GLchar * name
std::optional< V > operator()(const V &value)
ApplyHelper(const T &owner, const pxr_boost::python::object &callback)
Type::ModifyCallback ModifyCallback
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
std::optional< V > operator()(SdfListOpType op, const V &value)
#define PXR_NAMESPACE_CLOSE_SCOPE
ModifyHelper(const pxr_boost::python::object &callback)
TF_API std::string TfStringReplace(const std::string &source, const std::string &from, const std::string &to)