Add ADVANCED_CFG to skip caching 3d models to file

This commit is contained in:
Marek Roszko 2021-07-10 23:59:54 -04:00
parent 01d3a88faa
commit 79b90813ec
3 changed files with 15 additions and 2 deletions

View File

@ -47,6 +47,7 @@
#include "sg/scenegraph.h"
#include "plugins/3dapi/ifsg_api.h"
#include <advanced_config.h>
#include <common.h> // For ExpandEnvVarSubstitutions
#include <filename_resolver.h>
#include <paths.h>
@ -345,12 +346,13 @@ SCENEGRAPH* S3D_CACHE::checkCache( const wxString& aFileName, S3D_CACHE_ENTRY**
wxString bname = ep->GetCacheBaseName();
wxString cachename = m_CacheDir + bname + wxT( ".3dc" );
if( wxFileName::FileExists( cachename ) && loadCacheData( ep ) )
if( !ADVANCED_CFG::GetCfg().m_Skip3DFileCache && wxFileName::FileExists( cachename )
&& loadCacheData( ep ) )
return ep->sceneData;
ep->sceneData = m_Plugins->Load3DModel( aFileName, ep->pluginInfo );
if( nullptr != ep->sceneData )
if( !ADVANCED_CFG::GetCfg().m_Skip3DFileCache && nullptr != ep->sceneData )
saveCacheData( ep );
return ep->sceneData;

View File

@ -162,6 +162,8 @@ static const wxChar DrawBoundingBoxes[] = wxT( "DrawBoundingBoxes" );
static const wxChar ShowPcbnewExportNetlist[] = wxT( "ShowPcbnewExportNetlist" );
static const wxChar Skip3DFileCache[] = wxT( "Skip3DFileCache" );
} // namespace KEYS
@ -264,6 +266,7 @@ ADVANCED_CFG::ADVANCED_CFG()
m_HotkeysDumper = false;
m_DrawBoundingBoxes = false;
m_ShowPcbnewExportNetlist = false;
m_Skip3DFileCache = false;
loadFromConfigFile();
}
@ -364,6 +367,9 @@ 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 ) );
wxConfigLoadSetups( &aCfg, configParams );
dumpCfg( configParams );

View File

@ -170,6 +170,11 @@ public:
*/
bool m_ShowPcbnewExportNetlist;
/**
* Skip reading/writing 3d model file caches
*/
bool m_Skip3DFileCache;
private:
ADVANCED_CFG();