Core/Utils/PropertyManager: Added createIfNotExists factory method.

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@669 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
Hans-Christian Ebke
2012-09-11 18:16:01 +00:00
parent 3bd89949a9
commit 1d29252126

View File

@@ -131,6 +131,18 @@ class PropertyManager {
return *this; return *this;
} }
/**
* Create a property manager for the supplied property and mesh.
* If the property doesn't exist, it is created. In any case,
* lifecycle management is disabled.
*/
static PropertyManager createIfNotExists(MeshT &mesh, const char *propname) {
PROPTYPE dummy_prop;
PropertyManager pm(mesh, propname, mesh.get_property_handle(dummy_prop, propname));
pm.retain();
return std::move(pm);
}
#endif #endif
/** /**