3D viewer: apply OCC colors in order: XCAFDoc_ColorSurf > XCAFDoc_ColorCurv > XCAFDoc_ColorGen

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14906
This commit is contained in:
Alex Shvartzkop 2024-04-29 01:25:28 +03:00
parent 5c0a654e1e
commit f15551a6b5
1 changed files with 9 additions and 7 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com> * Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
* Copyright (C) 2020-2023 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2020-2024 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -487,12 +487,12 @@ bool getColor( DATA& data, TDF_Label label, Quantity_ColorRGBA& color )
{ {
while( true ) while( true )
{ {
if( data.m_color->GetColor( label, XCAFDoc_ColorGen, color ) ) if( data.m_color->GetColor( label, XCAFDoc_ColorSurf, color ) )
return true;
else if( data.m_color->GetColor( label, XCAFDoc_ColorSurf, color ) )
return true; return true;
else if( data.m_color->GetColor( label, XCAFDoc_ColorCurv, color ) ) else if( data.m_color->GetColor( label, XCAFDoc_ColorCurv, color ) )
return true; return true;
else if( data.m_color->GetColor( label, XCAFDoc_ColorGen, color ) )
return true;
label = label.Father(); label = label.Father();
@ -1149,10 +1149,12 @@ bool processFace( const TopoDS_Face& face, DATA& data, SGNODE* parent, std::vect
Quantity_ColorRGBA lcolor; Quantity_ColorRGBA lcolor;
// check for a face color; this has precedence over SOLID colors // check for a face color; this has precedence over SOLID colors
if( data.m_color->GetColor( face, XCAFDoc_ColorGen, lcolor ) if( data.m_color->GetColor( face, XCAFDoc_ColorSurf, lcolor )
|| data.m_color->GetColor( face, XCAFDoc_ColorCurv, lcolor ) || data.m_color->GetColor( face, XCAFDoc_ColorCurv, lcolor )
|| data.m_color->GetColor( face, XCAFDoc_ColorSurf, lcolor ) ) || data.m_color->GetColor( face, XCAFDoc_ColorGen, lcolor ) )
color = &lcolor; {
color = &lcolor;
}
SGNODE* ocolor = data.GetColor( color ); SGNODE* ocolor = data.GetColor( color );