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")
This class is intended to manage the lifecycle of properties.
Definition: PropertyManager.hh:94
object propman_get_item(PropertyManager &_self, IndexHandle _handle)
Implementation of Python's __getitem__ magic method.
Definition: PropertyManager.hh:24
void expose_property_manager(const char *_name)
Expose a property manager type to Python.
Definition: PropertyManager.hh:97
bool property_exists(Mesh &_mesh, const char *_propname)
Thin wrapper for propertyExists.
Definition: PropertyManager.hh:77
Polygonal mesh based on the ArrayKernel.
Definition: PolyMesh_ArrayKernelT.hh:98
Triangle mesh based on the ArrayKernel.
Definition: TriMesh_ArrayKernelT.hh:98
void propman_set_range(PropertyManager &_self, Iterator _it, object _value)
Conveniently set the property value for an entire range of mesh items using a Python iterator...
Definition: PropertyManager.hh:55
void propman_set_item(PropertyManager &_self, IndexHandle _handle, object _value)
Implementation of Python's __setitem__ magic method.
Definition: PropertyManager.hh:39
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:64
void retain(bool doRetain=true)
Disable lifecycle management for this property.
Definition: PropertyManager.hh:340