Added support for large lists of shape formats. Needed for assimp.

This commit is contained in:
Andrew Mac 2014-05-21 14:50:44 -03:00
parent 938e28b6f3
commit eb74525a38
10 changed files with 154 additions and 20 deletions

View file

@ -42,3 +42,29 @@ function getLoadFilename(%filespec, %callback, %currentFile)
%dlg.delete();
}
// Opens a choose file dialog with format filters already loaded
// in. This avoids the issue of passing a massive list of format
// filters into a function as an arguement.
function getLoadFormatFilename(%callback, %currentFile)
{
%dlg = new OpenFileDialog()
{
Filters = getFormatFilters() @ "(All Files (*.*)|*.*|";
DefaultFile = %currentFile;
ChangePath = false;
MustExist = true;
MultipleFiles = false;
};
if ( filePath( %currentFile ) !$= "" )
%dlg.DefaultPath = filePath(%currentFile);
if ( %dlg.Execute() )
{
eval(%callback @ "(\"" @ %dlg.FileName @ "\");");
$Tools::FileDialogs::LastFilePath = filePath( %dlg.FileName );
}
%dlg.delete();
}

View file

@ -366,7 +366,7 @@ function ShapeEdSelectWindow::navigate( %this, %address )
%this-->shapeLibrary.clear();
ShapeEdSelectMenu.clear();
%filePatterns = "*.dts" TAB "*.dae" TAB "*.kmz";
%filePatterns = getFormatExtensions();
%fullPath = findFirstFileMultiExpr( %filePatterns );
while ( %fullPath !$= "" )
@ -1632,7 +1632,7 @@ function ShapeEdSequences::onAddSequence( %this, %name )
if ( %from $= "" )
{
// No sequence selected => open dialog to browse for one
getLoadFilename( "DSQ Files|*.dsq|COLLADA Files|*.dae|Google Earth Files|*.kmz", %this @ ".onAddSequenceFromBrowse", ShapeEdFromMenu.lastPath );
getLoadFormatFilename( %this @ ".onAddSequenceFromBrowse", ShapeEdFromMenu.lastPath );
return;
}
else
@ -1740,7 +1740,7 @@ function ShapeEdSeqFromMenu::onSelect( %this, %id, %text )
%this.setText( %seqFrom );
// Allow the user to browse for an external source of animation data
getLoadFilename( "DSQ Files|*.dsq|COLLADA Files|*.dae|Google Earth Files|*.kmz", %this @ ".onBrowseSelect", %this.lastPath );
getLoadFormatFilename( %this @ ".onBrowseSelect", %this.lastPath );
}
else
{
@ -2862,7 +2862,7 @@ function ShapeEdDetails::onAddMeshFromFile( %this, %path )
{
if ( %path $= "" )
{
getLoadFilename( "DTS Files|*.dts|COLLADA Files|*.dae|Google Earth Files|*.kmz", %this @ ".onAddMeshFromFile", %this.lastPath );
getLoadFormatFilename( %this @ ".onAddMeshFromFile", %this.lastPath );
return;
}
@ -3291,7 +3291,7 @@ function ShapeEdMountShapeMenu::onSelect( %this, %id, %text )
if ( %text $= "Browse..." )
{
// Allow the user to browse for an external model file
getLoadFilename( "DTS Files|*.dts|COLLADA Files|*.dae|Google Earth Files|*.kmz", %this @ ".onBrowseSelect", %this.lastPath );
getLoadFormatFilename( %this @ ".onBrowseSelect", %this.lastPath );
}
else
{

View file

@ -324,13 +324,13 @@ function EWCreatorWindow::navigate( %this, %address )
if ( %this.tab $= "Meshes" )
{
%fullPath = findFirstFileMultiExpr( "*.dts" TAB "*.dae" TAB "*.kmz" TAB "*.dif" );
%fullPath = findFirstFileMultiExpr( getFormatExtensions() );
while ( %fullPath !$= "" )
{
if (strstr(%fullPath, "cached.dts") != -1)
{
%fullPath = findNextFileMultiExpr( "*.dts" TAB "*.dae" TAB "*.kmz" TAB "*.dif" );
%fullPath = findNextFileMultiExpr( getFormatExtensions() );
continue;
}
@ -338,7 +338,7 @@ function EWCreatorWindow::navigate( %this, %address )
%splitPath = strreplace( %fullPath, "/", " " );
if( getWord(%splitPath, 0) $= "tools" )
{
%fullPath = findNextFileMultiExpr( "*.dts" TAB "*.dae" TAB "*.kmz" TAB "*.dif" );
%fullPath = findNextFileMultiExpr( getFormatExtensions() );
continue;
}
@ -396,7 +396,7 @@ function EWCreatorWindow::navigate( %this, %address )
}
}
%fullPath = findNextFileMultiExpr( "*.dts" TAB "*.dae" TAB "*.kmz" TAB "*.dif" );
%fullPath = findNextFileMultiExpr( getFormatExtensions() );
}
}