Merge branch 'Preview4_0' of https://github.com/TorqueGameEngines/Torque3D into BugfixQOL_20210909

This commit is contained in:
Areloch 2021-09-10 02:20:13 -05:00
commit dec9f54a9b
322 changed files with 10473 additions and 10241 deletions

View file

@ -263,6 +263,8 @@ function AssetBrowser::selectAsset( %this, %asset )
//eval("materialEd_previewMaterial." @ %propertyField @ " = " @ %value @ ";");
if( AssetBrowser.returnType $= "name" )
{
// TODO!
%name = "";
eval( "" @ AssetBrowser.selectCallback @ "(" @ %name @ ");");
}
else
@ -689,6 +691,7 @@ function AssetBrowser::loadDirectories( %this )
//Remove any modules that have no assets if we have that filter on
if(%this.onlyShowModulesWithAssets)
{
%modulesList = ModuleDatabase.findModules();
for(%i=0; %i < getWordCount(%modulesList); %i++)
{
%moduleName = getWord(%modulesList, %i).ModuleId;
@ -943,6 +946,13 @@ function AssetBrowser::toggleTagFilterPopup(%this)
//now, add the asset's category
%assetType = AssetDatabase.getAssetCategory(%assetId);
// TODO?
%text = "";
%var = "";
%cmd = "";
%textLength = strlen(%text);
// end todo
%checkBox = new GuiCheckBoxCtrl()
{
canSaveDynamicFields = "0";
@ -1003,6 +1013,9 @@ function AssetBrowser::reImportAsset(%this)
//if(%assetType $= "ImageAsset")
// %filters = "";
//TODO
%currentFile = "";
%dlg = new OpenFileDialog()
{
Filters = "(All Files (*.*)|*.*|";
@ -1047,7 +1060,7 @@ function AssetBrowserPreviewButton::onRightClick(%this)
EditAssetPopup.enableItem(7, true);
//Is it an editable type?
if(%assetType $= "ImageAsset" /*|| %assetType $= "GameObjectAsset"*/ || %assetType $= "CppAsset" || %assetType $= "SoundAsset")
if(%assetType $= "ImageAsset" /*|| %assetType $= "GameObjectAsset"*/ || %assetType $= "CppAsset")
{
EditAssetPopup.enableItem(0, false);
}

View file

@ -277,6 +277,9 @@ function AssetBrowser::onDropFolder(%this, %filePath)
//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.
// TODO
%fileExt = "";
//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);

View file

@ -142,6 +142,7 @@ function ImportAssetOptionsWindow::editImportSettings(%this, %assetItem)
%filePath = %assetItem.filePath;
%assetName = %assetItem.assetName;
%assetConfigObj = %assetItem.importConfig;
%optionsObj = %assetItem.optionsObj; // TODO IS THIS RIGHT
ImportOptionsList.startGroup("Asset");
ImportOptionsList.addField("AssetName", "Asset Name", "string", "", "NewAsset", "", %assetItem);
@ -405,6 +406,7 @@ function ImportAssetConfigEditorWindow::editConfig(%this)
function ImportAssetConfigEditorWindow::deleteConfig(%this)
{
%configList = ImportAssetConfigSettingsList;
for(%i=0; %i < %configList.count(); %i++)
{

View file

@ -110,7 +110,7 @@ function AssetBrowser::renameComponentAsset(%this, %assetDef, %newAssetId, %orig
%line = %file.readLine();
%line = trim( %line );
%editedFileContents = %editedFileContents @ strreplace(%line, %originalAssetName, %newName) @ "\n";
%editedFileContents = %editedFileContents @ strreplace(%line, %originalName, %newName) @ "\n";
}
%file.close();

View file

@ -50,6 +50,8 @@ function AssetBrowser::createCpp(%this)
TamlWrite(%asset, %tamlpath);*/
%tamlpath = %assetPath @ %assetName @ ".asset.taml";
%moduleDef = ModuleDatabase.findModule(%moduleName, 1);
AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath);

View file

@ -137,7 +137,7 @@ function AssetBrowser::buildLevelAssetPreview(%this, %assetDef, %previewData)
%previewData.assetPath = %assetDef.getLevelPath();
%previewData.doubleClickCommand = "schedule( 1, 0, \"EditorOpenMission\", "@%assetDef@");";
%levelPreviewImage = %assetDesc.PreviewImage;
%levelPreviewImage = %assetDef.PreviewImage;
if(isFile(%levelPreviewImage))
%previewData.previewImage = %levelPreviewImage;

View file

@ -49,8 +49,7 @@ function AssetBrowser::importScriptAsset(%this, %assetId)
function AssetBrowser::onScriptAssetEditorDropped(%this, %assetDef, %position)
{
if(!isObject(%dropTarget))
return;
}
//Renames the asset

View file

@ -42,6 +42,10 @@ function AssetBrowser::editShapeAsset(%this, %assetDef)
ShapeEditorPlugin.openShapeAsset(%assetDef);
}
function AssetBrowser::onShapeAssetChanged(%this, %assetDef)
{
}
function AssetBrowser::deleteShapeAsset(%this, %assetDef)
{
@ -340,7 +344,7 @@ function AssetBrowser::onShapeAssetEditorDropped(%this, %assetDef, %position)
%newStatic = new TSStatic()
{
position = %pos;
position = %position;
shapeAsset = %assetId;
};

View file

@ -1,13 +1,36 @@
function AssetBrowser::editSoundAsset(%this, %assetDef)
{
if (isObject($PreviewSoundSource))
sfxStop($PreviewSoundSource);
$PreviewSoundSource = %assetDef.playSound();
}
function AssetBrowser::onSoundAssetChanged(%this, %assetDef)
{
if (isObject($PreviewSoundSource))
sfxStop($PreviewSoundSource);
}
function AssetBrowser::buildSoundAssetPreview(%this, %assetDef, %previewData)
{
%previewData.assetName = %assetDef.assetName;
%previewData.assetPath = %assetDef.soundFilePath;
//%previewData.doubleClickCommand = "EditorOpenFileInTorsion( "@%previewData.assetPath@", 0 );";
if(%this.selectMode)
{
%previewData.doubleClickCommand = "AssetBrowser.selectAsset( AssetBrowser.selectedAsset );";
}
else
{
if(EditorSettings.value("Assets/Browser/doubleClickAction", "Edit Asset") $= "Edit Asset")
{
%previewData.doubleClickCommand = "AssetBrowser.editAsset( "@%assetDef@" );";
}
else
{
%previewData.doubleClickCommand = "AssetBrowser.onSoundAssetEditorDropped( "@%assetDef@" );";
}
}
%previewData.previewImage = "ToolsModule:soundIcon_image";
@ -38,7 +61,7 @@ function AssetBrowser::onSoundAssetEditorDropped(%this, %assetDef, %position)
%newSFXEmitter = new SFXEmitter()
{
position = %pos;
fileName = %assetDef.getSoundPath();
soundAsset = %assetDef.getAssetId();
pitch = %assetDef.pitchAdjust;
volume = %assetDef.volumeAdjust;
};
@ -50,4 +73,28 @@ function AssetBrowser::onSoundAssetEditorDropped(%this, %assetDef, %position)
EWorldEditor.isDirty = true;
}
function GuiInspectorTypeShapeAssetPtr::onControlDropped( %this, %payload, %position )
{
Canvas.popDialog(EditorDragAndDropLayer);
// Make sure this is a color swatch drag operation.
if( !%payload.parentGroup.isInNamespaceHierarchy( "AssetPreviewControlType_AssetDrop" ) )
return;
%assetType = %payload.assetType;
if(%assetType $= "SoundAsset")
{
%module = %payload.moduleName;
%asset = %payload.assetName;
%targetComponent = %this.targetObject;
%targetComponent.soundAsset = %module @ ":" @ %asset;
//Inspector.refresh();
}
EWorldEditor.isDirty = true;
}

View file

@ -86,6 +86,9 @@ function AssetBrowser::editStateMachineAsset(%this, %assetDef)
function AssetBrowser::duplicateStateMachineAsset(%this, %assetDef)
{
// TODO:
%targetModule = "";
//Check if we have a target module, if not we need to select one
if(%targetModule $= "")
{

View file

@ -325,7 +325,7 @@ function directoryHandler::copyFolder(%this, %fromFolder, %toFolder)
if(!%success)
error("copyProjectFolder() - failed to copy file: " @ %file);
%file = findNextFileMultiExpr( %fullPath @ "/*.*" );
%file = findNextFileMultiExpr( %fromFolder @ "/*.*" );
}
//do sub directories

View file

@ -3,7 +3,14 @@ function AssetBrowser_editAsset::saveAsset(%this)
%file = AssetDatabase.getAssetFilePath(%this.editedAssetId);
%success = TamlWrite(AssetBrowser_editAsset.editedAsset, %file);
AssetBrowser.loadFilters();
AssetBrowser.reloadAsset(%this.editedAssetId);
AssetBrowser.refresh();
%assetType = AssetDatabase.getAssetType(%this.editedAssetId);
%assetDef = AssetDatabase.acquireAsset(%this.editedAssetId);
AssetBrowser.call("on" @ %assetType @ "Changed", %assetDef);
AssetDatabase.releaseAsset(%this.editedAssetId);
Canvas.popDialog(AssetBrowser_editAsset);
}
@ -79,6 +86,17 @@ function AssetBrowser::editAssetInfo(%this)
}
//------------------------------------------------------------
function AssetBrowser::reloadAsset(%this, %assetId)
{
%moduleName = getToken(%assetId, ":", 0);
%moduleDef = ModuleDatabase.findModule(%moduleName);
%assetName = getToken(%assetId, ":", 1);
%assetFilePath = AssetDatabase.getAssetFilePath(%assetId);
AssetDatabase.removeDeclaredAsset(%assetId);
AssetDatabase.addDeclaredAsset(%moduleDef, %assetFilePath);
}
function AssetBrowser::refreshAsset(%this, %assetId)
{
@ -143,6 +161,10 @@ function AssetBrowser::performRenameAsset(%this, %originalAssetName, %newName)
//Update the selection to immediately jump to the new asset
AssetBrowser-->filterTree.clearSelection();
%ModuleItem = AssetBrowser-->filterTree.findItemByName(%moduleName);
// TODO is this correct?
%assetType = %ModuleItem.getClassName();
%assetTypeId = AssetBrowser-->filterTree.findChildItemByName(%ModuleItem, %assetType);
AssetBrowser-->filterTree.selectItem(%assetTypeId);
@ -236,9 +258,9 @@ function moveAssetFile(%assetDef, %destinationPath)
%assetPath = makeFullPath(AssetDatabase.getAssetFilePath(%assetDef.getAssetId()));
%assetFilename = fileName(%assetPath);
%newAssetPath = %destination @ "/" @ %assetFilename;
%newAssetPath = %destinationPath @ "/" @ %assetFilename;
%copiedSuccess = pathCopy(%assetPath, %destination @ "/" @ %assetFilename);
%copiedSuccess = pathCopy(%assetPath, %destinationPath @ "/" @ %assetFilename);
if(!%copiedSuccess)
return "";

View file

@ -1,5 +1,5 @@
//--- OBJECT WRITE BEGIN ---
%guiContent = new GuiControl(@@)
$guiContent = new GuiControl(@@)
{
position = "0 0";
extent = "100 100";

View file

@ -11,7 +11,7 @@ singleton Material(TerrainFX_@)
impactSoundId = "0";
};
new TerrainMaterial(@)
singleton TerrainMaterial(@)
{
internalName = "@";
diffuseMap = "";