2
0
Эх сурвалжийг харах

Merge pull request #1018 from Areloch/MiscFixes20230508

Misc Fixes for 2023/05/08
Brian Roberts 2 жил өмнө
parent
commit
6c17386cdf

+ 5 - 5
Engine/source/T3D/assets/MaterialAsset.cpp

@@ -362,16 +362,16 @@ StringTableEntry MaterialAsset::getAssetIdByMaterialName(StringTableEntry matNam
    U32 foundCount = AssetDatabase.findAssetType(&query, "MaterialAsset");
    if (foundCount != 0)
    {
-      for (U32 i = 0; i < foundCount; i++)
+      for (U32 i = 0; i < foundCount && materialAssetId == MaterialAsset::smNoMaterialAssetFallback; i++)
       {
          MaterialAsset* matAsset = AssetDatabase.acquireAsset<MaterialAsset>(query.mAssetList[i]);
-         if (matAsset && matAsset->getMaterialDefinitionName() == matName)
+         if (matAsset)
          {
-            materialAssetId = matAsset->getAssetId();
+            if (matAsset->getMaterialDefinitionName() == matName)
+               materialAssetId = matAsset->getAssetId();
+
             AssetDatabase.releaseAsset(query.mAssetList[i]);
-            break;
          }
-         AssetDatabase.releaseAsset(query.mAssetList[i]);
       }
    }
 

+ 5 - 5
Engine/source/T3D/assets/SoundAsset.cpp

@@ -274,16 +274,16 @@ StringTableEntry SoundAsset::getAssetIdByFileName(StringTableEntry fileName)
    U32 foundCount = AssetDatabase.findAssetType(&query, "SoundAsset");
    if (foundCount != 0)
    {
-      for (U32 i = 0; i < foundCount; i++)
+      for (U32 i = 0; i < foundCount && soundAssetId == StringTable->EmptyString(); i++)
       {
          SoundAsset* soundAsset = AssetDatabase.acquireAsset<SoundAsset>(query.mAssetList[i]);
-         if (soundAsset && soundAsset->getSoundPath() == fileName)
+         if (soundAsset)
          {
-            soundAssetId = soundAsset->getAssetId();
+            if (soundAsset->getSoundPath() == fileName)
+               soundAssetId = soundAsset->getAssetId();
+
             AssetDatabase.releaseAsset(query.mAssetList[i]);
-            break;
          }
-         AssetDatabase.releaseAsset(query.mAssetList[i]);
       }
    }
 

+ 5 - 5
Engine/source/T3D/assets/TerrainMaterialAsset.cpp

@@ -378,16 +378,16 @@ StringTableEntry TerrainMaterialAsset::getAssetIdByMaterialName(StringTableEntry
    U32 foundCount = AssetDatabase.findAssetType(&query, "TerrainMaterialAsset");
    if (foundCount != 0)
    {
-      for (U32 i = 0; i < foundCount; i++)
+      for (U32 i = 0; i < foundCount && materialAssetId == StringTable->EmptyString(); i++)
       {
          TerrainMaterialAsset* matAsset = AssetDatabase.acquireAsset<TerrainMaterialAsset>(query.mAssetList[i]);
-         if (matAsset && matAsset->getMaterialDefinitionName() == matName)
+         if (matAsset)
          {
-            materialAssetId = matAsset->getAssetId();
+            if (matAsset->getMaterialDefinitionName() == matName)
+               materialAssetId = matAsset->getAssetId();
+
             AssetDatabase.releaseAsset(query.mAssetList[i]);
-            break;
          }
-         AssetDatabase.releaseAsset(query.mAssetList[i]);
       }
    }
 

+ 3 - 0
Engine/source/T3D/lighting/reflectionProbe.cpp

@@ -883,6 +883,9 @@ void ReflectionProbe::prepRenderImage(SceneRenderState *state)
 
       BaseMatInstance* probePrevMat = mEditorShapeInst->getMaterialList()->getMaterialInst(0);
 
+      if (probePrevMat == nullptr)
+         return;
+
       setPreviewMatParameters(state, probePrevMat);
 
       // GFXTransformSaver is a handy helper class that restores

+ 6 - 4
Engine/source/module/moduleManager.cpp

@@ -104,6 +104,7 @@ S32 ModuleManager::moduleDependencySort(ModuleDefinition* const* a, ModuleDefini
 ModuleManager::ModuleManager() :
     mEnforceDependencies(true),
     mEchoInfo(false),
+    mFailGroupIfModuleFail(false),
     mDatabaseLocks( 0 ),
     mIgnoreLoadedGroups(false)
 {
@@ -148,6 +149,7 @@ void ModuleManager::initPersistFields()
 
     addField( "EnforceDependencies", TypeBool, Offset(mEnforceDependencies, ModuleManager), "Whether the module manager enforces any dependencies on module definitions it discovers or not." );
     addField( "EchoInfo", TypeBool, Offset(mEchoInfo, ModuleManager), "Whether the module manager echos extra information to the console or not." );
+    addField( "FailGroupIfModuleFail", TypeBool, Offset(mFailGroupIfModuleFail, ModuleManager), "Whether the module manager will fail to load an entire module group if a single module fails to load.");
 }
 
 //-----------------------------------------------------------------------------
@@ -292,8 +294,8 @@ bool ModuleManager::loadModuleGroup( const char* pModuleGroup )
         StringTableEntry moduleId = *moduleIdItr;
 
         // Finish if we could not resolve the dependencies for module Id (of any version Id).
-        if ( !resolveModuleDependencies( moduleId, 0, moduleGroup, false, moduleResolvingQueue, moduleReadyQueue ) )
-            return false;
+        if (!resolveModuleDependencies(moduleId, 0, moduleGroup, false, moduleResolvingQueue, moduleReadyQueue) && mFailGroupIfModuleFail)
+           return false;
     }
 
     // Check the modules we want to load to ensure that we do not have incompatible modules loaded already.
@@ -524,8 +526,8 @@ bool ModuleManager::unloadModuleGroup( const char* pModuleGroup )
         StringTableEntry moduleId = *moduleIdItr;
 
         // Finish if we could not resolve the dependencies for module Id (of any version Id).
-        if ( !resolveModuleDependencies( moduleId, 0, moduleGroup, false, moduleResolvingQueue, moduleReadyQueue ) )
-            return false;
+        if (!resolveModuleDependencies(moduleId, 0, moduleGroup, false, moduleResolvingQueue, moduleReadyQueue) && mFailGroupIfModuleFail)
+           return false;
     }
 
     // Check the modules we want to load to ensure that we do not have incompatible modules loaded already.

+ 1 - 0
Engine/source/module/moduleManager.h

@@ -117,6 +117,7 @@ private:
     /// Miscellaneous.
     bool                        mEnforceDependencies;
     bool                        mEchoInfo;
+    bool                        mFailGroupIfModuleFail;
     S32                         mDatabaseLocks;
     char                        mModuleExtension[256];
     Taml                        mTaml;

+ 1 - 1
Engine/source/ts/tsShapeInstance.cpp

@@ -891,7 +891,7 @@ bool TSShapeInstance::hasAccumulation()
    for ( U32 i = 0; i < mMaterialList->size(); ++i )
    {
       BaseMatInstance* mat = mMaterialList->getMaterialInst(i);
-      if ( mat->hasAccumulation() )
+      if (mat != nullptr && mat->hasAccumulation() )
          result = true;
    }
    return result;

+ 1 - 1
Templates/BaseGame/game/tools/gui/simViewDlg, EditorGuiGroup.asset.taml → Templates/BaseGame/game/tools/gui/simViewDlg.asset.taml

@@ -1,7 +1,7 @@
 <GUIAsset
     canSave="true"
     canSaveDynamicFields="true"
-    AssetName="simViewDlg, EditorGuiGroup"
+    AssetName="simViewDlg"
     scriptFile="@assetFile=simViewDlg.ed.gui"
     GUIFile="@assetFile=simViewDlg.ed.gui"
     VersionId="1" />

+ 103 - 214
Templates/BaseGame/game/tools/gui/simViewDlg.ed.gui

@@ -1,262 +1,142 @@
 //--- OBJECT WRITE BEGIN ---
-$guiContent = new GuiControl(simViewDlg, EditorGuiGroup) {
-   canSaveDynamicFields = "0";
-   Profile = "ToolsGuiDefaultProfile";
-   HorizSizing = "right";
-   VertSizing = "bottom";
-   position = "0 0";
-   Extent = "800 600";
-   MinExtent = "8 8";
-   canSave = "1";
-   Visible = "1";
-   hovertime = "1000";
+$guiContent = new GuiControl(simViewDlg,EditorGuiGroup) {
+   extent = "1024 768";
+   minExtent = "8 8";
+   profile = "ToolsGuiDefaultProfile";
+   tooltipProfile = "GuiToolTipProfile";
+   isContainer = "1";
+   canSaveDynamicFields = "1";
 
    new GuiWindowCtrl() {
-      canSaveDynamicFields = "0";
-      Profile = "ToolsGuiWindowProfile";
-      HorizSizing = "center";
-      VertSizing = "center";
-      position = "70 43";
-      Extent = "685 489";
-      MinExtent = "602 440";
-      canSave = "1";
-      Visible = "1";
-      hovertime = "1000";
       text = "Torque SimView";
-      maxLength = "1024";
-      resizeWidth = "1";
-      resizeHeight = "1";
-      canMove = "1";
-      canClose = "1";
-      canMinimize = "1";
-      canMaximize = "1";
-      minSize = "50 50";
       closeCommand = "Canvas.popDialog(simViewDlg);";
+      position = "169 139";
+      extent = "685 489";
+      minExtent = "602 440";
+      horizSizing = "center";
+      vertSizing = "center";
+      profile = "ToolsGuiWindowProfile";
+      tooltipProfile = "GuiToolTipProfile";
 
       new GuiScrollCtrl() {
-         canSaveDynamicFields = "0";
-         Profile = "ToolsGuiScrollProfile";
-         HorizSizing = "width";
-         VertSizing = "height";
-         position = "10 28";
-         Extent = "255 448";
-         MinExtent = "8 8";
-         canSave = "1";
-         Visible = "1";
-         hovertime = "1000";
-         willFirstRespond = "1";
          hScrollBar = "dynamic";
-         vScrollBar = "alwaysOn";
-         lockHorizScroll = "false";
-         lockVertScroll = "false";
-         constantThumbHeight = "0";
-         childMargin = "0 0";
+         position = "10 51";
+         extent = "255 425";
+         minExtent = "8 8";
+         horizSizing = "width";
+         vertSizing = "height";
+         profile = "ToolsGuiScrollProfile";
+         tooltipProfile = "GuiToolTipProfile";
 
          new GuiTreeViewCtrl(InspectTreeView) {
-            canSaveDynamicFields = "0";
-            Profile = "ToolsGuiTreeViewProfile";
-            HorizSizing = "right";
-            VertSizing = "bottom";
-            position = "2 2";
-            Extent = "212 21";
-            MinExtent = "8 8";
-            canSave = "1";
-            Visible = "1";
-            hovertime = "1000";
-            tabSize = "16";
-            textOffset = "2";
-            fullRowSelect = "0";
             itemHeight = "21";
-            destroyTreeOnSleep = "1";
-            MouseDragging = "1";
-            MultipleSelections = "1";
-            DeleteObjectAllowed = "1";
-            DragToItemAllowed = "1";
+            position = "2 25";
+            extent = "212 21";
+            minExtent = "8 8";
+            profile = "ToolsGuiTreeViewProfile";
+            tooltipProfile = "GuiToolTipProfile";
          };
       };
       new GuiScrollCtrl() {
-         canSaveDynamicFields = "0";
-         Profile = "ToolsGuiScrollProfile";
-         HorizSizing = "left";
-         VertSizing = "height";
-         position = "272 96";
-         Extent = "404 380";
-         MinExtent = "8 8";
-         canSave = "1";
-         Visible = "1";
-         hovertime = "1000";
-         willFirstRespond = "1";
          hScrollBar = "alwaysOff";
-         vScrollBar = "alwaysOn";
-         lockHorizScroll = "true";
-         lockVertScroll = "false";
-         constantThumbHeight = "0";
-         childMargin = "0 0";
+         lockHorizScroll = "1";
+         position = "272 96";
+         extent = "404 380";
+         minExtent = "8 8";
+         horizSizing = "left";
+         vertSizing = "height";
+         profile = "ToolsGuiScrollProfile";
+         tooltipProfile = "GuiToolTipProfile";
 
          new GuiInspector(InspectFields) {
-            StackingType = "Vertical";
-            HorizStacking = "Left to Right";
-            VertStacking = "Top to Bottom";
-            Padding = "1";
-            canSaveDynamicFields = "0";
-            Profile = "ToolsGuiTransparentProfile";
-            HorizSizing = "width";
-            VertSizing = "bottom";
-            position = "2 2";
-            Extent = "382 8";
-            MinExtent = "8 8";
-            canSave = "1";
-            Visible = "1";
-            hovertime = "1000";
+            position = "1 1";
+            extent = "389 8";
+            minExtent = "8 8";
+            horizSizing = "width";
+            profile = "ToolsGuiTransparentProfile";
+            tooltipProfile = "GuiToolTipProfile";
          };
       };
+      new GuiTextEditCtrl(SimViewTreeFilter) {
+         position = "11 27";
+         extent = "255 18";
+         profile = "ToolsGuiTextEditProfile";
+         tooltipProfile = "GuiToolTipProfile";
+         placeholderText = "Filter...";
+      };
       new GuiControl() {
-         canSaveDynamicFields = "0";
-         Profile = "ToolsGuiButtonProfile";
-         HorizSizing = "left";
-         VertSizing = "bottom";
          position = "272 28";
-         Extent = "403 61";
-         MinExtent = "8 2";
-         canSave = "1";
-         Visible = "1";
-         hovertime = "1000";
+         extent = "403 61";
+         horizSizing = "left";
+         profile = "ToolsGuiButtonProfile";
+         tooltipProfile = "GuiToolTipProfile";
+         isContainer = "1";
 
          new GuiTextEditCtrl(InspectObjectName) {
-            canSaveDynamicFields = "0";
-            Profile = "ToolsGuiTextEditProfile";
-            HorizSizing = "right";
-            VertSizing = "bottom";
             position = "121 8";
-            Extent = "195 18";
-            MinExtent = "8 8";
-            canSave = "1";
-            Visible = "1";
-            hovertime = "1000";
-            maxLength = "1024";
-            historySize = "0";
-            password = "0";
-            tabComplete = "0";
-            sinkAllKeyEvents = "0";
-            password = "0";
-            passwordMask = "*";
+            extent = "195 18";
+            minExtent = "8 8";
+            profile = "ToolsGuiTextEditProfile";
+            tooltipProfile = "GuiToolTipProfile";
          };
          new GuiTextCtrl() {
-            canSaveDynamicFields = "0";
-            Profile = "EditorTextHLRight";
-            HorizSizing = "right";
-            VertSizing = "bottom";
-            position = "217 35";
-            Extent = "44 18";
-            MinExtent = "8 8";
-            canSave = "1";
-            Visible = "1";
-            hovertime = "1000";
             text = "Sim ID:";
-            maxLength = "1024";
+            position = "217 35";
+            extent = "44 18";
+            minExtent = "8 8";
+            profile = "GuiTextProfile";
+            tooltipProfile = "GuiToolTipProfile";
          };
          new GuiTextCtrl() {
-            canSaveDynamicFields = "0";
-            Profile = "EditorTextHLRight";
-            HorizSizing = "right";
-            VertSizing = "bottom";
-            position = "10 35";
-            Extent = "106 18";
-            MinExtent = "8 8";
-            canSave = "1";
-            Visible = "1";
-            hovertime = "1000";
             text = "Internal Name:";
-            maxLength = "1024";
+            position = "10 35";
+            extent = "106 18";
+            minExtent = "8 8";
+            profile = "GuiTextProfile";
+            tooltipProfile = "GuiToolTipProfile";
          };
          new GuiTextEditCtrl(InspectObjectInternalName) {
-            canSaveDynamicFields = "0";
-            Profile = "ToolsGuiTextEditProfile";
-            HorizSizing = "right";
-            VertSizing = "bottom";
             position = "121 35";
-            Extent = "93 18";
-            MinExtent = "8 8";
-            canSave = "1";
-            Visible = "1";
-            hovertime = "1000";
-            maxLength = "1024";
-            historySize = "0";
-            password = "0";
-            tabComplete = "0";
-            sinkAllKeyEvents = "0";
-            password = "0";
-            passwordMask = "*";
+            extent = "93 18";
+            minExtent = "8 8";
+            profile = "ToolsGuiTextEditProfile";
+            tooltipProfile = "GuiToolTipProfile";
          };
          new GuiTextCtrl() {
-            canSaveDynamicFields = "0";
-            Profile = "EditorTextHLBoldRight";
-            HorizSizing = "right";
-            VertSizing = "bottom";
-            position = "10 8";
-            Extent = "106 18";
-            MinExtent = "8 8";
-            canSave = "1";
-            Visible = "1";
-            hovertime = "1000";
             text = "Selected Object:";
-            maxLength = "1024";
+            position = "10 8";
+            extent = "106 18";
+            minExtent = "8 8";
+            profile = "GuiTextProfile";
+            tooltipProfile = "GuiToolTipProfile";
          };
          new GuiIconButtonCtrl() {
-            canSaveDynamicFields = "0";
-            Profile = "ToolsGuiButtonProfile";
-            HorizSizing = "right";
-            VertSizing = "bottom";
-            position = "321 33";
-            Extent = "76 22";
-            MinExtent = "8 2";
-            canSave = "1";
-            Visible = "1";
-            Command = "InspectApply();";
-            hovertime = "1000";
-            text = "Refresh";
-            groupNum = "-1";
-            buttonType = "PushButton";
-            bitmapAsset = "ToolsModule:iconRefresh_image";
-            sizeIconToButton = "0";
+            BitmapAsset = "ToolsModule:iconRefresh_image";
             textLocation = "Right";
-            textMargin = "4";
-            buttonMargin = "4 4";
+            text = "Refresh";
+            position = "321 33";
+            extent = "76 22";
+            profile = "ToolsGuiButtonProfile";
+            command = "InspectApply();";
+            tooltipProfile = "GuiToolTipProfile";
          };
          new GuiTextCtrl(InspectObjectSimID) {
-            canSaveDynamicFields = "0";
-            Profile = "EditorTextHLBoldCenter";
-            HorizSizing = "right";
-            VertSizing = "bottom";
-            position = "265 35";
-            Extent = "51 18";
-            MinExtent = "8 8";
-            canSave = "1";
-            Visible = "1";
-            hovertime = "1000";
             text = "0";
-            maxLength = "1024";
+            position = "265 35";
+            extent = "51 18";
+            minExtent = "8 8";
+            profile = "GuiTextProfile";
+            tooltipProfile = "GuiToolTipProfile";
          };
          new GuiIconButtonCtrl() {
-            canSaveDynamicFields = "0";
-            Profile = "ToolsGuiButtonProfile";
-            HorizSizing = "right";
-            VertSizing = "bottom";
-            position = "321 6";
-            Extent = "76 22";
-            MinExtent = "8 2";
-            canSave = "1";
-            Visible = "1";
-            Command = "InspectDelete();";
-            hovertime = "1000";
-            text = "Delete";
-            groupNum = "-1";
-            buttonType = "PushButton";
-            bitmapAsset = "ToolsModule:iconDelete_image";
-            sizeIconToButton = "0";
+            BitmapAsset = "ToolsModule:iconDelete_image";
             textLocation = "Right";
-            textMargin = "4";
-            buttonMargin = "4 4";
+            text = "Delete";
+            position = "321 6";
+            extent = "76 22";
+            profile = "ToolsGuiButtonProfile";
+            command = "InspectDelete();";
+            tooltipProfile = "GuiToolTipProfile";
          };
       };
    };
@@ -346,3 +226,12 @@ function GuiInspector::setAllGroupStateScript(%this, %obj, %groupState)
    %this.setAllGroupState(%groupState);
    %this.inspect(%obj);
 }
+
+function SimViewTreeFilter::onReturn(%this)
+{
+   %text = %this.getText();
+   if( %text $= "" )
+      %this.reset();
+   else
+      InspectTreeView.setFilterText( %text );
+}