Merge branch 'assignment_property_fix' into 'master'

Assignment property fix

Closes #50

See merge request OpenMesh/OpenMesh!158
This commit is contained in:
Jan Möbius
2018-03-19 16:21:25 +01:00
2 changed files with 134 additions and 42 deletions

View File

@@ -744,48 +744,34 @@ private:
{ {
//mesh has no points? //mesh has no points?
} }
if(this->get_property_handle(vertex_normals_, refcount_vnormals_ = this->get_property_handle(vertex_normals_,
"v:normals")) "v:normals") ? 1 : 0 ;
refcount_vnormals_ = 1; refcount_vcolors_ = this->get_property_handle(vertex_colors_,
if(this->get_property_handle(vertex_colors_, "v:colors") ? 1 : 0 ;
"v:colors")) refcount_vtexcoords1D_ = this->get_property_handle(vertex_texcoords1D_,
refcount_vcolors_ = 1; "v:texcoords1D") ? 1 : 0 ;
if(this->get_property_handle(vertex_texcoords1D_, refcount_vtexcoords2D_ = this->get_property_handle(vertex_texcoords2D_,
"v:texcoords1D")) "v:texcoords2D") ? 1 : 0 ;
refcount_vtexcoords1D_ = 1; refcount_vtexcoords3D_ = this->get_property_handle(vertex_texcoords3D_,
if(this->get_property_handle(vertex_texcoords2D_, "v:texcoords3D") ? 1 : 0 ;
"v:texcoords2D")) refcount_htexcoords1D_ = this->get_property_handle(halfedge_texcoords1D_,
refcount_vtexcoords2D_ = 1; "h:texcoords1D") ? 1 : 0 ;
if(this->get_property_handle(vertex_texcoords3D_, refcount_htexcoords2D_ = this->get_property_handle(halfedge_texcoords2D_,
"v:texcoords3D")) "h:texcoords2D") ? 1 : 0 ;
refcount_vtexcoords3D_ = 1; refcount_htexcoords3D_ = this->get_property_handle(halfedge_texcoords3D_,
if(this->get_property_handle(halfedge_texcoords1D_, "h:texcoords3D") ? 1 : 0 ;
"h:texcoords1D")) refcount_henormals_ = this->get_property_handle(halfedge_normals_,
refcount_htexcoords1D_ = 1; "h:normals") ? 1 : 0 ;
if(this->get_property_handle(halfedge_texcoords2D_, refcount_hecolors_ = this->get_property_handle(halfedge_colors_,
"h:texcoords2D")) "h:colors") ? 1 : 0 ;
refcount_htexcoords2D_ = 1; refcount_ecolors_ = this->get_property_handle(edge_colors_,
if(this->get_property_handle(halfedge_texcoords3D_, "e:colors") ? 1 : 0 ;
"h:texcoords3D")) refcount_fnormals_ = this->get_property_handle(face_normals_,
refcount_htexcoords3D_ = 1; "f:normals") ? 1 : 0 ;
if(this->get_property_handle(halfedge_normals_, refcount_fcolors_ = this->get_property_handle(face_colors_,
"h:normals")) "f:colors") ? 1 : 0 ;
refcount_henormals_ = 1; refcount_ftextureIndex_ = this->get_property_handle(face_texture_index_,
if(this->get_property_handle(halfedge_colors_, "f:textureindex") ? 1 : 0 ;
"h:colors"))
refcount_hecolors_ = 1;
if(this->get_property_handle(edge_colors_,
"e:colors"))
refcount_ecolors_ = 1;
if(this->get_property_handle(face_normals_,
"f:normals"))
refcount_fnormals_ = 1;
if(this->get_property_handle(face_colors_,
"f:colors"))
refcount_fcolors_ = 1;
if(this->get_property_handle(face_texture_index_,
"f:textureindex"))
refcount_ftextureIndex_ = 1;
} }
}; };

View File

@@ -746,5 +746,111 @@ TEST_F(OpenMeshProperties, PropertyIterators ) {
} }
TEST_F(OpenMeshProperties, MeshAssignment ) {
mesh_.clear();
mesh_.add_vertex(Mesh::Point());
auto copy = mesh_;
copy.request_vertex_status();
copy.request_vertex_normals();
copy.request_vertex_colors();
copy.request_vertex_texcoords1D();
copy.request_vertex_texcoords2D();
copy.request_vertex_texcoords3D();
copy.request_halfedge_status();
copy.request_halfedge_texcoords1D();
copy.request_halfedge_texcoords2D();
copy.request_halfedge_texcoords3D();
copy.request_edge_status();
copy.request_edge_colors();
copy.request_halfedge_normals();
copy.request_halfedge_colors();
copy.request_face_status();
copy.request_face_normals();
copy.request_face_colors();
copy.request_face_texture_index();
EXPECT_TRUE(copy.has_vertex_status());
EXPECT_TRUE(copy.has_vertex_normals());
EXPECT_TRUE(copy.has_vertex_colors());
EXPECT_TRUE(copy.has_vertex_texcoords1D());
EXPECT_TRUE(copy.has_vertex_texcoords2D());
EXPECT_TRUE(copy.has_vertex_texcoords3D());
EXPECT_TRUE(copy.has_halfedge_status());
EXPECT_TRUE(copy.has_halfedge_texcoords1D());
EXPECT_TRUE(copy.has_halfedge_texcoords2D());
EXPECT_TRUE(copy.has_halfedge_texcoords3D());
EXPECT_TRUE(copy.has_edge_status());
EXPECT_TRUE(copy.has_edge_colors());
EXPECT_TRUE(copy.has_halfedge_normals());
EXPECT_TRUE(copy.has_halfedge_colors());
EXPECT_TRUE(copy.has_face_status());
EXPECT_TRUE(copy.has_face_normals());
EXPECT_TRUE(copy.has_face_colors());
EXPECT_TRUE(copy.has_face_texture_index());
copy.assign(mesh_, true);
EXPECT_FALSE(copy.has_vertex_status());
EXPECT_FALSE(copy.has_vertex_normals());
EXPECT_FALSE(copy.has_vertex_colors());
EXPECT_FALSE(copy.has_vertex_texcoords1D());
EXPECT_FALSE(copy.has_vertex_texcoords2D());
EXPECT_FALSE(copy.has_vertex_texcoords3D());
EXPECT_FALSE(copy.has_halfedge_status());
EXPECT_FALSE(copy.has_halfedge_texcoords1D());
EXPECT_FALSE(copy.has_halfedge_texcoords2D());
EXPECT_FALSE(copy.has_halfedge_texcoords3D());
EXPECT_FALSE(copy.has_edge_status());
EXPECT_FALSE(copy.has_edge_colors());
EXPECT_FALSE(copy.has_halfedge_normals());
EXPECT_FALSE(copy.has_halfedge_colors());
EXPECT_FALSE(copy.has_face_status());
EXPECT_FALSE(copy.has_face_normals());
EXPECT_FALSE(copy.has_face_colors());
EXPECT_FALSE(copy.has_face_texture_index());
copy.request_vertex_status();
copy.request_vertex_normals();
copy.request_vertex_colors();
copy.request_vertex_texcoords1D();
copy.request_vertex_texcoords2D();
copy.request_vertex_texcoords3D();
copy.request_halfedge_status();
copy.request_halfedge_texcoords1D();
copy.request_halfedge_texcoords2D();
copy.request_halfedge_texcoords3D();
copy.request_edge_status();
copy.request_edge_colors();
copy.request_halfedge_normals();
copy.request_halfedge_colors();
copy.request_face_status();
copy.request_face_normals();
copy.request_face_colors();
copy.request_face_texture_index();
EXPECT_TRUE(copy.has_vertex_status()) << "Mesh has no vertex status even though they have been requested";
EXPECT_TRUE(copy.has_vertex_normals()) << "Mesh has no vertex normals even though they have been requested";
EXPECT_TRUE(copy.has_vertex_colors()) << "Mesh has no vertex colors even though they have been requested";
EXPECT_TRUE(copy.has_vertex_texcoords1D()) << "Mesh has no vertex texcoord1D even though they have been requested";
EXPECT_TRUE(copy.has_vertex_texcoords2D()) << "Mesh has no vertex texcoord2D even though they have been requested";
EXPECT_TRUE(copy.has_vertex_texcoords3D()) << "Mesh has no vertex texcoord3D even though they have been requested";
EXPECT_TRUE(copy.has_halfedge_status()) << "Mesh has no halfedge status even though they have been requested";
EXPECT_TRUE(copy.has_halfedge_texcoords1D()) << "Mesh has no halfedge texcoords1D even though they have been requested";
EXPECT_TRUE(copy.has_halfedge_texcoords2D()) << "Mesh has no halfedge texcoords2D even though they have been requested";
EXPECT_TRUE(copy.has_halfedge_texcoords3D()) << "Mesh has no halfedge texcoords3D even though they have been requested";
EXPECT_TRUE(copy.has_edge_status()) << "Mesh has no edge status even though they have been requested";
EXPECT_TRUE(copy.has_edge_colors()) << "Mesh has no edge colors even though they have been requested";
EXPECT_TRUE(copy.has_halfedge_normals()) << "Mesh has no halfedge normals even though they have been requested";
EXPECT_TRUE(copy.has_halfedge_colors()) << "Mesh has no halfedge colors even though they have been requested";
EXPECT_TRUE(copy.has_face_status()) << "Mesh has no face status even though they have been requested";
EXPECT_TRUE(copy.has_face_normals()) << "Mesh has no face normals even though they have been requested";
EXPECT_TRUE(copy.has_face_colors()) << "Mesh has no face colors even though they have been requested";
EXPECT_TRUE(copy.has_face_texture_index()) << "Mesh has no face texture index even though they have been requested";
}
} }