Fix step colors some more

Fixes https://gitlab.com/kicad/code/kicad/-/issues/13611

I need to refactor the overall structure and know what to do, but ugh lazy
This commit is contained in:
Marek Roszko 2023-02-14 19:43:31 -05:00
parent 473979d686
commit c6540575b5
2 changed files with 31 additions and 29 deletions

View File

@ -800,7 +800,7 @@ bool processShell( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
}
bool processSolid( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
bool processSolidOrShell( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
std::vector< SGNODE* >* items )
{
TDF_Label label;
@ -887,8 +887,17 @@ bool processSolid( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
items->push_back( pptr );
}
// instantiate the solid
std::vector< SGNODE* > itemList;
// instantiate resulting object
std::vector<SGNODE*> itemList;
TopAbs_ShapeEnum stype = shape.ShapeType();
if( stype == TopAbs_SHELL )
{
if( processShell( shape, data, pptr, &itemList, lcolor ) )
ret = true;
}
else
{
for( it.Initialize( shape, false, false ); it.More(); it.Next() )
{
@ -904,6 +913,7 @@ bool processSolid( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
wxLogTrace( MASK_OCE, wxT( "Unsupported subshape in solid" ) );
}
}
}
if( !ret )
childNode.Destroy();
@ -996,14 +1006,14 @@ bool processLabel( const TDF_Label& aLabel, DATA& aData, SGNODE* aParent,
for( xp.Init( shape, TopAbs_SOLID ); xp.More(); xp.Next() )
{
processSolid( xp.Current(), aData, pptr, aItems );
processSolidOrShell( xp.Current(), aData, pptr, aItems );
ret = true;
}
// Get all shells, avoid those that may be attached to solids
for( xp.Init( shape, TopAbs_SHELL, TopAbs_SOLID ); xp.More(); xp.Next() )
{
processShell( xp.Current(), aData, pptr, aItems, nullptr );
processSolidOrShell( xp.Current(), aData, pptr, aItems );
ret = true;
}
@ -1019,13 +1029,13 @@ bool processLabel( const TDF_Label& aLabel, DATA& aData, SGNODE* aParent,
break;
case TopAbs_SOLID:
if( processSolid( shape, aData, pptr, aItems ) )
if( processSolidOrShell( shape, aData, pptr, aItems ) )
ret = true;
break;
case TopAbs_SHELL:
if( processShell( shape, aData, pptr, aItems, nullptr ) )
if( processSolidOrShell( shape, aData, pptr, aItems ) )
ret = true;
break;
@ -1130,18 +1140,10 @@ bool processFace( const TopoDS_Face& face, DATA& data, SGNODE* parent, std::vect
Quantity_ColorRGBA lcolor;
// check for a face color; this has precedence over SOLID colors
do
{
TDF_Label L;
if( data.m_color->ShapeTool()->Search( face, L ) )
{
if( data.m_color->GetColor( L, XCAFDoc_ColorGen, lcolor )
|| data.m_color->GetColor( L, XCAFDoc_ColorCurv, lcolor )
|| data.m_color->GetColor( L, XCAFDoc_ColorSurf, lcolor ) )
if( data.m_color->GetColor( face, XCAFDoc_ColorGen, lcolor )
|| data.m_color->GetColor( face, XCAFDoc_ColorCurv, lcolor )
|| data.m_color->GetColor( face, XCAFDoc_ColorSurf, lcolor ) )
color = &lcolor;
}
} while( 0 );
SGNODE* ocolor = data.GetColor( color );

View File

@ -37,7 +37,7 @@ SCENEGRAPH* LoadModel( char const* filename );
#define PLUGIN_OCE_MAJOR 1
#define PLUGIN_OCE_MINOR 4
#define PLUGIN_OCE_PATCH 1
#define PLUGIN_OCE_PATCH 2
#define PLUGIN_OCE_REVNO 0