瀏覽代碼

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

Areloch 3 年之前
父節點
當前提交
97484247ae

+ 7 - 4
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;
          }
 

+ 8 - 2
Engine/source/T3D/assets/assetImporter.h

@@ -905,9 +905,15 @@ public:
    /// </summary>
    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;
+      }
    }
 
    /// <summary>

+ 10 - 0
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);
 }

+ 7 - 5
Templates/BaseGame/game/tools/assetBrowser/assetImportConfigs.xml

@@ -26,18 +26,18 @@
             <Setting name="AddedImageSuffix">_image</Setting>
             <Setting name="AlwaysAddImageSuffix">1</Setting>
             <Setting name="AOTypeSuffixes">_AO,_AMBIENT,_AMBIENTOCCLUSION</Setting>
-            <Setting name="CompositeTypeSuffixes">_COMP,_COMPOSITE,_PBR,-COMP,-COMPOSITE,-PBR,_ORM,-ORM</Setting>
+            <Setting name="CompositeTypeSuffixes">_COMP,_COMPOSITE,_PBR,-COMP,-COMPOSITE,-PBR,_ORM,-ORM,_C</Setting>
             <Setting name="Compressed">1</Setting>
             <Setting name="DiffuseTypeSuffixes">_ALBEDO,_DIFFUSE,_ALB,_DIF,_COLOR,_COL</Setting>
             <Setting name="GenerateMaterialOnImport">0</Setting>
             <Setting name="ImageType">N/A</Setting>
             <Setting name="ImportImages">1</Setting>
             <Setting name="IsHDR">0</Setting>
-            <Setting name="MetalnessTypeSuffixes">_METAL,_MET,_METALNESS,_METALLIC</Setting>
-            <Setting name="NormalTypeSuffixes">_NORMAL,_NORM</Setting>
-            <Setting name="RoughnessTypeSuffixes">_ROUGH,_ROUGHNESS</Setting>
+            <Setting name="MetalnessTypeSuffixes">_METAL,_MET,_METALNESS,_METALLIC,_M</Setting>
+            <Setting name="NormalTypeSuffixes">_NORMAL,_NORM,_N</Setting>
+            <Setting name="RoughnessTypeSuffixes">_ROUGH,_ROUGHNESS,_R</Setting>
             <Setting name="Scaling">1.0</Setting>
-            <Setting name="SmoothnessTypeSuffixes">_SMOOTH,_SMOOTHNESS</Setting>
+            <Setting name="SmoothnessTypeSuffixes">_SMOOTH,_SMOOTHNESS,_S</Setting>
             <Setting name="TextureFilteringMode">Bilinear</Setting>
             <Setting name="UseMips">1</Setting>
         </Group>
@@ -45,6 +45,8 @@
             <Setting name="AddedMaterialSuffix">_mat</Setting>
             <Setting name="AlwaysAddMaterialSuffix">0</Setting>
             <Setting name="CreateComposites">1</Setting>
+            <Setting name="CreateORMConfig">1</Setting>
+            <Setting name="IgnoreMaterials">DefaultMaterial</Setting>
             <Setting name="ImportMaterials">1</Setting>
             <Setting name="PopulateMaterialMaps">1</Setting>
             <Setting name="UseDiffuseSuffixOnOriginImage">1</Setting>

+ 12 - 3
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);
+  
+}
+//

+ 2 - 2
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")

+ 2 - 2
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();";

+ 7 - 6
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"@

+ 1 - 1
Templates/BaseGame/game/tools/settings.xml

@@ -35,7 +35,7 @@
         <Setting
             name="AssetImporDefaultConfig">DefaultImportConfig</Setting>
         <Setting
-            name="AutoImport">1</Setting>
+            name="AutoImport">0</Setting>
         <Group
             name="Browser">
             <Setting

+ 0 - 2
Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.tscript

@@ -158,8 +158,6 @@ function EditorGui::init(%this)
    {
       exec("tools/gui/EditorSettingsWindow.ed.gui");
       exec("tools/gui/editorSettingsWindow.ed." @ $TorqueScriptFileExtension);
-      %this.add( ESettingsWindow );
-      ESettingsWindow.setVisible(false);
       
       // Start the standard settings tabs pages
       /*exec( "~/worldEditor/gui/GeneralSettingsTab.ed.gui" );

+ 0 - 142
Templates/BaseGame/game/tools/worldEditor/scripts/editorSettingsWindow.ed.tscript

@@ -1,142 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) 2012 GarageGames, LLC
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to
-// deal in the Software without restriction, including without limitation the
-// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-//-----------------------------------------------------------------------------
-
-function ESettingsWindow::startup( %this )
-{
-   ESettingsWindowTabBook.selectPage( 0 );
-   ESettingsWindowList.setSelectedById( 0 );
-}
-
-function ESettingsWindow::onWake( %this )
-{
-}
-
-function ESettingsWindow::hideDialog( %this )
-{
-   %this.setVisible(false);
-}
-
-function ESettingsWindow::ToggleVisibility()
-{
-   if ( ESettingsWindow.visible  )
-   {
-      ESettingsWindow.setVisible(false);
-   }
-   else
-   {
-      ESettingsWindow.setVisible(true);
-      ESettingsWindow.selectWindow();
-      ESettingsWindow.setCollapseGroup(false);
-   }
-}
-
-function ESettingsWindow::addTabPage( %this, %page )
-{
-   ESettingsWindowTabBook.add( %page );
-   ESettingsWindowList.addRow( ESettingsWindowTabBook.getSelectedPage(), %page.text );
-   ESettingsWindowList.sort(0);
-}
-
-//-----------------------------------------------------------------------------
-
-function ESettingsWindowList::onSelect( %this, %id, %text )
-{
-   ESettingsWindowTabBook.selectPage( %id );
-}
-
-//-----------------------------------------------------------------------------
-// Standard settings GUI classes.  Editors may define their own methods of
-// working with settings and are not required to use these.
-//-----------------------------------------------------------------------------
-
-function ESettingsWindowCheckbox::onWake( %this )
-{
-   %this.setStateOn( EditorSettings.value( %this.editorSettingsValue ));
-}
-
-function ESettingsWindowCheckbox::onClick( %this )
-{
-   EditorSettings.setValue( %this.editorSettingsValue, %this.getValue() );
-   eval(%this.editorSettingsRead);
-}
-
-//-----------------------------------------------------------------------------
-
-function ESettingsWindowTextEdit::onWake( %this )
-{
-   %this.setText( EditorSettings.value( %this.editorSettingsValue ));
-}
-
-function ESettingsWindowTextEdit::onValidate( %this )
-{
-   EditorSettings.setValue( %this.editorSettingsValue, %this.getValue() );
-   eval(%this.editorSettingsRead);
-}
-
-function ESettingsWindowTextEdit::onGainFirstResponder( %this )
-{
-   %this.selectAllText();
-}
-
-//-----------------------------------------------------------------------------
-
-function ESettingsWindowColor::apply( %this, %color )
-{
-   EditorSettings.setValue( %this.editorSettingsValue, %color );
-   eval(%this.editorSettingsRead);
-
-   %this.findObjectByInternalName("ColorEdit", true).setText( %color);
-   %this.findObjectByInternalName("ColorButton", true).color = ColorIntToFloat( %color );
-}
-
-function ESettingsWindowColorEdit::onWake( %this )
-{
-   %this.setText( EditorSettings.value( %this.getParent().editorSettingsValue ));
-}
-
-function ESettingsWindowColorEdit::onValidate( %this )
-{
-   %this.getParent().apply( %this.getValue() );
-}
-
-function ESettingsWindowColorEdit::onGainFirstResponder( %this )
-{
-   %this.selectAllText();
-}
-
-function ESettingsWindowColorButton::onWake( %this )
-{
-   %this.color = ColorIntToFloat( EditorSettings.value( %this.getParent().editorSettingsValue ) );
-}
-
-function ESettingsWindowColorButton::onClick( %this )
-{
-   getColorI( ColorFloatToInt( %this.color ), %this.getId() @ ".apply", %this.getRoot() );
-   //EditorSettings.setValue( %this.editorSettingsValue, %this.getValue() );
-   //eval(%this.editorSettingsRead);
-}
-
-function ESettingsWindowColorButton::apply( %this, %color )
-{
-   %this.getParent().apply(%color);
-   echo("ESettingsWindowColorButton::apply(): " @ %color);
-}