mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-13 07:34:45 +00:00
Removed unneeded deletion of asset definition in various asset deconstructors - was causing crash on shutdown when a new asset was made
Added ability to check if popup menu is currently Visible Removed unwanted path debug/testing code from tsShapeConstructor Made a number of default postFX's names more consistent and set up asset definitions for them. Began adding hooks to PostFX editor as well Refactored Asset Import window with new layout, revamped import behavior to work with new layout concept and easier editing of import 'session' Updated Asset Browser to utilize a common 'DirectoryHandler' object to standardize/centralize all folder navigation behavior for the asset tool ecosystem Added new window to select path for assets Refactored import config editor to be easier to utilize Added field in editor settings to edit import configs without needing to first try and import assets Updated a number of asset types' scripts to handle address-based system Began standardizing a number of 'actions' for the asset browser, including drag-n-drop, renaming, deleting, moving, etc. Made refreshing behavior of AB more consistent When making new in AB folder, it will automatically navigate to the new folder When making a new folder, prompts the folder name via new popup window Refactored PostFX editor to use newer layout with side list for easier use
This commit is contained in:
parent
b2fcd5e7fb
commit
b1e3706dd6
69 changed files with 2692 additions and 1443 deletions
|
|
@ -41,27 +41,20 @@ function AssetBrowser::onWake(%this)
|
|||
if(!isObject(AssetPreviewArray))
|
||||
new ArrayObject(AssetPreviewArray);
|
||||
|
||||
if(!isObject(ImportAssetTree))
|
||||
new GuiTreeViewCtrl(ImportAssetTree);
|
||||
if(!isObject(%this.dirHandler))
|
||||
%this.dirHandler = makedirectoryHandler(AssetBrowser-->filterTree, "cache,shaderCache", "");
|
||||
|
||||
if(!isObject(AssetBrowser_NavPrevHistoryList))
|
||||
{
|
||||
new ArrayObject(AssetBrowser_NavPrevHistoryList);
|
||||
}
|
||||
if(!isObject(AssetBrowser_NavForeHistoryList))
|
||||
{
|
||||
new ArrayObject(AssetBrowser_NavForeHistoryList);
|
||||
}
|
||||
AssetBrowser-->filterTree.buildIconTable( ":tools/classIcons/Prefab:tools/classIcons/Prefab" @
|
||||
":tools/classIcons/SimSet:tools/classIcons/SimSet");
|
||||
|
||||
%this.importingFilesArray = new ArrayObject();
|
||||
%this.importAssetUnprocessedListArray = new ArrayObject();
|
||||
%this.importAssetFinalListArray = new ArrayObject();
|
||||
|
||||
%this.isReImportingAsset = false;
|
||||
|
||||
%this.coreModulesFilter = false;
|
||||
%this.toolsModulesFilter = false;
|
||||
%this.onlyShowModulesWithAssets = false;
|
||||
%this.treeFilterMode = "list";
|
||||
|
||||
%this.folderPanelState = true;
|
||||
%this.folderPanelSplit = 0;
|
||||
|
|
@ -109,7 +102,7 @@ function AssetBrowser::viewCoreModulesFilter(%this)
|
|||
|
||||
EditorSettings.setValue("Assets/Browser/showCoreModule", %newVal);
|
||||
|
||||
AssetBrowser.loadFilters();
|
||||
AssetBrowser.refresh();
|
||||
}
|
||||
|
||||
function AssetBrowser::viewToolsModulesFilter(%this)
|
||||
|
|
@ -121,7 +114,7 @@ function AssetBrowser::viewToolsModulesFilter(%this)
|
|||
|
||||
EditorSettings.setValue("Assets/Browser/showToolsModule", %newVal);
|
||||
|
||||
AssetBrowser.loadFilters();
|
||||
AssetBrowser.refresh();
|
||||
}
|
||||
|
||||
function AssetBrowser::viewPopulatedModulesFilter(%this)
|
||||
|
|
@ -133,7 +126,7 @@ function AssetBrowser::viewPopulatedModulesFilter(%this)
|
|||
|
||||
EditorSettings.setValue("Assets/Browser/showOnlyPopulatedModule", %newVal);
|
||||
|
||||
AssetBrowser.loadFilters();
|
||||
AssetBrowser.refresh();
|
||||
}
|
||||
|
||||
function AssetBrowser::toggleShowingFolders(%this)
|
||||
|
|
@ -145,7 +138,7 @@ function AssetBrowser::toggleShowingFolders(%this)
|
|||
|
||||
EditorSettings.setValue("Assets/Browser/showFolders", %newVal);
|
||||
|
||||
AssetBrowser.loadFilters();
|
||||
AssetBrowser.refresh();
|
||||
}
|
||||
|
||||
function AssetBrowser::toggleShowingEmptyFolders(%this)
|
||||
|
|
@ -157,19 +150,7 @@ function AssetBrowser::toggleShowingEmptyFolders(%this)
|
|||
|
||||
EditorSettings.setValue("Assets/Browser/showEmptyFolders", %newVal);
|
||||
|
||||
AssetBrowser.loadFilters();
|
||||
}
|
||||
|
||||
function AssetBrowser::viewListFilter(%this)
|
||||
{
|
||||
%this.treeFilterMode = "list";
|
||||
AssetBrowser.loadFilters();
|
||||
}
|
||||
|
||||
function AssetBrowser::viewTagsFilter(%this)
|
||||
{
|
||||
%this.treeFilterMode = "tags";
|
||||
AssetBrowser.loadFilters();
|
||||
AssetBrowser.refresh();
|
||||
}
|
||||
|
||||
function AssetBrowser::toggleAssetTypeFilter(%this, %assetTypeIdx)
|
||||
|
|
@ -223,6 +204,7 @@ function AssetBrowser::toggleAssetTypeFilter(%this, %assetTypeIdx)
|
|||
%this.rebuildAssetArray();
|
||||
}
|
||||
|
||||
//
|
||||
function AssetBrowser::selectAsset( %this, %asset )
|
||||
{
|
||||
if(AssetBrowser.selectCallback !$= "")
|
||||
|
|
@ -280,10 +262,8 @@ function AssetBrowser::showDialog( %this, %AssetTypeFilter, %selectCallback, %ta
|
|||
{
|
||||
%this-->SelectButton.setHidden(false);
|
||||
}
|
||||
|
||||
//AssetBrowser_importAssetWindow.setVisible(0);
|
||||
//AssetBrowser_importAssetConfigWindow.setVisible(0);
|
||||
AssetBrowser.loadFilters();
|
||||
|
||||
AssetBrowser.loadDirectories();
|
||||
}
|
||||
|
||||
function AssetBrowser::hideDialog( %this )
|
||||
|
|
@ -397,6 +377,10 @@ function AssetBrowser::buildPreviewArray( %this, %asset, %moduleName )
|
|||
AssetPreviewArray.add( %previewButton, %this.previewData.previewImage );
|
||||
}
|
||||
|
||||
function AssetBrowser::refresh(%this)
|
||||
{
|
||||
%this.navigateTo(%this.dirHandler.currentAddress);
|
||||
}
|
||||
//
|
||||
//
|
||||
function AssetPreviewButton::onClick(%this)
|
||||
|
|
@ -411,246 +395,31 @@ function AssetPreviewButton::onDoubleClick(%this)
|
|||
//
|
||||
//
|
||||
|
||||
function AssetBrowser::loadFolders(%this, %path, %parentId)
|
||||
{
|
||||
//utilize home dir project setting here
|
||||
%paths = getDirectoryList(%path);
|
||||
for(%i=0; %i < getFieldCount(%paths); %i++)
|
||||
{
|
||||
%childPath = getField(%paths, %i);
|
||||
|
||||
%folderCount = getTokenCount(%childPath, "/");
|
||||
|
||||
for(%f=0; %f < %folderCount; %f++)
|
||||
{
|
||||
%folderName = getToken(%childPath, "/", %f);
|
||||
|
||||
//we don't need to display the shadercache folder
|
||||
if(%parentId == 1 && (%folderName $= "shaderCache" || %folderName $= "cache"))
|
||||
continue;
|
||||
|
||||
%iconIdx = 1;
|
||||
|
||||
if(ModuleDatabase.findModule(%folderName) !$= "")
|
||||
%iconIdx = 0;
|
||||
|
||||
%searchFoldersText = AssetBrowserFolderSearchFilter.getText();
|
||||
if(%searchFoldersText !$= "Search Folders...")
|
||||
{
|
||||
if(strstr(strlwr(%folderName), strlwr(%searchFoldersText)) != -1)
|
||||
{
|
||||
%folderID = AssetBrowser-->filterTree.insertItem(%parentId, %folderName, %path, "", %iconIdx, %iconIdx);
|
||||
|
||||
%this.loadFolders(%path @ "/" @ %folderName, %folderID);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
%folderID = AssetBrowser-->filterTree.insertItem(%parentId, %folderName, %path, "", %iconIdx, %iconIdx);
|
||||
|
||||
%this.loadFolders(%path @ "/" @ %folderName, %folderID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function AssetBrowser::loadFilters( %this )
|
||||
function AssetBrowser::loadDirectories( %this )
|
||||
{
|
||||
AssetBrowser-->filterTree.clear();
|
||||
|
||||
AssetBrowser-->filterTree.buildIconTable( "tools/classIcons/Prefab" @
|
||||
":tools/classIcons/SimSet");
|
||||
|
||||
%dataItem = AssetBrowser-->filterTree.insertItem(0, "Data");
|
||||
%this.loadFolders("Data", %dataItem);
|
||||
%this.dirHandler.loadFolders("Data", %dataItem);
|
||||
|
||||
//If set to, show core
|
||||
if(%this.coreModulesFilter)
|
||||
{
|
||||
%coreItem = AssetBrowser-->filterTree.insertItem(0, "Core");
|
||||
%this.loadFolders("Core", %coreItem);
|
||||
%this.dirHandler.loadFolders("Core", %coreItem);
|
||||
}
|
||||
|
||||
//If set to, show tools
|
||||
if(%this.toolsModulesFilter)
|
||||
{
|
||||
%toolsItem = AssetBrowser-->filterTree.insertItem(0, "Tools");
|
||||
%this.loadFolders("Tools", %toolsItem);
|
||||
%this.dirHandler.loadFolders("Tools", %toolsItem);
|
||||
}
|
||||
|
||||
//AssetBrowser-->filterTree.insertItem(0, "Data");
|
||||
|
||||
//get it alllll
|
||||
/*%directoryDump = getDirectoryList("data", -1);
|
||||
|
||||
%dirs = getFieldCount(%directoryDump);
|
||||
|
||||
for(%i=0; %i < %dirs; %i++)
|
||||
{
|
||||
%folderName = getToken(%assetBasePath, "/", %f);
|
||||
|
||||
%folderID = AssetBrowser-->filterTree.findChildItemByName(%prevFolderID, %folderName);
|
||||
|
||||
if(%folderID == -1 || %folderID == 0)
|
||||
{
|
||||
%pathCache = "";
|
||||
|
||||
for(%c=0; %c < %f; %c++)
|
||||
{
|
||||
%pathCache = %c == 0 ? getToken(%assetBasePath, "/", %c) : %pathCache @ "/" @ getToken(%assetBasePath, "/", %c);
|
||||
}
|
||||
|
||||
%folderID = AssetBrowser-->filterTree.insertItem(%prevFolderID, %folderName, %pathCache, "", 1, 1);
|
||||
}
|
||||
}*/
|
||||
|
||||
AssetPreviewArray.empty();
|
||||
|
||||
/*%assetQuery = new AssetQuery();
|
||||
%numAssetsFound = AssetDatabase.findAllAssets(%assetQuery);
|
||||
|
||||
for( %i=0; %i < %numAssetsFound; %i++)
|
||||
{
|
||||
%assetId = %assetQuery.getAsset(%i);
|
||||
|
||||
%assetPath = makeRelativePath(AssetDatabase.getAssetFilePath(%assetId));
|
||||
|
||||
//clean up the path
|
||||
%assetPath = strreplace(%assetPath, "\\\\", "\\");
|
||||
%assetPath = strreplace(%assetPath, "\\", "\\");
|
||||
%assetPath = strreplace(%assetPath, "//", "\\");
|
||||
|
||||
%assetBasePath = filePath(%assetPath);
|
||||
|
||||
%foldersCount = getTokenCount(%assetBasePath, "/");
|
||||
|
||||
//Build our directory structure
|
||||
%prevFolderID = 0;
|
||||
for(%f=0; %f < %foldersCount; %f++)
|
||||
{
|
||||
%folderName = getToken(%assetBasePath, "/", %f);
|
||||
|
||||
%folderID = AssetBrowser-->filterTree.findChildItemByName(%prevFolderID, %folderName);
|
||||
|
||||
if(%folderID == -1 || %folderID == 0)
|
||||
{
|
||||
%pathCache = "";
|
||||
|
||||
for(%c=0; %c < %f; %c++)
|
||||
{
|
||||
%pathCache = %c == 0 ? getToken(%assetBasePath, "/", %c) : %pathCache @ "/" @ getToken(%assetBasePath, "/", %c);
|
||||
}
|
||||
|
||||
%folderID = AssetBrowser-->filterTree.insertItem(%prevFolderID, %folderName, %pathCache, "", 1, 1);
|
||||
}
|
||||
|
||||
%prevFolderID = %folderID;
|
||||
}
|
||||
|
||||
//first, get the asset's module, as our major categories
|
||||
%module = AssetDatabase.getAssetModule(%assetId);
|
||||
|
||||
%moduleName = %module.moduleId;
|
||||
|
||||
%moduleGroup = %module.Group;
|
||||
if((%moduleGroup $= "Core" || %moduleGroup $= "Tools") && !%this.coreModulesFilter)
|
||||
continue;
|
||||
|
||||
//first, see if this module Module is listed already
|
||||
/*%moduleItemId = AssetBrowser-->filterTree.findItemByName(%moduleName);
|
||||
|
||||
//if(%moduleItemId == 0)
|
||||
// %moduleItemId = AssetBrowser-->filterTree.insertItem(1, %moduleName, "", "", 1, 1);
|
||||
|
||||
%assetType = AssetDatabase.getAssetCategory(%assetId);
|
||||
|
||||
if(%assetType $= "")
|
||||
{
|
||||
%assetType = AssetDatabase.getAssetType(%assetId);
|
||||
if(%assetType $= "")
|
||||
%assetType = "Misc";
|
||||
}
|
||||
|
||||
if(AssetBrowser.assetTypeFilter !$= "" && AssetBrowser.assetTypeFilter !$= %assetType)
|
||||
continue;
|
||||
|
||||
%assetTypeId = AssetBrowser-->filterTree.findChildItemByName(%moduleItemId, %assetType);
|
||||
|
||||
if(%assetTypeId == 0)
|
||||
%assetTypeId = AssetBrowser-->filterTree.insertItem(%moduleItemId, %assetType);*/
|
||||
//}
|
||||
|
||||
AssetBrowser-->filterTree.buildVisibleTree(true);
|
||||
|
||||
/*if(%this.treeFilterMode $= "list")
|
||||
{
|
||||
//First, build our our list of active modules
|
||||
%modulesList = ModuleDatabase.findModules(true);
|
||||
|
||||
for(%i=0; %i < getWordCount(%modulesList); %i++)
|
||||
{
|
||||
%moduleName = getWord(%modulesList, %i).ModuleId;
|
||||
|
||||
%moduleGroup = getWord(%modulesList, %i).Group;
|
||||
if((%moduleGroup $= "Core" || %moduleGroup $= "Tools") && !%this.coreModulesFilter)
|
||||
continue;
|
||||
|
||||
%moduleItemId = AssetBrowser-->filterTree.findItemByName(%moduleName);
|
||||
|
||||
if(%moduleItemId == 0)
|
||||
%moduleItemId = AssetBrowser-->filterTree.insertItem(1, %moduleName, "", "", 1, 1);
|
||||
}
|
||||
|
||||
//Next, go through and list the asset categories
|
||||
%assetQuery = new AssetQuery();
|
||||
%numAssetsFound = AssetDatabase.findAllAssets(%assetQuery);
|
||||
|
||||
for( %i=0; %i < %numAssetsFound; %i++)
|
||||
{
|
||||
%assetId = %assetQuery.getAsset(%i);
|
||||
|
||||
//first, get the asset's module, as our major categories
|
||||
%module = AssetDatabase.getAssetModule(%assetId);
|
||||
|
||||
%moduleName = %module.moduleId;
|
||||
|
||||
%moduleGroup = %module.Group;
|
||||
if((%moduleGroup $= "Core" || %moduleGroup $= "Tools") && !%this.coreModulesFilter)
|
||||
continue;
|
||||
|
||||
//first, see if this module Module is listed already
|
||||
%moduleItemId = AssetBrowser-->filterTree.findItemByName(%moduleName);
|
||||
|
||||
if(%moduleItemId == 0)
|
||||
%moduleItemId = AssetBrowser-->filterTree.insertItem(1, %moduleName, "", "", 1, 1);
|
||||
|
||||
%assetType = AssetDatabase.getAssetCategory(%assetId);
|
||||
|
||||
if(%assetType $= "")
|
||||
{
|
||||
%assetType = AssetDatabase.getAssetType(%assetId);
|
||||
if(%assetType $= "")
|
||||
%assetType = "Misc";
|
||||
}
|
||||
|
||||
if(AssetBrowser.assetTypeFilter !$= "" && AssetBrowser.assetTypeFilter !$= %assetType)
|
||||
continue;
|
||||
|
||||
%assetTypeId = AssetBrowser-->filterTree.findChildItemByName(%moduleItemId, %assetType);
|
||||
|
||||
if(%assetTypeId == 0)
|
||||
%assetTypeId = AssetBrowser-->filterTree.insertItem(%moduleItemId, %assetType);
|
||||
}
|
||||
|
||||
AssetBrowser-->filterTree.buildVisibleTree(true);
|
||||
}
|
||||
else if(%this.treeFilterMode $= "tags")
|
||||
{
|
||||
|
||||
}*/
|
||||
|
||||
//%this.collapseTree();
|
||||
|
||||
//Remove any modules that have no assets if we have that filter on
|
||||
if(%this.onlyShowModulesWithAssets)
|
||||
{
|
||||
|
|
@ -677,61 +446,14 @@ function AssetBrowser::loadFilters( %this )
|
|||
%dataItem = AssetBrowser-->filterTree.findItemByName("Data");
|
||||
AssetBrowser-->filterTree.expandItem(%dataItem);
|
||||
|
||||
AssetBrowser.expandTreeToAddress(AssetBrowser.currentAddress);
|
||||
AssetBrowser.dirHandler.expandTreeToAddress(AssetBrowser.dirHandler.currentAddress);
|
||||
|
||||
%selectedItem = AssetBrowser.getFolderTreeItemFromAddress(AssetBrowser.currentAddress);
|
||||
%selectedItem = AssetBrowser.dirHandler.getFolderTreeItemFromAddress(AssetBrowser.dirHandler.currentAddress);
|
||||
AssetBrowser-->filterTree.scrollVisibleByObjectId(%selectedItem);
|
||||
|
||||
AssetBrowser-->filterTree.buildVisibleTree();
|
||||
}
|
||||
|
||||
// create category and update current material if there is one
|
||||
function AssetBrowser::createFilter( %this, %filter )
|
||||
{
|
||||
if( %filter $= %existingFilters )
|
||||
{
|
||||
MessageBoxOK( "Error", "Can not create blank filter.");
|
||||
return;
|
||||
}
|
||||
|
||||
for( %i = AssetBrowser.staticFilterObjects; %i < AssetBrowser-->filterArray.getCount() ; %i++ )
|
||||
{
|
||||
%existingFilters = AssetBrowser-->filterArray.getObject(%i).getObject(0).filter;
|
||||
if( %filter $= %existingFilters )
|
||||
{
|
||||
MessageBoxOK( "Error", "Can not create two filters of the same name.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
%container = new GuiControl(){
|
||||
profile = "ToolsGuiDefaultProfile";
|
||||
Position = "0 0";
|
||||
Extent = "128 18";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
isContainer = "1";
|
||||
|
||||
new GuiCheckBoxCtrl(){
|
||||
Profile = "ToolsGuiCheckBoxListProfile";
|
||||
position = "5 1";
|
||||
Extent = "118 18";
|
||||
Command = "";
|
||||
groupNum = "0";
|
||||
buttonType = "ToggleButton";
|
||||
text = %filter @ " ( " @ MaterialFilterAllArray.countKey(%filter) @ " )";
|
||||
filter = %filter;
|
||||
Command = "AssetBrowser.preloadFilter();";
|
||||
};
|
||||
};
|
||||
|
||||
AssetBrowser-->filterArray.add( %container );
|
||||
|
||||
// if selection exists, lets reselect it to refresh it
|
||||
if( isObject(AssetBrowser.selectedMaterial) )
|
||||
AssetBrowser.updateSelection( AssetBrowser.selectedMaterial, AssetBrowser.selectedPreviewImagePath );
|
||||
|
||||
// material category text field to blank
|
||||
AssetBrowser_addFilterWindow-->tagName.setText("");
|
||||
AssetBrowser.refresh();
|
||||
}
|
||||
|
||||
function AssetBrowser::updateSelection( %this, %asset, %moduleName )
|
||||
|
|
@ -765,26 +487,6 @@ function AssetBrowser::updateSelection( %this, %asset, %moduleName )
|
|||
%this.prevSelectedMaterialHL = %asset;
|
||||
}
|
||||
|
||||
function AssetBrowser::collapseTree(%this)
|
||||
{
|
||||
%modulesList = ModuleDatabase.findModules(true);
|
||||
|
||||
for(%i=0; %i < getWordCount(%modulesList); %i++)
|
||||
{
|
||||
%moduleName = getWord(%modulesList, %i).ModuleId;
|
||||
|
||||
%moduleGroup = getWord(%modulesList, %i).Group;
|
||||
if((%moduleGroup $= "Core" || %moduleGroup $= "Tools") && !%this.coreModulesFilter)
|
||||
continue;
|
||||
|
||||
%moduleItemId = AssetBrowser-->filterTree.findItemByName(%moduleName);
|
||||
|
||||
AssetBrowser-->filterTree.expandItem(%moduleItemId, false);
|
||||
}
|
||||
|
||||
AssetBrowser-->filterTree.expandItem(1, true);
|
||||
}
|
||||
|
||||
//
|
||||
//needs to be deleted with the persistence manager and needs to be blanked out of the matmanager
|
||||
//also need to update instances... i guess which is the tricky part....
|
||||
|
|
@ -893,7 +595,7 @@ function AssetBrowser::toggleTagFilterPopup(%this)
|
|||
%moduleItemId = AssetBrowser-->filterTree.findItemByName(%moduleName);
|
||||
|
||||
if(%moduleItemId == -1 || %moduleItemId == 0)
|
||||
%moduleItemId = AssetBrowser-->filterTree.insertItem(1, %module.moduleId, "", "", 1, 1);
|
||||
%moduleItemId = AssetBrowser-->filterTree.insertItem(1, %module.moduleId, "", "", 1, 2);
|
||||
|
||||
//now, add the asset's category
|
||||
%assetType = AssetDatabase.getAssetCategory(%assetId);
|
||||
|
|
@ -1015,7 +717,10 @@ function AssetPreviewButton::onRightClick(%this)
|
|||
if(%assetType $= "LevelAsset")
|
||||
EditLevelAssetPopup.showPopup(Canvas);
|
||||
else if(%assetType $= "Folder")
|
||||
{
|
||||
EditFolderPopup.dirPath = %this.getParent().assetPath;
|
||||
EditFolderPopup.showPopup(Canvas);
|
||||
}
|
||||
else
|
||||
EditAssetPopup.showPopup(Canvas);
|
||||
|
||||
|
|
@ -1050,6 +755,7 @@ function AssetBrowserFilterTree::onRightMouseDown(%this, %itemId)
|
|||
else
|
||||
{
|
||||
EditFolderPopup.showPopup(Canvas);
|
||||
EditFolderPopup.assetType = "Folder";
|
||||
}
|
||||
}
|
||||
else if(%itemId == 1)
|
||||
|
|
@ -1126,14 +832,14 @@ function AssetBrowserFilterTree::onSelect(%this, %itemId)
|
|||
%breadcrumbPath = %this.getItemText(%itemId);
|
||||
|
||||
if(%breadcrumbPath $= "")
|
||||
%breadcrumbPath = AssetBrowser.currentAddress;
|
||||
%breadcrumbPath = AssetBrowser.dirHandler.currentAddress;
|
||||
|
||||
AssetBrowser.navigateTo(%breadcrumbPath);
|
||||
}
|
||||
|
||||
function AssetBrowser::rebuildAssetArray(%this)
|
||||
{
|
||||
%breadcrumbPath = AssetBrowser.currentAddress;
|
||||
%breadcrumbPath = AssetBrowser.dirHandler.currentAddress;
|
||||
|
||||
// we have to empty out the list; so when we create new guicontrols, these dont linger
|
||||
AssetBrowser-->assetList.deleteAllObjects();
|
||||
|
|
@ -1329,7 +1035,7 @@ function AssetBrowserFolderSearchFilter::onReturn( %this )
|
|||
if( %text $= "" )
|
||||
%this.reset();
|
||||
|
||||
AssetBrowser.loadFilters();
|
||||
AssetBrowser.refresh();
|
||||
}
|
||||
|
||||
function AssetBrowserSearchFilter::onReturn( %this )
|
||||
|
|
@ -1345,7 +1051,7 @@ function AssetBrowserFolderSearchFilter::reset( %this )
|
|||
{
|
||||
%this.setText( "Search Folders..." );
|
||||
|
||||
AssetBrowser.loadFilters();
|
||||
AssetBrowser.refresh();
|
||||
}
|
||||
|
||||
function AssetBrowserSearchFilter::reset( %this )
|
||||
|
|
@ -1364,15 +1070,64 @@ function AssetBrowser_ClearAssetFilterBtn::onClick( %this )
|
|||
{
|
||||
AssetBrowserSearchFilter.reset();
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
// Navigation
|
||||
function AssetBrowser::navigateTo(%this, %address, %historyNav)
|
||||
{
|
||||
//Don't bother navigating if it's to the place we already are
|
||||
if(AssetBrowser.currentAddress $= %address)
|
||||
return;
|
||||
if(AssetBrowser.dirHandler.currentAddress !$= %address)
|
||||
{
|
||||
AssetBrowser.dirHandler.navigateTo(%address, %historyNav);
|
||||
|
||||
%this.updateNavigationBreadcrumb(%address);
|
||||
|
||||
%module = AssetBrowser.dirHandler.getModuleFromAddress(%address);
|
||||
if(%module !$= "")
|
||||
{
|
||||
//legit module, so set it as current target
|
||||
AssetBrowser.SelectedModule = %module.moduleId;
|
||||
}
|
||||
}
|
||||
|
||||
%this.rebuildAssetArray();
|
||||
}
|
||||
|
||||
function AssetBrowser::navigateHistoryForward(%this)
|
||||
{
|
||||
%this.dirHandler.navigateHistoryForward();
|
||||
|
||||
%this.updateNavigationBreadcrumb();
|
||||
|
||||
%module = AssetBrowser.dirHandler.getModuleFromAddress(%address);
|
||||
if(%module !$= "")
|
||||
{
|
||||
//legit module, so set it as current target
|
||||
AssetBrowser.SelectedModule = %module.moduleId;
|
||||
}
|
||||
|
||||
%this.rebuildAssetArray();
|
||||
}
|
||||
|
||||
function AssetBrowser::navigateHistoryBack(%this)
|
||||
{
|
||||
%this.dirHandler.navigateHistoryBack();
|
||||
|
||||
%this.updateNavigationBreadcrumb();
|
||||
|
||||
%module = AssetBrowser.dirHandler.getModuleFromAddress(%address);
|
||||
if(%module !$= "")
|
||||
{
|
||||
//legit module, so set it as current target
|
||||
AssetBrowser.SelectedModule = %module.moduleId;
|
||||
}
|
||||
|
||||
%this.rebuildAssetArray();
|
||||
}
|
||||
|
||||
function AssetBrowser::updateNavigationBreadcrumb(%this, %address)
|
||||
{
|
||||
//clear the breadcrumb bar
|
||||
AssetBrowser_BreadcrumbBar.clear();
|
||||
|
||||
|
|
@ -1411,80 +1166,24 @@ function AssetBrowser::navigateTo(%this, %address, %historyNav)
|
|||
}
|
||||
}
|
||||
|
||||
//find our folder tree and action on it tree
|
||||
%folderId = AssetBrowser.getFolderTreeItemFromAddress(%address);
|
||||
|
||||
%oldAddress = AssetBrowser.currentAddress;
|
||||
AssetBrowser.currentAddress = %address;
|
||||
AssetBrowser.selectedItem = %folderId;
|
||||
|
||||
AssetBrowser-->filterTree.clearSelection();
|
||||
AssetBrowser-->filterTree.selectItem(%folderId);
|
||||
|
||||
//remove any history records that are 'newer' than this one
|
||||
if(%historyNav $= "")
|
||||
{
|
||||
AssetBrowser_NavForeHistoryList.empty();
|
||||
|
||||
if(%oldAddress !$= "")
|
||||
AssetBrowser_NavPrevHistoryList.push_front(%oldAddress);
|
||||
}
|
||||
|
||||
//refresh the nav buttons to display the history
|
||||
%backButtonHistory = "";
|
||||
for(%i=0; %i < AssetBrowser_NavPrevHistoryList.Count(); %i++)
|
||||
for(%i=0; %i < AssetBrowser.dirHandler.prevHistoryList.Count(); %i++)
|
||||
{
|
||||
%prevAddress = AssetBrowser_NavPrevHistoryList.getKey(%i);
|
||||
%prevAddress = AssetBrowser.dirHandler.prevHistoryList.getKey(%i);
|
||||
%backButtonHistory = %i==0 ? %prevAddress @ "\n" : %backButtonHistory @ %prevAddress @ "\n";
|
||||
}
|
||||
|
||||
AssetBrowser_NavigateBackBtn.tooltip = %backButtonHistory;
|
||||
|
||||
%foreButtonHistory = "";
|
||||
for(%i=0; %i < AssetBrowser_NavForeHistoryList.Count(); %i++)
|
||||
for(%i=0; %i < AssetBrowser.dirHandler.foreHistoryList.Count(); %i++)
|
||||
{
|
||||
%prevAddress = AssetBrowser_NavForeHistoryList.getKey(%i);
|
||||
%prevAddress = AssetBrowser.dirHandler.foreHistoryList.getKey(%i);
|
||||
%foreButtonHistory = %i==0 ? %prevAddress @ "\n" : %foreButtonHistory @ %prevAddress @ "\n";
|
||||
}
|
||||
|
||||
AssetBrowser_NavigateForwardBtn.tooltip = %foreButtonHistory;
|
||||
|
||||
%module = AssetBrowser.getModuleFromAddress(%address);
|
||||
if(%module !$= "")
|
||||
{
|
||||
//legit module, so set it as current target
|
||||
AssetBrowser.SelectedModule = %module.moduleId;
|
||||
}
|
||||
|
||||
%this.rebuildAssetArray();
|
||||
}
|
||||
|
||||
function AssetBrowser::navigateHistoryForward(%this)
|
||||
{
|
||||
if(AssetBrowser_NavForeHistoryList.count() == 0)
|
||||
return;
|
||||
|
||||
%newAddress = AssetBrowser_NavForeHistoryList.getKey(0);
|
||||
%prevHistory = AssetBrowser.currentAddress;
|
||||
|
||||
AssetBrowser_NavPrevHistoryList.push_front(%prevHistory);
|
||||
AssetBrowser_NavForeHistoryList.pop_front();
|
||||
|
||||
%this.navigateTo(%newAddress, true);
|
||||
}
|
||||
|
||||
function AssetBrowser::navigateHistoryBack(%this)
|
||||
{
|
||||
if(AssetBrowser_NavPrevHistoryList.count() == 0)
|
||||
return;
|
||||
|
||||
%newAddress = AssetBrowser_NavPrevHistoryList.getKey(0);
|
||||
%foreHistory = AssetBrowser.currentAddress;
|
||||
|
||||
AssetBrowser_NavForeHistoryList.push_front(%foreHistory);
|
||||
AssetBrowser_NavPrevHistoryList.pop_front();
|
||||
|
||||
%this.navigateTo(%newAddress, true);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
@ -1519,88 +1218,6 @@ function AssetBrowser::reloadModules(%this)
|
|||
//ModuleDatabase.loadGroup("Game");
|
||||
}
|
||||
|
||||
function AssetBrowser::getModuleFromAddress(%this, %address)
|
||||
{
|
||||
//break down the address
|
||||
%folderCount = getTokenCount(%address, "/");
|
||||
|
||||
for(%f=0; %f < %folderCount; %f++)
|
||||
{
|
||||
%folderName = getToken(%address, "/", %f);
|
||||
|
||||
%module = ModuleDatabase.findModule(%folderName);
|
||||
if(%module !$= "")
|
||||
return %module;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
//AssetBrowser.getFolderTreeItemFromAddress(AssetBrowser.currentAddress);
|
||||
function AssetBrowser::getFolderTreeItemFromAddress(%this, %address)
|
||||
{
|
||||
//break down the address
|
||||
%folderCount = getTokenCount(%address, "/");
|
||||
|
||||
%curItem = 0;
|
||||
%rebuiltPath = "";
|
||||
for(%f=0; %f < %folderCount; %f++)
|
||||
{
|
||||
%folderName = getToken(%address, "/", %f);
|
||||
%curItem = AssetBrowser-->filterTree.findChildItemByName(%curItem, %folderName);
|
||||
}
|
||||
|
||||
return %curItem;
|
||||
}
|
||||
|
||||
function AssetBrowser::expandTreeToAddress(%this, %address)
|
||||
{
|
||||
//break down the address
|
||||
%folderCount = getTokenCount(%address, "/");
|
||||
AssetBrowser-->filterTree.expandItem(0);
|
||||
|
||||
%curItem = 0;
|
||||
%rebuiltPath = "";
|
||||
for(%f=0; %f < %folderCount; %f++)
|
||||
{
|
||||
%folderName = getToken(%address, "/", %f);
|
||||
%curItem = AssetBrowser-->filterTree.findChildItemByName(%curItem, %folderName);
|
||||
AssetBrowser-->filterTree.expandItem(%curItem);
|
||||
}
|
||||
}
|
||||
//
|
||||
//
|
||||
//
|
||||
function AssetBrowser::createNewFolder(%this)
|
||||
{
|
||||
%newFolderIdx = "";
|
||||
%matched = true;
|
||||
%newFolderPath = "";
|
||||
while(%matched == true)
|
||||
{
|
||||
%newFolderPath = AssetBrowser.currentAddress @ "/NewFolder" @ %newFolderIdx;
|
||||
if(!isDirectory(%newFolderPath))
|
||||
{
|
||||
%matched = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
%newFolderIdx++;
|
||||
}
|
||||
}
|
||||
|
||||
//make a dummy file
|
||||
%file = new FileObject();
|
||||
%file.openForWrite(%newFolderPath @ "/test");
|
||||
%file.close();
|
||||
|
||||
fileDelete(%newFolderPath @ "/test");
|
||||
|
||||
//refresh the directory
|
||||
%this.loadFilters();
|
||||
%this.rebuildAssetArray();
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
|
|
@ -1749,7 +1366,14 @@ function EWorldEditor::onControlDropped( %this, %payload, %position )
|
|||
%module = %payload.dragSourceControl.parentGroup.moduleName;
|
||||
%asset = %payload.dragSourceControl.parentGroup.assetName;
|
||||
|
||||
if(%assetType $= "ImageAsset")
|
||||
if(AssetBrowser.isMethod("on" @ %assetType @ "EditorDropped"))
|
||||
{
|
||||
%assetDef = AssetDatabase.acquireAsset(%module @ ":" @ %asset);
|
||||
%buildCommand = AssetBrowser @ ".on" @ %assetType @ "EditorDropped(" @ %assetDef @ ",\"" @ %position @ "\");";
|
||||
eval(%buildCommand);
|
||||
}
|
||||
|
||||
/*if(%assetType $= "ImageAsset")
|
||||
{
|
||||
echo("WorldEditor::onControlDropped - dropped an ImageAsset onto the editor window. Todo: Implement dropping image/material into scene");
|
||||
}
|
||||
|
|
@ -1766,7 +1390,7 @@ function EWorldEditor::onControlDropped( %this, %payload, %position )
|
|||
|
||||
%newEntity.dirtyGameObject = true; //because if we're specifically setting the mesh asset, it's dirty*/
|
||||
|
||||
%newEntity = new TSStatic()
|
||||
/*%newEntity = new TSStatic()
|
||||
{
|
||||
position = %pos;
|
||||
shapeAsset = %module @ ":" @ %asset;
|
||||
|
|
@ -1820,7 +1444,7 @@ function EWorldEditor::onControlDropped( %this, %payload, %position )
|
|||
|
||||
EWorldEditor.clearSelection();
|
||||
EWorldEditor.selectObject(%newEntity);
|
||||
}
|
||||
}*/
|
||||
|
||||
EWorldEditor.isDirty = true;
|
||||
}
|
||||
|
|
@ -1850,7 +1474,7 @@ function AssetBrowserFilterTree::onControlDropped( %this, %payload, %position )
|
|||
%path = %this.getItemValue(%item) @ "/" @ %this.getItemText(%item);
|
||||
echo("DROPPED IT ON PATH " @ %path);
|
||||
|
||||
if(%path !$= AssetBrowser.CurrentAddress)
|
||||
if(%path !$= AssetBrowser.dirHandler.CurrentAddress)
|
||||
{
|
||||
//we're trying to move the asset to a different module!
|
||||
MessageBoxYesNo( "Move Asset", "Do you wish to move asset " @ %assetName @ " to " @ %path @ "?",
|
||||
|
|
|
|||
|
|
@ -203,10 +203,10 @@ function AssetBrowser::onEndDropFiles( %this )
|
|||
MessageBoxOK( "Warning", "No base import config. Please create an import configuration set to simplify asset importing.");
|
||||
}
|
||||
}
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
function AssetBrowser::reloadImportingFiles(%this)
|
||||
{
|
||||
//Effectively, we re-import the files we were trying to originally. We'd only usually do this in the event we change our import config
|
||||
|
|
@ -423,6 +423,17 @@ function ImportAssetWindow::onWake(%this)
|
|||
{
|
||||
%this.assetValidationList = new ArrayObject();
|
||||
}
|
||||
|
||||
AssetImportCtrl-->NewAssetsTree.buildIconTable( ":tools/classIcons/TSStatic:tools/classIcons/TSStatic" @
|
||||
":tools/classIcons/material:tools/classIcons/material"@
|
||||
":tools/classIcons/GuiBitmapCtrl:tools/classIcons/GuiBitmapCtrl"@
|
||||
":tools/classIcons/SFXEmitter:tools/classIcons/SFXEmitter"@
|
||||
":tools/gui/images/iconWarn:tools/gui/images/iconWarn"@
|
||||
":tools/gui/images/iconError:tools/gui/images/iconError");
|
||||
|
||||
AssetImportTargetAddress.text = AssetBrowser.dirHandler.currentAddress;
|
||||
AssetImportTargetModule.text = AssetBrowser.dirHandler.getModuleFromAddress(AssetBrowser.dirHandler.currentAddress).ModuleId;
|
||||
ImportAssetConfigList.setSelected(0);
|
||||
}
|
||||
|
||||
function ImportAssetWindow::reloadImportOptionConfigs(%this)
|
||||
|
|
@ -466,69 +477,15 @@ function ImportAssetWindow::reloadImportOptionConfigs(%this)
|
|||
if(%importConfigIdx $= "")
|
||||
%importConfigIdx = 0;
|
||||
|
||||
ImportAssetConfigList.setSelected(%importConfigIdx);
|
||||
//ImportAssetConfigList.setSelected(%importConfigIdx);
|
||||
}
|
||||
|
||||
function ImportAssetWindow::setImportOptions(%this, %configName)
|
||||
//
|
||||
function assetImportUpdatePath(%newPath)
|
||||
{
|
||||
//Todo, editor + load from files for preconfigs
|
||||
|
||||
//General
|
||||
%optionsObj.treatWarningsAsErrors = false;
|
||||
%optionsObj.ignoreDuplicateAssets = false;
|
||||
|
||||
//Meshes
|
||||
%optionsObj.ImportMesh = true;
|
||||
%optionsObj.UpAxisOverride = "Z_AXIS";
|
||||
%optionsObj.OverrideScale = 1.0;
|
||||
%optionsObj.IgnoreNodeScale = false;
|
||||
%optionsObj.AdjustCenter = false;
|
||||
%optionsObj.AdjustFloor = false;
|
||||
%optionsObj.CollapseSubmeshes = false;
|
||||
%optionsObj.LODType = "TrailingNumber";
|
||||
%optionsObj.TrailingNumber = 2;
|
||||
%optionsObj.ImportedNodes = "";
|
||||
%optionsObj.IgnoreNodes = "";
|
||||
%optionsObj.ImportMeshes = "";
|
||||
%optionsObj.IgnoreMeshes = "";
|
||||
|
||||
//Materials
|
||||
%optionsObj.ImportMaterials = true;
|
||||
%optionsObj.CreateComposites = true;
|
||||
|
||||
//Animations
|
||||
%optionsObj.ImportAnimations = true;
|
||||
%optionsObj.SeparateAnimations = true;
|
||||
%optionsObj.SeparateAnimationPrefix = "";
|
||||
|
||||
//Collision
|
||||
%optionsObj.GenerateCollisions = true;
|
||||
%optionsObj.GenCollisionType = "CollisionMesh";
|
||||
%optionsObj.CollisionMeshPrefix = "Collision";
|
||||
%optionsObj.GenerateLOSCollisions = true;
|
||||
%optionsObj.GenLOSCollisionType = "CollisionMesh";
|
||||
%optionsObj.LOSCollisionMeshPrefix = "LOS";
|
||||
|
||||
//Images
|
||||
%optionsObj.ImageType = "Diffuse";
|
||||
%optionsObj.DiffuseTypeSuffixes = "_ALBEDO,_DIFFUSE,_ALB,_DIF,_COLOR,_COL";
|
||||
%optionsObj.NormalTypeSuffixes = "_NORMAL,_NORM";
|
||||
%optionsObj.SpecularTypeSuffixes = "_SPECULAR,_SPEC";
|
||||
%optionsObj.MetalnessTypeSuffixes = "_METAL,_MET,_METALNESS,_METALLIC";
|
||||
%optionsObj.RoughnessTypeSuffixes = "_ROUGH,_ROUGHNESS";
|
||||
%optionsObj.SmoothnessTypeSuffixes = "_SMOOTH,_SMOOTHNESS";
|
||||
%optionsObj.AOTypeSuffixes = "_AO,_AMBIENT,_AMBIENTOCCLUSION";
|
||||
%optionsObj.CompositeTypeSuffixes = "_COMP,_COMPOSITE";
|
||||
%optionsObj.TextureFilteringMode = "Bilinear";
|
||||
%optionsObj.UseMips = true;
|
||||
%optionsObj.IsHDR = false;
|
||||
%optionsObj.Scaling = 1.0;
|
||||
%optionsObj.Compressed = true;
|
||||
|
||||
//Sounds
|
||||
%optionsObj.VolumeAdjust = 1.0;
|
||||
%optionsObj.PitchAdjust = 1.0;
|
||||
%optionsObj.Compressed = false;
|
||||
AssetBrowser.navigateTo(%newPath);
|
||||
AssetImportTargetAddress.text = %newPath;
|
||||
AssetImportTargetModule.text = AssetBrowser.dirHandler.getModuleFromAddress(AssetBrowser.dirHandler.currentAddress).ModuleId;
|
||||
}
|
||||
|
||||
//
|
||||
|
|
@ -818,11 +775,15 @@ function ImportAssetWindow::refresh(%this)
|
|||
|
||||
%this.processNewImportAssets(%id);
|
||||
|
||||
%this.indentCount = 0;
|
||||
%this.ImportingAssets = 0;
|
||||
%this.FetchedAssets = 0;
|
||||
%this.prunedDuplicateAssets = 0;
|
||||
%this.autoRenamedAssets = 0;
|
||||
|
||||
%this.validateAssets();
|
||||
|
||||
ImportingAssetList.clear();
|
||||
AssetImportCtrl-->NewAssetsTree.clear();
|
||||
AssetImportCtrl-->NewAssetsTree.insertItem(0, "Importing Assets");
|
||||
|
||||
if(AssetBrowser.importAssetUnprocessedListArray.count() == 0)
|
||||
{
|
||||
|
|
@ -838,6 +799,31 @@ function ImportAssetWindow::refresh(%this)
|
|||
//Continue processing
|
||||
%this.refresh();
|
||||
}
|
||||
|
||||
AssetImportCtrl-->NewAssetsTree.buildVisibleTree(true);
|
||||
|
||||
%ImportActionSummary = "";
|
||||
|
||||
if(%this.ImportingAssets != 0)
|
||||
{
|
||||
%ImportActionSummary = %ImportActionSummary SPC %this.ImportingAssets @ " Imported|";
|
||||
}
|
||||
if(%this.FetchedAssets != 0)
|
||||
{
|
||||
%ImportActionSummary = %ImportActionSummary SPC %this.FetchedAssets @ " Fetched|";
|
||||
}
|
||||
if(%this.prunedDuplicateAssets != 0)
|
||||
{
|
||||
%ImportActionSummary = %ImportActionSummary SPC %this.prunedDuplicateAssets @ " Duplicates Pruned|";
|
||||
}
|
||||
if(%this.autoRenamedAssets != 0)
|
||||
{
|
||||
%ImportActionSummary = %ImportActionSummary SPC %this.autoRenamedAssets @ " Auto Renamed|";
|
||||
}
|
||||
|
||||
warn(%ImportActionSummary);
|
||||
|
||||
AssetImportSummarization.Text = %ImportActionSummary;
|
||||
}
|
||||
|
||||
function ImportAssetWindow::refreshChildItem(%this, %id)
|
||||
|
|
@ -859,43 +845,35 @@ function ImportAssetWindow::refreshChildItem(%this, %id)
|
|||
//Once validated, attempt any fixes for issues
|
||||
%this.resolveIssue(%assetItem);
|
||||
|
||||
//Make sure we size correctly
|
||||
ImportingAssetList.extent.x = ImportingAssetList.getParent().extent.x - 15;
|
||||
|
||||
//create!
|
||||
%width = mRound(mRound(ImportingAssetList.extent.x) / 2);
|
||||
%height = 20;
|
||||
%indent = %this.indentCount * 16;
|
||||
%toolTip = "";
|
||||
|
||||
%iconPath = "tools/gui/images/iconInformation";
|
||||
%configCommand = "ImportAssetOptionsWindow.editImportSettings(" @ %assetItem @ ");";
|
||||
|
||||
if(%assetType $= "Model" || %assetType $= "Animation" || %assetType $= "Image" || %assetType $= "Sound")
|
||||
{
|
||||
if(%assetItem.status $= "Error")
|
||||
{
|
||||
%iconPath = "tools/gui/images/iconError";
|
||||
%iconIdx = 11;
|
||||
}
|
||||
else if(%assetItem.status $= "Warning")
|
||||
{
|
||||
%iconPath = "tools/gui/images/iconWarn";
|
||||
%iconIdx = 9;
|
||||
}
|
||||
|
||||
%configCommand = "ImportAssetOptionsWindow.fixIssues(" @ %assetItem @ ");";
|
||||
|
||||
if(%assetItem.statusType $= "DuplicateAsset" || %assetItem.statusType $= "DuplicateImportAsset")
|
||||
%assetName = %assetItem.assetName @ " <Duplicate Asset>";
|
||||
if(%assetItem.statusType $= "DuplicateAsset" || %assetItem.statusType $= "DuplicateImportAsset")
|
||||
%assetName = %assetItem.assetName @ " <Duplicate Asset>";
|
||||
}
|
||||
else
|
||||
{
|
||||
if(%assetItem.status $= "Error")
|
||||
{
|
||||
%iconPath = "tools/gui/images/iconError";
|
||||
%iconIdx = 11;
|
||||
}
|
||||
else if(%assetItem.status $= "Warning")
|
||||
{
|
||||
%iconPath = "tools/gui/images/iconWarn";
|
||||
%iconIdx = 9;
|
||||
}
|
||||
|
||||
%configCommand = "";//"ImportAssetOptionsWindow.fixIssues(" @ %assetItem @ ");";
|
||||
|
|
@ -905,128 +883,26 @@ function ImportAssetWindow::refreshChildItem(%this, %id)
|
|||
}
|
||||
|
||||
%toolTip = %assetItem.statusInfo;
|
||||
%parentItem = ImportAssetTree.getParentItem(%id);
|
||||
|
||||
%inputCellPos = %indent;
|
||||
%inputCellWidth = (ImportingAssetList.extent.x * 0.3) - %indent;
|
||||
|
||||
%filePathBtnPos = %inputCellPos + %inputCellWidth - %height;
|
||||
|
||||
%assetNameCellPos = %inputCellPos + %inputCellWidth;
|
||||
%assetNameCellWidth = ImportingAssetList.extent.x * 0.3;
|
||||
|
||||
%assetTypeCellPos = %assetNameCellPos + %assetNameCellWidth;
|
||||
%assetTypeCellWidth = ImportingAssetList.extent.x * 0.3;
|
||||
|
||||
%configBtnPos = %assetTypeCellPos + %assetTypeCellWidth - (%height * 2);
|
||||
%configBtnWidth = %height;
|
||||
|
||||
%delBtnPos = %assetTypeCellPos + %assetTypeCellWidth - %height;
|
||||
%delBtnWidth = %height;
|
||||
|
||||
%inputField = %filePath;
|
||||
|
||||
//Check if it's a generated type, like materials
|
||||
%inputPathProfile = ToolsGuiTextEditProfile;
|
||||
%generatedField = false;
|
||||
if(%assetItem.generatedAsset)
|
||||
if(%assetItem.status $= "")
|
||||
{
|
||||
%generatedField = true;
|
||||
%inputField = "(Generated)";
|
||||
}
|
||||
else
|
||||
{
|
||||
//nope, so check that it's a valid file path. If not, flag it as such
|
||||
if(%assetItem.status $= "Error")
|
||||
{
|
||||
if(!isFile(%filePath))
|
||||
{
|
||||
%inputField = "File not found!";
|
||||
%inputPathProfile = ToolsGuiTextEditErrorProfile;
|
||||
}
|
||||
}
|
||||
if(%assetType $= "Model")
|
||||
%iconIdx = 1;
|
||||
else if(%assetType $= "Material")
|
||||
%iconIdx = 3;
|
||||
else if(%assetType $= "Image")
|
||||
%iconIdx = 5;
|
||||
else if(%assetType $= "Sound")
|
||||
%iconIdx = 7;
|
||||
}
|
||||
|
||||
AssetImportCtrl-->NewAssetsTree.insertItem(%parentItem, %assetName, %assetItem, "", %iconIdx, %iconIdx+1);
|
||||
|
||||
%importEntry = new GuiControl()
|
||||
{
|
||||
position = "0 0";
|
||||
extent = ImportingAssetList.extent.x SPC %height;
|
||||
horzSizing = "width";
|
||||
vertSizing = "bottom";
|
||||
|
||||
new GuiTextEditCtrl()
|
||||
{
|
||||
Text = %inputField;
|
||||
position = %inputCellPos SPC "0";
|
||||
extent = %inputCellWidth SPC %height;
|
||||
internalName = "InputPath";
|
||||
active = false;
|
||||
profile = %inputPathProfile;
|
||||
horzSizing = "width";
|
||||
vertSizing = "bottom";
|
||||
};
|
||||
|
||||
new GuiButtonCtrl()
|
||||
{
|
||||
position = %filePathBtnPos SPC "0";
|
||||
extent = %height SPC %height;
|
||||
command = "ImportAssetWindow.findMissingFile(" @ %assetItem @ ");";
|
||||
text = "...";
|
||||
internalName = "InputPathButton";
|
||||
tooltip = %toolTip;
|
||||
visible = !%generatedField;
|
||||
horzSizing = "width";
|
||||
vertSizing = "bottom";
|
||||
};
|
||||
|
||||
new GuiTextEditCtrl()
|
||||
{
|
||||
Text = %assetName;
|
||||
position = %assetNameCellPos SPC "0";
|
||||
extent = %assetNameCellWidth SPC %height;
|
||||
internalName = "AssetName";
|
||||
horzSizing = "width";
|
||||
vertSizing = "bottom";
|
||||
};
|
||||
|
||||
new GuiTextEditCtrl()
|
||||
{
|
||||
Text = %assetType;
|
||||
position = %assetTypeCellPos SPC "0";
|
||||
extent = %assetTypeCellWidth SPC %height;
|
||||
active = false;
|
||||
internalName = "AssetType";
|
||||
horzSizing = "width";
|
||||
vertSizing = "bottom";
|
||||
};
|
||||
|
||||
new GuiBitmapButtonCtrl()
|
||||
{
|
||||
position = %configBtnPos SPC "0";
|
||||
extent = %height SPC %height;
|
||||
command = "ImportAssetWindow.importResolution(" @ %assetItem @ ");";
|
||||
bitmap = %iconPath;
|
||||
tooltip = %toolTip;
|
||||
horzSizing = "width";
|
||||
vertSizing = "bottom";
|
||||
};
|
||||
new GuiBitmapButtonCtrl()
|
||||
{
|
||||
position = %delBtnPos SPC "0";
|
||||
extent = %height SPC %height;
|
||||
command = "ImportAssetWindow.deleteImportingAsset(" @ %assetItem @ ");";
|
||||
bitmap = "tools/gui/images/iconDelete";
|
||||
horzSizing = "width";
|
||||
vertSizing = "bottom";
|
||||
};
|
||||
};
|
||||
|
||||
ImportingAssetList.add(%importEntry);
|
||||
AssetBrowser.importAssetFinalListArray.add(%assetItem);
|
||||
|
||||
if(ImportAssetTree.isParentItem(%id))
|
||||
{
|
||||
%this.indentCount++;
|
||||
|
||||
%childItem = ImportAssetTree.getChild(%id);
|
||||
|
||||
//recurse!
|
||||
|
|
@ -1035,11 +911,123 @@ function ImportAssetWindow::refreshChildItem(%this, %id)
|
|||
|
||||
%id = ImportAssetTree.getNextSibling(%id);
|
||||
}
|
||||
|
||||
%this.indentCount--;
|
||||
}
|
||||
//
|
||||
|
||||
//
|
||||
function NewAssetsViewTree::onSelect(%this, %itemId)
|
||||
{
|
||||
if(%itemId == 1)
|
||||
//can't select root
|
||||
return;
|
||||
|
||||
%assetItem = %this.getItemValue(%itemId);
|
||||
|
||||
AssetImportCtrl-->NewAssetsInspector.clearFields();
|
||||
|
||||
AssetImportCtrl-->NewAssetsInspector.startGroup("General");
|
||||
AssetImportCtrl-->NewAssetsInspector.addField("assetName", "Asset Name", "string", "", %assetItem.assetName, "", %assetItem);
|
||||
AssetImportCtrl-->NewAssetsInspector.addField("assetType", "Asset Type", "string", "", %assetItem.assetType, "", %assetItem);
|
||||
|
||||
if(!%assetItem.generatedAsset)
|
||||
AssetImportCtrl-->NewAssetsInspector.addField("filePath", "File Path", "fileName", "", %assetItem.filePath, "", %assetItem);
|
||||
|
||||
//AssetImportCtrl-->NewAssetsInspector.addField("assetName", "Asset Name", "string", "", %assetItem.assetName, "", %assetItem);
|
||||
//AssetImportCtrl-->NewAssetsInspector.addField("assetName", "Asset Name", "string", "", %assetItem.assetName, "", %assetItem);
|
||||
|
||||
AssetImportCtrl-->NewAssetsInspector.addField("status", "Status", "string", "", %assetItem.status, "", %assetItem);
|
||||
AssetImportCtrl-->NewAssetsInspector.endGroup();
|
||||
|
||||
AssetImportCtrl-->NewAssetsInspector.setFieldEnabled("assetType", false);
|
||||
//AssetImportCtrl-->NewAssetsInspector.setFieldEnabled("status", false);
|
||||
|
||||
/*moduleName = %moduleName;
|
||||
dirty = true;
|
||||
parentAssetItem = %parentAssetItem;
|
||||
status = "";
|
||||
statusType = "";
|
||||
statusInfo = "";
|
||||
skip = false;
|
||||
processed = false;
|
||||
generatedAsset = false;*/
|
||||
}
|
||||
|
||||
function NewAssetsViewTree::onRightMouseDown(%this, %itemId)
|
||||
{
|
||||
ImportAssetActions.enableItem(1, true);
|
||||
|
||||
if( %itemId != 1 && %itemId != -1)
|
||||
{
|
||||
ImportAssetActions.showPopup(Canvas);
|
||||
ImportAssetActions.assetItem = %this.getItemValue(%itemId);
|
||||
ImportAssetActions.itemId = %itemId;
|
||||
}
|
||||
else
|
||||
{
|
||||
ImportAssetActions.enableItem(1, false);
|
||||
ImportAssetActions.showPopup(Canvas);
|
||||
}
|
||||
}
|
||||
|
||||
function NewAssetsPanelInputs::onRightMouseDown(%this)
|
||||
{
|
||||
NewAssetsViewTree::onRightMouseDown(0, -1);
|
||||
}
|
||||
|
||||
//
|
||||
function ImportAssetWindow::removeImportingAsset(%this)
|
||||
{
|
||||
ImportAssetTree.removeAllChildren(ImportAssetActions.itemId);
|
||||
ImportAssetTree.removeItem(ImportAssetActions.itemId);
|
||||
|
||||
ImportAssetWindow.refresh();
|
||||
}
|
||||
|
||||
function ImportAssetWindow::addNewImportingAsset(%this)
|
||||
{
|
||||
%dlg = new OpenFileDialog()
|
||||
{
|
||||
Filters = "Shape Files(*.dae, *.cached.dts)|*.dae;*.cached.dts|Images Files(*.jpg,*.png,*.tga,*.bmp,*.dds)|*.jpg;*.png;*.tga;*.bmp;*.dds|Any Files (*.*)|*.*|";
|
||||
DefaultFile = "";
|
||||
ChangePath = false;
|
||||
MustExist = true;
|
||||
MultipleFiles = false;
|
||||
forceRelativePath = false;
|
||||
};
|
||||
|
||||
if ( %dlg.Execute() )
|
||||
{
|
||||
%filePath = %dlg.FileName;
|
||||
}
|
||||
|
||||
%dlg.delete();
|
||||
|
||||
//AssetBrowser.onDropFile( %path );
|
||||
|
||||
%fileExt = fileExt( %filePath );
|
||||
//add it to our array!
|
||||
if(isImageFormat(%fileExt))
|
||||
%type = "Image";
|
||||
else if( isShapeFormat(%fileExt))
|
||||
%type = "Model";
|
||||
else if( isSoundFormat(%fileExt))
|
||||
%type = "Sound";
|
||||
else if( %fileExt $= ".cs" || %fileExt $= ".cs.dso" )
|
||||
%type = "Script";
|
||||
else if( %fileExt $= ".gui" || %fileExt $= ".gui.dso" )
|
||||
%type = "GUI";
|
||||
|
||||
AssetBrowser.addImportingAsset(%type, %filePath, ImportAssetActions.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(%this.importingFilesArray.getIndexFromKey(%filePath) == -1)
|
||||
%this.importingFilesArray.add(%filePath);
|
||||
|
||||
AssetBrowser.onEndDropFiles();
|
||||
}
|
||||
|
||||
//
|
||||
function ImportAssetWindow::importResolution(%this, %assetItem)
|
||||
{
|
||||
if(%assetItem.status !$= "Error" && %assetItem.status !$= "Warning")
|
||||
|
|
@ -1086,8 +1074,7 @@ function ImportAssetWindow::validateAssets(%this)
|
|||
|
||||
function ImportAssetWindow::validateAsset(%this, %id)
|
||||
{
|
||||
|
||||
%moduleName = ImportAssetModuleList.getText();
|
||||
%moduleName = AssetImportTargetModule.getText();
|
||||
|
||||
while (%id > 0)
|
||||
{
|
||||
|
|
@ -1201,7 +1188,7 @@ function ImportAssetWindow::resetAssetsValidationStatus(%this)
|
|||
|
||||
function ImportAssetWindow::resetAssetValidationStatus(%this, %id)
|
||||
{
|
||||
%moduleName = ImportAssetModuleList.getText();
|
||||
%moduleName = AssetImportTargetModule.getText();
|
||||
|
||||
%id = ImportAssetTree.getChild(%id);
|
||||
while (%id > 0)
|
||||
|
|
@ -1239,7 +1226,7 @@ function ImportAssetWindow::checkAssetsForCollision(%this, %assetItem)
|
|||
|
||||
function ImportAssetWindow::checkAssetForCollision(%this, %assetItem, %id)
|
||||
{
|
||||
%moduleName = ImportAssetModuleList.getText();
|
||||
%moduleName = AssetImportTargetModule.getText();
|
||||
|
||||
%id = ImportAssetTree.getChild(%id);
|
||||
while (%id > 0)
|
||||
|
|
@ -1288,7 +1275,7 @@ function ImportAssetWindow::deleteImportingAsset(%this, %assetItem)
|
|||
|
||||
schedule(10, 0, "refreshImportAssetWindow");
|
||||
//ImportAssetWindow.refresh();
|
||||
ImportAssetOptionsWindow.setVisible(0);
|
||||
//ImportAssetOptionsWindow.setVisible(0);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
@ -1298,7 +1285,7 @@ function ImportAssetWindow::ImportAssets(%this)
|
|||
%assetCount = AssetBrowser.importAssetFinalListArray.count();
|
||||
|
||||
//get the selected module data
|
||||
%moduleName = ImportAssetModuleList.getText();
|
||||
%moduleName = AssetImportTargetModule.getText();
|
||||
|
||||
%module = ModuleDatabase.findModule(%moduleName, 1);
|
||||
|
||||
|
|
@ -1313,8 +1300,7 @@ function ImportAssetWindow::ImportAssets(%this)
|
|||
%this.doImportAssets(%id);
|
||||
|
||||
//force an update of any and all modules so we have an up-to-date asset list
|
||||
AssetBrowser.loadFilters();
|
||||
AssetBrowser.refreshPreviews();
|
||||
AssetBrowser.refresh();
|
||||
Canvas.popDialog(AssetImportCtrl);
|
||||
AssetBrowser.isAssetReImport = false;
|
||||
}
|
||||
|
|
@ -1486,6 +1472,7 @@ function ImportAssetWindow::resolveIssue(%this, %assetItem)
|
|||
if(%resolutionAction $= "AutoPrune")
|
||||
{
|
||||
%this.deleteImportingAsset(%assetItem);
|
||||
%this.prunedDuplicateAssets++;
|
||||
}
|
||||
else if(%resolutionAction $= "AutoRename")
|
||||
{
|
||||
|
|
@ -1501,6 +1488,8 @@ function ImportAssetWindow::resolveIssue(%this, %assetItem)
|
|||
%num++;
|
||||
%assetItem.assetName = %noNum @ %num;
|
||||
}
|
||||
|
||||
%this.autoRenamedAssets++;
|
||||
}
|
||||
}
|
||||
else if(%assetItem.statusType $= "MissingFile")
|
||||
|
|
|
|||
|
|
@ -0,0 +1,203 @@
|
|||
function AssetImportConfigEditor::onWake(%this)
|
||||
{
|
||||
%this.refresh();
|
||||
}
|
||||
|
||||
function AssetImportConfigEditor::refresh(%this)
|
||||
{
|
||||
AssetImportConfigList.clear();
|
||||
|
||||
ImportAssetWindow.reloadImportOptionConfigs();
|
||||
setupImportConfigSettingsList();
|
||||
|
||||
for(%i=0; %i < ImportAssetWindow.importConfigsList.count(); %i++)
|
||||
{
|
||||
%configName = ImportAssetWindow.importConfigsList.getKey(%i);
|
||||
AssetImportConfigList.addRow(%i, %configName);
|
||||
}
|
||||
|
||||
if(ESettingsWindow.isAwake())
|
||||
ESettingsWindow.refresh();
|
||||
|
||||
if(AssetImportCtrl.isAwake())
|
||||
ImportAssetConfigList.setSelected(0);
|
||||
}
|
||||
|
||||
function AssetImportConfigList::onSelect( %this, %id, %text )
|
||||
{
|
||||
ImportOptionsConfigList.clearFields();
|
||||
ImportOptionsConfigList.setAutoUpdate(false); //we don't want to be updating every time we add a field in here
|
||||
|
||||
%this.currentConfig = %text;
|
||||
|
||||
%this.populateConfigListByGroup("General");
|
||||
%this.populateConfigListByGroup("Meshes");
|
||||
%this.populateConfigListByGroup("Materials");
|
||||
//%this.populateConfigListByGroup("Animations");
|
||||
//%this.populateConfigListByGroup("Images");
|
||||
//%this.populateConfigListByGroup("Collision");
|
||||
//%this.populateConfigListByGroup("Sound");
|
||||
|
||||
ImportOptionsConfigList.update();
|
||||
}
|
||||
|
||||
function AssetImportConfigList::populateConfigListByGroup(%this, %groupName)
|
||||
{
|
||||
AssetImportConfigEditorInspector.startGroup(%groupName);
|
||||
for(%i=0; %i < ImportAssetConfigSettingsList.count(); %i++)
|
||||
{
|
||||
%settingName = getField(ImportAssetConfigSettingsList.getKey(%i),0);
|
||||
if(startsWith(%settingName, %groupName@"/"))
|
||||
{
|
||||
%labelName = getField(ImportAssetConfigSettingsList.getKey(%i), 1);
|
||||
%type = getField(ImportAssetConfigSettingsList.getKey(%i), 2);
|
||||
%tooltip = getField(ImportAssetConfigSettingsList.getKey(%i), 3);
|
||||
|
||||
%defaultValue = getField(ImportAssetConfigSettingsList.getValue(%i), 0);
|
||||
%dataValues = getField(ImportAssetConfigSettingsList.getValue(%i), 1);
|
||||
AssetImportConfigEditorInspector.addSettingsField(%settingName, %labelName, %type, %tooltip, %defaultValue, %dataValues);
|
||||
}
|
||||
}
|
||||
AssetImportConfigEditorInspector.endGroup();
|
||||
}
|
||||
|
||||
function AssetImportConfigEditorInspector::addSettingsField(%this, %settingsFieldName, %labelText, %fieldType, %tooltip, %fieldValue, %fieldData)
|
||||
{
|
||||
%moddedSettingsFieldName = strreplace(%settingsFieldName, "/", "-");
|
||||
|
||||
%configGroup = AssetImportConfigList.currentConfig;
|
||||
|
||||
%value = AssetImportSettings.value(%configGroup @ "/" @ %settingsFieldName);
|
||||
if(%value $= "")
|
||||
%value = %fieldValue;
|
||||
|
||||
//%this.addCallbackField(%moddedSettingsFieldName, %labelText, %fieldType, "", %value, %fieldData, %this @ ".changeEditorSetting");
|
||||
%this.addCallbackField(%moddedSettingsFieldName, %labelText, %fieldType, "", %value, %fieldData, "changeEditorSetting");
|
||||
}
|
||||
|
||||
function AssetImportConfigEditorInspector::changeEditorSetting(%this, %varName, %value)
|
||||
{
|
||||
%varName = strreplace(%varName, "-", "/");
|
||||
|
||||
echo("Set " @ %varName @ " to be " @ %value);
|
||||
|
||||
%configGroup = AssetImportConfigList.currentConfig;
|
||||
|
||||
%oldValue = AssetImportSettings.value(%configGroup @ "/" @ %varName, %value);
|
||||
|
||||
AssetImportSettings.setValue(%configGroup @ "/" @ %varName, %value);
|
||||
|
||||
if(%oldValue !$= %value)
|
||||
{
|
||||
%scollPos = ImportAssetConfigEditorScroll.getScrollPosition();
|
||||
ImportAssetConfigEditorWindow.populateConfigList(ImportAssetWindow.activeImportConfig);
|
||||
ImportAssetConfigEditorScroll.setScrollPosition(%scollPos.x, %scollPos.y);
|
||||
}
|
||||
}
|
||||
|
||||
function AssetImportConfigEditorInspector::setDefaultValuesByGroup(%this, %groupName)
|
||||
{
|
||||
%configList = ImportAssetConfigSettingsList;
|
||||
|
||||
for(%i=0; %i < %configList.count(); %i++)
|
||||
{
|
||||
%settingName = getField(%configList.getKey(%i),0);
|
||||
if(startsWith(%settingName, %groupName @ "/"))
|
||||
{
|
||||
%defaultValue = getField(%configList.getValue(%i), 0);
|
||||
AssetImportSettings.setValue(%settingName, %defaultValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function AssetImportConfigEditorInspector::ToggleImportMesh(%this, %fieldName, %newValue, %ownerObject)
|
||||
{
|
||||
%this.setFieldEnabled("DoUpAxisOverride", %newValue);
|
||||
%this.setFieldEnabled("UpAxisOverride", %newValue);
|
||||
%this.setFieldEnabled("DoScaleOverride", %newValue);
|
||||
%this.setFieldEnabled("ScaleOverride", %newValue);
|
||||
%this.setFieldEnabled("IgnoreNodeScale", %newValue);
|
||||
%this.setFieldEnabled("AdjustCenter", %newValue);
|
||||
%this.setFieldEnabled("AdjustFloor", %newValue);
|
||||
%this.setFieldEnabled("CollapseSubmeshes", %newValue);
|
||||
%this.setFieldEnabled("LODType", %newValue);
|
||||
%this.setFieldEnabled("ImportedNodes", %newValue);
|
||||
%this.setFieldEnabled("IgnoreNodes", %newValue);
|
||||
%this.setFieldEnabled("ImportMeshes", %newValue);
|
||||
%this.setFieldEnabled("IgnoreMeshes", %newValue);
|
||||
}
|
||||
|
||||
function AssetImportConfigEditor::addNewConfig(%this)
|
||||
{
|
||||
//Ensure our list is set up
|
||||
setupImportConfigSettingsList();
|
||||
|
||||
ImportAssetNewConfigEditorWindow.setVisible(1);
|
||||
ImportAssetNewConfigEditorWindow.selectWindow();
|
||||
}
|
||||
|
||||
function AssetImportConfigEditor::createNewImportConfig(%this)
|
||||
{
|
||||
%configName = AssetImportNewConfigName.getText();
|
||||
%configList = ImportAssetConfigSettingsList;
|
||||
|
||||
AssetImportSettings.beginGroup(%configName);
|
||||
|
||||
AssetImportConfigEditorInspector.setDefaultValuesByGroup("General");
|
||||
AssetImportConfigEditorInspector.setDefaultValuesByGroup("Meshes");
|
||||
AssetImportConfigEditorInspector.setDefaultValuesByGroup("Materials");
|
||||
AssetImportConfigEditorInspector.setDefaultValuesByGroup("Animations");
|
||||
AssetImportConfigEditorInspector.setDefaultValuesByGroup("Collision");
|
||||
AssetImportConfigEditorInspector.setDefaultValuesByGroup("Images");
|
||||
AssetImportConfigEditorInspector.setDefaultValuesByGroup("Sounds");
|
||||
|
||||
AssetImportSettings.endGroup();
|
||||
|
||||
%success = AssetImportSettings.write();
|
||||
|
||||
ImportAssetNewConfigEditorWindow.setVisible(0);
|
||||
|
||||
%this.refresh();
|
||||
}
|
||||
|
||||
function AssetImportConfigEditor::deleteConfig(%this)
|
||||
{
|
||||
%callback = "AssetImportConfigEditor.onDeleteConfig();";
|
||||
MessageBoxOKCancel("Delete Import Config", "This will delete the " @ AssetImportConfigList.currentConfig @ " config. Continue?", %callback, "");
|
||||
}
|
||||
|
||||
function AssetImportConfigEditor::onDeleteConfig(%this)
|
||||
{
|
||||
%configGroup = AssetImportConfigList.currentConfig;
|
||||
|
||||
AssetImportConfigEditorInspector.removeSettingsByGroup("General");
|
||||
AssetImportConfigEditorInspector.removeSettingsByGroup("Meshes");
|
||||
AssetImportConfigEditorInspector.removeSettingsByGroup("Materials");
|
||||
AssetImportConfigEditorInspector.removeSettingsByGroup("Animations");
|
||||
AssetImportConfigEditorInspector.removeSettingsByGroup("Collision");
|
||||
AssetImportConfigEditorInspector.removeSettingsByGroup("Images");
|
||||
AssetImportConfigEditorInspector.removeSettingsByGroup("Sounds");
|
||||
}
|
||||
|
||||
function AssetImportConfigEditorInspector::removeSettingsByGroup(%this, %groupName)
|
||||
{
|
||||
%configList = ImportAssetConfigSettingsList;
|
||||
|
||||
%configGroup = AssetImportConfigList.currentConfig;
|
||||
|
||||
for(%i=0; %i < %configList.count(); %i++)
|
||||
{
|
||||
%settingName = getField(%configList.getKey(%i),0);
|
||||
if(startsWith(%settingName, %groupName @ "/"))
|
||||
{
|
||||
%defaultValue = getField(%configList.getValue(%i), 0);
|
||||
|
||||
%targetSetting = %configGroup @ "/" @ %settingName;
|
||||
|
||||
AssetImportSettings.remove(%configGroup @ "/" @ %settingName);
|
||||
}
|
||||
}
|
||||
|
||||
%success = AssetImportSettings.write();
|
||||
AssetImportConfigEditor.refresh();
|
||||
}
|
||||
|
|
@ -3,11 +3,13 @@ function AssetBrowser::createCppAsset(%this)
|
|||
%moduleName = AssetBrowser.newAssetSettings.moduleName;
|
||||
%modulePath = "data/" @ %moduleName;
|
||||
|
||||
%assetName = AssetBrowser.newAssetSettings.assetName;
|
||||
%assetName = AssetBrowser.newAssetSettings.assetName;
|
||||
|
||||
%tamlpath = %modulePath @ "/source/" @ %assetName @ ".asset.taml";
|
||||
%codePath = %modulePath @ "/source/" @ %assetName @ ".cpp";
|
||||
%headerPath = %modulePath @ "/source/" @ %assetName @ ".h";
|
||||
%assetPath = AssetBrowser.dirHandler.currentAddress @ "/";
|
||||
|
||||
%tamlpath = %assetPath @ %assetName @ ".asset.taml";
|
||||
%codePath = %assetPath @ %assetName @ ".cpp";
|
||||
%headerPath = %assetPath @ %assetName @ ".h";
|
||||
|
||||
//Do the work here
|
||||
%assetType = AssetBrowser.newAssetSettings.assetType;
|
||||
|
|
@ -95,7 +97,7 @@ function AssetBrowser::createCppAsset(%this)
|
|||
}
|
||||
|
||||
//Last, check that we have a C++ Module definition. If not, make one so anything important can be initialized on startup there
|
||||
%cppModuleFilePath = %modulePath @ "/source/" @ %moduleName @ ".cpp";
|
||||
%cppModuleFilePath = %modulePath @ "/" @ %moduleName @ ".cpp";
|
||||
if(!isFile(%cppModuleFilePath))
|
||||
{
|
||||
%file = new FileObject();
|
||||
|
|
|
|||
|
|
@ -1,3 +1,45 @@
|
|||
function AssetBrowser::createNewFolder(%this)
|
||||
{
|
||||
AssetBrowser_newFolderNameTxt.text = "NewFolder";
|
||||
Canvas.pushDialog(AssetBrowser_newFolder);
|
||||
}
|
||||
|
||||
function AssetBrowser::doCreateNewFolder(%this)
|
||||
{
|
||||
%newFolderName = AssetBrowser_newFolderNameTxt.getText();
|
||||
|
||||
if(%newFolderName $= "")
|
||||
%newFolderName = "NewFolder";
|
||||
|
||||
%newFolderIdx = "";
|
||||
%matched = true;
|
||||
%newFolderPath = "";
|
||||
while(%matched == true)
|
||||
{
|
||||
%newFolderPath = AssetBrowser.dirHandler.currentAddress @ "/" @ %newFolderName @ %newFolderIdx;
|
||||
if(!isDirectory(%newFolderPath))
|
||||
{
|
||||
%matched = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
%newFolderIdx++;
|
||||
}
|
||||
}
|
||||
|
||||
//make a dummy file
|
||||
%file = new FileObject();
|
||||
%file.openForWrite(%newFolderPath @ "/test");
|
||||
%file.close();
|
||||
|
||||
fileDelete(%newFolderPath @ "/test");
|
||||
|
||||
//refresh the directory
|
||||
AssetBrowser.loadDirectories();
|
||||
|
||||
%this.navigateTo(%newFolderPath);
|
||||
}
|
||||
|
||||
function AssetBrowser::buildFolderPreview(%this, %assetDef, %previewData)
|
||||
{
|
||||
%previewData.assetName = %assetDef.assetName;
|
||||
|
|
@ -26,7 +68,7 @@ function AssetBrowser::renameFolder(%this, %folderPath, %newFolderName)
|
|||
//so, we nix any assets active for the module, do the delete action on the old folder, and then re-acquire our assets.
|
||||
//This will have the added benefit of updating paths for asset items
|
||||
|
||||
%module = AssetBrowser.getModuleFromAddress(AssetBrowser.currentAddress);
|
||||
%module = AssetBrowser.getModuleFromAddress(AssetBrowser.dirHandler.currentAddress);
|
||||
%moduleId = %module.ModuleId;
|
||||
|
||||
AssetDatabase.removeDeclaredAssets(%moduleId);
|
||||
|
|
@ -41,7 +83,7 @@ function AssetBrowser::deleteFolder(%this, %folderPath)
|
|||
{
|
||||
doDeleteFolder(%folderPath);
|
||||
|
||||
%this.loadFilters();
|
||||
%this.loadDirectories();
|
||||
}
|
||||
|
||||
function doDeleteFolder(%folderPath)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ function AssetBrowser::createGUIAsset(%this)
|
|||
|
||||
%assetName = AssetBrowser.newAssetSettings.assetName;
|
||||
|
||||
%assetPath = AssetBrowser.currentAddress @ "/";
|
||||
%assetPath = AssetBrowser.dirHandler.currentAddress @ "/";
|
||||
|
||||
%tamlpath = %assetPath @ %assetName @ ".asset.taml";
|
||||
%guipath = %assetPath @ %assetName @ ".gui";
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ function AssetBrowser::prepareImportImageAsset(%this, %assetItem)
|
|||
|
||||
function AssetBrowser::importImageAsset(%this, %assetItem)
|
||||
{
|
||||
%moduleName = ImportAssetModuleList.getText();
|
||||
%moduleName = AssetImportTargetModule.getText();
|
||||
|
||||
%assetType = %assetItem.AssetType;
|
||||
%filePath = %assetItem.filePath;
|
||||
|
|
@ -117,7 +117,7 @@ function AssetBrowser::importImageAsset(%this, %assetItem)
|
|||
%assetImportSuccessful = false;
|
||||
%assetId = %moduleName@":"@%assetName;
|
||||
|
||||
%assetPath = AssetBrowser.currentAddress @ "/";
|
||||
%assetPath = AssetBrowser.dirHandler.currentAddress @ "/";
|
||||
|
||||
%assetFullPath = %assetPath @ "/" @ fileName(%filePath);
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ function AssetBrowser::createLevelAsset(%this)
|
|||
|
||||
%assetName = AssetBrowser.newAssetSettings.assetName;
|
||||
|
||||
%assetPath = AssetBrowser.currentAddress @ "/";
|
||||
%assetPath = AssetBrowser.dirHandler.currentAddress @ "/";
|
||||
|
||||
%tamlpath = %assetPath @ %assetName @ ".asset.taml";
|
||||
%levelPath = %assetPath @ %assetName @ ".mis";
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ function AssetBrowser::createMaterialAsset(%this)
|
|||
%moduleName = AssetBrowser.newAssetSettings.moduleName;
|
||||
%modulePath = "data/" @ %moduleName;
|
||||
|
||||
%assetPath = AssetBrowser.currentAddress @ "/";
|
||||
%assetPath = AssetBrowser.dirHandler.currentAddress @ "/";
|
||||
|
||||
%tamlpath = %assetPath @ %assetName @ ".asset.taml";
|
||||
%sgfPath = %assetPath @ %assetName @ ".sgf";
|
||||
|
|
@ -234,7 +234,7 @@ function AssetBrowser::prepareImportMaterialAsset(%this, %assetItem)
|
|||
%assetItem.AOImageAsset.skip = true;
|
||||
%assetItem.metalnessImageAsset.skip = true;
|
||||
|
||||
%compositeAssetPath = AssetBrowser.currentAddress @ "/";
|
||||
%compositeAssetPath = AssetBrowser.dirHandler.currentAddress @ "/";
|
||||
%saveAsPath = %compositeAssetPath @ "/" @ %assetItem.assetName @ "_composite.png";
|
||||
%compositeAsset = AssetBrowser.addImportingAsset("Image", "", %assetItem, %assetItem.assetName @ "_composite");
|
||||
%compositeAsset.generatedAsset = true;
|
||||
|
|
@ -279,7 +279,7 @@ function AssetBrowser::findMaterialMapFileWSuffix(%this, %fileDir, %filename, %f
|
|||
|
||||
function AssetBrowser::importMaterialAsset(%this, %assetItem)
|
||||
{
|
||||
%moduleName = ImportAssetModuleList.getText();
|
||||
%moduleName = AssetImportTargetModule.getText();
|
||||
|
||||
%assetType = %assetItem.AssetType;
|
||||
%filePath = %assetItem.filePath;
|
||||
|
|
@ -287,7 +287,7 @@ function AssetBrowser::importMaterialAsset(%this, %assetItem)
|
|||
%assetImportSuccessful = false;
|
||||
%assetId = %moduleName@":"@%assetName;
|
||||
|
||||
%assetPath = AssetBrowser.currentAddress @ "/";
|
||||
%assetPath = AssetBrowser.dirHandler.currentAddress @ "/";
|
||||
%tamlpath = %assetPath @ %assetName @ ".asset.taml";
|
||||
%sgfPath = %assetPath @ %assetName @ ".sgf";
|
||||
%scriptPath = %assetPath @ %assetName @ ".cs";
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ function AssetBrowser::createScriptAsset(%this)
|
|||
|
||||
%assetName = AssetBrowser.newAssetSettings.assetName;
|
||||
|
||||
%assetPath = AssetBrowser.currentAddress @ "/";
|
||||
%assetPath = AssetBrowser.dirHandler.currentAddress @ "/";
|
||||
|
||||
%tamlpath = %assetPath @ %assetName @ ".asset.taml";
|
||||
%scriptPath = %assetPath @ %assetName @ ".cs";
|
||||
|
|
@ -21,13 +21,6 @@ function AssetBrowser::createScriptAsset(%this)
|
|||
|
||||
%moduleDef = ModuleDatabase.findModule(%moduleName, 1);
|
||||
AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath);
|
||||
|
||||
AssetBrowser.loadFilters();
|
||||
|
||||
%treeItemId = AssetBrowserFilterTree.findItemByName(%moduleName);
|
||||
%smItem = AssetBrowserFilterTree.findChildItemByName(%treeItemId, "ScriptAsset");
|
||||
|
||||
AssetBrowserFilterTree.onSelect(%smItem);
|
||||
|
||||
%file = new FileObject();
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ function AssetBrowser::createShapeAsset(%this)
|
|||
|
||||
%assetName = AssetBrowser.newAssetSettings.assetName;
|
||||
|
||||
%assetPath = AssetBrowser.currentAddress @ "/";
|
||||
%assetPath = AssetBrowser.dirHandler.currentAddress @ "/";
|
||||
|
||||
%tamlpath = %assetPath @ %assetName @ ".asset.taml";
|
||||
%shapeFilePath = %assetPath @ %assetName @ ".dae";
|
||||
|
|
@ -42,6 +42,11 @@ function AssetBrowser::editShapeAsset(%this, %assetDef)
|
|||
ShapeEditorPlugin.openShapeAsset(%assetDef);
|
||||
}
|
||||
|
||||
function AssetBrowser::deleteShapeAsset(%this, %assetDef)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function AssetBrowser::prepareImportShapeAsset(%this, %assetItem)
|
||||
{
|
||||
%fileExt = fileExt(%assetItem.filePath);
|
||||
|
|
@ -166,7 +171,7 @@ function AssetBrowser::prepareImportShapeAsset(%this, %assetItem)
|
|||
|
||||
function AssetBrowser::importShapeAsset(%this, %assetItem)
|
||||
{
|
||||
%moduleName = ImportAssetModuleList.getText();
|
||||
%moduleName = AssetImportTargetModule.getText();
|
||||
|
||||
%assetType = %assetItem.AssetType;
|
||||
%filePath = %assetItem.filePath;
|
||||
|
|
@ -174,7 +179,7 @@ function AssetBrowser::importShapeAsset(%this, %assetItem)
|
|||
%assetImportSuccessful = false;
|
||||
%assetId = %moduleName@":"@%assetName;
|
||||
|
||||
%assetPath = AssetBrowser.currentAddress @ "/";
|
||||
%assetPath = AssetBrowser.dirHandler.currentAddress @ "/";
|
||||
%assetFullPath = %assetPath @ fileName(%filePath);
|
||||
|
||||
%newAsset = new ShapeAsset()
|
||||
|
|
@ -309,6 +314,28 @@ function AssetBrowser::buildShapeAssetPreview(%this, %assetDef, %previewData)
|
|||
%previewData.tooltip = %assetDef.friendlyName @ "\n" @ %assetDef;
|
||||
}
|
||||
|
||||
function AssetBrowser::onShapeAssetEditorDropped(%this, %assetDef, %position)
|
||||
{
|
||||
//echo("DROPPED A SHAPE ON THE EDITOR WINDOW!");
|
||||
|
||||
%assetId = %assetDef.getAssetId();
|
||||
|
||||
%pos = EWCreatorWindow.getCreateObjectPosition();
|
||||
|
||||
%newStatic = new TSStatic()
|
||||
{
|
||||
position = %pos;
|
||||
shapeAsset = %assetId;
|
||||
};
|
||||
|
||||
getScene(0).add(%newStatic);
|
||||
|
||||
EWorldEditor.clearSelection();
|
||||
EWorldEditor.selectObject(%newStatic);
|
||||
|
||||
EWorldEditor.isDirty = true;
|
||||
}
|
||||
|
||||
function GuiInspectorTypeShapeAssetPtr::onControlDropped( %this, %payload, %position )
|
||||
{
|
||||
Canvas.popDialog(EditorDragAndDropLayer);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ function AssetBrowser::createTerrainAsset(%this)
|
|||
%assetName = AssetBrowser.newAssetSettings.assetName;
|
||||
|
||||
%assetType = AssetBrowser.newAssetSettings.assetType;
|
||||
%assetPath = AssetBrowser.currentAddress @ "/";
|
||||
%assetPath = AssetBrowser.dirHandler.currentAddress @ "/";
|
||||
|
||||
%tamlpath = %assetPath @ %assetName @ ".asset.taml";
|
||||
%terPath = %assetPath @ %assetName @ ".ter";
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ function AssetBrowser::createTerrainMaterialAsset(%this)
|
|||
%assetName = AssetBrowser.newAssetSettings.assetName;
|
||||
|
||||
%assetType = AssetBrowser.newAssetSettings.assetType;
|
||||
%assetPath = AssetBrowser.currentAddress @ "/";
|
||||
%assetPath = AssetBrowser.dirHandler.currentAddress @ "/";
|
||||
|
||||
%tamlpath = %assetPath @ %assetName @ ".asset.taml";
|
||||
%scriptPath = %assetPath @ %assetName @ ".cs";
|
||||
|
|
|
|||
|
|
@ -0,0 +1,207 @@
|
|||
function makedirectoryHandler(%targetTree, %folderExclusionList, %searchFilter)
|
||||
{
|
||||
%newHandler = new ScriptObject()
|
||||
{
|
||||
class = "directoryHandler";
|
||||
};
|
||||
|
||||
%newHandler.currentAddress = "";
|
||||
%newHandler.treeCtrl = %targetTree;
|
||||
%newHandler.folderExclusionList = %folderExclusionList;
|
||||
%newHandler.searchFilter = %searchFilter;
|
||||
|
||||
%newHandler.prevHistoryList = new ArrayObject();
|
||||
%newHandler.foreHistoryList = new ArrayObject();
|
||||
|
||||
return %newHandler;
|
||||
}
|
||||
|
||||
function directoryHandler::loadFolders(%this, %path, %parentId)
|
||||
{
|
||||
//utilize home dir project setting here
|
||||
%paths = getDirectoryList(%path);
|
||||
for(%i=0; %i < getFieldCount(%paths); %i++)
|
||||
{
|
||||
%childPath = getField(%paths, %i);
|
||||
|
||||
%folderCount = getTokenCount(%childPath, "/");
|
||||
|
||||
for(%f=0; %f < %folderCount; %f++)
|
||||
{
|
||||
%folderName = getToken(%childPath, "/", %f);
|
||||
|
||||
//we don't need to display the shadercache folder
|
||||
if(%parentId == 1 && (%folderName $= "shaderCache" || %folderName $= "cache"))
|
||||
continue;
|
||||
|
||||
%iconIdx = 3;
|
||||
|
||||
if(ModuleDatabase.findModule(%folderName) !$= "")
|
||||
%iconIdx = 1;
|
||||
|
||||
%searchFoldersText = %this.searchFilter;
|
||||
if(%searchFoldersText !$= "Search Folders...")
|
||||
{
|
||||
if(strstr(strlwr(%folderName), strlwr(%searchFoldersText)) != -1)
|
||||
{
|
||||
%folderID = %this.treeCtrl.insertItem(%parentId, %folderName, %path, "", %iconIdx, %iconIdx+1);
|
||||
|
||||
%this.loadFolders(%path @ "/" @ %folderName, %folderID);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
%folderID = %this.treeCtrl.insertItem(%parentId, %folderName, %path, "", %iconIdx, %iconIdx);
|
||||
|
||||
%this.loadFolders(%path @ "/" @ %folderName, %folderID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function directoryHandler::navigateTo(%this, %address, %historyNav, %selectionNav)
|
||||
{
|
||||
//Don't bother navigating if it's to the place we already are
|
||||
if(%this.currentAddress $= %address)
|
||||
return;
|
||||
|
||||
//clear the breadcrumb bar
|
||||
AssetBrowser_BreadcrumbBar.clear();
|
||||
|
||||
//break down the address
|
||||
%folderCount = getTokenCount(%address, "/");
|
||||
|
||||
/*%rebuiltPath = "";
|
||||
for(%f=0; %f < %folderCount; %f++)
|
||||
{
|
||||
%folderName = getToken(%address, "/", %f);
|
||||
|
||||
%rebuiltPath = %f == 0 ? %folderName : %rebuiltPath @ "/" @ %folderName;
|
||||
|
||||
%folderNavButton = new GuiButtonCtrl()
|
||||
{
|
||||
profile = ToolsGuiButtonProfile;
|
||||
text = %folderName;
|
||||
command = "AssetBrowser.navigateTo(\"" @ %rebuiltPath @ "\");";
|
||||
extent = "100" SPC AssetBrowser_BreadcrumbBar.extent.y;
|
||||
};
|
||||
|
||||
AssetBrowser_BreadcrumbBar.add(%folderNavButton);
|
||||
|
||||
if(%f != %folderCount-1)
|
||||
{
|
||||
%folderSpacerButton = new GuiBitmapButtonCtrl()
|
||||
{
|
||||
profile = ToolsGuiButtonProfile;
|
||||
bitmap = "tools/gui/images/rightArrowWhite";
|
||||
bitmapMode = "Centered";
|
||||
extent = "25" SPC AssetBrowser_BreadcrumbBar.extent.y;
|
||||
//command = "AssetBrowser.navigateTo(\"" @ %rebuiltPath @ "\");";
|
||||
};
|
||||
|
||||
AssetBrowser_BreadcrumbBar.add(%folderSpacerButton);
|
||||
}
|
||||
}*/
|
||||
|
||||
//find our folder tree and action on it tree
|
||||
%folderId = %this.getFolderTreeItemFromAddress(%address);
|
||||
|
||||
%this.oldAddress = %this.currentAddress;
|
||||
%this.currentAddress = %address;
|
||||
%this.selectedItem = %folderId;
|
||||
|
||||
//This lets us update the tree selection if we didn't get here because of that
|
||||
if(%selectionNav $= "")
|
||||
{
|
||||
%this.treeCtrl.clearSelection();
|
||||
%this.treeCtrl.selectItem(%folderId);
|
||||
}
|
||||
|
||||
//remove any history records that are 'newer' than this one
|
||||
if(%historyNav $= "")
|
||||
{
|
||||
%this.foreHistoryList.empty();
|
||||
|
||||
if(%oldAddress !$= "")
|
||||
%this.prevHistoryList.push_front(%this.oldAddress);
|
||||
}
|
||||
|
||||
%this.treeCtrl.buildVisibleTree(true);
|
||||
}
|
||||
|
||||
function directoryHandler::navigateHistoryForward(%this)
|
||||
{
|
||||
if(%this.foreHistoryList.count() == 0)
|
||||
return;
|
||||
|
||||
%newAddress = %this.foreHistoryList.getKey(0);
|
||||
%prevHistory = %this.currentAddress;
|
||||
|
||||
%this.prevHistoryList.push_front(%prevHistory);
|
||||
%this.foreHistoryList.pop_front();
|
||||
|
||||
%this.navigateTo(%newAddress, true);
|
||||
}
|
||||
|
||||
function directoryHandler::navigateHistoryBack(%this)
|
||||
{
|
||||
if(%this.prevHistoryList.count() == 0)
|
||||
return;
|
||||
|
||||
%newAddress = %this.prevHistoryList.getKey(0);
|
||||
%foreHistory = %this.currentAddress;
|
||||
|
||||
%this.foreHistoryList.push_front(%foreHistory);
|
||||
%this.prevHistoryList.pop_front();
|
||||
|
||||
%this.navigateTo(%newAddress, true);
|
||||
}
|
||||
|
||||
function directoryHandler::getModuleFromAddress(%this, %address)
|
||||
{
|
||||
//break down the address
|
||||
%folderCount = getTokenCount(%address, "/");
|
||||
|
||||
for(%f=0; %f < %folderCount; %f++)
|
||||
{
|
||||
%folderName = getToken(%address, "/", %f);
|
||||
|
||||
%module = ModuleDatabase.findModule(%folderName);
|
||||
if(%module !$= "")
|
||||
return %module;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
function directoryHandler::getFolderTreeItemFromAddress(%this, %address)
|
||||
{
|
||||
//break down the address
|
||||
%folderCount = getTokenCount(%address, "/");
|
||||
|
||||
%curItem = 0;
|
||||
%rebuiltPath = "";
|
||||
for(%f=0; %f < %folderCount; %f++)
|
||||
{
|
||||
%folderName = getToken(%address, "/", %f);
|
||||
%curItem = %this.treeCtrl.findChildItemByName(%curItem, %folderName);
|
||||
}
|
||||
|
||||
return %curItem;
|
||||
}
|
||||
|
||||
function directoryHandler::expandTreeToAddress(%this, %address)
|
||||
{
|
||||
//break down the address
|
||||
%folderCount = getTokenCount(%address, "/");
|
||||
%this.treeCtrl.expandItem(0);
|
||||
|
||||
%curItem = 0;
|
||||
%rebuiltPath = "";
|
||||
for(%f=0; %f < %folderCount; %f++)
|
||||
{
|
||||
%folderName = getToken(%address, "/", %f);
|
||||
%curItem = %this.treeCtrl.findChildItemByName(%curItem, %folderName);
|
||||
%this.treeCtrl.expandItem(%curItem);
|
||||
}
|
||||
}
|
||||
|
|
@ -68,7 +68,7 @@ function AssetBrowser::refreshAsset(%this, %assetId)
|
|||
}
|
||||
|
||||
AssetDatabase.refreshAsset(%assetId);
|
||||
AssetBrowser.refreshPreviews();
|
||||
%this.refresh();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------
|
||||
|
|
@ -129,7 +129,7 @@ function AssetBrowser::performRenameAsset(%this, %originalAssetName, %newName)
|
|||
}
|
||||
|
||||
//Make sure everything is refreshed
|
||||
AssetBrowser.loadFilters();
|
||||
%this.refresh();
|
||||
|
||||
//Update the selection to immediately jump to the new asset
|
||||
AssetBrowser-->filterTree.clearSelection();
|
||||
|
|
@ -173,6 +173,8 @@ function AssetBrowser::moveAsset(%this, %assetId, %destination)
|
|||
eval(%this @ ".move" @ %assetType @ "(" @ %assetDef @ ",\"" @ %destination @ "\");");
|
||||
}
|
||||
}
|
||||
|
||||
%this.refresh();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------
|
||||
|
|
@ -212,30 +214,30 @@ function AssetBrowser::confirmDeleteAsset(%this)
|
|||
%currentSelectedItem = AssetBrowserFilterTree.getSelectedItem();
|
||||
%currentItemParent = AssetBrowserFilterTree.getParentItem(%currentSelectedItem);
|
||||
|
||||
if(EditAssetPopup.assetType $= "Folder")
|
||||
if(EditFolderPopup.visible)
|
||||
{
|
||||
//Do any cleanup required given the type
|
||||
if(EditFolderPopup.dirPath !$= "")
|
||||
%folderPath = EditFolderPopup.dirPath;
|
||||
else
|
||||
%folderPath = AssetBrowserFilterTree.getItemValue(%currentSelectedItem) @ "/" @ AssetBrowserFilterTree.getItemText(%currentSelectedItem);
|
||||
|
||||
if(%this.isMethod("deleteFolder"))
|
||||
eval(%this @ ".deleteFolder(\""@EditAssetPopup.assetId@"\");");
|
||||
}
|
||||
eval(%this @ ".deleteFolder(\""@%folderPath@"\");");
|
||||
}
|
||||
else
|
||||
{
|
||||
%assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId);
|
||||
%assetType = AssetDatabase.getAssetType(EditAssetPopup.assetType);
|
||||
|
||||
if(!isObject(%assetDef))
|
||||
return;
|
||||
|
||||
//Do any cleanup required given the type
|
||||
if(%this.isMethod("delete"@%assetType))
|
||||
eval(%this @ ".delete"@%assetType@"("@%assetDef@");");
|
||||
|
||||
AssetDatabase.deleteAsset(EditAssetPopup.assetId, false);
|
||||
AssetDatabase.deleteAsset(EditAssetPopup.assetId, true, false);
|
||||
}
|
||||
|
||||
%this.loadFilters();
|
||||
|
||||
if(!AssetBrowserFilterTree.selectItem(%currentSelectedItem))
|
||||
{
|
||||
//if it failed, that means we deleted the last item in that category, and we need to do the parent
|
||||
AssetBrowserFilterTree.selectItem(%currentItemParent);
|
||||
AssetBrowserFilterTree.expandItem(%currentItemParent);
|
||||
}
|
||||
%this.refresh();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -184,8 +184,6 @@ function CreateNewAsset()
|
|||
%moduleDef = ModuleDatabase.findModule(%moduleName,1);
|
||||
AssetDatabase.addDeclaredAsset(%moduleDef, %assetFilePath);
|
||||
|
||||
AssetBrowser.loadFilters();
|
||||
|
||||
if(AssetBrowser_newAsset.callbackFunc !$= "")
|
||||
{
|
||||
%callbackCommand = "" @ AssetBrowser_newAsset.callbackFunc @ "(\"" @ %moduleName @ ":" @ %assetName @ "\");";
|
||||
|
|
@ -193,7 +191,7 @@ function CreateNewAsset()
|
|||
}
|
||||
|
||||
//Update the selection to immediately jump to the new asset
|
||||
AssetBrowser-->filterTree.clearSelection();
|
||||
/*AssetBrowser-->filterTree.clearSelection();
|
||||
%ModuleItem = AssetBrowser-->filterTree.findItemByName(%moduleName);
|
||||
%assetTypeId = AssetBrowser-->filterTree.findChildItemByName(%ModuleItem, %assetType);
|
||||
|
||||
|
|
@ -202,7 +200,8 @@ function CreateNewAsset()
|
|||
%selectedItem = AssetBrowser-->filterTree.getSelectedItem();
|
||||
AssetBrowser-->filterTree.scrollVisibleByObjectId(%selectedItem);
|
||||
|
||||
AssetBrowser-->filterTree.buildVisibleTree();
|
||||
AssetBrowser-->filterTree.buildVisibleTree(); */
|
||||
AssetBrowser.refresh();
|
||||
}
|
||||
|
||||
function ParentComponentList::onWake(%this)
|
||||
|
|
|
|||
|
|
@ -340,6 +340,19 @@ function AssetBrowser::buildPopupMenus(%this)
|
|||
};
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
if( !isObject( ImportAssetActions ) )
|
||||
{
|
||||
%this.ImportAssetActions = new PopupMenu( ImportAssetActions )
|
||||
{
|
||||
superClass = "MenuBuilder";
|
||||
class = "EditorWorldMenu";
|
||||
|
||||
item[0] = "Add asset" TAB "" TAB "ImportAssetWindow.addNewImportingAsset();";
|
||||
item[1] = "Remove asset" TAB "" TAB "ImportAssetWindow.removeImportingAsset();";
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function AddNewScriptAssetPopupMenu::onSelectItem(%this, %id, %text)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,47 @@
|
|||
function SelectAssetPath::onWake(%this)
|
||||
{
|
||||
}
|
||||
|
||||
//SelectAssetPath.showDialog();
|
||||
function SelectAssetPath::showDialog(%this, %startingPath, %callback)
|
||||
{
|
||||
if(!isObject(%this.dirHandler))
|
||||
%this.dirHandler = makedirectoryHandler(SelectAssetPath-->folderTree, "Core,Tools,cache,shaderCache", "");
|
||||
|
||||
SelectAssetPath-->folderTree.clear();
|
||||
|
||||
SelectAssetPath-->folderTree.buildIconTable( ":tools/classIcons/Prefab:tools/classIcons/Prefab" @
|
||||
":tools/classIcons/SimSet:tools/classIcons/SimSet");
|
||||
|
||||
%this.dirHandler.currentPath = %startingPath;
|
||||
%this.callback = %callback;
|
||||
|
||||
%dataItem = SelectAssetPath-->folderTree.insertItem(0, "Data");
|
||||
%this.dirHandler.loadFolders("Data", %dataItem);
|
||||
|
||||
Canvas.pushDialog(SelectAssetPath);
|
||||
}
|
||||
|
||||
function selectAssetPathTree::onSelect(%this, %itemId)
|
||||
{
|
||||
if(%itemId == 1)
|
||||
//can't select root
|
||||
return;
|
||||
|
||||
SelectAssetPath.selectedTreeItem = %itemId;
|
||||
}
|
||||
|
||||
|
||||
function SelectAssetPath::selectPath(%this)
|
||||
{
|
||||
//do callback
|
||||
%selectedId = %this.selectedTreeItem;
|
||||
%selectedPath = %this-->folderTree.getItemValue(%selectedId) @ "/" @ %this-->folderTree.getItemText(%selectedId);
|
||||
|
||||
if(%this.callback !$= "")
|
||||
{
|
||||
eval( "" @ %this.callback @ "(\"" @ %selectedPath @ "\");");
|
||||
}
|
||||
|
||||
Canvas.popDialog(SelectAssetPath);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue