Add advanced cfg to force reloading memory cached 3d models

This commit is contained in:
Marek Roszko 2021-07-11 00:35:38 -04:00
parent 7cb0f8f808
commit 9162013132
3 changed files with 16 additions and 12 deletions

View File

@ -238,7 +238,7 @@ SCENEGRAPH* S3D_CACHE::load( const wxString& aModelFile, S3D_CACHE_ENTRY** aCach
if( fname.FileExists() ) // Only check if file exists. If not, it will
{ // use the same model in cache.
bool reload = ADVANCED_CFG::GetCfg().m_Skip3DMemoryCache;
bool reload = ADVANCED_CFG::GetCfg().m_Skip3DModelMemoryCache;
wxDateTime fmdate = fname.GetModificationTime();
if( fmdate != mi->second->modTime )
@ -341,13 +341,13 @@ SCENEGRAPH* S3D_CACHE::checkCache( const wxString& aFileName, S3D_CACHE_ENTRY**
wxString bname = ep->GetCacheBaseName();
wxString cachename = m_CacheDir + bname + wxT( ".3dc" );
if( !ADVANCED_CFG::GetCfg().m_Skip3DFileCache && wxFileName::FileExists( cachename )
if( !ADVANCED_CFG::GetCfg().m_Skip3DModelFileCache && wxFileName::FileExists( cachename )
&& loadCacheData( ep ) )
return ep->sceneData;
ep->sceneData = m_Plugins->Load3DModel( aFileName, ep->pluginInfo );
if( !ADVANCED_CFG::GetCfg().m_Skip3DFileCache && nullptr != ep->sceneData )
if( !ADVANCED_CFG::GetCfg().m_Skip3DModelFileCache && nullptr != ep->sceneData )
saveCacheData( ep );
return ep->sceneData;

View File

@ -162,9 +162,9 @@ static const wxChar DrawBoundingBoxes[] = wxT( "DrawBoundingBoxes" );
static const wxChar ShowPcbnewExportNetlist[] = wxT( "ShowPcbnewExportNetlist" );
static const wxChar Skip3DFileCache[] = wxT( "Skip3DFileCache" );
static const wxChar Skip3DModelFileCache[] = wxT( "Skip3DModelFileCache" );
static const wxChar Skip3DMemoryCache[] = wxT( "Skip3DMemoryCache" );
static const wxChar Skip3DModelMemoryCache[] = wxT( "Skip3DModelMemoryCache" );
} // namespace KEYS
@ -268,7 +268,8 @@ ADVANCED_CFG::ADVANCED_CFG()
m_HotkeysDumper = false;
m_DrawBoundingBoxes = false;
m_ShowPcbnewExportNetlist = false;
m_Skip3DFileCache = false;
m_Skip3DModelFileCache = false;
m_Skip3DModelMemoryCache = false;
loadFromConfigFile();
}
@ -369,11 +370,11 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::ShowPcbnewExportNetlist,
&m_ShowPcbnewExportNetlist, false ) );
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::Skip3DFileCache,
&m_Skip3DFileCache, false ) );
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::Skip3DModelFileCache,
&m_Skip3DModelFileCache, false ) );
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::Skip3DMemoryCache,
&m_Skip3DMemoryCache, false ) );
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::Skip3DModelMemoryCache,
&m_Skip3DModelMemoryCache, false ) );
wxConfigLoadSetups( &aCfg, configParams );

View File

@ -172,13 +172,16 @@ public:
/**
* Skip reading/writing 3d model file caches
* This does not prevent the models from being cached in memory meaning reopening the 3d viewer
* in the same project session will not reload model data from disk again.
*/
bool m_Skip3DFileCache;
bool m_Skip3DModelFileCache;
/**
* Skip reading/writing 3d model memory caches
* This ensures 3d models are always reloaded from disk even if we previously opened the 3d viewer.
*/
bool m_Skip3DMemoryCache;
bool m_Skip3DModelMemoryCache;
private:
ADVANCED_CFG();