mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 15:14:35 +00:00
Merge remote-tracking branch 'devhead/Preview4_0' into tsneo
# Conflicts: # Engine/source/platform/types.visualc.h # Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript # Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/terrain.tscript # Templates/BaseGame/game/tools/gui/editorSettingsWindow.ed.tscript # Templates/BaseGame/game/tools/gui/scriptEditorDlg.ed.gui
This commit is contained in:
commit
17231ca9fb
51 changed files with 736 additions and 488 deletions
|
|
@ -1,5 +1,3 @@
|
|||
new SimGroup(AssetBrowserPreviewCache);
|
||||
|
||||
//AssetBrowser.addToolbarButton
|
||||
function AssetBrowser::addToolbarButton(%this)
|
||||
{
|
||||
|
|
@ -30,18 +28,18 @@ function AssetBrowser::addToolbarButton(%this)
|
|||
EWToolsToolbar.setExtent((25 + 8) * (ToolsToolbarArray.getCount()) + 12 SPC "33");
|
||||
}
|
||||
//
|
||||
function AssetBrowser::onAdd(%this)
|
||||
{
|
||||
}
|
||||
|
||||
function AssetBrowser::onWake(%this)
|
||||
function AssetBrowser::initialize(%this)
|
||||
{
|
||||
// manage preview array
|
||||
if(!isObject(AssetPreviewArray))
|
||||
new ArrayObject(AssetPreviewArray);
|
||||
|
||||
if(!isObject(%this.dirHandler))
|
||||
{
|
||||
%this.dirHandler = makedirectoryHandler(AssetBrowser-->filterTree, "cache,shaderCache", "");
|
||||
%this.dirHandler.currentAddress = "data/";
|
||||
}
|
||||
|
||||
AssetBrowser-->filterTree.buildIconTable( ":tools/classIcons/Prefab:tools/classIcons/Prefab" @
|
||||
":tools/classIcons/SimSet:tools/classIcons/SimSet");
|
||||
|
|
@ -65,6 +63,30 @@ function AssetBrowser::onWake(%this)
|
|||
AssetBrowser-->filterAssetsButton.setActive(true);
|
||||
}
|
||||
|
||||
function AssetBrowser::onAdd(%this)
|
||||
{
|
||||
}
|
||||
|
||||
function AssetBrowser::onWake(%this)
|
||||
{
|
||||
%this.initialize();
|
||||
}
|
||||
|
||||
function AssetBrowser::onDialogPop(%this)
|
||||
{
|
||||
%lastPosExt = AssetBrowserWindow.position SPC AssetBrowserWindow.extent;
|
||||
EditorSettings.setValue("Assets/Browser/LastPosExt", %lastPosExt);
|
||||
}
|
||||
|
||||
function AssetBrowser::restoreLastPosExt(%this)
|
||||
{
|
||||
%lastPosExt = EditorSettings.value("Assets/Browser/LastPosExt", "");
|
||||
if(%lastPosExt !$= "")
|
||||
{
|
||||
AssetBrowserWindow.resize(getWord(%lastPosExt, 0), getWord(%lastPosExt, 1), getWord(%lastPosExt, 2), getWord(%lastPosExt, 3));
|
||||
}
|
||||
}
|
||||
|
||||
function contentTreeTabBook::onTabSelected(%this, %tabText, %tabIndex)
|
||||
{
|
||||
if(%tabText $= "Content")
|
||||
|
|
@ -273,6 +295,7 @@ function AssetBrowser::showDialog( %this, %AssetTypeFilter, %selectCallback, %ta
|
|||
|
||||
Canvas.popDialog(AssetBrowser);
|
||||
Canvas.pushDialog(AssetBrowser);
|
||||
|
||||
AssetBrowser.setVisible(1);
|
||||
AssetBrowserWindow.setVisible(1);
|
||||
AssetBrowserWindow.selectWindow();
|
||||
|
|
@ -301,6 +324,8 @@ function AssetBrowser::showDialog( %this, %AssetTypeFilter, %selectCallback, %ta
|
|||
}
|
||||
|
||||
AssetBrowser.loadDirectories();
|
||||
|
||||
AssetBrowser.restoreLastPosExt();
|
||||
}
|
||||
|
||||
function AssetBrowser::hideDialog( %this )
|
||||
|
|
@ -313,6 +338,18 @@ function AssetBrowser::hideDialog( %this )
|
|||
Canvas.popDialog(AssetBrowser);
|
||||
}
|
||||
|
||||
function AssetBrowser::toggleDialog( %this )
|
||||
{
|
||||
if(AssetBrowser.isAwake())
|
||||
{
|
||||
AssetBrowser.hideDialog();
|
||||
}
|
||||
else
|
||||
{
|
||||
AssetBrowser.showDialog();
|
||||
}
|
||||
}
|
||||
|
||||
function AssetBrowser::buildAssetPreview( %this, %asset, %moduleName )
|
||||
{
|
||||
if(!isObject(%this.previewData))
|
||||
|
|
@ -481,13 +518,12 @@ function AssetBrowser::buildAssetPreview( %this, %asset, %moduleName )
|
|||
{
|
||||
%previewButton.iconLocation = "Left";
|
||||
%previewButton.textLocation = "Right";
|
||||
%previewButton.extent = "120 20";
|
||||
%previewButton.setextent(120,20);
|
||||
}
|
||||
else
|
||||
{
|
||||
%size = %previewSize.x * %previewScaleSize;
|
||||
%previewButton.extent.x = %size;
|
||||
%previewButton.extent.y = %size + %textBottomPad;
|
||||
%previewButton.setextent(%size,%size + %textBottomPad);
|
||||
}
|
||||
|
||||
//%previewButton.extent = %previewSize.x + %previewBounds SPC %previewSize.y + %previewBounds + 24;
|
||||
|
|
@ -1417,13 +1453,10 @@ function AssetBrowser::doRebuildAssetArray(%this)
|
|||
AssetBrowser-->assetList.deleteAllObjects();
|
||||
AssetPreviewArray.empty();
|
||||
|
||||
// uhh?? I just added global schenanagins here to make this work
|
||||
%assetArray = $AssetBrowser::AssetArray;
|
||||
if(isObject(%assetArray))
|
||||
%assetArray.delete();
|
||||
if(isObject($AssetBrowser::AssetArray))
|
||||
$AssetBrowser::AssetArray.delete();
|
||||
|
||||
%assetArray = new ArrayObject();
|
||||
$AssetBrowser::AssetArray = %assetArray;
|
||||
$AssetBrowser::AssetArray = new ArrayObject();
|
||||
|
||||
//First, Query for our assets
|
||||
%assetQuery = new AssetQuery();
|
||||
|
|
@ -1504,7 +1537,7 @@ function AssetBrowser::doRebuildAssetArray(%this)
|
|||
{
|
||||
if(matchesSearch(%assetName, %assetType))
|
||||
{
|
||||
%assetArray.add( %moduleName, %assetId);
|
||||
$AssetBrowser::AssetArray.add( %moduleName, %assetId);
|
||||
|
||||
if(%assetType !$= "Folder")
|
||||
%finalAssetCount++;
|
||||
|
|
@ -1518,7 +1551,7 @@ function AssetBrowser::doRebuildAssetArray(%this)
|
|||
{
|
||||
if(AssetBrowser.assetTypeFilter $= %assetType)
|
||||
{
|
||||
%assetArray.add( %moduleName, %assetId );
|
||||
$AssetBrowser::AssetArray.add( %moduleName, %assetId );
|
||||
|
||||
if(%assetType !$= "Folder")
|
||||
%finalAssetCount++;
|
||||
|
|
@ -1527,7 +1560,7 @@ function AssetBrowser::doRebuildAssetArray(%this)
|
|||
else
|
||||
{
|
||||
//got it.
|
||||
%assetArray.add( %moduleName, %assetId );
|
||||
$AssetBrowser::AssetArray.add( %moduleName, %assetId );
|
||||
|
||||
if(%assetType !$= "Folder")
|
||||
%finalAssetCount++;
|
||||
|
|
@ -1549,7 +1582,7 @@ function AssetBrowser::doRebuildAssetArray(%this)
|
|||
{
|
||||
if(matchesSearch(%folderName, "Folder", ""))
|
||||
{
|
||||
%assetArray.add( %breadcrumbPath, "Folder" TAB %folderName );
|
||||
$AssetBrowser::AssetArray.add( %breadcrumbPath, "Folder" TAB %folderName );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
@ -1565,7 +1598,7 @@ function AssetBrowser::doRebuildAssetArray(%this)
|
|||
if(!%this.toolsModulesFilter && %folderName $= "tools" && %breadcrumbPath $= "")
|
||||
continue;
|
||||
|
||||
%assetArray.add( %breadcrumbPath, "Folder" TAB %folderName );
|
||||
$AssetBrowser::AssetArray.add( %breadcrumbPath, "Folder" TAB %folderName );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1595,14 +1628,14 @@ function AssetBrowser::doRebuildAssetArray(%this)
|
|||
%dbName = %obj.getName();
|
||||
if(matchesSearch(%dbName, "Datablock"))
|
||||
{
|
||||
%assetArray.add( %dbFilename, "Datablock" TAB %dbName );
|
||||
$AssetBrowser::AssetArray.add( %dbFilename, "Datablock" TAB %dbName );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(%dbFilePath $= %breadcrumbPath)
|
||||
{
|
||||
%dbName = %obj.getName();
|
||||
%assetArray.add( %dbFilename, "Datablock" TAB %dbName );
|
||||
$AssetBrowser::AssetArray.add( %dbFilename, "Datablock" TAB %dbName );
|
||||
|
||||
/*%catItem = AssetBrowser-->filterTree.findItemByName(%obj.category);
|
||||
|
||||
|
|
@ -1627,7 +1660,7 @@ function AssetBrowser::doRebuildAssetArray(%this)
|
|||
%looseFileName = fileName(%looseFileFullPath);
|
||||
%looseFileExt = fileExt(%looseFileFullPath);
|
||||
|
||||
%assetArray.add( %looseFilePath, "LooseFile" TAB %looseFileName );
|
||||
$AssetBrowser::AssetArray.add( %looseFilePath, "LooseFile" TAB %looseFileName );
|
||||
}
|
||||
|
||||
//Prefabs
|
||||
|
|
@ -1646,13 +1679,13 @@ function AssetBrowser::doRebuildAssetArray(%this)
|
|||
{
|
||||
if(matchesSearch(%prefabName, "Prefab"))
|
||||
{
|
||||
%assetArray.add( %prefabPath, "Prefab" TAB %prefabName );
|
||||
$AssetBrowser::AssetArray.add( %prefabPath, "Prefab" TAB %prefabName );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(%prefabPath $= %breadcrumbPath)
|
||||
{
|
||||
%assetArray.add( %prefabPath, "Prefab" TAB %prefabName );
|
||||
$AssetBrowser::AssetArray.add( %prefabPath, "Prefab" TAB %prefabName );
|
||||
}
|
||||
|
||||
%fullPrefabPath = findNextFile( %breadcrumbPath @ "/" @ %expr );
|
||||
|
|
@ -1672,13 +1705,13 @@ function AssetBrowser::doRebuildAssetArray(%this)
|
|||
{
|
||||
if(matchesSearch(%cppName, "Cpp"))
|
||||
{
|
||||
%assetArray.add( %cppPath, "Cpp" TAB %cppName );
|
||||
$AssetBrowser::AssetArray.add( %cppPath, "Cpp" TAB %cppName );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(%cppPath $= %breadcrumbPath)
|
||||
{
|
||||
%assetArray.add( %cppPath, "Cpp" TAB %cppName );
|
||||
$AssetBrowser::AssetArray.add( %cppPath, "Cpp" TAB %cppName );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1696,13 +1729,13 @@ function AssetBrowser::doRebuildAssetArray(%this)
|
|||
{
|
||||
if(matchesSearch(%cppName, "Cpp"))
|
||||
{
|
||||
%assetArray.add( %cppPath, "Cpp" TAB %cppName );
|
||||
$AssetBrowser::AssetArray.add( %cppPath, "Cpp" TAB %cppName );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(%cppPath $= %breadcrumbPath)
|
||||
{
|
||||
%assetArray.add( %cppPath, "Cpp" TAB %cppName );
|
||||
$AssetBrowser::AssetArray.add( %cppPath, "Cpp" TAB %cppName );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1744,13 +1777,13 @@ function AssetBrowser::doRebuildAssetArray(%this)
|
|||
{
|
||||
if(matchesSearch(%tscriptName, "tscript"))
|
||||
{
|
||||
%assetArray.add( %tscriptPath, "tscript" TAB %tscriptName );
|
||||
$AssetBrowser::AssetArray.add( %tscriptPath, "tscript" TAB %tscriptName );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(%tscriptPath $= %breadcrumbPath)
|
||||
{
|
||||
%assetArray.add( %tscriptPath, "tscript" TAB %tscriptName );
|
||||
$AssetBrowser::AssetArray.add( %tscriptPath, "tscript" TAB %tscriptName );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1772,13 +1805,13 @@ function AssetBrowser::doRebuildAssetArray(%this)
|
|||
%name = %creatorObj.val[1];
|
||||
%func = %creatorObj.val[2];
|
||||
|
||||
%assetArray.add( %name, "Creator" TAB %creatorObj );
|
||||
$AssetBrowser::AssetArray.add( %name, "Creator" TAB %creatorObj );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(%i=0; %i < %assetArray.count(); %i++)
|
||||
AssetBrowser.buildAssetPreview( %assetArray.getValue(%i), %assetArray.getKey(%i) );
|
||||
for(%i=0; %i < $AssetBrowser::AssetArray.count(); %i++)
|
||||
AssetBrowser.buildAssetPreview( $AssetBrowser::AssetArray.getValue(%i), $AssetBrowser::AssetArray.getKey(%i) );
|
||||
|
||||
AssetBrowser_FooterText.text = %finalAssetCount @ " Assets";
|
||||
|
||||
|
|
@ -2075,7 +2108,14 @@ function AssetBrowser::navigateTo(%this, %address, %historyNav)
|
|||
|
||||
if(%this.hasLooseFilesInDir())
|
||||
{
|
||||
if(EditorSettings.value("Assets/AutoImportLooseFiles", false) && EditorSettings.value("Assets/AutoImport", false))
|
||||
{
|
||||
AssetBrowser.autoImportSimpleLooseFiles();
|
||||
}
|
||||
else
|
||||
{
|
||||
%this-->AutoImportAssetButton.visible = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -2420,6 +2460,11 @@ function EWorldEditor::onControlDropped( %this, %payload, %position )
|
|||
%buildCommand = AssetBrowser @ ".on" @ %assetType @ "EditorDropped(" @ %assetDef @ ",\"" @ %position @ "\");";
|
||||
}
|
||||
eval(%buildCommand);
|
||||
|
||||
if(EditorSettings.value("AssetManagement/Assets/closeBrowserOnDragAction", false))
|
||||
{
|
||||
AssetBrowser.hideDialog();
|
||||
}
|
||||
}
|
||||
|
||||
EWorldEditor.isDirty = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue