Don't show 3D models with their show flag set to false.
Fixes https://gitlab.com/kicad/code/kicad/issues/5548
This commit is contained in:
parent
f347118ce3
commit
2251716784
|
@ -869,50 +869,40 @@ void C3D_RENDER_OGL_LEGACY::load_3D_models( REPORTER* aStatusReporter )
|
|||
return;
|
||||
|
||||
// Go for all modules
|
||||
for( auto module : m_boardAdapter.GetBoard()->Modules() )
|
||||
for( MODULE* module : m_boardAdapter.GetBoard()->Modules() )
|
||||
{
|
||||
if( !module->Models().empty() )
|
||||
for( const MODULE_3D_SETTINGS& model : module->Models() )
|
||||
{
|
||||
// Get the list of model files for this model
|
||||
auto sM = module->Models().begin();
|
||||
auto eM = module->Models().end();
|
||||
|
||||
while( sM != eM )
|
||||
if( model.m_Show && !model.m_Filename.empty() )
|
||||
{
|
||||
if( sM->m_Show && !sM->m_Filename.empty() )
|
||||
if( aStatusReporter )
|
||||
{
|
||||
if( aStatusReporter )
|
||||
{
|
||||
// Display the short filename of the 3D model loaded:
|
||||
// (the full name is usually too long to be displayed)
|
||||
wxFileName fn( sM->m_Filename );
|
||||
wxString msg;
|
||||
msg.Printf( _( "Loading %s" ), fn.GetFullName() );
|
||||
aStatusReporter->Report( msg );
|
||||
}
|
||||
|
||||
// Check if the model is not present in our cache map
|
||||
// (Not already loaded in memory)
|
||||
if( m_3dmodel_map.find( sM->m_Filename ) == m_3dmodel_map.end() )
|
||||
{
|
||||
// It is not present, try get it from cache
|
||||
const S3DMODEL *modelPtr =
|
||||
m_boardAdapter.Get3DCacheManager()->GetModel( sM->m_Filename );
|
||||
|
||||
// only add it if the return is not NULL
|
||||
if( modelPtr )
|
||||
{
|
||||
C_OGL_3DMODEL* ogl_model =
|
||||
new C_OGL_3DMODEL( *modelPtr,
|
||||
m_boardAdapter.MaterialModeGet() );
|
||||
|
||||
if( ogl_model )
|
||||
m_3dmodel_map[ sM->m_Filename ] = ogl_model;
|
||||
}
|
||||
}
|
||||
// Display the short filename of the 3D model loaded:
|
||||
// (the full name is usually too long to be displayed)
|
||||
wxFileName fn( model.m_Filename );
|
||||
wxString msg;
|
||||
msg.Printf( _( "Loading %s" ), fn.GetFullName() );
|
||||
aStatusReporter->Report( msg );
|
||||
}
|
||||
|
||||
++sM;
|
||||
// Check if the model is not present in our cache map
|
||||
// (Not already loaded in memory)
|
||||
if( m_3dmodel_map.find( model.m_Filename ) == m_3dmodel_map.end() )
|
||||
{
|
||||
// It is not present, try get it from cache
|
||||
const S3DMODEL* modelPtr =
|
||||
m_boardAdapter.Get3DCacheManager()->GetModel( model.m_Filename );
|
||||
|
||||
// only add it if the return is not NULL
|
||||
if( modelPtr )
|
||||
{
|
||||
MATERIAL_MODE materialMode = m_boardAdapter.MaterialModeGet();
|
||||
C_OGL_3DMODEL* ogl_model = new C_OGL_3DMODEL( *modelPtr, materialMode );
|
||||
|
||||
if( ogl_model )
|
||||
m_3dmodel_map[ model.m_Filename ] = ogl_model;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1191,9 +1191,9 @@ void C3D_RENDER_OGL_LEGACY::render_3D_module( const MODULE* module,
|
|||
modelunit_to_3d_units_factor );
|
||||
|
||||
// Get the list of model files for this model
|
||||
for( auto& sM : module->Models () )
|
||||
for( const MODULE_3D_SETTINGS& sM : module->Models() )
|
||||
{
|
||||
if( sM.m_Filename.empty() )
|
||||
if( !sM.m_Show || sM.m_Filename.empty() )
|
||||
continue;
|
||||
|
||||
// Check if the model is present in our cache map
|
||||
|
|
Loading…
Reference in New Issue