fixed bug in const copy of mesh attributes

This commit is contained in:
Luigi Malomo 2021-03-29 17:29:44 +02:00
parent 7973ee6b48
commit 895f8b0d03
1 changed files with 66 additions and 54 deletions

View File

@ -674,11 +674,14 @@ static void MeshAppendConst(
// per vertex attributes
for (al = ml.vert_attr.begin(); al != ml.vert_attr.end(); ++al)
if(!(*al)._name.empty()){
if(!(*al)._name.empty())
{
ar = mr.vert_attr.find(*al);
if(ar!= mr.vert_attr.end()){
if (ar != mr.vert_attr.end())
{
id_r = 0;
for (auto v: mr.vert){
for (const auto & v : mr.vert)
{
if( !v.IsD() && (!selected || v.IsS()))
(*al)._handle->CopyValue(remap.vert[Index(mr,v)], id_r, (*ar)._handle);
++id_r;
@ -688,11 +691,14 @@ static void MeshAppendConst(
// per edge attributes
for (al = ml.edge_attr.begin(); al != ml.edge_attr.end(); ++al)
if(!(*al)._name.empty()){
if (!(*al)._name.empty())
{
ar = mr.edge_attr.find(*al);
if(ar!= mr.edge_attr.end()){
if (ar!= mr.edge_attr.end())
{
id_r = 0;
for (auto e: mr.edge){
for (const auto & e : mr.edge)
{
if( !e.IsD() && (!selected || e.IsS()))
(*al)._handle->CopyValue(remap.edge[Index(mr,e)], id_r, (*ar)._handle);
++id_r;
@ -702,11 +708,14 @@ static void MeshAppendConst(
// per face attributes
for (al = ml.face_attr.begin(); al != ml.face_attr.end(); ++al)
if(!(*al)._name.empty()){
if (!(*al)._name.empty())
{
ar = mr.face_attr.find(*al);
if(ar!= mr.face_attr.end()){
if (ar!= mr.face_attr.end())
{
id_r = 0;
for (auto f: mr.face) {
for (const auto & f : mr.face)
{
if( !f.IsD() && (!selected || f.IsS()))
(*al)._handle->CopyValue(remap.face[Index(mr,f)], id_r, (*ar)._handle);
++id_r;
@ -716,11 +725,14 @@ static void MeshAppendConst(
// per tetra attributes
for (al = ml.tetra_attr.begin(); al != ml.tetra_attr.end(); ++al)
if(!(*al)._name.empty()){
if (!(*al)._name.empty())
{
ar = mr.tetra_attr.find(*al);
if(ar!= mr.tetra_attr.end()){
if (ar!= mr.tetra_attr.end())
{
id_r = 0;
for (auto t: mr.tetra) {
for (const auto & t: mr.tetra)
{
if( !t.IsD() && (!selected || t.IsS()))
(*al)._handle->CopyValue(remap.tetra[Index(mr, t)], id_r, (*ar)._handle);
++id_r;