From c7763fe3ec47ebad19088b6dd6041ed8ab5703a2 Mon Sep 17 00:00:00 2001 From: JeffR Date: Thu, 2 Jun 2022 20:17:23 -0500 Subject: [PATCH] Added cleanup of exec stack for module when it's finished to avoid duplicate executions Added proper container bracketing for the main menu buttons and made that the main navigation target Added logic to UINav to prevent needlessly re-setting the root page if it already is the root page, which would break the navigation stack Added logic to UINav toprevent needlessly adding duplicate pages whicn would break the navigation stack Added logic to close the chooseLevelDlg page when the level is loaded to avoid the page being left hanging on the nav stack Fixed assetId for no preview image fallback on the chooseLevelDlg page Fixed display of icons in the shape editor shape helper section Fixed name lookup on terrain material editor dialogue which would break saving of terrain materials Disables TORQUE_SFX_DirectX which is currently not in use and nonfunctional --- .../game/core/utility/scripts/module.tscript | 1 + .../BaseGame/game/data/UI/guis/MainMenuButtons.gui | 2 ++ .../game/data/UI/guis/MainMenuButtons.tscript | 8 ++++---- .../game/data/UI/guis/chooseLevelDlg.tscript | 6 ++++-- .../BaseGame/game/data/UI/guis/mainMenu.tscript | 13 ++++++------- .../game/data/UI/scripts/menuNavigation.tscript | 7 +++++++ .../shapeEditor/scripts/shapeEditor.ed.tscript | 5 ++++- .../interfaces/terrainMaterialDlg.ed.tscript | 2 +- Tools/CMake/torque3d.cmake | 4 ++-- 9 files changed, 31 insertions(+), 17 deletions(-) diff --git a/Templates/BaseGame/game/core/utility/scripts/module.tscript b/Templates/BaseGame/game/core/utility/scripts/module.tscript index ae7f0ce13..137cf6835 100644 --- a/Templates/BaseGame/game/core/utility/scripts/module.tscript +++ b/Templates/BaseGame/game/core/utility/scripts/module.tscript @@ -39,6 +39,7 @@ function callOnModules(%functionName, %moduleGroup, %var0, %var1, %var2, %var3, } ExecFilesList.pop_back(); //cleanup + %execArray.delete(); } function loadModuleMaterials(%moduleGroup) diff --git a/Templates/BaseGame/game/data/UI/guis/MainMenuButtons.gui b/Templates/BaseGame/game/data/UI/guis/MainMenuButtons.gui index 8664b312e..accf22ef6 100644 --- a/Templates/BaseGame/game/data/UI/guis/MainMenuButtons.gui +++ b/Templates/BaseGame/game/data/UI/guis/MainMenuButtons.gui @@ -1,6 +1,8 @@ //--- OBJECT WRITE BEGIN --- $guiContent = new GuiControl(MainMenuButtons) { extent = "1024 768"; + horizSizing = "width"; + vertSizing = "height"; profile = "GuiNonModalDefaultProfile"; tooltipProfile = "GuiToolTipProfile"; isContainer = "1"; diff --git a/Templates/BaseGame/game/data/UI/guis/MainMenuButtons.tscript b/Templates/BaseGame/game/data/UI/guis/MainMenuButtons.tscript index 73f38e4f6..be79f9dd3 100644 --- a/Templates/BaseGame/game/data/UI/guis/MainMenuButtons.tscript +++ b/Templates/BaseGame/game/data/UI/guis/MainMenuButtons.tscript @@ -11,7 +11,7 @@ function MainMenuButtons::onSleep(%this) // set MainMenuButtonList as it's root page. // This is an optional function, but is called as part of the validation that the page // CAN be opened, so it's shown here as an example -function MainMenuButtonList::canOpen(%this) +function MainMenuButtons::canOpen(%this) { return true; } @@ -21,7 +21,7 @@ function MainMenuButtonList::canOpen(%this) // set MainMenuButtonList as it's root page. // Once the page is added to the MainMenuGUI's UINavigation page stack, onOpen here is called // Which allows us to actually do the work we need to do for display -function MainMenuButtonList::onOpen(%this) +function MainMenuButtons::onOpen(%this) { //Here, we set the MainMenuButtonList - a GuiStackControl with the MenuList class // to be the active menu list. @@ -57,13 +57,13 @@ function MainMenuButtonList::onOpen(%this) } //Optional, as the check defaults to true, but here as an example case -function MainMenuButtonList::canClose(%this) +function MainMenuButtons::canClose(%this) { return true; } -function MainMenuButtonList::onClose(%this) +function MainMenuButtons::onClose(%this) { } diff --git a/Templates/BaseGame/game/data/UI/guis/chooseLevelDlg.tscript b/Templates/BaseGame/game/data/UI/guis/chooseLevelDlg.tscript index 11dcec6de..b39db49d1 100644 --- a/Templates/BaseGame/game/data/UI/guis/chooseLevelDlg.tscript +++ b/Templates/BaseGame/game/data/UI/guis/chooseLevelDlg.tscript @@ -35,7 +35,7 @@ function ChooseLevelDlg::onOpen(%this) LevelList.clearRows(); LevelListEntries.empty(); - ChooseLevelWindow->CurrentPreview.setBitmap("data/ui/images/no-preview"); + ChooseLevelWindow->CurrentPreview.setBitmap("UI:no_preview_image"); ChooseLevelWindow->LevelDescriptionLabel.visible = false; ChooseLevelWindow->LevelDescription.visible = false; @@ -167,7 +167,7 @@ function LevelList::onChange(%this) if (isFile(%levelPreview)) ChooseLevelWindow->CurrentPreview.setBitmap(%levelPreview); else - ChooseLevelWindow->CurrentPreview.setBitmap("data/ui/images/no-preview"); + ChooseLevelWindow->CurrentPreview.setBitmap("UI:no_preview_image"); // Get the description %levelDesc = %levelAsset.description; @@ -193,6 +193,8 @@ function ChooseLevelDlg::beginLevel(%this) // So we can't fire the button when loading is in progress. if ( isObject( ServerGroup ) ) return; + + %this.navigation.popPage(); // Launch the chosen level with the editor open? if ( ChooseLevelDlg.launchInEditor ) diff --git a/Templates/BaseGame/game/data/UI/guis/mainMenu.tscript b/Templates/BaseGame/game/data/UI/guis/mainMenu.tscript index bae675ea3..71bb01746 100644 --- a/Templates/BaseGame/game/data/UI/guis/mainMenu.tscript +++ b/Templates/BaseGame/game/data/UI/guis/mainMenu.tscript @@ -24,18 +24,17 @@ function MainMenuGui::onWake(%this) //We set up this catch by making said control our first responder, here MainMenuInputHandler.setFirstResponder(); - //Lastly, we go ahead and display some actual navigable content up on our main menu here - //In this case, we set the MainMenuButtonList as our root page, so we always come back - //to having the main menu buttons on screen if every other page is closed. - //This will ultimately call MainMenuButtonList::onOpen(), so to see where the navigation - //chain continues, see that function. - %this.setRootPage(MainMenuButtonList); - //We also go ahead and mark for any future pages being added to the UINavigation's page stack //to be prompted to resize when added. This isn't required, but helps keep pages formated to //the current size of the UINavigation, which is useful when dealing with aspect ratio or resolution //changes. %this.resizePages = true; + //Lastly, we go ahead and display some actual navigable content up on our main menu here + //In this case, we set the MainMenuButtons as our root page, so we always come back + //to having the main menu buttons on screen if every other page is closed. + //This will ultimately call MainMenuButtons::onOpen(), so to see where the navigation + //chain continues, see that function. + %this.setRootPage(MainMenuButtons); } function MainMenuButtonHolder::onWake(%this) diff --git a/Templates/BaseGame/game/data/UI/scripts/menuNavigation.tscript b/Templates/BaseGame/game/data/UI/scripts/menuNavigation.tscript index 80eeb33a6..b33552d40 100644 --- a/Templates/BaseGame/game/data/UI/scripts/menuNavigation.tscript +++ b/Templates/BaseGame/game/data/UI/scripts/menuNavigation.tscript @@ -14,6 +14,9 @@ function UINavigation::setRootPage(%this, %rootPage) %this.pageStack = new ArrayObject(); } + if(%this.rootPage $= %rootPage) + return; + if(isObject(%this.rootPage)) { %canClose = true; @@ -71,6 +74,10 @@ function UINavigation::pushPage(%this, %newPage, %callback) %this.pageStack = new ArrayObject(); } + //don't re-add pages + if(%this.pageStack.getIndexFromKey(%newPage) != -1) + return; + %canChange = true; if(%newPage.isMethod("canOpen")) %canChange = %newPage.call("canOpen"); diff --git a/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditor.ed.tscript b/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditor.ed.tscript index 929fc510e..5edcb77ef 100644 --- a/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditor.ed.tscript +++ b/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditor.ed.tscript @@ -563,7 +563,10 @@ function ShapeEdSelectWindow::addObjectHint( %this, %type, %name, %desc, %presen %ctrl.text = %name; %ctrl.tooltip = %desc; - %ctrl.setBitmap( "tools/editorClasses/gui/images/" @ ( %present ? "iconAccept" : "iconCancel" ) ); + if(%present) + %ctrl.setBitmap( "ToolsModule:iconAccept_image" ); + else + %ctrl.setBitmap( "ToolsModule:iconCancel_image" ); %ctrl.setStateOn( false ); %ctrl.resetState(); diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/interfaces/terrainMaterialDlg.ed.tscript b/Templates/BaseGame/game/tools/worldEditor/scripts/interfaces/terrainMaterialDlg.ed.tscript index 4a7338c24..2486564cd 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/interfaces/terrainMaterialDlg.ed.tscript +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/interfaces/terrainMaterialDlg.ed.tscript @@ -640,7 +640,7 @@ function TerrainMaterialDlg::saveDirtyMaterial( %this, %materialAssetId ) // Read out properties from the dialog. - %newName = %this-->matNameCtrl.getText(); + %newName = %this-->matNameCtrl.text; %blankBitmap = AssetDatabase.acquireAsset($TerrainMaterialEditor::emptyMaterialImage).getImagePath(); diff --git a/Tools/CMake/torque3d.cmake b/Tools/CMake/torque3d.cmake index 2f5a0b6ac..0edfb477f 100644 --- a/Tools/CMake/torque3d.cmake +++ b/Tools/CMake/torque3d.cmake @@ -61,8 +61,8 @@ option(TORQUE_ADVANCED_LIGHTING "Advanced Lighting" ON) mark_as_advanced(TORQUE_ADVANCED_LIGHTING) option(TORQUE_BASIC_LIGHTING "Basic Lighting" ON) mark_as_advanced(TORQUE_BASIC_LIGHTING) -option(TORQUE_SFX_DirectX "DirectX Sound" OFF) -mark_as_advanced(TORQUE_SFX_DirectX) +# option(TORQUE_SFX_DirectX "DirectX Sound" OFF) +# mark_as_advanced(TORQUE_SFX_DirectX) option(TORQUE_SFX_OPENAL "OpenAL Sound" ON) mark_as_advanced(TORQUE_APP_PASSWORD) set(TORQUE_APP_PASSWORD "changeme" CACHE STRING "zip file password")