From 97484247ae5c3e7ecb21c2b9abce4f5b0bb2d5ae Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 14 Nov 2021 01:26:04 -0600 Subject: [PATCH] Fixes Settings window not being able to be brought forward over AB Adds checkbox to mark as not showing Import Window each time Added loaded import config to import log output Fixed targeted material map slot field names Added helper function for playing a sound asset via AssetId Updated import config to have some more common suffixes Updated editor settings to have Import Window show by default Changed AB context menu from listing item as "Refresh Asset" to "Reload Asset" for improved clarity Removed unneeded duplicate editor settings window script file --- Engine/source/T3D/assets/assetImporter.cpp | 11 +- Engine/source/T3D/assets/assetImporter.h | 10 +- .../utility/scripts/helperFunctions.tscript | 10 ++ .../tools/assetBrowser/assetImportConfigs.xml | 12 +- .../assetBrowser/scripts/assetImport.tscript | 15 +- .../scripts/assetImportConfig.tscript | 4 +- .../assetBrowser/scripts/popupMenus.tscript | 4 +- .../tools/gui/editorSettingsWindow.ed.tscript | 13 +- Templates/BaseGame/game/tools/settings.xml | 2 +- .../worldEditor/scripts/EditorGui.ed.tscript | 2 - .../scripts/editorSettingsWindow.ed.tscript | 142 ------------------ 11 files changed, 56 insertions(+), 169 deletions(-) delete mode 100644 Templates/BaseGame/game/tools/worldEditor/scripts/editorSettingsWindow.ed.tscript diff --git a/Engine/source/T3D/assets/assetImporter.cpp b/Engine/source/T3D/assets/assetImporter.cpp index e4ca498eb..2ceb677af 100644 --- a/Engine/source/T3D/assets/assetImporter.cpp +++ b/Engine/source/T3D/assets/assetImporter.cpp @@ -2381,6 +2381,9 @@ void AssetImporter::resetImportConfig() Settings* importConfigs; if (Sim::findObject("AssetImportSettings", importConfigs)) { + dSprintf(importLogBuffer, sizeof(importLogBuffer), "Loading import config: %s!", defaultImportConfig.c_str()); + activityLog.push_back(importLogBuffer); + //Now load the editor setting-deigned config! activeImportConfig->loadImportConfig(importConfigs, defaultImportConfig.c_str()); } @@ -2798,7 +2801,7 @@ Torque::Path AssetImporter::importMaterialAsset(AssetImportObject* assetItem) } else if (imageType == ImageAsset::ImageTypes::Metalness) { - mapFieldName = "MetalnessMap"; + mapFieldName = "MetalMap"; } else if (imageType == ImageAsset::ImageTypes::AO) { @@ -2806,7 +2809,7 @@ Torque::Path AssetImporter::importMaterialAsset(AssetImportObject* assetItem) } else if (imageType == ImageAsset::ImageTypes::Roughness) { - mapFieldName = "RoughnessMap"; + mapFieldName = "RoughMap"; } assetFieldName = mapFieldName + "Asset[0]"; @@ -2874,7 +2877,7 @@ Torque::Path AssetImporter::importMaterialAsset(AssetImportObject* assetItem) } else if (imageType == ImageAsset::ImageTypes::Metalness) { - mapFieldName = "MetalnessMap"; + mapFieldName = "MetalMap"; } else if (imageType == ImageAsset::ImageTypes::AO) { @@ -2882,7 +2885,7 @@ Torque::Path AssetImporter::importMaterialAsset(AssetImportObject* assetItem) } else if (imageType == ImageAsset::ImageTypes::Roughness) { - mapFieldName = "RoughnessMap"; + mapFieldName = "RoughMap"; hasRoughness = true; } diff --git a/Engine/source/T3D/assets/assetImporter.h b/Engine/source/T3D/assets/assetImporter.h index 327b38dca..6605ebe8f 100644 --- a/Engine/source/T3D/assets/assetImporter.h +++ b/Engine/source/T3D/assets/assetImporter.h @@ -905,9 +905,15 @@ public: /// AssetImportConfig* getImportConfig() { return activeImportConfig; } - void setImportConfig(AssetImportConfig* importConfig) { - if(importConfig != nullptr) + void setImportConfig(AssetImportConfig* importConfig) + { + if (importConfig != nullptr) + { + dSprintf(importLogBuffer, sizeof(importLogBuffer), "Loading import config: %s!", importConfig->getName()); + activityLog.push_back(importLogBuffer); + activeImportConfig = importConfig; + } } /// diff --git a/Templates/BaseGame/game/core/utility/scripts/helperFunctions.tscript b/Templates/BaseGame/game/core/utility/scripts/helperFunctions.tscript index ee7378bf8..3143eb410 100644 --- a/Templates/BaseGame/game/core/utility/scripts/helperFunctions.tscript +++ b/Templates/BaseGame/game/core/utility/scripts/helperFunctions.tscript @@ -642,4 +642,14 @@ function populateAllFonts(%font) populateFontCacheRange(%font,24,0,65535); populateFontCacheRange(%font,32,0,65535); populateFontCacheRange(%font,36,0,65535); +} + +//------------------------------------------------------------------------------ +function playSoundAsset(%soundAssetId) +{ + %assetDef = AssetDatabase.acquireAsset(%soundAssetId); + if(isObject(%assetDef)) + %assetDef.playSound(); + + AssetDatabase.releaseAsset(%soundAssetId); } \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/assetBrowser/assetImportConfigs.xml b/Templates/BaseGame/game/tools/assetBrowser/assetImportConfigs.xml index ae2e6b034..ad9de2677 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/assetImportConfigs.xml +++ b/Templates/BaseGame/game/tools/assetBrowser/assetImportConfigs.xml @@ -26,18 +26,18 @@ _image 1 _AO,_AMBIENT,_AMBIENTOCCLUSION - _COMP,_COMPOSITE,_PBR,-COMP,-COMPOSITE,-PBR,_ORM,-ORM + _COMP,_COMPOSITE,_PBR,-COMP,-COMPOSITE,-PBR,_ORM,-ORM,_C 1 _ALBEDO,_DIFFUSE,_ALB,_DIF,_COLOR,_COL 0 N/A 1 0 - _METAL,_MET,_METALNESS,_METALLIC - _NORMAL,_NORM - _ROUGH,_ROUGHNESS + _METAL,_MET,_METALNESS,_METALLIC,_M + _NORMAL,_NORM,_N + _ROUGH,_ROUGHNESS,_R 1.0 - _SMOOTH,_SMOOTHNESS + _SMOOTH,_SMOOTHNESS,_S Bilinear 1 @@ -45,6 +45,8 @@ _mat 0 1 + 1 + DefaultMaterial 1 1 1 diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImport.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImport.tscript index 14023d9b2..f96b1b645 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImport.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImport.tscript @@ -86,6 +86,8 @@ function ImportAssetWindow::onWake(%this) %this.importer.targetModuleId = AssetImportTargetModule.getText(); %this.refresh(); + + toggleImportWindowVizBtn.setStateOn(EditorSettings.value("Assets/AutoImport")); } // @@ -469,9 +471,7 @@ function ImportAssetWindow::doRefresh(%this) ImportAssetWindow.importer.processImportingAssets(); //%this.processImportAssets(); - //ImportAssetWindow.hasImportIssues = %this.validateAssets(); - - ImportAssetWindow.importer.validateImportingAssets(); + ImportAssetWindow.hasImportIssues = ImportAssetWindow.importer.hasImportIssues(); AssetImportCtrl-->NewAssetsTree.clear(); AssetImportCtrl-->NewAssetsTree.insertItem(0, "Importing Assets"); @@ -947,3 +947,12 @@ function ImportAssetModuleList::refresh(%this) } } // + +// +function toggleImportWindowViz() +{ + %value = EditorSettings.value("Assets/AutoImport"); + EditorSettings.setValue("Assets/AutoImport", !%value); + +} +// diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImportConfig.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImportConfig.tscript index 39ed541db..175d0f4d5 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImportConfig.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImportConfig.tscript @@ -66,7 +66,7 @@ function setupImportConfigSettingsList() ImportAssetConfigSettingsList.addNewConfigSetting("Materials/ImportMaterials", "Import Materials", "bool", "", "1", ""); ImportAssetConfigSettingsList.addNewConfigSetting("Materials/AlwaysAddMaterialSuffix", "Always Add Material Suffix", "bool", "", "1", ""); ImportAssetConfigSettingsList.addNewConfigSetting("Materials/AddedMaterialSuffix", "Added Material Suffix", "string", "", "_mat", ""); - ImportAssetConfigSettingsList.addNewConfigSetting("Materials/CreateComposites", "Create Composites", "bool", "", "1", ""); + ImportAssetConfigSettingsList.addNewConfigSetting("Materials/CreateORMConfig", "Create ORM Map", "bool", "", "1", ""); 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", "", "", ""); @@ -185,7 +185,7 @@ function ImportAssetOptionsWindow::editImportSettings(%this, %assetItem) else if(%assetType $= "MaterialAsset") { ImportOptionsList.startGroup("Material"); - ImportOptionsList.addField("CreateComposites", "Create Composite Textures", "bool", "", "1", "", %assetConfigObj); + ImportOptionsList.addField("CreateORMConfig", "Create ORM Map", "bool", "", "1", "", %assetConfigObj); ImportOptionsList.endGroup(); } else if(%assetType $= "ImageAsset") diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/popupMenus.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/popupMenus.tscript index 31909cf07..3294387b0 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/popupMenus.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/popupMenus.tscript @@ -25,7 +25,7 @@ function AssetBrowser::buildPopupMenus(%this) item[ 0 ] = "Edit Asset" TAB "" TAB "AssetBrowser.editAsset();"; item[ 1 ] = "Rename Asset" TAB "" TAB "AssetBrowser.renameAsset();"; - item[ 2 ] = "Refresh Asset" TAB "" TAB "AssetBrowser.refreshAsset();"; + item[ 2 ] = "Reload Asset" TAB "" TAB "AssetBrowser.refreshAsset();"; item[ 3 ] = "Asset Properties" TAB "" TAB "AssetBrowser.editAssetInfo();"; item[ 4 ] = "-"; Item[ 5 ] = "Duplicate Asset" TAB "" TAB "AssetBrowser.duplicateAsset();"; @@ -50,7 +50,7 @@ function AssetBrowser::buildPopupMenus(%this) item[ 0 ] = "Edit Level" TAB "" TAB "AssetBrowser.editAsset();"; item[ 1 ] = "Append as Sublevel" TAB "" TAB "AssetBrowser.appendSublevel();"; item[ 2 ] = "Rename Asset" TAB "" TAB "AssetBrowser.renameAsset();"; - item[ 3 ] = "Refresh Asset" TAB "" TAB "AssetBrowser.refreshAsset();"; + item[ 3 ] = "Reload Asset" TAB "" TAB "AssetBrowser.refreshAsset();"; item[ 4 ] = "Asset Properties" TAB "" TAB "AssetBrowser.editAssetInfo();"; item[ 5 ] = "-"; Item[ 6 ] = "Duplicate Asset" TAB "" TAB "AssetBrowser.duplicateAsset();"; diff --git a/Templates/BaseGame/game/tools/gui/editorSettingsWindow.ed.tscript b/Templates/BaseGame/game/tools/gui/editorSettingsWindow.ed.tscript index fea4a1a6d..848a625aa 100644 --- a/Templates/BaseGame/game/tools/gui/editorSettingsWindow.ed.tscript +++ b/Templates/BaseGame/game/tools/gui/editorSettingsWindow.ed.tscript @@ -53,26 +53,27 @@ function ESettingsWindow::onWake( %this ) function ESettingsWindow::hideDialog( %this ) { - %this.setVisible(false); + Canvas.popDialog(EditorSettingsWindow); } function ESettingsWindow::ToggleVisibility() { - if ( ESettingsWindow.visible ) + if(ESettingsWindow.isAwake()) { - ESettingsWindow.setVisible(false); + Canvas.popDialog(EditorSettingsWindow); } else { - ESettingsWindow.setVisible(true); + Canvas.pushDialog(EditorSettingsWindow); + ESettingsWindow.selectWindow(); ESettingsWindow.setCollapseGroup(false); ESettingsWindowList.clear(); - } ESettingsWindowList.setSelectedById( 1 ); } +} function ESettingsWindow::toggleProjectSettings(%this) { @@ -528,7 +529,7 @@ function ESettingsWindow::getAssetEditingSettings(%this) } SettingsInspector.startGroup("Assets Importing"); - SettingsInspector.addField("Edit Asset Configs", "Edit Asset Import Configs", "button", "Open Asset Import Config Editor", "", "Canvas.pushDialog(AssetImportConfigEditor);"); + SettingsInspector.addField("Edit Import Configs", "Edit Asset Import Configs", "button", "Open Asset Import Config Editor", "", "Canvas.pushDialog(AssetImportConfigEditor);"); SettingsInspector.addSettingsField("Assets/AssetImporDefaultConfig", "Default Asset Import Config", "list", "", %formattedConfigList); SettingsInspector.addSettingsField("Assets/AutoImport", "Automatically Import using default config", "bool", "If on, the asset importing process" @ "will attempt to automatically import any inbound assets"@ diff --git a/Templates/BaseGame/game/tools/settings.xml b/Templates/BaseGame/game/tools/settings.xml index 225b2d67e..b7103a680 100644 --- a/Templates/BaseGame/game/tools/settings.xml +++ b/Templates/BaseGame/game/tools/settings.xml @@ -35,7 +35,7 @@ DefaultImportConfig 1 + name="AutoImport">0