Merge branch 'fix_face_colors_in_blayers' into 'master'

Fix reading face_colors and face_transparencies for faces without attached geometry surface

See merge request ngsolve/netgen!658
This commit is contained in:
Hochsteger, Matthias 2024-07-10 19:02:10 +02:00
commit 5e9d22e496

View File

@ -1208,6 +1208,8 @@ namespace netgen
bool endmesh = false; bool endmesh = false;
bool has_facedescriptors = false;
while (infile.good() && !endmesh) while (infile.good() && !endmesh)
{ {
@ -1226,6 +1228,7 @@ namespace netgen
if (strcmp (str, "facedescriptors") == 0) if (strcmp (str, "facedescriptors") == 0)
{ {
has_facedescriptors = true;
int nfd; int nfd;
infile >> nfd; infile >> nfd;
for([[maybe_unused]] auto i : Range(nfd)) for([[maybe_unused]] auto i : Range(nfd))
@ -1610,7 +1613,11 @@ namespace netgen
surfnr--; surfnr--;
if(surfnr > 0) if(has_facedescriptors)
{
GetFaceDescriptor(i).SetSurfColour(surfcolour);
}
else if(surfnr > 0)
{ {
for(int facedesc = 1; facedesc <= cnt_facedesc; facedesc++) for(int facedesc = 1; facedesc <= cnt_facedesc; facedesc++)
{ {
@ -1637,7 +1644,14 @@ namespace netgen
double transp; double transp;
infile >> surfnr >> transp; infile >> surfnr >> transp;
surfnr--; surfnr--;
if(surfnr > 0) if(has_facedescriptors)
{
auto& fd = GetFaceDescriptor(index);
auto scol = fd.SurfColour();
scol[3] = transp;
fd.SetSurfColour(scol);
}
else if(surfnr > 0)
{ {
for(int facedesc = 1; facedesc <= cnt_facedesc; facedesc++) for(int facedesc = 1; facedesc <= cnt_facedesc; facedesc++)
{ {