24 #ifndef PXR_USD_SDF_PY_LIST_EDITOR_PROXY_H
25 #define PXR_USD_SDF_PY_LIST_EDITOR_PROXY_H
41 #include <hboost/python.hpp>
47 template <
class T,
class V>
59 using namespace hboost::python;
62 object result = _callback(_owner, value, op);
66 return std::optional<V>(e());
70 "incorrect return type.");
73 return std::optional<V>();
92 using namespace hboost::python;
95 object result = _callback(value);
99 return std::optional<V>(e());
103 "incorrect return type.");
106 return std::optional<V>();
128 TfPyWrapOnce<Type>(&This::_Wrap);
135 using namespace hboost::python;
137 class_<Type>(_GetName().c_str(), no_init)
138 .def(
"__str__", &This::_GetStr)
139 .add_property(
"isExpired", &Type::IsExpired)
140 .add_property(
"explicitItems",
141 &Type::GetExplicitItems,
142 &This::_SetExplicitProxy)
143 .add_property(
"addedItems",
144 &Type::GetAddedItems,
145 &This::_SetAddedProxy)
146 .add_property(
"prependedItems",
147 &Type::GetPrependedItems,
148 &This::_SetPrependedProxy)
149 .add_property(
"appendedItems",
150 &Type::GetAppendedItems,
151 &This::_SetAppendedProxy)
152 .add_property(
"deletedItems",
153 &Type::GetDeletedItems,
154 &This::_SetDeletedProxy)
155 .add_property(
"orderedItems",
156 &Type::GetOrderedItems,
157 &This::_SetOrderedProxy)
158 .def(
"GetAddedOrExplicitItems", &Type::GetAppliedItems,
159 return_value_policy<TfPySequenceToTuple>())
160 .def(
"GetAppliedItems", &Type::GetAppliedItems,
161 return_value_policy<TfPySequenceToTuple>())
162 .add_property(
"isExplicit", &Type::IsExplicit)
163 .add_property(
"isOrderedOnly", &Type::IsOrderedOnly)
164 .def(
"ApplyEditsToList",
165 &This::_ApplyEditsToList,
166 return_value_policy<TfPySequenceToList>())
167 .def(
"ApplyEditsToList",
168 &This::_ApplyEditsToList2,
169 return_value_policy<TfPySequenceToList>())
171 .def(
"CopyItems", &Type::CopyItems)
172 .def(
"ClearEdits", &Type::ClearEdits)
173 .def(
"ClearEditsAndMakeExplicit", &Type::ClearEditsAndMakeExplicit)
174 .def(
"ContainsItemEdit", &Type::ContainsItemEdit,
175 (
arg(
"item"),
arg(
"onlyAddOrExplicit")=
false))
176 .def(
"RemoveItemEdits", &Type::RemoveItemEdits)
177 .def(
"ReplaceItemEdits", &Type::ReplaceItemEdits)
178 .def(
"ModifyItemEdits", &This::_ModifyEdits)
182 .def(
"Prepend", &Type::Prepend)
183 .def(
"Append", &Type::Append)
184 .def(
"Remove", &Type::Remove)
185 .def(
"Erase", &Type::Erase)
192 ArchGetDemangled<TypePolicy>();
206 static void _SetExplicitProxy(
Type& x,
const value_vector_type&
v)
208 x.GetExplicitItems() =
v;
211 static void _SetAddedProxy(
Type& x,
const value_vector_type& v)
213 x.GetAddedItems() =
v;
216 static void _SetPrependedProxy(
Type& x,
const value_vector_type& v)
218 x.GetPrependedItems() =
v;
221 static void _SetAppendedProxy(
Type& x,
const value_vector_type& v)
223 x.GetAppendedItems() =
v;
226 static void _SetDeletedProxy(
Type& x,
const value_vector_type& v)
228 x.GetDeletedItems() =
v;
231 static void _SetOrderedProxy(
Type& x,
const value_vector_type& v)
233 x.GetOrderedItems() =
v;
236 static value_vector_type _ApplyEditsToList(
const Type& x,
237 const value_vector_type& v)
239 value_vector_type tmp =
v;
240 x.ApplyEditsToList(&tmp);
244 static value_vector_type _ApplyEditsToList2(
const Type& x,
245 const value_vector_type& v,
248 value_vector_type tmp =
v;
249 x.ApplyEditsToList(&tmp,
262 #endif // PXR_USD_SDF_PY_LIST_EDITOR_PROXY_H
SdfListProxy< TypePolicy > ListProxy
GLsizei const GLchar *const * string
Type::ApplyCallback ApplyCallback
SdfPyWrapListEditorProxy()
**But if you need a result
ModifyHelper(const hboost::python::object &callback)
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
SdfPyWrapListEditorProxy< Type > This
std::string TfStringify(const T &v)
Type::TypePolicy TypePolicy
GLuint const GLchar * name
std::optional< V > operator()(const V &value)
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
ApplyHelper(const T &owner, const hboost::python::object &callback)
TF_API bool TfPyIsNone(hboost::python::object const &obj)
Return true iff obj is None.
TF_API std::string TfStringReplace(const std::string &source, const std::string &from, const std::string &to)