mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-13 07:34:45 +00:00
Added ImageAsset type mode for cubemaps.
Added new inspector type TypeShapeAssetId which is processed as a assetId string instead of an AssetPtr. Added utility function to ShapeAsset to getAssetIdByFilename, which lets you find - if any exist - the asset that utilizes a given loose file. If it doesn't find one, it can attempt to run an auto-import if the editor settings allow, then proceed. Fixed callback of the shapeAsset inspector fields so the Open in Shape Editor correctly binds the asset's shape to the editor for modification. Added function to open a shapeAssetId in the shape editor to facilitate the above. Added additional check to findShapeConstructor to look up the full path of the shape in the cases where a full path is provided instead of a local path. This prevents the shapeConstructor from not finding shapes that absolutely exist. Added beginnings of Datablock representation in Asset Browser. Fixed a few minor issues with asset auto import causing false positive errors, preventing Import or erroneous logging. Fixed issue where editing of asset import configs didn't save. Fixed logic of materials in asset browser so they will open in the material editor as expected. Re-enabled AutoImport of assets editor setting by default.
This commit is contained in:
parent
72b489fe25
commit
157b114ec7
15 changed files with 1057 additions and 686 deletions
|
|
@ -278,7 +278,45 @@ function AssetBrowser::buildAssetPreview( %this, %asset, %moduleName )
|
|||
}
|
||||
else
|
||||
{
|
||||
%fullPath = %moduleName !$= "" ? %moduleName @ "/" @ %asset : %asset;
|
||||
//special-case entry
|
||||
if(getFieldCount(%asset) > 1)
|
||||
{
|
||||
%specialType = getField(%asset,0);
|
||||
|
||||
/*if(%specialType $= "Folder")
|
||||
{
|
||||
|
||||
}
|
||||
else if(%specialType $= "Datablock")
|
||||
{
|
||||
%sdfasdgah = true;
|
||||
}*/
|
||||
%assetType = %specialType;
|
||||
%assetName = getField(%asset, 1);
|
||||
%sdfasdgah = true;
|
||||
|
||||
if(%assetType $= "Folder")
|
||||
{
|
||||
%fullPath = %moduleName !$= "" ? %moduleName @ "/" @ %assetName : %assetName;
|
||||
%fullPath = strreplace(%fullPath, "/", "_");
|
||||
|
||||
if(isObject(%fullPath))
|
||||
%assetDesc = %fullPath;
|
||||
else
|
||||
%assetDesc = new ScriptObject(%fullPath);
|
||||
|
||||
%assetDesc.dirPath = %moduleName;
|
||||
%assetDesc.assetName = %assetName;
|
||||
%assetDesc.description = %moduleName @ "/" @ %assetName;
|
||||
%assetDesc.assetType = %assetType;
|
||||
}
|
||||
else if(%assetType $= "Datablock")
|
||||
{
|
||||
%assetDesc = %assetName;
|
||||
%assetDesc.assetType = %assetType;
|
||||
}
|
||||
}
|
||||
/*%fullPath = %moduleName !$= "" ? %moduleName @ "/" @ %assetName : %assetName;
|
||||
%fullPath = strreplace(%fullPath, "/", "_");
|
||||
|
||||
if(isObject(%fullPath))
|
||||
|
|
@ -287,12 +325,12 @@ function AssetBrowser::buildAssetPreview( %this, %asset, %moduleName )
|
|||
%assetDesc = new ScriptObject(%fullPath);
|
||||
|
||||
%assetDesc.dirPath = %moduleName;
|
||||
%assetDesc.assetName = %asset;
|
||||
%assetDesc.description = %moduleName @ "/" @ %asset;
|
||||
%assetDesc.assetType = "Folder";
|
||||
%assetDesc.assetName = %assetName;
|
||||
%assetDesc.description = %moduleName @ "/" @ %assetName;
|
||||
%assetDesc.assetType = %assetType;*/
|
||||
|
||||
%assetName = %asset;
|
||||
%assetType = "Folder";
|
||||
//%assetName = %asset;
|
||||
//%assetType = "Folder";
|
||||
}
|
||||
|
||||
%previewSize = %this.previewSize SPC %this.previewSize;
|
||||
|
|
@ -425,7 +463,7 @@ function AssetBrowser::loadDirectories( %this )
|
|||
}
|
||||
|
||||
//Add Non-Asset Scripted Objects. Datablock, etc based
|
||||
%category = getWord( %breadcrumbPath, 1 );
|
||||
/*%category = getWord( %breadcrumbPath, 1 );
|
||||
%dataGroup = "DataBlockGroup";
|
||||
|
||||
if(%dataGroup.getCount() != 0)
|
||||
|
|
@ -437,8 +475,14 @@ function AssetBrowser::loadDirectories( %this )
|
|||
%obj = %dataGroup.getObject(%i);
|
||||
// echo ("Obj: " @ %obj.getName() @ " - " @ %obj.category );
|
||||
|
||||
if ( %obj.category $= "" && %obj.category == 0 )
|
||||
continue;
|
||||
//if ( %obj.category $= "" && %obj.category == 0 )
|
||||
// continue;
|
||||
|
||||
%dbFilename = %obj.getFileName();
|
||||
%dbFilePath = filePath(%dbFilename);
|
||||
|
||||
if(%breadcrumbPath $= %dbFilePath)
|
||||
{
|
||||
|
||||
//if ( %breadcrumbPath $= "" )
|
||||
//{
|
||||
|
|
@ -456,8 +500,9 @@ function AssetBrowser::loadDirectories( %this )
|
|||
{
|
||||
AssetBrowser-->filterTree.insertItem(%scriptedItem, %obj.getName());
|
||||
}*/
|
||||
}
|
||||
}
|
||||
//}
|
||||
//}
|
||||
// }
|
||||
|
||||
AssetPreviewArray.empty();
|
||||
|
||||
|
|
@ -916,6 +961,9 @@ function AssetBrowser::doRebuildAssetArray(%this)
|
|||
AssetBrowser-->assetList.deleteAllObjects();
|
||||
AssetPreviewArray.empty();
|
||||
|
||||
if(isObject(%assetArray))
|
||||
%assetArray.delete();
|
||||
|
||||
%assetArray = new ArrayObject();
|
||||
|
||||
//First, Query for our assets
|
||||
|
|
@ -1032,12 +1080,12 @@ function AssetBrowser::doRebuildAssetArray(%this)
|
|||
if(%searchText !$= "Search Assets...")
|
||||
{
|
||||
if(strstr(strlwr(%folderName), strlwr(%searchText)) != -1)
|
||||
%assetArray.add( %breadcrumbPath, %folderName );
|
||||
%assetArray.add( %breadcrumbPath, "Folder" TAB %folderName );
|
||||
}
|
||||
else
|
||||
{
|
||||
//got it.
|
||||
%assetArray.add( %breadcrumbPath, %folderName );
|
||||
%assetArray.add( %breadcrumbPath, "Folder" TAB %folderName );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1046,32 +1094,36 @@ function AssetBrowser::doRebuildAssetArray(%this)
|
|||
%category = getWord( %breadcrumbPath, 1 );
|
||||
%dataGroup = "DataBlockGroup";
|
||||
|
||||
if(%dataGroup.getCount() != 0)
|
||||
for ( %i = 0; %i < %dataGroup.getCount(); %i++ )
|
||||
{
|
||||
%scriptedItem = AssetBrowser-->filterTree.findItemByName("Scripted");
|
||||
%obj = %dataGroup.getObject(%i);
|
||||
// echo ("Obj: " @ %obj.getName() @ " - " @ %obj.category );
|
||||
|
||||
for ( %i = 0; %i < %dataGroup.getCount(); %i++ )
|
||||
//if ( %obj.category $= "" && %obj.category == 0 )
|
||||
// continue;
|
||||
|
||||
%dbFilename = %obj.getFileName();
|
||||
%dbFilePath = filePath(%dbFilename);
|
||||
|
||||
if(%breadcrumbPath $= %dbFilePath)
|
||||
{
|
||||
%obj = %dataGroup.getObject(%i);
|
||||
// echo ("Obj: " @ %obj.getName() @ " - " @ %obj.category );
|
||||
%dbName = %obj.getName();
|
||||
%assetArray.add( %breadcrumbPath, "Datablock" TAB %dbName );
|
||||
|
||||
if ( %obj.category $= "" && %obj.category == 0 )
|
||||
continue;
|
||||
/*%catItem = AssetBrowser-->filterTree.findItemByName(%obj.category);
|
||||
|
||||
/*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());
|
||||
}
|
||||
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());
|
||||
}*/
|
||||
}
|
||||
|
||||
AssetBrowser.currentPreviewPage = 0;
|
||||
|
|
|
|||
|
|
@ -464,11 +464,15 @@ function importLooseFile(%filePath, %forceAutoImport)
|
|||
|
||||
%assetItem.moduleName = %targetModule;
|
||||
|
||||
%assetName = %assetItem.assetName;
|
||||
|
||||
AssetBrowser.dirHandler.currentAddress = filePath(%filePath);
|
||||
|
||||
//skip the refresh delay, we'll force it here
|
||||
ImportAssetWindow.doRefresh();
|
||||
|
||||
ImportAssetItems.empty();
|
||||
|
||||
if(ImportAssetWindow.hasImportIssues)
|
||||
return false;
|
||||
}
|
||||
|
|
@ -673,7 +677,8 @@ function ImportAssetWindow::doRefresh(%this)
|
|||
%ImportActionSummary = %ImportActionSummary SPC %this.autoRenamedAssets @ " Auto Renamed|";
|
||||
}
|
||||
|
||||
warn(%ImportActionSummary);
|
||||
if(%ImportActionSummary !$= "")
|
||||
warn(%ImportActionSummary);
|
||||
|
||||
AssetImportSummarization.Text = %ImportActionSummary;
|
||||
|
||||
|
|
@ -1222,7 +1227,7 @@ function ImportAssetWindow::checkAssetsForCollision(%this, %assetItemToCheck, %a
|
|||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
return %result;
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
|||
|
|
@ -23,6 +23,11 @@ function AssetImportConfigEditor::refresh(%this)
|
|||
ImportAssetConfigList.setSelected(0);
|
||||
}
|
||||
|
||||
function AssetImportConfigEditor::apply(%this)
|
||||
{
|
||||
AssetImportSettings.write();
|
||||
}
|
||||
|
||||
function AssetImportConfigList::onSelect( %this, %id, %text )
|
||||
{
|
||||
ImportOptionsConfigList.clearFields();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,127 @@
|
|||
function AssetBrowser::createNewDatablock(%this)
|
||||
{
|
||||
AssetBrowser_newFolderNameTxt.text = "NewFolder";
|
||||
Canvas.pushDialog(AssetBrowser_newFolder);
|
||||
}
|
||||
|
||||
function AssetBrowser::doCreateNewDatablock(%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::buildDatablockPreview(%this, %assetDef, %previewData)
|
||||
{
|
||||
%previewData.assetName = %assetDef.assetName;
|
||||
%previewData.assetPath = %assetDef.dirPath;
|
||||
|
||||
%previewData.previewImage = "tools/assetBrowser/art/scriptIcon";
|
||||
|
||||
//%previewData.assetFriendlyName = %assetDef.assetName;
|
||||
%previewData.assetDesc = %assetDef.description;
|
||||
%previewData.tooltip = %assetDef.dirPath;
|
||||
%previewData.doubleClickCommand = "AssetBrowser.schedule(10, \"navigateTo\",\""@ %assetDef.dirPath @ "/" @ %assetDef.assetName @"\");";//browseTo %assetDef.dirPath / %assetDef.assetName
|
||||
}
|
||||
|
||||
function AssetBrowser::renameDatablock(%this, %folderPath, %newFolderName)
|
||||
{
|
||||
%fullPath = makeFullPath(%folderPath);
|
||||
%newFullPath = makeFullPath(%folderPath);
|
||||
|
||||
%fullPath = strreplace(%fullPath, "//", "/");
|
||||
|
||||
%count = getTokenCount(%fullPath, "/");
|
||||
%basePath = getTokens(%fullPath, "/", 0, %count-2);
|
||||
%oldName = getToken(%fullPath, "/", %count-1);
|
||||
|
||||
//We need to ensure that no files are 'active' while we try and clean up behind ourselves with the delete action
|
||||
//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.dirHandler.getModuleFromAddress(AssetBrowser.dirHandler.currentAddress);
|
||||
%moduleId = %module.ModuleId;
|
||||
|
||||
AssetDatabase.removeDeclaredAssets(%moduleId);
|
||||
|
||||
%copiedSuccess = %this.dirHandler.copyDatablock(%fullPath, %basePath @ "/" @ %newFolderName);
|
||||
%this.dirHandler.deleteDatablock(%fullPath);
|
||||
|
||||
%this.loadDirectories();
|
||||
|
||||
AssetDatabase.addModuleDeclaredAssets(%moduleId);
|
||||
}
|
||||
|
||||
function AssetBrowser::moveDatablock(%this, %folderPath, %newFolderPath)
|
||||
{
|
||||
%fullPath = makeFullPath(%folderPath);
|
||||
%newFullPath = makeFullPath(%newFolderPath);
|
||||
|
||||
%fullPath = strreplace(%fullPath, "//", "/");
|
||||
%newFullPath = strreplace(%newFullPath, "//", "/");
|
||||
|
||||
%count = getTokenCount(%fullPath, "/");
|
||||
%basePath = getTokens(%fullPath, "/", 0, %count-2);
|
||||
%oldName = getToken(%fullPath, "/", %count-1);
|
||||
|
||||
%copiedSuccess = %this.dirHandler.copyDatablock(%fullPath, %newFullPath);
|
||||
%this.dirHandler.deleteDatablock(%fullPath);
|
||||
|
||||
%this.loadDirectories();
|
||||
|
||||
//thrash the modules and reload them
|
||||
%oldModule = %this.dirHandler.getModuleFromAddress(%folderPath);
|
||||
%newModule = %this.dirHandler.getModuleFromAddress(%newFolderPath);
|
||||
|
||||
//if we didn't move modules, then we don't need to do anything other than refresh the assets within it
|
||||
if(%oldModule == %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(%oldModule.getModuleId());
|
||||
ModuleDatabase.loadExplicit(%oldModule.getModuleId());
|
||||
|
||||
ModuleDatabase.unloadExplicit(%newModule.getModuleId());
|
||||
ModuleDatabase.loadExplicit(%newModule.getModuleId());
|
||||
}
|
||||
}
|
||||
|
||||
function AssetBrowser::deleteDatablock(%this, %folderPath)
|
||||
{
|
||||
%this.dirHandler.deleteDatablock(%folderPath);
|
||||
|
||||
%this.refresh();
|
||||
}
|
||||
|
|
@ -43,6 +43,18 @@ function AssetBrowser::editMaterialAsset(%this, %assetDef)
|
|||
MaterialEditorGui.setActiveMaterial( %assetDef.materialDefinitionName );
|
||||
|
||||
AssetBrowser.hideDialog();
|
||||
|
||||
//
|
||||
//
|
||||
/*%assetDef.materialDefinitionName.reload();
|
||||
$Tools::materialEditorList = "";
|
||||
EWorldEditor.clearSelection();
|
||||
MaterialEditorGui.currentObject = 0;
|
||||
MaterialEditorGui.currentMode = "asset";
|
||||
MaterialEditorGui.currentMaterial = %assetDef.materialDefinitionName;
|
||||
MaterialEditorGui.setActiveMaterial( %assetDef.materialDefinitionName);
|
||||
EditorGui.setEditor(MaterialEditorPlugin);
|
||||
AssetBrowser.hideDialog();*/
|
||||
}
|
||||
|
||||
//Renames the asset
|
||||
|
|
@ -424,7 +436,7 @@ function AssetBrowser::buildMaterialAssetPreview(%this, %assetDef, %previewData)
|
|||
%previewData.assetPath = %assetDef.scriptFile;
|
||||
|
||||
//Lotta prepwork
|
||||
%previewData.doubleClickCommand = %assetDef@".materialDefinitionName.reload(); "
|
||||
/*%previewData.doubleClickCommand = %assetDef@".materialDefinitionName.reload(); "
|
||||
@ "$Tools::materialEditorList = \"\";"
|
||||
@ "EWorldEditor.clearSelection();"
|
||||
@ "MaterialEditorGui.currentObject = 0;"
|
||||
|
|
@ -432,7 +444,9 @@ function AssetBrowser::buildMaterialAssetPreview(%this, %assetDef, %previewData)
|
|||
@ "MaterialEditorGui.currentMaterial = "@%assetDef@".materialDefinitionName;"
|
||||
@ "MaterialEditorGui.setActiveMaterial( "@%assetDef@".materialDefinitionName );"
|
||||
@ "EditorGui.setEditor(MaterialEditorPlugin); "
|
||||
@ "AssetBrowser.hideDialog();";
|
||||
@ "AssetBrowser.hideDialog();";*/
|
||||
|
||||
%previewData.doubleClickCommand = "AssetBrowser.editAsset(" @ %assetDef @ ");";
|
||||
|
||||
%test = %assetDef.materialDefinitionName.diffuseMapAsset[0];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue