1 #ifndef OPENMESH_PYTHON_PROPERTYMANAGER_HH 2 #define OPENMESH_PYTHON_PROPERTYMANAGER_HH 5 #include "OpenMesh/Core/Utils/PropertyManager.hh" 10 BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(retain_overloads, retain, 0, 1)
23 template <class PropertyManager, class IndexHandle>
25 return _self[_handle];
38 template <
class PropertyManager,
class IndexHandle>
40 _self[_handle] = _value;
54 template <
class PropertyManager,
class Iterator>
58 _self[_it.next()] = _value;
61 catch (error_already_set exception) {
76 template <
class PropertyManager,
class Mesh>
78 return PropertyManager::propertyExists(_mesh, _propname);
96 template <
class PropHandle,
class IndexHandle,
class Iterator>
109 bool (*property_exists_poly)(
PolyMesh&,
const char *) = &property_exists<PropertyManager, PolyMesh>;
110 bool (*property_exists_tri )(
TriMesh&,
const char *) = &property_exists<PropertyManager, TriMesh >;
113 class_<PropertyManager, boost::noncopyable>(_name)
114 .def(init<
PolyMesh&,
const char *, optional<bool> >()[with_custodian_and_ward<1,2>()])
115 .def(init<
TriMesh&,
const char *, optional<bool> >()[with_custodian_and_ward<1,2>()])
117 .def(
"swap", &PropertyManager::swap)
118 .def(
"is_valid", &PropertyManager::isValid)
120 .def(
"__bool__", &PropertyManager::operator
bool)
121 .def(
"__nonzero__", &PropertyManager::operator
bool)
123 .def(
"get_raw_property", &PropertyManager::getRawProperty, return_value_policy<copy_const_reference>())
124 .def(
"get_name", &PropertyManager::getName, return_value_policy<copy_const_reference>())
125 .def(
"get_mesh", &PropertyManager::getMesh, return_value_policy<reference_existing_object>())
127 .def(
"retain", retain, retain_overloads())
129 .def(
"__getitem__", getitem)
130 .def(
"__setitem__", setitem)
132 .def(
"set_range", set_range)
134 .def(
"property_exists", property_exists_poly)
135 .def(
"property_exists", property_exists_tri)
136 .staticmethod(
"property_exists")
void propman_set_range(PropertyManager &_self, Iterator _it, object _value)
bool property_exists(Mesh &_mesh, const char *_propname)
object propman_get_item(PropertyManager &_self, IndexHandle _handle)
void expose_property_manager(const char *_name)
void retain(bool doRetain=true)
Disable lifecycle management for this property.
void propman_set_item(PropertyManager &_self, IndexHandle _handle, object _value)