remove wxApp()::FindLibraryPath() usages from Pcbnew. Use environment variable substitution.
This commit is contained in:
parent
33e26b278d
commit
142782b402
|
@ -62,52 +62,43 @@ S3D_MODEL_PARSER* S3D_MODEL_PARSER::Create( S3D_MASTER* aMaster,
|
|||
|
||||
int S3D_MASTER::ReadData()
|
||||
{
|
||||
wxFileName fn;
|
||||
wxString FullFilename;
|
||||
|
||||
if( m_Shape3DName.IsEmpty() )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
wxString shape3DNname = m_Shape3DName;
|
||||
// Expand any environment variables embedded in footprint's m_Shape3DName field.
|
||||
wxString filename = wxExpandEnvVars( m_Shape3DName );
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
shape3DNname.Replace( wxT( "/" ), wxT( "\\" ) );
|
||||
filename.Replace( wxT( "/" ), wxT( "\\" ) );
|
||||
#else
|
||||
shape3DNname.Replace( wxT( "\\" ), wxT( "/" ) );
|
||||
filename.Replace( wxT( "\\" ), wxT( "/" ) );
|
||||
#endif
|
||||
|
||||
if( wxFileName::FileExists( shape3DNname ) )
|
||||
if( !wxFileName::FileExists( filename ) )
|
||||
{
|
||||
FullFilename = shape3DNname;
|
||||
fn.Assign( FullFilename );
|
||||
}
|
||||
else
|
||||
{
|
||||
fn = shape3DNname;
|
||||
FullFilename = wxGetApp().FindLibraryPath( fn );
|
||||
|
||||
if( FullFilename.IsEmpty() )
|
||||
{
|
||||
wxLogDebug( wxT( "3D part library <%s> could not be found." ),
|
||||
GetChars( fn.GetFullPath() ) );
|
||||
wxLogDebug( wxT( "3D shape '%s' not found, even tried '%s' after env var substitution." ),
|
||||
GetChars( m_Shape3DName ),
|
||||
GetChars( filename )
|
||||
);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
wxFileName fn( filename );
|
||||
|
||||
wxString extension = fn.GetExt();
|
||||
S3D_MODEL_PARSER* parser = S3D_MODEL_PARSER::Create( this, extension );
|
||||
|
||||
if( parser )
|
||||
{
|
||||
parser->Load( FullFilename );
|
||||
parser->Load( filename );
|
||||
delete parser;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogDebug( wxT( "Unknown file type <%s>" ), GetChars( extension ) );
|
||||
wxLogDebug( wxT( "Unknown file type '%s'" ), GetChars( extension ) );
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
|
|
@ -60,7 +60,7 @@ add_dependencies(gal shader_headers)
|
|||
# Only for win32 cross compilation using MXE
|
||||
if( WIN32 AND MSYS )
|
||||
add_definitions( -DGLEW_STATIC )
|
||||
endif(WIN32 AND MSYS)
|
||||
endif()
|
||||
|
||||
set( COMMON_ABOUT_DLG_SRCS
|
||||
dialog_about/AboutDialog_main.cpp
|
||||
|
@ -120,7 +120,6 @@ set( COMMON_SRCS
|
|||
drawpanel.cpp
|
||||
drawtxt.cpp
|
||||
dsnlexer.cpp
|
||||
edaappl.cpp
|
||||
eda_dde.cpp
|
||||
eda_doc.cpp
|
||||
filter_reader.cpp
|
||||
|
@ -150,8 +149,13 @@ set( COMMON_SRCS
|
|||
zoom.cpp
|
||||
)
|
||||
|
||||
# We will not want edaappl.cpp linked into the KIFACE, only into the KIWAY.
|
||||
if( TRUE OR NOT USE_KIWAY_DLLS )
|
||||
list( APPEND COMMON_SRCS edaappl.cpp )
|
||||
endif()
|
||||
|
||||
if( NOT HAVE_STRTOKR )
|
||||
set( COMMON_SRCS ${COMMON_SRCS} strtok_r.c )
|
||||
list( APPEND COMMON_SRCS strtok_r.c )
|
||||
endif()
|
||||
|
||||
|
||||
|
|
|
@ -1149,26 +1149,18 @@ static void export_vrml_module( MODEL_VRML& aModel, BOARD* aPcb, MODULE* aModule
|
|||
bool isFlipped = aModule->GetLayer() == LAYER_N_BACK;
|
||||
|
||||
// Export the object VRML model(s)
|
||||
for( S3D_MASTER* vrmlm = aModule->Models(); vrmlm != 0; vrmlm = vrmlm->Next() )
|
||||
for( S3D_MASTER* vrmlm = aModule->Models(); vrmlm; vrmlm = vrmlm->Next() )
|
||||
{
|
||||
if( !vrmlm->Is3DType( S3D_MASTER::FILE3D_VRML ) )
|
||||
continue;
|
||||
|
||||
wxString fname = vrmlm->GetShape3DName();
|
||||
|
||||
if( !wxFileName::FileExists( fname ) )
|
||||
{
|
||||
wxFileName fn = fname;
|
||||
fname = wxGetApp().FindLibraryPath( fn );
|
||||
|
||||
if( fname.IsEmpty() ) // keep "short" name if full filename not found
|
||||
fname = vrmlm->GetShape3DName();
|
||||
}
|
||||
// expand environment variables
|
||||
wxString fname = wxExpandEnvVars( vrmlm->GetShape3DName() );
|
||||
|
||||
fname.Replace( wxT( "\\" ), wxT( "/" ) );
|
||||
wxString source_fname = fname;
|
||||
|
||||
if( aExport3DFiles ) // Change illegal characters in short filename
|
||||
if( aExport3DFiles ) // Change illegal characters
|
||||
{
|
||||
ChangeIllegalCharacters( fname, true );
|
||||
fname = a3D_Subdir + wxT( "/" ) + fname;
|
||||
|
@ -1295,6 +1287,7 @@ bool PCB_EDIT_FRAME::ExportVRML_File( const wxString& aFullFileName,
|
|||
|
||||
// Global VRML scale to export to a different scale.
|
||||
model3d.scale = aMMtoWRMLunit / MM_PER_IU;
|
||||
|
||||
// Set the mechanical deviation limit (in this case 0.02mm)
|
||||
// XXX - NOTE: the value should be set via the GUI
|
||||
model3d.SetMaxDev( 20000 * model3d.scale );
|
||||
|
|
|
@ -1155,16 +1155,12 @@ bool IDF_COMP::PlaceComponent( const wxString aComponentFile, const std::string
|
|||
rotation = aRotation;
|
||||
top = isOnTop;
|
||||
|
||||
if( !wxFileName::FileExists( aComponentFile ) )
|
||||
{
|
||||
wxFileName fn = aComponentFile;
|
||||
wxString fname = wxGetApp().FindLibraryPath( fn );
|
||||
wxString fname = wxExpandEnvVars( aComponentFile );
|
||||
|
||||
if( fname.IsEmpty() )
|
||||
if( !wxFileName::FileExists( fname ) )
|
||||
return false;
|
||||
else
|
||||
|
||||
componentFile = fname;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue