diff --git a/src/OpenMesh/Core/Utils/PropertyManager.hh b/src/OpenMesh/Core/Utils/PropertyManager.hh index b5d07764..62d87b76 100644 --- a/src/OpenMesh/Core/Utils/PropertyManager.hh +++ b/src/OpenMesh/Core/Utils/PropertyManager.hh @@ -85,14 +85,17 @@ class PropertyManager { private: // Mesh properties (MPropHandleT<...>) are stored differently than the other properties. - // This class implements different behavior when copying or swapping data from one - // property manager to a another one. + // This class implements different behavior when initializing a property or when + // copying or swapping data from one property manager to a another one. template struct StorageT; // specialization for Mesh Properties template struct StorageT> { + static void initialize(PropertyManager& pm, const Value& initial_value ) { + pm() = initial_value; + } static void copy(const PropertyManager& from, PropertyManager2& to) { *to = *from; } @@ -110,6 +113,9 @@ class PropertyManager { // definition for other Mesh Properties template struct StorageT { + static void initialize(PropertyManager& pm, const Value& initial_value ) { + pm.set_range(pm.mesh_.template all_elements(), initial_value); + } static void copy(const PropertyManager& from, PropertyManager2& to) { from.copy_to(from.mesh_.template all_elements(), to, to.mesh_.template all_elements()); } @@ -190,7 +196,7 @@ class PropertyManager { PropertyManager(const Value& initial_value, PolyConnectivity& mesh, const char *propname) : mesh_(mesh), retain_(true), name_(propname) { if (!mesh_.get_property_handle(prop_, propname)) { PropertyManager::mesh().add_property(prop_, propname); - set_range(mesh_.all_elements(), initial_value); + Storage::initialize(*this, initial_value); } } @@ -215,7 +221,7 @@ class PropertyManager { */ PropertyManager(const Value& initial_value, const PolyConnectivity& mesh) : mesh_(mesh), retain_(false), name_("") { PropertyManager::mesh().add_property(prop_, name_); - set_range(mesh_.all_elements(), initial_value); + Storage::initialize(*this, initial_value); } /**