|
@@ -165,8 +165,14 @@ function getAssetTypeByFilename(%filePath)
|
|
|
|
|
|
function AssetBrowser::onBeginDropFiles( %this )
|
|
function AssetBrowser::onBeginDropFiles( %this )
|
|
{
|
|
{
|
|
- if(!AssetBrowser.isAwake())
|
|
|
|
|
|
+ if(!AssetBrowser.isAwake() || !AssetBrowser.isVisible())
|
|
|
|
+ {
|
|
|
|
+ if(GuiEditorIsActive())
|
|
|
|
+ GuiEditor.onBeginDropFiles();
|
|
|
|
+ else if(EditorIsActive())
|
|
|
|
+ EWorldEditor.onBeginDropFiles();
|
|
return;
|
|
return;
|
|
|
|
+ }
|
|
|
|
|
|
error("% DragDrop - Beginning files dropping.");
|
|
error("% DragDrop - Beginning files dropping.");
|
|
if(!ImportAssetWindow.isAwake())
|
|
if(!ImportAssetWindow.isAwake())
|
|
@@ -175,45 +181,28 @@ function AssetBrowser::onBeginDropFiles( %this )
|
|
|
|
|
|
function AssetBrowser::onDropFile( %this, %filePath )
|
|
function AssetBrowser::onDropFile( %this, %filePath )
|
|
{
|
|
{
|
|
- if(!%this.isVisible())
|
|
|
|
|
|
+ if(!AssetBrowser.isAwake() || !AssetBrowser.isVisible())
|
|
|
|
+ {
|
|
|
|
+ if(GuiEditorIsActive())
|
|
|
|
+ GuiEditor.onDropFile(%filePath);
|
|
|
|
+ else if(EditorIsActive())
|
|
|
|
+ EWorldEditor.onDropFile(%filePath);
|
|
return;
|
|
return;
|
|
|
|
+ }
|
|
|
|
|
|
ImportAssetWindow.importer.addImportingFile(%filePath);
|
|
ImportAssetWindow.importer.addImportingFile(%filePath);
|
|
-
|
|
|
|
- /*%fileExt = fileExt( %filePath );
|
|
|
|
- //add it to our array!
|
|
|
|
- if(isImageFormat(%fileExt))
|
|
|
|
- %assetItem = %this.addImportingAsset("ImageAsset", %filePath);
|
|
|
|
- else if( isShapeFormat(%fileExt))
|
|
|
|
- %assetItem = %this.addImportingAsset("ShapeAsset", %filePath);
|
|
|
|
- else if( isSoundFormat(%fileExt))
|
|
|
|
- %assetItem = %this.addImportingAsset("SoundAsset", %filePath);
|
|
|
|
- else if( %fileExt $= "." @ $TorqueScriptFileExtension || %fileExt $= "." @ $TorqueScriptFileExtension @ ".dso" )
|
|
|
|
- %assetItem = %this.addImportingAsset("ScriptAsset", %filePath);
|
|
|
|
- else if( %fileExt $= ".gui" || %fileExt $= ".gui.dso" )
|
|
|
|
- %assetItem = %this.addImportingAsset("GUIAsset", %filePath);
|
|
|
|
- else if (%fileExt $= ".zip")
|
|
|
|
- %this.onDropZipFile(%filePath);
|
|
|
|
- else if( %fileExt $= "")
|
|
|
|
- %this.onDropFolder(%filePath);
|
|
|
|
-
|
|
|
|
- if(%assetItem !$= "")
|
|
|
|
- {
|
|
|
|
- SessionImportAssetItems.add(%assetItem);
|
|
|
|
- ImportAssetItems.add(%assetItem);
|
|
|
|
- }*/
|
|
|
|
-
|
|
|
|
- //Used to keep tabs on what files we were trying to import, used mainly in the event of
|
|
|
|
- //adjusting configs and needing to completely reprocess the import
|
|
|
|
- //ensure we're not doubling-up on files by accident
|
|
|
|
- //if(ImportAssetWindow.importingFilesArray.getIndexFromKey(%filePath) == -1)
|
|
|
|
- // ImportAssetWindow.importingFilesArray.add(%filePath);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
function AssetBrowser::onDropZipFile(%this, %filePath)
|
|
function AssetBrowser::onDropZipFile(%this, %filePath)
|
|
{
|
|
{
|
|
- if(!%this.isVisible())
|
|
|
|
|
|
+ if(!AssetBrowser.isAwake() || !AssetBrowser.isVisible())
|
|
|
|
+ {
|
|
|
|
+ if(GuiEditorIsActive())
|
|
|
|
+ GuiEditor.onDropZipFile(%filePath);
|
|
|
|
+ else if(EditorIsActive())
|
|
|
|
+ EWorldEditor.onDropZipFile(%filePath);
|
|
return;
|
|
return;
|
|
|
|
+ }
|
|
|
|
|
|
%zip = new ZipObject();
|
|
%zip = new ZipObject();
|
|
%zip.openArchive(%filePath);
|
|
%zip.openArchive(%filePath);
|
|
@@ -226,27 +215,6 @@ function AssetBrowser::onDropZipFile(%this, %filePath)
|
|
%fileEntry = %zip.getFileEntry(%i);
|
|
%fileEntry = %zip.getFileEntry(%i);
|
|
%fileFrom = getField(%fileEntry, 0);
|
|
%fileFrom = getField(%fileEntry, 0);
|
|
|
|
|
|
- //First, we wanna scan to see if we have modules to contend with. If we do, we'll just plunk them in wholesale
|
|
|
|
- //and not process their contents.
|
|
|
|
-
|
|
|
|
- //If not modules, it's likely an art pack or other mixed files, so we'll import them as normal
|
|
|
|
- /*if( (%fileExt $= ".png") || (%fileExt $= ".jpg") || (%fileExt $= ".bmp") || (%fileExt $= ".dds") )
|
|
|
|
- %this.importAssetListArray.add("ImageAsset", %filePath);
|
|
|
|
- else if( (%fileExt $= ".dae") || (%fileExt $= ".dts"))
|
|
|
|
- %this.importAssetListArray.add("ShapeAsset", %filePath);
|
|
|
|
- else if( (%fileExt $= ".ogg") || (%fileExt $= ".wav") || (%fileExt $= ".mp3"))
|
|
|
|
- %this.importAssetListArray.add("SoundAsset", %filePath);
|
|
|
|
- else if( (%fileExt $= ".gui") || (%fileExt $= ".gui.dso"))
|
|
|
|
- %this.importAssetListArray.add("GUIAsset", %filePath);
|
|
|
|
- //else if( (%fileExt $= "." @ $TorqueScriptFileExtension) || (%fileExt $= ".dso"))
|
|
|
|
- // %this.importAssetListArray.add("Script", %filePath);
|
|
|
|
- else if( (%fileExt $= ".mis"))
|
|
|
|
- %this.importAssetListArray.add("LevelAsset", %filePath);*/
|
|
|
|
-
|
|
|
|
- // For now, if it's a .tscript file, we'll assume it's a behavior.
|
|
|
|
- //if (fileExt(%fileFrom) !$= "." @ $TorqueScriptFileExtension)
|
|
|
|
- // continue;
|
|
|
|
-
|
|
|
|
%fileTo = expandFilename("^tools/assetBrowser/importTemp/") @ %fileFrom;
|
|
%fileTo = expandFilename("^tools/assetBrowser/importTemp/") @ %fileFrom;
|
|
%zip.extractFile(%fileFrom, %fileTo);
|
|
%zip.extractFile(%fileFrom, %fileTo);
|
|
//exec(%fileTo);
|
|
//exec(%fileTo);
|
|
@@ -259,8 +227,14 @@ function AssetBrowser::onDropZipFile(%this, %filePath)
|
|
|
|
|
|
function AssetBrowser::onDropFolder(%this, %filePath)
|
|
function AssetBrowser::onDropFolder(%this, %filePath)
|
|
{
|
|
{
|
|
- if(!%this.isVisible())
|
|
|
|
|
|
+ if(!AssetBrowser.isAwake() || !AssetBrowser.isVisible())
|
|
|
|
+ {
|
|
|
|
+ if(GuiEditorIsActive())
|
|
|
|
+ GuiEditor.onDropFolder(%filePath);
|
|
|
|
+ else if(EditorIsActive())
|
|
|
|
+ EWorldEditor.onDropFolder(%filePath);
|
|
return;
|
|
return;
|
|
|
|
+ }
|
|
|
|
|
|
%zip = new ZipObject();
|
|
%zip = new ZipObject();
|
|
%zip.openArchive(%filePath);
|
|
%zip.openArchive(%filePath);
|
|
@@ -306,8 +280,14 @@ function AssetBrowser::onDropFolder(%this, %filePath)
|
|
|
|
|
|
function AssetBrowser::onEndDropFiles( %this )
|
|
function AssetBrowser::onEndDropFiles( %this )
|
|
{
|
|
{
|
|
- if(!%this.isVisible())
|
|
|
|
|
|
+ if(!AssetBrowser.isAwake() || !AssetBrowser.isVisible())
|
|
|
|
+ {
|
|
|
|
+ if(GuiEditorIsActive())
|
|
|
|
+ GuiEditor.onEndDropFiles();
|
|
|
|
+ else if(EditorIsActive())
|
|
|
|
+ EWorldEditor.onEndDropFiles();
|
|
return;
|
|
return;
|
|
|
|
+ }
|
|
|
|
|
|
ImportAssetWindow.refresh();
|
|
ImportAssetWindow.refresh();
|
|
}
|
|
}
|