mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-13 23:54:35 +00:00
Updated path handling for loose asset files for CPP, Image, Level, Material, PostFX, Shape, Terrain, TerrainMat and StateMachine assets to be more predictable in when and how they expando the loose file path into a full, useable path
Fixed loose file bindings for all associated slots in level asset, such as postFX file, decals, etc Expanded TSStatic onInspect testcase to parse materialSlots and hook-in a specialized material field for editing/quick reference from the inspector Adjusted expand behavior of guiTree to be more reliable Added internal name 'stack' to inspectorGroup's stack child objects for easier access to add programatic fields Removed redundant PreMult translucency type code Added setting of feature so probes work when in forward/basic lit mode Corrected indexing error in SQLiteObject class so it properly parses with the updated console API Tweaked the FOV setting logic in GameConnection::onControlObjectChange to not be spammy Fixed var when trying to bind the camera to the client Added project setting field to dictate the default render mode between Forward or Deferred Integrated MotionBlur PostFX into updated PostFX Editor paradigm and exposed the samples uniform as an editable field Integrated DOF PostFX into updated PostFX Editor paradigm Updated setting group name for vignette postFX Shifted shaderCache to be in data/cache along with other cached files Added helper function to replace strings in a file Fixed ExampleCppObject asset to have correct loose file references Adjusted editor default level logic so it can be modifed and then stored, as well as reset back to the original default Fixed verve reference to root scene group Adjusted location of a nonmodal gui profile so it loads at the correct time Reorganized AssetBrowser loading and refresh logic so it doesn't stack multiple refresh requests back-to-back causing lag Updated the search behavior to search not just the current address, but all child folders as well, making it far more useful Initial work into zip and folder drag-and-drop asset importing support Removed the import config setting for 'always display material maps' as it is redundant with the new importer context menu actions Updated example asset type file Ensured all asset types have proper handling for move, rename and delete actions Fixed double-click behavior on folders in the AB Fixed CPP asset preview Added better logic to discern if a top-level folder belongs to a module or not in the AB directory browser Added ability to convert a non-module top-level folder in the AB into a module Added initial hooks for being able to generate a new Editor Tool, similar to how the AB can generate modules Renamed CPP asset template files to have the .template so they aren't accidentally picked up by cmake Fixed convex editor's material handling to work with AB and reference back properly Updated AB images for folder up/down navigation buttons, and the breadcrumb divider arrow Made PostFX Editor properly allow for input pass-through so you can still edit the level with it open Added some additional common text gui profiles Disabled calls to old editor settings logic in various editors to remove spam Added callOnModules call so tools can initialize properly when the world editor is opened Fixed logic test for visualizers Added ability for cmake to scan tools directory for any tools that add source files
This commit is contained in:
parent
9735b1180d
commit
f7b891442a
92 changed files with 1735 additions and 536 deletions
|
|
@ -68,7 +68,7 @@ function AssetBrowser::onWake(%this)
|
|||
%moduleName = getWord(%modulesList, %i).ModuleId;
|
||||
|
||||
%moduleGroup = getWord(%modulesList, %i).Group;
|
||||
if((%moduleGroup $= "Core" || %moduleGroup $= "Tools") && !%this.coreModulesFilter)
|
||||
if((%moduleGroup $= "Core" && !%this.coreModulesFilter) || (%moduleGroup $= "Tools" && !%this.toolsModulesFilter))
|
||||
continue;
|
||||
|
||||
%nonDefaultModuleCount++;
|
||||
|
|
@ -82,6 +82,8 @@ function AssetBrowser::onWake(%this)
|
|||
}
|
||||
|
||||
%this.setPreviewSize(EditorSettings.value("Assets/Browser/previewTileSize", "small"));
|
||||
|
||||
AssetBrowser.toggleAssetTypeFilter(0);
|
||||
}
|
||||
|
||||
//Filters
|
||||
|
|
@ -95,11 +97,13 @@ function AssetBrowser::viewCoreModulesFilter(%this)
|
|||
%oldVal = EditorSettings.value("Assets/Browser/showCoreModule", false);
|
||||
%newVal = !%oldVal;
|
||||
|
||||
%this.coreModulesFilter = %newVal;
|
||||
|
||||
BrowserVisibilityPopup.checkItem(0,%newVal);
|
||||
|
||||
EditorSettings.setValue("Assets/Browser/showCoreModule", %newVal);
|
||||
|
||||
AssetBrowser.refresh();
|
||||
AssetBrowser.loadDirectories();
|
||||
}
|
||||
|
||||
function AssetBrowser::viewToolsModulesFilter(%this)
|
||||
|
|
@ -107,11 +111,13 @@ function AssetBrowser::viewToolsModulesFilter(%this)
|
|||
%oldVal = EditorSettings.value("Assets/Browser/showToolsModule", false);
|
||||
%newVal = !%oldVal;
|
||||
|
||||
%this.toolsModulesFilter = %newVal;
|
||||
|
||||
BrowserVisibilityPopup.checkItem(1,%newVal);
|
||||
|
||||
EditorSettings.setValue("Assets/Browser/showToolsModule", %newVal);
|
||||
|
||||
AssetBrowser.refresh();
|
||||
AssetBrowser.loadDirectories();
|
||||
}
|
||||
|
||||
function AssetBrowser::viewPopulatedModulesFilter(%this)
|
||||
|
|
@ -123,7 +129,7 @@ function AssetBrowser::viewPopulatedModulesFilter(%this)
|
|||
|
||||
EditorSettings.setValue("Assets/Browser/showOnlyPopulatedModule", %newVal);
|
||||
|
||||
AssetBrowser.refresh();
|
||||
AssetBrowser.loadDirectories();
|
||||
}
|
||||
|
||||
function AssetBrowser::toggleShowingFolders(%this)
|
||||
|
|
@ -135,7 +141,7 @@ function AssetBrowser::toggleShowingFolders(%this)
|
|||
|
||||
EditorSettings.setValue("Assets/Browser/showFolders", %newVal);
|
||||
|
||||
AssetBrowser.refresh();
|
||||
AssetBrowser.loadDirectories();
|
||||
}
|
||||
|
||||
function AssetBrowser::toggleShowingEmptyFolders(%this)
|
||||
|
|
@ -273,7 +279,7 @@ function AssetBrowser::hideDialog( %this )
|
|||
Canvas.popDialog(AssetBrowser);
|
||||
}
|
||||
|
||||
function AssetBrowser::buildPreviewArray( %this, %asset, %moduleName )
|
||||
function AssetBrowser::buildAssetPreview( %this, %asset, %moduleName )
|
||||
{
|
||||
if(!isObject(%this.previewData))
|
||||
{
|
||||
|
|
@ -284,7 +290,7 @@ function AssetBrowser::buildPreviewArray( %this, %asset, %moduleName )
|
|||
|
||||
%previewImage = "core/art/warnmat";
|
||||
|
||||
if(ModuleDatabase.findModule(%moduleName, 1) !$= "")
|
||||
if(/*%moduleName !$= "" && */ModuleDatabase.findModule(%moduleName, 1) !$= "")
|
||||
{
|
||||
%assetDesc = AssetDatabase.acquireAsset(%asset);
|
||||
%assetName = AssetDatabase.getAssetName(%asset);
|
||||
|
|
@ -296,7 +302,6 @@ function AssetBrowser::buildPreviewArray( %this, %asset, %moduleName )
|
|||
%fullPath = strreplace(%fullPath, "/", "_");
|
||||
|
||||
if(isObject(%fullPath))
|
||||
|
||||
%assetDesc = %fullPath;
|
||||
else
|
||||
%assetDesc = new ScriptObject(%fullPath);
|
||||
|
|
@ -359,10 +364,10 @@ function AssetBrowser::buildPreviewArray( %this, %asset, %moduleName )
|
|||
%previewButton-->AssetPreviewBorderButton.extent = %previewSize;
|
||||
|
||||
//%previewButton-->AssetPreviewButton.internalName = %this.previewData.assetName@"Border";
|
||||
%previewButton-->AssetPreviewButton.extent = %previewSize.x + %previewBounds SPC %previewSize.y + 24;
|
||||
%previewButton-->AssetPreviewButton.tooltip = %this.previewData.tooltip;
|
||||
%previewButton-->AssetPreviewButton.Command = "AssetBrowser.updateSelection( $ThisControl.getParent().assetName, $ThisControl.getParent().moduleName );";
|
||||
%previewButton-->AssetPreviewButton.altCommand = %this.previewData.doubleClickCommand;
|
||||
%previewButton-->Button.extent = %previewSize.x + %previewBounds SPC %previewSize.y + 24;
|
||||
%previewButton-->Button.tooltip = %this.previewData.tooltip;
|
||||
%previewButton-->Button.Command = "AssetBrowser.updateSelection( $ThisControl.getParent().assetName, $ThisControl.getParent().moduleName );";
|
||||
%previewButton-->Button.altCommand = %doubleClickCommand;
|
||||
//%previewButton-->AssetPreviewButton.icon = %this.previewData.previewImage;
|
||||
|
||||
%previewButton-->AssetNameLabel.position = 0 SPC %previewSize.y + %previewBounds - 16;
|
||||
|
|
@ -379,11 +384,32 @@ function AssetBrowser::buildPreviewArray( %this, %asset, %moduleName )
|
|||
|
||||
function AssetBrowser::refresh(%this)
|
||||
{
|
||||
%this.navigateTo(%this.dirHandler.currentAddress);
|
||||
if(!%this.dirty)
|
||||
{
|
||||
%this.dirty = true;
|
||||
|
||||
%this.schedule(1, "doRefresh");
|
||||
}
|
||||
}
|
||||
|
||||
function AssetBrowser::doRefresh(%this)
|
||||
{
|
||||
if(%this.dirty)
|
||||
{
|
||||
%this.navigateTo(%this.dirHandler.currentAddress);
|
||||
|
||||
//Forces a clean collapse of the tree for any not-really-exposed items
|
||||
%dataItem = AssetBrowser-->filterTree.findItemByName("Data");
|
||||
|
||||
AssetBrowser-->filterTree.expandItem(%dataItem, false);
|
||||
AssetBrowser-->filterTree.expandItem(%dataItem);
|
||||
|
||||
%this.dirty = false;
|
||||
}
|
||||
}
|
||||
//
|
||||
//
|
||||
function AssetPreviewButton::onClick(%this)
|
||||
/*function AssetPreviewButton::onClick(%this)
|
||||
{
|
||||
echo("CLICKED AN ASSET PREVIEW BUTTON");
|
||||
}
|
||||
|
|
@ -391,7 +417,7 @@ function AssetPreviewButton::onClick(%this)
|
|||
function AssetPreviewButton::onDoubleClick(%this)
|
||||
{
|
||||
echo("DOUBLE CLICKED AN ASSET PREVIEW BUTTON");
|
||||
}
|
||||
}*/
|
||||
//
|
||||
//
|
||||
|
||||
|
|
@ -399,23 +425,60 @@ function AssetBrowser::loadDirectories( %this )
|
|||
{
|
||||
AssetBrowser-->filterTree.clear();
|
||||
|
||||
%dataItem = AssetBrowser-->filterTree.insertItem(0, "Data");
|
||||
%dataItem = AssetBrowser-->filterTree.insertItem(0, "Content");
|
||||
|
||||
%dataItem = AssetBrowser-->filterTree.insertItem(1, "Data");
|
||||
%this.dirHandler.loadFolders("Data", %dataItem);
|
||||
|
||||
//If set to, show core
|
||||
if(%this.coreModulesFilter)
|
||||
{
|
||||
%coreItem = AssetBrowser-->filterTree.insertItem(0, "Core");
|
||||
%coreItem = AssetBrowser-->filterTree.insertItem(1, "Core");
|
||||
%this.dirHandler.loadFolders("Core", %coreItem);
|
||||
}
|
||||
|
||||
//If set to, show tools
|
||||
if(%this.toolsModulesFilter)
|
||||
{
|
||||
%toolsItem = AssetBrowser-->filterTree.insertItem(0, "Tools");
|
||||
%toolsItem = AssetBrowser-->filterTree.insertItem(1, "Tools");
|
||||
%this.dirHandler.loadFolders("Tools", %toolsItem);
|
||||
}
|
||||
|
||||
//Add Non-Asset Scripted Objects. Datablock, etc based
|
||||
%category = getWord( %breadcrumbPath, 1 );
|
||||
%dataGroup = "DataBlockGroup";
|
||||
|
||||
if(%dataGroup.getCount() != 0)
|
||||
{
|
||||
%scriptedItem = AssetBrowser-->filterTree.insertItem(1, "Scripted");
|
||||
|
||||
for ( %i = 0; %i < %dataGroup.getCount(); %i++ )
|
||||
{
|
||||
%obj = %dataGroup.getObject(%i);
|
||||
// echo ("Obj: " @ %obj.getName() @ " - " @ %obj.category );
|
||||
|
||||
if ( %obj.category $= "" && %obj.category == 0 )
|
||||
continue;
|
||||
|
||||
//if ( %breadcrumbPath $= "" )
|
||||
//{
|
||||
%catItem = AssetBrowser-->filterTree.findItemByName(%obj.category);
|
||||
|
||||
if(%catItem == 0)
|
||||
AssetBrowser-->filterTree.insertItem(%scriptedItem, %obj.category, "scripted");
|
||||
/*%ctrl = %this.findIconCtrl( %obj.category );
|
||||
if ( %ctrl == -1 )
|
||||
{
|
||||
%this.addFolderIcon( %obj.category );
|
||||
}*/
|
||||
//}
|
||||
/*else if ( %breadcrumbPath $= %obj.category )
|
||||
{
|
||||
AssetBrowser-->filterTree.insertItem(%scriptedItem, %obj.getName());
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
AssetPreviewArray.empty();
|
||||
|
||||
AssetBrowser-->filterTree.buildVisibleTree(true);
|
||||
|
|
@ -443,15 +506,15 @@ function AssetBrowser::loadDirectories( %this )
|
|||
AssetBrowser.newModuleId = "";
|
||||
}
|
||||
|
||||
%dataItem = AssetBrowser-->filterTree.findItemByName("Data");
|
||||
AssetBrowser-->filterTree.expandItem(%dataItem);
|
||||
//%dataItem = AssetBrowser-->filterTree.findItemByName("Data");
|
||||
//AssetBrowser-->filterTree.expandItem(%dataItem);
|
||||
|
||||
AssetBrowser.dirHandler.expandTreeToAddress(AssetBrowser.dirHandler.currentAddress);
|
||||
|
||||
%selectedItem = AssetBrowser.dirHandler.getFolderTreeItemFromAddress(AssetBrowser.dirHandler.currentAddress);
|
||||
AssetBrowser-->filterTree.scrollVisibleByObjectId(%selectedItem);
|
||||
|
||||
AssetBrowser-->filterTree.buildVisibleTree();
|
||||
AssetBrowser-->filterTree.buildVisibleTree(true);
|
||||
|
||||
AssetBrowser.refresh();
|
||||
}
|
||||
|
|
@ -739,18 +802,30 @@ function AssetListPanelInputs::onRightMouseDown(%this)
|
|||
function AssetBrowserFilterTree::onRightMouseDown(%this, %itemId)
|
||||
{
|
||||
%count = %this.getSelectedItemsCount();
|
||||
if( %this.getSelectedItemsCount() > 0 && %itemId != 1)
|
||||
|
||||
%itemText = %this.getItemText(%itemId);
|
||||
if( %this.getSelectedItemsCount() > 0 && (%itemText !$= "Data" && %itemText !$= "Core" && %itemText !$= "Tools"))
|
||||
{
|
||||
//AddNewAssetPopup.showPopup(Canvas);
|
||||
|
||||
//We have something clicked, so figure out if it's a sub-filter or a module filter, then push the correct
|
||||
//popup menu
|
||||
if(%this.getParentItem(%itemId) == 1)
|
||||
%parentItem = %this.getParentItem(%itemId);
|
||||
if(%this.getItemText(%parentItem) $= "Data") //if it's a data module, continue
|
||||
{
|
||||
//yep, module, push the all-inclusive popup
|
||||
EditModulePopup.showPopup(Canvas);
|
||||
//also set the module value for creation info
|
||||
AssetBrowser.selectedModule = %this.getItemText(%itemId);
|
||||
//find out if it's a folder or a module!
|
||||
if(ModuleDatabase.findModule(%itemText))
|
||||
{
|
||||
//yep, module, push the all-inclusive popup
|
||||
EditModulePopup.showPopup(Canvas);
|
||||
//also set the module value for creation info
|
||||
AssetBrowser.selectedModule = %itemText;
|
||||
}
|
||||
else
|
||||
{
|
||||
EditNonModulePopup.showPopup(Canvas);
|
||||
EditNonModulePopup.targetFolder = %itemText;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -758,10 +833,14 @@ function AssetBrowserFilterTree::onRightMouseDown(%this, %itemId)
|
|||
EditFolderPopup.assetType = "Folder";
|
||||
}
|
||||
}
|
||||
else if(%itemId == 1)
|
||||
else if(%itemText $= "Data")
|
||||
{
|
||||
AddNewModulePopup.showPopup(Canvas);
|
||||
}
|
||||
else if(%itemText $= "Tools")
|
||||
{
|
||||
AddNewToolPopup.showPopup(Canvas);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
|
@ -839,6 +918,18 @@ function AssetBrowserFilterTree::onSelect(%this, %itemId)
|
|||
|
||||
function AssetBrowser::rebuildAssetArray(%this)
|
||||
{
|
||||
if(!%this.previewArrayDirty)
|
||||
{
|
||||
%this.previewArrayDirty = true;
|
||||
%this.schedule(16, "doRebuildAssetArray");
|
||||
}
|
||||
}
|
||||
|
||||
function AssetBrowser::doRebuildAssetArray(%this)
|
||||
{
|
||||
if(!%this.previewArrayDirty)
|
||||
return;
|
||||
|
||||
%breadcrumbPath = AssetBrowser.dirHandler.currentAddress;
|
||||
|
||||
// we have to empty out the list; so when we create new guicontrols, these dont linger
|
||||
|
|
@ -852,6 +943,9 @@ function AssetBrowser::rebuildAssetArray(%this)
|
|||
%numAssetsFound = AssetDatabase.findAllAssets(%assetQuery);
|
||||
|
||||
%finalAssetCount = 0;
|
||||
|
||||
%searchText = AssetBrowserSearchFilter.getText();
|
||||
%searchFilterActive = %searchText !$= "Search Assets...";
|
||||
|
||||
//now, we'll iterate through, and find the assets that are in this module, and this category
|
||||
for( %i=0; %i < %numAssetsFound; %i++)
|
||||
|
|
@ -864,7 +958,7 @@ function AssetBrowser::rebuildAssetArray(%this)
|
|||
//clean up the path
|
||||
%assetBasePath = strreplace(%assetBasePath, "//", "/");
|
||||
|
||||
if(%assetBasePath $= %breadcrumbPath)
|
||||
if(%assetBasePath $= %breadcrumbPath || (%searchFilterActive && startsWith(%assetBasePath,%breadcrumbPath)))
|
||||
{
|
||||
//first, get the asset's module, as our major categories
|
||||
%module = AssetDatabase.getAssetModule(%assetId);
|
||||
|
|
@ -924,8 +1018,7 @@ function AssetBrowser::rebuildAssetArray(%this)
|
|||
//stop adding after previewsPerPage is hit
|
||||
%assetName = AssetDatabase.getAssetName(%assetId);
|
||||
|
||||
%searchText = AssetBrowserSearchFilter.getText();
|
||||
if(%searchText !$= "Search Assets...")
|
||||
if(%searchFilterActive)
|
||||
{
|
||||
if(strstr(strlwr(%assetName), strlwr(%searchText)) != -1)
|
||||
{
|
||||
|
|
@ -969,11 +1062,43 @@ function AssetBrowser::rebuildAssetArray(%this)
|
|||
}
|
||||
}
|
||||
|
||||
//Add Non-Asset Scripted Objects. Datablock, etc based
|
||||
%category = getWord( %breadcrumbPath, 1 );
|
||||
%dataGroup = "DataBlockGroup";
|
||||
|
||||
if(%dataGroup.getCount() != 0)
|
||||
{
|
||||
%scriptedItem = AssetBrowser-->filterTree.findItemByName("Scripted");
|
||||
|
||||
for ( %i = 0; %i < %dataGroup.getCount(); %i++ )
|
||||
{
|
||||
%obj = %dataGroup.getObject(%i);
|
||||
// echo ("Obj: " @ %obj.getName() @ " - " @ %obj.category );
|
||||
|
||||
if ( %obj.category $= "" && %obj.category == 0 )
|
||||
continue;
|
||||
|
||||
/*if ( %breadcrumbPath $= "" )
|
||||
{
|
||||
%ctrl = %this.findIconCtrl( %obj.category );
|
||||
if ( %ctrl == -1 )
|
||||
{
|
||||
%this.addFolderIcon( %obj.category );
|
||||
}
|
||||
}
|
||||
else */
|
||||
if ( %breadcrumbPath $= %obj.category )
|
||||
{
|
||||
AssetBrowser-->filterTree.insertItem(%scriptedItem, %obj.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AssetBrowser.currentPreviewPage = 0;
|
||||
AssetBrowser.totalPages = 1;
|
||||
|
||||
for(%i=0; %i < %assetArray.count(); %i++)
|
||||
AssetBrowser.buildPreviewArray( %assetArray.getValue(%i), %assetArray.getKey(%i) );
|
||||
AssetBrowser.buildAssetPreview( %assetArray.getValue(%i), %assetArray.getKey(%i) );
|
||||
|
||||
AssetBrowser_FooterText.text = %finalAssetCount @ " Assets";
|
||||
|
||||
|
|
@ -998,8 +1123,8 @@ function AssetBrowser::rebuildAssetArray(%this)
|
|||
}
|
||||
}
|
||||
|
||||
if(!%validType)
|
||||
continue;
|
||||
//if(!%validType)
|
||||
// continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1008,6 +1133,8 @@ function AssetBrowser::rebuildAssetArray(%this)
|
|||
|
||||
if(%activeTypeFilterList !$= "")
|
||||
AssetBrowser_FooterText.text = AssetBrowser_FooterText.text @ " | Active Type Filters: " @ %activeTypeFilterList;
|
||||
|
||||
%this.previewArrayDirty = false;
|
||||
}
|
||||
|
||||
//
|
||||
|
|
@ -1092,6 +1219,7 @@ function AssetBrowser::navigateTo(%this, %address, %historyNav)
|
|||
}
|
||||
|
||||
%this.rebuildAssetArray();
|
||||
%this.refresh();
|
||||
}
|
||||
|
||||
function AssetBrowser::navigateHistoryForward(%this)
|
||||
|
|
|
|||
|
|
@ -110,6 +110,8 @@ function AssetBrowser::onDropFile( %this, %filePath )
|
|||
%this.addImportingAsset("GUIAsset", %filePath);
|
||||
else if (%fileExt $= ".zip")
|
||||
%this.onDropZipFile(%filePath);
|
||||
else if( %fileExt $= "")
|
||||
%this.onDropFolder(%filePath);
|
||||
|
||||
//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
|
||||
|
|
@ -129,6 +131,53 @@ function AssetBrowser::onDropZipFile(%this, %filePath)
|
|||
|
||||
echo("Dropped in a zip file with" SPC %count SPC "files inside!");
|
||||
|
||||
for (%i = 0; %i < %count; %i++)
|
||||
{
|
||||
%fileEntry = %zip.getFileEntry(%i);
|
||||
%fileFrom = getField(%fileEntry, 0);
|
||||
|
||||
//First, we wanna scan to see if we have modules to contend with. If we do, we'll just plunk them in wholesale
|
||||
//and not process their contents.
|
||||
|
||||
//If not modules, it's likely an art pack or other mixed files, so we'll import them as normal
|
||||
/*if( (%fileExt $= ".png") || (%fileExt $= ".jpg") || (%fileExt $= ".bmp") || (%fileExt $= ".dds") )
|
||||
%this.importAssetListArray.add("ImageAsset", %filePath);
|
||||
else if( (%fileExt $= ".dae") || (%fileExt $= ".dts"))
|
||||
%this.importAssetListArray.add("ShapeAsset", %filePath);
|
||||
else if( (%fileExt $= ".ogg") || (%fileExt $= ".wav") || (%fileExt $= ".mp3"))
|
||||
%this.importAssetListArray.add("SoundAsset", %filePath);
|
||||
else if( (%fileExt $= ".gui") || (%fileExt $= ".gui.dso"))
|
||||
%this.importAssetListArray.add("GUIAsset", %filePath);
|
||||
//else if( (%fileExt $= ".cs") || (%fileExt $= ".dso"))
|
||||
// %this.importAssetListArray.add("Script", %filePath);
|
||||
else if( (%fileExt $= ".mis"))
|
||||
%this.importAssetListArray.add("LevelAsset", %filePath);*/
|
||||
|
||||
// For now, if it's a .cs file, we'll assume it's a behavior.
|
||||
//if (fileExt(%fileFrom) !$= ".cs")
|
||||
// continue;
|
||||
|
||||
%fileTo = expandFilename("^tools/assetBrowser/importTemp/") @ %fileFrom;
|
||||
%zip.extractFile(%fileFrom, %fileTo);
|
||||
//exec(%fileTo);
|
||||
}
|
||||
|
||||
%zip.delete();
|
||||
|
||||
//Next, we loop over the files and import them
|
||||
}
|
||||
|
||||
function AssetBrowser::onDropFolder(%this, %filePath)
|
||||
{
|
||||
if(!%this.isVisible())
|
||||
return;
|
||||
|
||||
%zip = new ZipObject();
|
||||
%zip.openArchive(%filePath);
|
||||
%count = %zip.getFileEntryCount();
|
||||
|
||||
echo("Dropped in a zip file with" SPC %count SPC "files inside!");
|
||||
|
||||
return;
|
||||
for (%i = 0; %i < %count; %i++)
|
||||
{
|
||||
|
|
@ -391,7 +440,10 @@ function ImportAssetWindow::onWake(%this)
|
|||
//Lets refresh our list
|
||||
if(!ImportAssetWindow.isVisible())
|
||||
return;
|
||||
|
||||
|
||||
if(!isObject(%this.importTempDirHandler))
|
||||
%this.importTempDirHandler = makedirectoryHandler(0, "", "");
|
||||
|
||||
if(!isObject(AssetImportSettings))
|
||||
{
|
||||
new Settings(AssetImportSettings)
|
||||
|
|
@ -420,6 +472,8 @@ function ImportAssetWindow::onWake(%this)
|
|||
ImportAssetConfigList.setSelected(0);
|
||||
|
||||
ImportActivityLog.empty();
|
||||
|
||||
%this.refresh();
|
||||
}
|
||||
|
||||
function ImportAssetWindow::reloadImportOptionConfigs(%this)
|
||||
|
|
@ -973,7 +1027,6 @@ function NewAssetsViewTree::onRightMouseDown(%this, %itemId)
|
|||
}
|
||||
else
|
||||
{
|
||||
ImportAssetActions.enableItem(1, false);
|
||||
ImportAssetActions.showPopup(Canvas);
|
||||
}
|
||||
}
|
||||
|
|
@ -1510,6 +1563,8 @@ function ImportAssetWindow::Close(%this)
|
|||
//Some cleanup
|
||||
ImportAssetWindow.importingFilesArray.empty();
|
||||
|
||||
%this.importTempDirHandler.deleteFolder("tools/assetBrowser/importTemp/*/");
|
||||
|
||||
Canvas.popDialog();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -67,8 +67,6 @@ function setupImportConfigSettingsList()
|
|||
ImportAssetConfigSettingsList.addNewConfigSetting("Materials/UseDiffuseSuffixOnOriginImage", "Use Diffuse Suffix for Origin Image", "bool", "", "1", "");
|
||||
ImportAssetConfigSettingsList.addNewConfigSetting("Materials/UseExistingMaterials", "Use Existing Materials", "bool", "", "1", "");
|
||||
ImportAssetConfigSettingsList.addNewConfigSetting("Materials/IgnoreMaterials", "Ignore Materials", "command", "", "", "");
|
||||
ImportAssetConfigSettingsList.addNewConfigSetting("Materials/AlwaysPresentImageMaps", "Always Present Image Maps", "bool",
|
||||
"Wether to always display all normal material map fields, even if an image isn't detected.", "", "");
|
||||
ImportAssetConfigSettingsList.addNewConfigSetting("Materials/PopulateMaterialMaps", "Populate Material Maps", "bool", "", "1", "");
|
||||
|
||||
//Animations
|
||||
|
|
@ -321,7 +319,6 @@ function ImportAssetConfigEditorWindow::addNewConfig(%this)
|
|||
AssetImportSettings.setValue("Materials/CreateComposites", "1");
|
||||
AssetImportSettings.setValue("Materials/UseDiffuseSuffixOnOriginImage", "1");
|
||||
AssetImportSettings.setValue("Materials/UseExistingMaterials", "1");
|
||||
AssetImportSettings.setValue("Materials/AlwaysPresentImageMaps", "0");
|
||||
AssetImportSettings.setValue("Materials/PopulateMaterialMaps", "1");
|
||||
|
||||
//Animations
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
|
||||
//Builds the preview data of the asset for the Asset Browser
|
||||
function AssetBrowser::build_AssetPreview(%this, %assetDef, %previewData)
|
||||
{
|
||||
%previewData.assetName = %assetDef.assetName;
|
||||
|
|
@ -11,59 +13,73 @@ function AssetBrowser::build_AssetPreview(%this, %assetDef, %previewData)
|
|||
%previewData.tooltip = %assetDef.gameObjectName;
|
||||
}
|
||||
|
||||
//Some last-step setup for the creation of the new asset before we do the actual making
|
||||
//This is generally intended to just set up any type-specific fields for creation
|
||||
function AssetBrowser::setupCreateNew_Asset(%this)
|
||||
{
|
||||
}
|
||||
|
||||
//Performs the actual creation of the asset, including loose file copy or generation
|
||||
function AssetBrowser::create_Asset(%this)
|
||||
{
|
||||
}
|
||||
|
||||
//This is a pre-process step to prepare the asset item for import
|
||||
function AssetBrowser::prepareImport_Asset(%this, %assetItem)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function AssetBrowser::setupCreateNew_Asset(%this)
|
||||
{
|
||||
}
|
||||
|
||||
function AssetBrowser::create_Asset(%this)
|
||||
{
|
||||
}
|
||||
|
||||
//Performs the action of actually importing the asset item
|
||||
function AssetBrowser::import_Asset(%this, %assetDef)
|
||||
{
|
||||
}
|
||||
|
||||
//Editing the asset
|
||||
function AssetBrowser::edit_Asset(%this, %assetDef)
|
||||
{
|
||||
}
|
||||
|
||||
//Duplicates the asset
|
||||
function AssetBrowser::duplicate_Asset(%this, %assetDef, %targetModule)
|
||||
{
|
||||
}
|
||||
|
||||
//Renames the asset
|
||||
function AssetBrowser::rename_Asset(%this, %assetDef, %newAssetName)
|
||||
{
|
||||
}
|
||||
|
||||
//Deletes the asset
|
||||
function AssetBrowser::delete_Asset(%this, %assetDef)
|
||||
{
|
||||
}
|
||||
|
||||
//Moves the asset to a new path/module
|
||||
function AssetBrowser::move_Asset(%this, %assetDef, %destinationFolder)
|
||||
{
|
||||
}
|
||||
|
||||
//Drag and drop action onto a GUI control
|
||||
function AssetBrowser::dragAndDrop_Asset(%this, %assetDef, %dropTarget)
|
||||
{
|
||||
if(!isObject(%dropTarget))
|
||||
return;
|
||||
}
|
||||
|
||||
//Even for when
|
||||
function AssetBrowser::on_AssetEditorDropped(%this, %assetDef, %position)
|
||||
{
|
||||
}
|
||||
|
||||
//Clicking of the button for the asset type inspector field
|
||||
function GuiInspectorType_AssetPtr::onClick( %this, %fieldName )
|
||||
{
|
||||
//Get our data
|
||||
%obj = %this.getInspector().getInspectObject(0);
|
||||
}
|
||||
|
||||
//Drag and droppin onto the asset type inspector field
|
||||
function GuiInspectorType_AssetPtr::onControlDropped( %this, %payload, %position )
|
||||
{
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,16 @@
|
|||
function AssetBrowser::buildCppAssetPreview(%this, %assetDef, %previewData)
|
||||
{
|
||||
%previewData.assetName = %assetDef.assetName;
|
||||
%previewData.assetPath = %assetDef.codeFilePath;
|
||||
%previewData.doubleClickCommand = "echo(\"Not yet implemented to edit C++ files from the editor\");";//"EditorOpenFileInTorsion( "@%previewData.assetPath@", 0 );";
|
||||
|
||||
%previewData.previewImage = "tools/assetBrowser/art/cppIcon";
|
||||
|
||||
%previewData.assetFriendlyName = %assetDef.assetName;
|
||||
%previewData.assetDesc = %assetDef.description;
|
||||
%previewData.tooltip = %assetDef.assetName;
|
||||
}
|
||||
|
||||
function AssetBrowser::createCppAsset(%this)
|
||||
{
|
||||
%moduleName = AssetBrowser.newAssetSettings.moduleName;
|
||||
|
|
@ -129,15 +142,50 @@ function AssetBrowser::createCppAsset(%this)
|
|||
return %tamlpath;
|
||||
}
|
||||
|
||||
function AssetBrowser::buildCppAssetPreview(%this, %assetDef, %previewData)
|
||||
function AssetBrowser::editCppAsset(%this, %assetDef)
|
||||
{
|
||||
%previewData.assetName = %assetDef.assetName;
|
||||
%previewData.assetPath = %assetDef.codeFilePath;
|
||||
%previewData.doubleClickCommand = "echo(\"Not yet implemented to edit C++ files from the editor\");";//"EditorOpenFileInTorsion( "@%previewData.assetPath@", 0 );";
|
||||
}
|
||||
|
||||
//Renames the asset
|
||||
function AssetBrowser::renameCppAsset(%this, %assetDef, %newAssetName)
|
||||
{
|
||||
%newCodeLooseFilename = renameAssetLooseFile(%assetDef.codefile, %newAssetName);
|
||||
|
||||
%previewData.previewImage = "tools/assetBrowser/art/cppIcon";
|
||||
if(!%newCodeLooseFilename $= "")
|
||||
return;
|
||||
|
||||
%newHeaderLooseFilename = renameAssetLooseFile(%assetDef.headerFile, %newAssetName);
|
||||
|
||||
%previewData.assetFriendlyName = %assetDef.assetName;
|
||||
%previewData.assetDesc = %assetDef.description;
|
||||
%previewData.tooltip = %assetDef.assetName;
|
||||
}
|
||||
if(!%newHeaderLooseFilename $= "")
|
||||
return;
|
||||
|
||||
%assetDef.codefile = %newCodeLooseFilename;
|
||||
%assetDef.headerFile = %newHeaderLooseFilename;
|
||||
%assetDef.saveAsset();
|
||||
|
||||
renameAssetFile(%assetDef, %newAssetName);
|
||||
}
|
||||
|
||||
//Deletes the asset
|
||||
function AssetBrowser::deleteCppAsset(%this, %assetDef)
|
||||
{
|
||||
AssetDatabase.deleteAsset(%assetDef.getAssetId(), true);
|
||||
}
|
||||
|
||||
//Moves the asset to a new path/module
|
||||
function AssetBrowser::moveCppAsset(%this, %assetDef, %destination)
|
||||
{
|
||||
%currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId());
|
||||
%targetModule = AssetBrowser.getModuleFromAddress(%destination);
|
||||
|
||||
%newAssetPath = moveAssetFile(%assetDef, %destination);
|
||||
|
||||
if(%newAssetPath $= "")
|
||||
return false;
|
||||
|
||||
moveAssetLooseFile(%assetDef.codeFile, %destination);
|
||||
moveAssetLooseFile(%assetDef.headerFile, %destination);
|
||||
|
||||
AssetDatabase.removeDeclaredAsset(%assetDef.getAssetId());
|
||||
AssetDatabase.addDeclaredAsset(%targetModule, %newAssetPath);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,50 @@ function AssetBrowser::editCubemapAsset(%this, %assetDef)
|
|||
CubemapEditor.openCubemapAsset(%assetDef);
|
||||
}
|
||||
|
||||
//Renames the asset
|
||||
function AssetBrowser::renameCubemapAsset(%this, %assetDef, %newAssetName)
|
||||
{
|
||||
/*%newCodeLooseFilename = renameAssetLooseFile(%assetDef.codefile, %newAssetName);
|
||||
|
||||
if(!%newCodeLooseFilename $= "")
|
||||
return;
|
||||
|
||||
%newHeaderLooseFilename = renameAssetLooseFile(%assetDef.headerFile, %newAssetName);
|
||||
|
||||
if(!%newHeaderLooseFilename $= "")
|
||||
return;
|
||||
|
||||
%assetDef.codefile = %newCodeLooseFilename;
|
||||
%assetDef.headerFile = %newHeaderLooseFilename;
|
||||
%assetDef.saveAsset();
|
||||
|
||||
renameAssetFile(%assetDef, %newAssetName);*/
|
||||
}
|
||||
|
||||
//Deletes the asset
|
||||
function AssetBrowser::deleteCubemapAsset(%this, %assetDef)
|
||||
{
|
||||
AssetDatabase.deleteAsset(%assetDef.getAssetId(), true);
|
||||
}
|
||||
|
||||
//Moves the asset to a new path/module
|
||||
function AssetBrowser::moveCubemapAsset(%this, %assetDef, %destination)
|
||||
{
|
||||
/*%currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId());
|
||||
%targetModule = AssetBrowser.getModuleFromAddress(%destination);
|
||||
|
||||
%newAssetPath = moveAssetFile(%assetDef, %destination);
|
||||
|
||||
if(%newAssetPath $= "")
|
||||
return false;
|
||||
|
||||
moveAssetLooseFile(%assetDef.codeFile, %destination);
|
||||
moveAssetLooseFile(%assetDef.headerFile, %destination);
|
||||
|
||||
AssetDatabase.removeDeclaredAsset(%assetDef.getAssetId());
|
||||
AssetDatabase.addDeclaredAsset(%targetModule, %newAssetPath);*/
|
||||
}
|
||||
|
||||
function GuiInspectorTypeCubemapAssetPtr::onControlDropped( %this, %payload, %position )
|
||||
{
|
||||
Canvas.popDialog(EditorDragAndDropLayer);
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ function AssetBrowser::buildFolderPreview(%this, %assetDef, %previewData)
|
|||
//%previewData.assetFriendlyName = %assetDef.assetName;
|
||||
%previewData.assetDesc = %assetDef.description;
|
||||
%previewData.tooltip = %assetDef.dirPath;
|
||||
%previewData.doubleClickCommand = "AssetBrowser.navigateTo(\""@ %assetDef.dirPath @ "/" @ %assetDef.assetName @"\")";//browseTo %assetDef.dirPath / %assetDef.assetName
|
||||
%previewData.doubleClickCommand = "AssetBrowser.schedule(10, \"navigateTo\",\""@ %assetDef.dirPath @ "/" @ %assetDef.assetName @"\");";//browseTo %assetDef.dirPath / %assetDef.assetName
|
||||
}
|
||||
|
||||
function AssetBrowser::renameFolder(%this, %folderPath, %newFolderName)
|
||||
|
|
|
|||
|
|
@ -234,6 +234,31 @@ function AssetBrowser::renameGameObjectAsset(%this, %assetDef, %newAssetId, %ori
|
|||
TAMLWrite(%gameObj, %newGOFile);
|
||||
}
|
||||
|
||||
//Deletes the asset
|
||||
function AssetBrowser::deleteGameObjectAsset(%this, %assetDef)
|
||||
{
|
||||
AssetDatabase.deleteAsset(%assetDef.getAssetId(), true);
|
||||
}
|
||||
|
||||
//Moves the asset to a new path/module
|
||||
function AssetBrowser::moveGameObjectAsset(%this, %assetDef, %destination)
|
||||
{
|
||||
%currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId());
|
||||
%targetModule = AssetBrowser.getModuleFromAddress(%destination);
|
||||
|
||||
%newAssetPath = moveAssetFile(%assetDef, %destination);
|
||||
|
||||
if(%newAssetPath $= "")
|
||||
return false;
|
||||
|
||||
moveAssetLooseFile(%assetDef.scriptFile, %destination);
|
||||
moveAssetLooseFile(%assetDef.TAMLFile, %destination);
|
||||
|
||||
AssetDatabase.removeDeclaredAsset(%assetDef.getAssetId());
|
||||
AssetDatabase.addDeclaredAsset(%targetModule, %newAssetPath);
|
||||
}
|
||||
|
||||
|
||||
function AssetBrowser::buildGameObjectAssetPreview(%this, %assetDef, %previewData)
|
||||
{
|
||||
%previewData.assetName = %assetDef.assetName;
|
||||
|
|
|
|||
|
|
@ -100,6 +100,51 @@ function AssetBrowser::editGUIAsset(%this, %assetDef)
|
|||
GuiEditContent(%assetDef.assetName);
|
||||
}
|
||||
|
||||
//Renames the asset
|
||||
function AssetBrowser::renameGUIAsset(%this, %assetDef, %newAssetName)
|
||||
{
|
||||
%newScriptLooseFilename = renameAssetLooseFile(%assetDef.scriptFile, %newAssetName);
|
||||
|
||||
if(!%newScriptLooseFilename $= "")
|
||||
return;
|
||||
|
||||
%newGUILooseFilename = renameAssetLooseFile(%assetDef.guiFile, %newAssetName);
|
||||
|
||||
if(!%newGUILooseFilename $= "")
|
||||
return;
|
||||
|
||||
%assetDef.scriptFile = %newScriptLooseFilename;
|
||||
%assetDef.guiFile = %newGUILooseFilename;
|
||||
%assetDef.saveAsset();
|
||||
|
||||
renameAssetFile(%assetDef, %newAssetName);
|
||||
}
|
||||
|
||||
//Deletes the asset
|
||||
function AssetBrowser::deleteGUIAsset(%this, %assetDef)
|
||||
{
|
||||
AssetDatabase.deleteAsset(%assetDef.getAssetId(), true);
|
||||
}
|
||||
|
||||
//Moves the asset to a new path/module
|
||||
function AssetBrowser::moveGUIAsset(%this, %assetDef, %destination)
|
||||
{
|
||||
%currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId());
|
||||
%targetModule = AssetBrowser.getModuleFromAddress(%destination);
|
||||
|
||||
%newAssetPath = moveAssetFile(%assetDef, %destination);
|
||||
|
||||
if(%newAssetPath $= "")
|
||||
return false;
|
||||
|
||||
moveAssetLooseFile(%assetDef.guifile, %destination);
|
||||
moveAssetLooseFile(%assetDef.scriptFile, %destination);
|
||||
|
||||
AssetDatabase.removeDeclaredAsset(%assetDef.getAssetId());
|
||||
AssetDatabase.addDeclaredAsset(%targetModule, %newAssetPath);
|
||||
}
|
||||
|
||||
|
||||
function AssetBrowser::buildGUIAssetPreview(%this, %assetDef, %previewData)
|
||||
{
|
||||
%previewData.assetName = %assetDef.assetName;
|
||||
|
|
|
|||
|
|
@ -81,9 +81,11 @@ function AssetBrowser::prepareImportImageAsset(%this, %assetItem)
|
|||
if(getAssetImportConfigValue("Materials/PopulateMaterialMaps", "1") == 1)
|
||||
{
|
||||
if(%foundSuffixType $= "diffuse")
|
||||
%materialAsset.diffuseImageAsset = %assetItem;
|
||||
%assetItem.ImageType = "Diffuse";
|
||||
//%materialAsset.diffuseImageAsset = %assetItem;
|
||||
else if(%foundSuffixType $= "normal")
|
||||
%materialAsset.normalImageAsset = %assetItem;
|
||||
%assetItem.ImageType = "Normal";
|
||||
//%materialAsset.normalImageAsset = %assetItem;
|
||||
else if(%foundSuffixType $= "metalness")
|
||||
%materialAsset.metalnessImageAsset = %assetItem;
|
||||
else if(%foundSuffixType $= "roughness")
|
||||
|
|
@ -173,28 +175,38 @@ function AssetBrowser::buildImageAssetPreview(%this, %assetDef, %previewData)
|
|||
%previewData.tooltip = %assetDef.friendlyName @ "\n" @ %assetDef;
|
||||
}
|
||||
|
||||
//Renames the asset
|
||||
function AssetBrowser::renameImageAsset(%this, %assetDef, %newAssetName)
|
||||
{
|
||||
%newFilename = renameAssetLooseFile(%assetDef.imageFile, %newAssetName);
|
||||
|
||||
if(!%newFilename $= "")
|
||||
return;
|
||||
|
||||
%assetDef.imageFile = %newFilename;
|
||||
%assetDef.saveAsset();
|
||||
|
||||
renameAssetFile(%assetDef, %newAssetName);
|
||||
}
|
||||
|
||||
//Deletes the asset
|
||||
function AssetBrowser::deleteImageAsset(%this, %assetDef)
|
||||
{
|
||||
AssetDatabase.deleteAsset(%assetDef.getAssetId(), true);
|
||||
}
|
||||
|
||||
//Moves the asset to a new path/module
|
||||
function AssetBrowser::moveImageAsset(%this, %assetDef, %destination)
|
||||
{
|
||||
%currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId());
|
||||
%targetModule = AssetBrowser.getModuleFromAddress(%destination);
|
||||
|
||||
if(%currentModule $= %targetModule)
|
||||
{
|
||||
//just move the files
|
||||
%assetPath = makeFullPath(AssetDatabase.getAssetFilePath(%assetDef.getAssetId()));
|
||||
%assetFilename = fileName(%assetPath);
|
||||
|
||||
%newAssetPath = %destination @ "/" @ %assetFilename;
|
||||
|
||||
%copiedSuccess = pathCopy(%assetPath, %destination @ "/" @ %assetFilename);
|
||||
%deleteSuccess = fileDelete(%assetPath);
|
||||
|
||||
%imagePath = %assetDef.imageFile;
|
||||
%imageFilename = fileName(%imagePath);
|
||||
|
||||
%copiedSuccess = pathCopy(%imagePath, %destination @ "/" @ %imageFilename);
|
||||
%deleteSuccess = fileDelete(%imagePath);
|
||||
}
|
||||
%newAssetPath = moveAssetFile(%assetDef, %destination);
|
||||
|
||||
if(%newAssetPath $= "")
|
||||
return false;
|
||||
|
||||
moveAssetLooseFile(%assetDef.imageFile, %destination);
|
||||
|
||||
AssetDatabase.removeDeclaredAsset(%assetDef.getAssetId());
|
||||
AssetDatabase.addDeclaredAsset(%targetModule, %newAssetPath);
|
||||
|
|
|
|||
|
|
@ -35,11 +35,19 @@ function AssetBrowser::createLevelAsset(%this)
|
|||
|
||||
TamlWrite(%asset, %tamlpath);
|
||||
|
||||
if(!pathCopy("tools/levels/BlankRoom.mis", %levelPath, false))
|
||||
//Special-case where if we're doing a save-as action, it'll base on the current scene.
|
||||
//Otherwise we're doing a basic create action, so just base it off our editor's default
|
||||
if(EditorGui.saveAs)
|
||||
{
|
||||
getRootScene().save(%levelPath);
|
||||
}
|
||||
else if(!pathCopy("tools/levels/DefaultEditorLevel.mis", %levelPath, false))
|
||||
{
|
||||
echo("Unable to copy template level file!");
|
||||
}
|
||||
|
||||
replaceInFile(%levelPath, "EditorTemplateLevel", %assetName);
|
||||
|
||||
//Generate the associated files
|
||||
DecalManagerSave( %assetPath @ %asset.DecalsFile );
|
||||
PostFXManager::savePresetHandler( %assetPath @ %asset.PostFXPresetFile );
|
||||
|
|
@ -61,6 +69,45 @@ function AssetBrowser::editLevelAsset(%this, %assetDef)
|
|||
{
|
||||
schedule( 1, 0, "EditorOpenMission", %assetDef);
|
||||
}
|
||||
|
||||
//Renames the asset
|
||||
function AssetBrowser::renameLevelAsset(%this, %assetDef, %newAssetName)
|
||||
{
|
||||
%newFilename = renameAssetLooseFile(%assetDef.LevelFile, %newAssetName);
|
||||
|
||||
if(!%newFilename $= "")
|
||||
return;
|
||||
|
||||
//TODO the other loose files
|
||||
|
||||
%assetDef.LevelFile = %newFilename;
|
||||
%assetDef.saveAsset();
|
||||
|
||||
renameAssetFile(%assetDef, %newAssetName);
|
||||
}
|
||||
|
||||
//Deletes the asset
|
||||
function AssetBrowser::deleteLevelAsset(%this, %assetDef)
|
||||
{
|
||||
AssetDatabase.deleteAsset(%assetDef.getAssetId(), true);
|
||||
}
|
||||
|
||||
//Moves the asset to a new path/module
|
||||
function AssetBrowser::moveLevelAsset(%this, %assetDef, %destination)
|
||||
{
|
||||
%currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId());
|
||||
%targetModule = AssetBrowser.getModuleFromAddress(%destination);
|
||||
|
||||
%newAssetPath = moveAssetFile(%assetDef, %destination);
|
||||
|
||||
if(%newAssetPath $= "")
|
||||
return false;
|
||||
|
||||
moveAssetLooseFile(%assetDef.LevelFile, %destination);
|
||||
|
||||
AssetDatabase.removeDeclaredAsset(%assetDef.getAssetId());
|
||||
AssetDatabase.addDeclaredAsset(%targetModule, %newAssetPath);
|
||||
}
|
||||
|
||||
function AssetBrowser::buildLevelAssetPreview(%this, %assetDef, %previewData)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -45,6 +45,43 @@ function AssetBrowser::editMaterialAsset(%this, %assetDef)
|
|||
AssetBrowser.hideDialog();
|
||||
}
|
||||
|
||||
//Renames the asset
|
||||
function AssetBrowser::renameMaterialAsset(%this, %assetDef, %newAssetName)
|
||||
{
|
||||
%newFilename = renameAssetLooseFile(%assetDef.scriptPath, %newAssetName);
|
||||
|
||||
if(!%newFilename $= "")
|
||||
return;
|
||||
|
||||
%assetDef.scriptPath = %newFilename;
|
||||
%assetDef.saveAsset();
|
||||
|
||||
renameAssetFile(%assetDef, %newAssetName);
|
||||
}
|
||||
|
||||
//Deletes the asset
|
||||
function AssetBrowser::deleteMaterialAsset(%this, %assetDef)
|
||||
{
|
||||
AssetDatabase.deleteAsset(%assetDef.getAssetId(), true);
|
||||
}
|
||||
|
||||
//Moves the asset to a new path/module
|
||||
function AssetBrowser::moveMaterialAsset(%this, %assetDef, %destination)
|
||||
{
|
||||
%currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId());
|
||||
%targetModule = AssetBrowser.getModuleFromAddress(%destination);
|
||||
|
||||
%newAssetPath = moveAssetFile(%assetDef, %destination);
|
||||
|
||||
if(%newAssetPath $= "")
|
||||
return false;
|
||||
|
||||
moveAssetLooseFile(%assetDef.scriptPath, %destination);
|
||||
|
||||
AssetDatabase.removeDeclaredAsset(%assetDef.getAssetId());
|
||||
AssetDatabase.addDeclaredAsset(%targetModule, %newAssetPath);
|
||||
}
|
||||
|
||||
function AssetBrowser::prepareImportMaterialAsset(%this, %assetItem)
|
||||
{
|
||||
ImportActivityLog.add("Preparing Shape for Import: " @ %assetItem.assetName);
|
||||
|
|
@ -95,14 +132,6 @@ function AssetBrowser::prepareImportMaterialAsset(%this, %assetItem)
|
|||
%diffuseAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem);
|
||||
%assetItem.diffuseImageAsset = %diffuseAsset;
|
||||
}
|
||||
else if(getAssetImportConfigValue("Materials/AlwaysPresentImageMaps", "0") == 1)
|
||||
{
|
||||
//In the event we don't have this image asset, but we DO wish to always display the field(affording when names don't aline with
|
||||
//the material name), then we go ahead and create a blank entry
|
||||
%suff = getTokenCount(%diffuseTypeSuffixes, ",;") == 0 ? "_albedo" : getToken(%diffuseTypeSuffixes, ",;", 0);
|
||||
%diffuseAsset = AssetBrowser.addImportingAsset("Image", %assetItem.AssetName @ %suff, %assetItem);
|
||||
%assetItem.diffuseImageAsset = %diffuseAsset;
|
||||
}
|
||||
}
|
||||
|
||||
//Now, iterate over our comma-delimited suffixes to see if we have any matches. We'll use the first match in each case, if any.
|
||||
|
|
@ -120,14 +149,6 @@ function AssetBrowser::prepareImportMaterialAsset(%this, %assetItem)
|
|||
%normalAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem);
|
||||
%assetItem.normalImageAsset = %normalAsset;
|
||||
}
|
||||
else if(getAssetImportConfigValue("Materials/AlwaysPresentImageMaps", "0") == 1)
|
||||
{
|
||||
//In the event we don't have this image asset, but we DO wish to always display the field(affording when names don't aline with
|
||||
//the material name), then we go ahead and create a blank entry
|
||||
%suff = getTokenCount(%normalTypeSuffixes, ",;") == 0 ? "_normal" : getToken(%normalTypeSuffixes, ",;", 0);
|
||||
%normalAsset = AssetBrowser.addImportingAsset("Image", %assetItem.AssetName @ %suff, %assetItem);
|
||||
%assetItem.normalImageAsset = %normalAsset;
|
||||
}
|
||||
}
|
||||
|
||||
if(%assetItem.metalImageAsset $= "")
|
||||
|
|
@ -143,14 +164,6 @@ function AssetBrowser::prepareImportMaterialAsset(%this, %assetItem)
|
|||
%metalAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem);
|
||||
%assetItem.metalImageAsset = %metalAsset;
|
||||
}
|
||||
else if(getAssetImportConfigValue("Materials/AlwaysPresentImageMaps", "0") == 1)
|
||||
{
|
||||
//In the event we don't have this image asset, but we DO wish to always display the field(affording when names don't aline with
|
||||
//the material name), then we go ahead and create a blank entry
|
||||
%suff = getTokenCount(%metalnessTypeSuffixes, ",;") == 0 ? "_metalness" : getToken(%metalnessTypeSuffixes, ",;", 0);
|
||||
%metalAsset = AssetBrowser.addImportingAsset("Image", %assetItem.AssetName @ %suff, %assetItem);
|
||||
%assetItem.metalImageAsset = %metalAsset;
|
||||
}
|
||||
}
|
||||
|
||||
if(%assetItem.roughnessImageAsset $= "")
|
||||
|
|
@ -166,14 +179,6 @@ function AssetBrowser::prepareImportMaterialAsset(%this, %assetItem)
|
|||
%roughnessAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem);
|
||||
%assetItem.roughnessImageAsset = %roughnessAsset;
|
||||
}
|
||||
else if(getAssetImportConfigValue("Materials/AlwaysPresentImageMaps", "0") == 1)
|
||||
{
|
||||
//In the event we don't have this image asset, but we DO wish to always display the field(affording when names don't aline with
|
||||
//the material name), then we go ahead and create a blank entry
|
||||
%suff = getTokenCount(%roughnessTypeSuffixes, ",;") == 0 ? "_roughness" : getToken(%roughnessTypeSuffixes, ",;", 0);
|
||||
%roughnessAsset = AssetBrowser.addImportingAsset("Image", %assetItem.AssetName @ %suff, %assetItem);
|
||||
%assetItem.roughnessImageAsset = %roughnessAsset;
|
||||
}
|
||||
}
|
||||
|
||||
if(%assetItem.smoothnessImageAsset $= "")
|
||||
|
|
@ -189,14 +194,6 @@ function AssetBrowser::prepareImportMaterialAsset(%this, %assetItem)
|
|||
%smoothnessAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem);
|
||||
%assetItem.SmoothnessImageAsset = %smoothnessAsset;
|
||||
}
|
||||
else if(getAssetImportConfigValue("Materials/AlwaysPresentImageMaps", "0") == 1)
|
||||
{
|
||||
//In the event we don't have this image asset, but we DO wish to always display the field(affording when names don't aline with
|
||||
//the material name), then we go ahead and create a blank entry
|
||||
%suff = getTokenCount(%smoothnessTypeSuffixes, ",;") == 0 ? "_smoothness" : getToken(%smoothnessTypeSuffixes, ",;", 0);
|
||||
%smoothnessAsset = AssetBrowser.addImportingAsset("Image", %assetItem.AssetName @ %suff, %assetItem);
|
||||
%assetItem.SmoothnessImageAsset = %smoothnessAsset;
|
||||
}
|
||||
}
|
||||
|
||||
if(%assetItem.AOImageAsset $= "")
|
||||
|
|
@ -212,14 +209,6 @@ function AssetBrowser::prepareImportMaterialAsset(%this, %assetItem)
|
|||
%AOAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem);
|
||||
%assetItem.AOImageAsset = %AOAsset;
|
||||
}
|
||||
else if(getAssetImportConfigValue("Materials/AlwaysPresentImageMaps", "0") == 1)
|
||||
{
|
||||
//In the event we don't have this image asset, but we DO wish to always display the field(affording when names don't aline with
|
||||
//the material name), then we go ahead and create a blank entry
|
||||
%suff = getTokenCount(%aoTypeSuffixes, ",;") == 0 ? "_AO" : getToken(%aoTypeSuffixes, ",;", 0);
|
||||
%AOAsset = AssetBrowser.addImportingAsset("Image", %assetItem.AssetName @ %suff, %assetItem);
|
||||
%assetItem.AOImageAsset = %AOAsset;
|
||||
}
|
||||
}
|
||||
|
||||
if(%assetItem.compositeImageAsset $= "")
|
||||
|
|
@ -235,21 +224,12 @@ function AssetBrowser::prepareImportMaterialAsset(%this, %assetItem)
|
|||
%compositeAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem);
|
||||
%assetItem.compositeImageAsset = %compositeAsset;
|
||||
}
|
||||
else if(getAssetImportConfigValue("Materials/AlwaysPresentImageMaps", "0") == 1)
|
||||
{
|
||||
//In the event we don't have this image asset, but we DO wish to always display the field(affording when names don't aline with
|
||||
//the material name), then we go ahead and create a blank entry
|
||||
%suff = getTokenCount(%compositeTypeSuffixes, ",;") == 0 ? "_composite" : getToken(%compositeTypeSuffixes, ",;", 0);
|
||||
%compositeAsset = AssetBrowser.addImportingAsset("Image", %assetItem.AssetName @ %suff, %assetItem);
|
||||
%assetItem.compositeImageAsset = %compositeAsset;
|
||||
}
|
||||
}
|
||||
|
||||
//If after the above we didn't find any, check to see if we should be generating one
|
||||
if(%assetItem.compositeImageAsset $= "" &&
|
||||
(%assetItem.roughnessImageAsset !$= "" || %assetItem.AOImageAsset !$= "" || %assetItem.metalnessImageAsset !$= "") &&
|
||||
getAssetImportConfigValue("Materials/CreateComposites", "1") == 1 &&
|
||||
getAssetImportConfigValue("Materials/AlwaysPresentImageMaps", "0") == 0)
|
||||
getAssetImportConfigValue("Materials/CreateComposites", "1") == 1)
|
||||
{
|
||||
%assetItem.roughnessImageAsset.skip = true;
|
||||
%assetItem.AOImageAsset.skip = true;
|
||||
|
|
|
|||
|
|
@ -111,6 +111,57 @@ function AssetBrowser::createPostEffectAsset(%this)
|
|||
return %tamlpath;
|
||||
}
|
||||
|
||||
//Renames the asset
|
||||
function AssetBrowser::renamePostEffectAsset(%this, %assetDef, %newAssetName)
|
||||
{
|
||||
%newScriptFilename = renameAssetLooseFile(%assetDef.scriptPath, %newAssetName);
|
||||
|
||||
if(!%newScriptFilename $= "")
|
||||
return;
|
||||
|
||||
%newHLSLFilename = renameAssetLooseFile(%assetDef.hlslShader, %newAssetName);
|
||||
|
||||
if(!%newHLSLFilename $= "")
|
||||
return;
|
||||
|
||||
%newGLSLFilename = renameAssetLooseFile(%assetDef.glslShader, %newAssetName);
|
||||
|
||||
if(!%newGLSLFilename $= "")
|
||||
return;
|
||||
|
||||
%assetDef.scriptPath = %newScriptFilename;
|
||||
%assetDef.hlslShader = %newHLSLFilename;
|
||||
%assetDef.glslShader = %newGLSLFilename;
|
||||
%assetDef.saveAsset();
|
||||
|
||||
renameAssetFile(%assetDef, %newAssetName);
|
||||
}
|
||||
|
||||
//Deletes the asset
|
||||
function AssetBrowser::deletePostEffectAsset(%this, %assetDef)
|
||||
{
|
||||
AssetDatabase.deleteAsset(%assetDef.getAssetId(), true);
|
||||
}
|
||||
|
||||
//Moves the asset to a new path/module
|
||||
function AssetBrowser::movePostEffectAsset(%this, %assetDef, %destination)
|
||||
{
|
||||
%currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId());
|
||||
%targetModule = AssetBrowser.getModuleFromAddress(%destination);
|
||||
|
||||
%newAssetPath = moveAssetFile(%assetDef, %destination);
|
||||
|
||||
if(%newAssetPath $= "")
|
||||
return false;
|
||||
|
||||
moveAssetLooseFile(%assetDef.scriptPath, %destination);
|
||||
moveAssetLooseFile(%assetDef.hlslShader, %destination);
|
||||
moveAssetLooseFile(%assetDef.glslShader, %destination);
|
||||
|
||||
AssetDatabase.removeDeclaredAsset(%assetDef.getAssetId());
|
||||
AssetDatabase.addDeclaredAsset(%targetModule, %newAssetPath);
|
||||
}
|
||||
|
||||
function AssetBrowser::buildPostEffectAssetPreview(%this, %assetDef, %previewData)
|
||||
{
|
||||
%previewData.assetName = %assetDef.assetName;
|
||||
|
|
|
|||
|
|
@ -53,87 +53,41 @@ function AssetBrowser::onScriptAssetEditorDropped(%this, %assetDef, %position)
|
|||
return;
|
||||
}
|
||||
|
||||
//Renames the asset
|
||||
function AssetBrowser::renameScriptAsset(%this, %assetDef, %newAssetName)
|
||||
{
|
||||
%assetId = %assetDef.getAssetID();
|
||||
%newFilename = renameAssetLooseFile(%assetDef.scriptFile, %newAssetName);
|
||||
|
||||
%module = AssetDatabase.getAssetModule(%assetId);
|
||||
|
||||
%scriptPath = %assetDef.scriptFile;
|
||||
%newScriptPath = filePath(%scriptPath) @ "/" @ %newAssetName @ fileExt(%scriptPath);
|
||||
%copiedSuccess = pathCopy(%scriptPath, %newScriptPath);
|
||||
|
||||
%looseFilepath = fileName(%newScriptPath);
|
||||
|
||||
%assetDef.scriptFile = "\"@AssetFile=" @ %looseFilepath @ "\"";
|
||||
if(!%newFilename $= "")
|
||||
return;
|
||||
|
||||
%assetDef.scriptFile = %newFilename;
|
||||
%assetDef.saveAsset();
|
||||
|
||||
AssetDatabase.renameDeclaredAsset("\"" @ %module @ ":" @ %newAssetName @ "\"");
|
||||
|
||||
//%assetFilePath = makeFullPath(AssetDatabase.getAssetFilePath(%assetId));
|
||||
//%newAssetFilePath = %newFullPath @ "/" @ fileName(%assetFilePath);
|
||||
//%copiedSuccess = pathCopy(%assetFilePath, %newAssetFilePath);
|
||||
|
||||
fileDelete(%scriptPath);
|
||||
|
||||
//ModuleDatabase.unloadExplicit(%module.getModuleId());
|
||||
//ModuleDatabase.loadExplicit(%module.getModuleId());
|
||||
renameAssetFile(%assetDef, %newAssetName);
|
||||
}
|
||||
|
||||
//Deletes the asset
|
||||
function AssetBrowser::deleteScriptAsset(%this, %assetDef)
|
||||
{
|
||||
%assetId = %assetDef.getAssetID();
|
||||
|
||||
%module = AssetDatabase.getAssetModule(%assetId);
|
||||
|
||||
%assetFilePath = makeFullPath(AssetDatabase.getAssetFilePath(%assetId));
|
||||
%scriptPath = %assetDef.scriptFile;
|
||||
|
||||
fileDelete(%assetFilePath);
|
||||
fileDelete(%scriptPath);
|
||||
|
||||
//they're different moduels now, so we gotta unload/reload both
|
||||
ModuleDatabase.unloadExplicit(%module.getModuleId());
|
||||
ModuleDatabase.unloadExplicit(%newModule.getModuleId());
|
||||
AssetDatabase.deleteAsset(%assetDef.getAssetId(), true);
|
||||
}
|
||||
|
||||
//Moves the asset to a new path/module
|
||||
function AssetBrowser::moveScriptAsset(%this, %assetDef, %destination)
|
||||
{
|
||||
%newFullPath = makeFullPath(%destination);
|
||||
%currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId());
|
||||
%targetModule = AssetBrowser.getModuleFromAddress(%destination);
|
||||
|
||||
%assetId = %assetDef.getAssetID();
|
||||
%newAssetPath = moveAssetFile(%assetDef, %destination);
|
||||
|
||||
%module = AssetDatabase.getAssetModule(%assetId);
|
||||
if(%newAssetPath $= "")
|
||||
return false;
|
||||
|
||||
moveAssetLooseFile(%assetDef.scriptFile, %destination);
|
||||
|
||||
%assetFilePath = makeFullPath(AssetDatabase.getAssetFilePath(%assetId));
|
||||
%newAssetFilePath = %newFullPath @ "/" @ fileName(%assetFilePath);
|
||||
%copiedSuccess = pathCopy(%assetFilePath, %newAssetFilePath);
|
||||
|
||||
%scriptPath = %assetDef.scriptFile;
|
||||
%newScriptPath = %newFullPath @ "/" @ fileName(%scriptPath);
|
||||
%copiedSuccess = pathCopy(%scriptPath, %newScriptPath);
|
||||
|
||||
fileDelete(%assetFilePath);
|
||||
fileDelete(%scriptPath);
|
||||
|
||||
//thrash the modules and reload them
|
||||
%newModule = %this.dirHandler.getModuleFromAddress(%newFullPath);
|
||||
|
||||
//if we didn't move modules, then we don't need to do anything other than refresh the assets within it
|
||||
if(%module == %newModule)
|
||||
{
|
||||
//only do a refresh to update asset loose file paths
|
||||
AssetDatabase.refreshAllAssets();
|
||||
}
|
||||
else
|
||||
{
|
||||
//they're different moduels now, so we gotta unload/reload both
|
||||
ModuleDatabase.unloadExplicit(%module.getModuleId());
|
||||
ModuleDatabase.loadExplicit(%module.getModuleId());
|
||||
|
||||
ModuleDatabase.unloadExplicit(%newModule.getModuleId());
|
||||
ModuleDatabase.loadExplicit(%newModule.getModuleId());
|
||||
}
|
||||
AssetDatabase.removeDeclaredAsset(%assetDef.getAssetId());
|
||||
AssetDatabase.addDeclaredAsset(%targetModule, %newAssetPath);
|
||||
}
|
||||
|
||||
function AssetBrowser::buildScriptAssetPreview(%this, %assetDef, %previewData)
|
||||
|
|
|
|||
|
|
@ -18,26 +18,44 @@ function makedirectoryHandler(%targetTree, %folderExclusionList, %searchFilter)
|
|||
|
||||
function directoryHandler::loadFolders(%this, %path, %parentId)
|
||||
{
|
||||
%modulesList = ModuleDatabase.findModules();
|
||||
|
||||
//utilize home dir project setting here
|
||||
%paths = getDirectoryList(%path);
|
||||
for(%i=0; %i < getFieldCount(%paths); %i++)
|
||||
{
|
||||
%childPath = getField(%paths, %i);
|
||||
|
||||
%fullChildPath = makeFullPath(%path @ "/" @ %childPath);
|
||||
|
||||
%folderCount = getTokenCount(%childPath, "/");
|
||||
|
||||
for(%f=0; %f < %folderCount; %f++)
|
||||
{
|
||||
%folderName = getToken(%childPath, "/", %f);
|
||||
|
||||
%parentName = %this.treeCtrl.getItemText(%parentId);
|
||||
|
||||
//we don't need to display the shadercache folder
|
||||
if(%parentId == 1 && (%folderName $= "shaderCache" || %folderName $= "cache"))
|
||||
if(%parentName $= "Data" && (%folderName $= "shaderCache" || %folderName $= "cache"))
|
||||
continue;
|
||||
|
||||
%iconIdx = 3;
|
||||
|
||||
if(ModuleDatabase.findModule(%folderName) !$= "")
|
||||
%iconIdx = 1;
|
||||
//Lets see if any modules match our current path)
|
||||
for(%m=0; %m < getWordCount(%modulesList); %m++)
|
||||
{
|
||||
%moduleDef = getWord(%modulesList, %m);
|
||||
|
||||
if(%moduleDef.modulePath $= %fullChildPath)
|
||||
{
|
||||
%iconIdx = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//if(ModuleDatabase.findModule(%folderName) !$= "")
|
||||
// %iconIdx = 1;
|
||||
|
||||
%searchFoldersText = %this.searchFilter;
|
||||
if(%searchFoldersText !$= "Search Folders...")
|
||||
|
|
@ -204,6 +222,8 @@ function directoryHandler::expandTreeToAddress(%this, %address)
|
|||
%curItem = %this.treeCtrl.findChildItemByName(%curItem, %folderName);
|
||||
%this.treeCtrl.expandItem(%curItem);
|
||||
}
|
||||
|
||||
%this.treeCtrl.expandItem(0);
|
||||
}
|
||||
|
||||
function directoryHandler::createFolder(%this, %folderPath)
|
||||
|
|
|
|||
|
|
@ -13,7 +13,22 @@ function AssetBrowser::editAsset(%this, %assetDef)
|
|||
//Find out what type it is
|
||||
//If the passed-in definition param is blank, then we're likely called via a popup
|
||||
if(%assetDef $= "")
|
||||
%assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId);
|
||||
{
|
||||
if(AssetDatabase.isDeclaredAsset(EditAssetPopup.assetId))
|
||||
{
|
||||
%assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId);
|
||||
}
|
||||
else
|
||||
{
|
||||
//if it's not a valid asset at all, then it's probably a folder
|
||||
%folder = strreplace(EditAssetPopup.assetId, ":", "/");
|
||||
if(isDirectory(%folder))
|
||||
{
|
||||
AssetBrowser.navigateTo(%folder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
%assetType = %assetDef.getClassName();
|
||||
|
||||
|
|
@ -132,6 +147,51 @@ function AssetBrowser::performRenameAsset(%this, %originalAssetName, %newName)
|
|||
AssetBrowser-->filterTree.buildVisibleTree();
|
||||
}
|
||||
|
||||
function renameAssetFile(%assetDef, %newName)
|
||||
{
|
||||
%assetId = %assetDef.getAssetID();
|
||||
%module = AssetDatabase.getAssetModule(%assetId);
|
||||
%moduleId = %module.moduleId;
|
||||
|
||||
%assetPath = AssetDatabase.getAssetFilePath(%assetId);
|
||||
|
||||
%newPath = filePath(%assetPath) @ "/" @ %newName @ ".asset.taml";
|
||||
%copiedSuccess = pathCopy(%assetPath, %newPath);
|
||||
|
||||
if(!%copiedSuccess)
|
||||
return "";
|
||||
|
||||
%deleteSuccess = fileDelete(%assetPath);
|
||||
|
||||
if(!%deleteSuccess)
|
||||
return "";
|
||||
|
||||
//Remove the old declaration
|
||||
AssetDatabase.removeDeclaredAsset(%assetId);
|
||||
//Add with the new file
|
||||
AssetDatabase.addDeclaredAsset(%module, %newPath);
|
||||
|
||||
//Perform the rename in the file/system itself
|
||||
AssetDatabase.renameDeclaredAsset(%assetId, %moduleId @ ":" @ %newName);
|
||||
}
|
||||
|
||||
function renameAssetLooseFile(%file, %newName)
|
||||
{
|
||||
%newPath = filePath(%file) @ "/" @ %newName @ fileExt(%file);
|
||||
%copiedSuccess = pathCopy(%file, %newPath);
|
||||
|
||||
if(!%copiedSuccess)
|
||||
return "";
|
||||
|
||||
%deleteSuccess = fileDelete(%file);
|
||||
|
||||
if(!%deleteSuccess)
|
||||
return "";
|
||||
|
||||
return fileName(%newPath);
|
||||
}
|
||||
|
||||
|
||||
function AssetNameField::onReturn(%this)
|
||||
{
|
||||
%this.clearFirstResponder();
|
||||
|
|
@ -165,6 +225,39 @@ function AssetBrowser::moveAsset(%this, %assetId, %destination)
|
|||
%this.refresh();
|
||||
}
|
||||
|
||||
function moveAssetFile(%assetDef, %destinationPath)
|
||||
{
|
||||
%assetPath = makeFullPath(AssetDatabase.getAssetFilePath(%assetDef.getAssetId()));
|
||||
%assetFilename = fileName(%assetPath);
|
||||
|
||||
%newAssetPath = %destination @ "/" @ %assetFilename;
|
||||
|
||||
%copiedSuccess = pathCopy(%assetPath, %destination @ "/" @ %assetFilename);
|
||||
|
||||
if(!%copiedSuccess)
|
||||
return "";
|
||||
|
||||
%deleteSuccess = fileDelete(%assetPath);
|
||||
|
||||
if(!%deleteSuccess)
|
||||
return "";
|
||||
|
||||
return %newAssetPath;
|
||||
}
|
||||
|
||||
function moveAssetLooseFile(%file, %destinationPath)
|
||||
{
|
||||
%filename = fileName(%file);
|
||||
|
||||
%copiedSuccess = pathCopy(%file, %destinationPath @ "/" @ %filename);
|
||||
|
||||
if(!%copiedSuccess)
|
||||
return false;
|
||||
|
||||
%deleteSuccess = fileDelete(%file);
|
||||
return %deleteSuccess;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------
|
||||
|
||||
function AssetBrowser::duplicateAsset(%this, %targetModule)
|
||||
|
|
|
|||
|
|
@ -1,10 +1,31 @@
|
|||
//
|
||||
function AssetBrowser::ConvertFolderIntoModule(%this, %folderName)
|
||||
{
|
||||
if(!isDirectory("data/" @ %folderName))
|
||||
return;
|
||||
|
||||
AssetBrowser_AddModule-->moduleName.text = %folderName;
|
||||
AssetBrowser_addModuleWindow.callbackFunction = "AssetBrowser.loadDirectories();";
|
||||
|
||||
AssetBrowser_addModuleWindow.CreateNewModule();
|
||||
}
|
||||
|
||||
function AssetBrowser::CreateNewModule(%this)
|
||||
{
|
||||
Canvas.pushDialog(AssetBrowser_AddModule);
|
||||
AssetBrowser_addModuleWindow.selectWindow();
|
||||
|
||||
AssetBrowser_addModuleWindow.callbackFunction = "AssetBrowser.loadFilters();";
|
||||
AssetBrowser_addModuleWindow.callbackFunction = "AssetBrowser.loadDirectories();";
|
||||
}
|
||||
|
||||
function AssetBrowser::createNewEditorTool(%this)
|
||||
{
|
||||
Canvas.pushDialog(AssetBrowser_AddModule);
|
||||
AssetBrowser_addModuleWindow.selectWindow();
|
||||
|
||||
AssetBrowser_addModuleWindow.callbackFunction = "AssetBrowser.loadDirectories();";
|
||||
|
||||
AssetBrowser_addModuleWindow.CreateNewModule();
|
||||
}
|
||||
|
||||
function AssetBrowser_editModule::saveModule(%this)
|
||||
|
|
|
|||
|
|
@ -185,6 +185,18 @@ function AssetBrowser::buildPopupMenus(%this)
|
|||
};
|
||||
}
|
||||
|
||||
if( !isObject( EditNonModulePopup ) )
|
||||
{
|
||||
new PopupMenu( EditNonModulePopup )
|
||||
{
|
||||
superClass = "MenuBuilder";
|
||||
class = "EditorWorldMenu";
|
||||
//isPopup = true;
|
||||
|
||||
item[ 0 ] = "Turn Folder into Module" TAB "" TAB "AssetBrowser.ConvertFolderIntoModule();";
|
||||
};
|
||||
}
|
||||
|
||||
//Some assets are not yet ready/implemented, so disable their creation here
|
||||
AddNewArtAssetPopup.enableItem(6, false); //shape
|
||||
AddNewArtAssetPopup.enableItem(7, false); //shape animation
|
||||
|
|
@ -257,8 +269,6 @@ function AssetBrowser::buildPopupMenus(%this)
|
|||
}
|
||||
}
|
||||
|
||||
AssetBrowser.toggleAssetTypeFilter(0);
|
||||
|
||||
//Browser visibility menu
|
||||
if( !isObject( BrowserVisibilityPopup ) )
|
||||
{
|
||||
|
|
@ -370,10 +380,27 @@ function AssetBrowser::buildPopupMenus(%this)
|
|||
class = "EditorWorldMenu";
|
||||
|
||||
item[0] = "Add New Asset" TAB "" TAB "ImportAssetWindow.addNewImportingAsset();";
|
||||
item[0] = "Add Reference to Existing Asset" TAB "" TAB "ImportAssetWindow.addRefExistingAsset();";
|
||||
item[1] = "Remove asset" TAB "" TAB "ImportAssetWindow.removeImportingAsset();";
|
||||
item[1] = "Import Existing File as Asset" TAB "" TAB "ImportAssetWindow.importExistingFile();";
|
||||
item[2] = "-";
|
||||
item[3] = "Add Reference to Existing Asset" TAB "" TAB "ImportAssetWindow.addRefExistingAsset();";
|
||||
item[4] = "-";
|
||||
item[5] = "Remove asset" TAB "" TAB "ImportAssetWindow.removeImportingAsset();";
|
||||
};
|
||||
}
|
||||
|
||||
if( !isObject( AddNewToolPopup ) )
|
||||
{
|
||||
new PopupMenu( AddNewToolPopup )
|
||||
{
|
||||
superClass = "MenuBuilder";
|
||||
class = "EditorWorldMenu";
|
||||
isPopup = true;
|
||||
|
||||
item[ 0 ] = "Create New Editor Tool" TAB "" TAB "AssetBrowser.createNewEditorTool(AddNewToolPopup.targetFolder);";
|
||||
};
|
||||
|
||||
AddNewModulePopup.enableItem(1, false);
|
||||
}
|
||||
}
|
||||
|
||||
function AddNewScriptAssetPopupMenu::onSelectItem(%this, %id, %text)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue