From e8450b6f785841947bcc27cdee8fe6570240e839 Mon Sep 17 00:00:00 2001 From: Areloch Date: Tue, 19 Nov 2019 01:25:24 -0600 Subject: [PATCH] From @rextimmy was missing the stateblock handling for the Transparency mode Sub Added Open Recent functionality to File menubar item Added new editor setting for Startup Mode to dictate if it'll open the most recent level edited or the blank level, instead of utilizing a game UI control for level selection. Properly re-enabled the handling for the forceSidebarToSide setting to track to the setting value --- Engine/source/materials/processedMaterial.cpp | 7 + .../base/utils/objectNameValidation.ed.cs | 8 +- .../tools/gui/EditorSettingsWindow.ed.gui | 4 +- .../game/tools/gui/editorSettingsWindow.ed.cs | 4 + Templates/BaseGame/game/tools/main.cs | 22 +- Templates/BaseGame/game/tools/settings.xml | 419 +++++++++--------- .../tools/worldEditor/scripts/EditorGui.ed.cs | 12 +- .../worldEditor/scripts/menuHandlers.ed.cs | 53 ++- .../tools/worldEditor/scripts/menus.ed.cs | 12 +- 9 files changed, 314 insertions(+), 227 deletions(-) diff --git a/Engine/source/materials/processedMaterial.cpp b/Engine/source/materials/processedMaterial.cpp index 3455257a6..cccccad7d 100644 --- a/Engine/source/materials/processedMaterial.cpp +++ b/Engine/source/materials/processedMaterial.cpp @@ -134,6 +134,13 @@ void ProcessedMaterial::_setBlendState(Material::BlendOp blendOp, GFXStateBlockD desc.blendDest = GFXBlendInvSrcAlpha; break; } + case Material::Sub: + { + desc.blendOp = GFXBlendOpSubtract; + desc.blendSrc = GFXBlendOne; + desc.blendDest = GFXBlendOne; + break; + } default: { diff --git a/Templates/BaseGame/game/tools/base/utils/objectNameValidation.ed.cs b/Templates/BaseGame/game/tools/base/utils/objectNameValidation.ed.cs index ba74d0d36..32fd1cd6f 100644 --- a/Templates/BaseGame/game/tools/base/utils/objectNameValidation.ed.cs +++ b/Templates/BaseGame/game/tools/base/utils/objectNameValidation.ed.cs @@ -25,12 +25,12 @@ function Editor::validateObjectName( %name, %mustHaveName ) { if( %mustHaveName && %name $= "" ) { - MessageBoxOK( "Missing Object Name", "No name given for object. Please enter a valid object name." ); + ToolsMessageBoxOK( "Missing Object Name", "No name given for object. Please enter a valid object name." ); return false; } if( !isValidObjectName( %name ) ) { - MessageBoxOK( "Invalid Object Name", "'" @ %name @ "' is not a valid object name." NL + ToolsMessageBoxOK( "Invalid Object Name", "'" @ %name @ "' is not a valid object name." NL "" NL "Please choose a name that begins with a letter or underscore and is otherwise comprised " @ "exclusively of letters, digits, and/or underscores." @@ -43,14 +43,14 @@ function Editor::validateObjectName( %name, %mustHaveName ) if ( %filename $= "" ) %filename = "an unknown file"; - MessageBoxOK( "Invalid Object Name", "Object names must be unique, and there is an " @ + ToolsMessageBoxOK( "Invalid Object Name", "Object names must be unique, and there is an " @ "existing " @ %name.getClassName() @ " object with the name '" @ %name @ "' (defined " @ "in " @ %filename @ "). Please choose another name." ); return false; } if( isClass( %name ) ) { - MessageBoxOK( "Invalid Object Name", "'" @ %name @ "' is the name of an existing TorqueScript " @ + ToolsMessageBoxOK( "Invalid Object Name", "'" @ %name @ "' is the name of an existing TorqueScript " @ "class. Please choose another name." ); return false; } diff --git a/Templates/BaseGame/game/tools/gui/EditorSettingsWindow.ed.gui b/Templates/BaseGame/game/tools/gui/EditorSettingsWindow.ed.gui index 1aa190e51..3d5d939ad 100644 --- a/Templates/BaseGame/game/tools/gui/EditorSettingsWindow.ed.gui +++ b/Templates/BaseGame/game/tools/gui/EditorSettingsWindow.ed.gui @@ -86,7 +86,7 @@ minExtent = "16 16"; horizSizing = "right"; vertSizing = "bottom"; - profile = "ToolsGuiDefaultProfile"; + profile = "ToolsGuiSolidDefaultProfile"; visible = "1"; active = "1"; tooltipProfile = "GuiToolTipProfile"; @@ -158,7 +158,7 @@ minExtent = "16 16"; horizSizing = "right"; vertSizing = "bottom"; - profile = "ToolsGuiDefaultProfile"; + profile = "ToolsGuiSolidDefaultProfile"; visible = "1"; active = "1"; tooltipProfile = "GuiToolTipProfile"; diff --git a/Templates/BaseGame/game/tools/gui/editorSettingsWindow.ed.cs b/Templates/BaseGame/game/tools/gui/editorSettingsWindow.ed.cs index b3fa1f58e..adacdc178 100644 --- a/Templates/BaseGame/game/tools/gui/editorSettingsWindow.ed.cs +++ b/Templates/BaseGame/game/tools/gui/editorSettingsWindow.ed.cs @@ -330,6 +330,10 @@ function ESettingsWindow::getNavEditorSettings(%this) function ESettingsWindow::getSceneEditorSettings(%this) { + SettingsInspector.startGroup("Startup"); + SettingsInspector.addSettingsField("WorldEditor/startupMode", "Startup Mode", "list", "", "Blank Level,Last Open Level"); + SettingsInspector.endGroup(); + SettingsInspector.startGroup("Render"); SettingsInspector.addSettingsField("WorldEditor/Render/renderObjHandle", "Object Icons", "bool", ""); SettingsInspector.addSettingsField("WorldEditor/Render/renderObjText", "Object Text", "bool", ""); diff --git a/Templates/BaseGame/game/tools/main.cs b/Templates/BaseGame/game/tools/main.cs index ab37d4f7b..8556c493d 100644 --- a/Templates/BaseGame/game/tools/main.cs +++ b/Templates/BaseGame/game/tools/main.cs @@ -273,8 +273,26 @@ function fastLoadWorldEdit(%val) if( !$missionRunning ) { // Flag saying, when level is chosen, launch it with the editor open. - ChooseLevelDlg.launchInEditor = true; - Canvas.pushDialog( ChooseLevelDlg ); + %defaultLevelFile = EditorSettings.value( "WorldEditor/newLevelFile" ); + + %startupMode = EditorSettings.value("WorldEditor/startupMode", "Blank Level"); + if(%startupMode $= "Blank Level") + { + EditorNewLevel(%defaultLevelFile); + } + else if(%startupMode $= "Last Open Level") + { + %lastLevel = EditorSettings.value("WorldEditor/lastEditedLevel", ""); + + if(%lastLevel $= "") + { + EditorNewLevel(%defaultLevelFile); + } + else + { + EditorOpenMission(%lastLevel); + } + } } else { diff --git a/Templates/BaseGame/game/tools/settings.xml b/Templates/BaseGame/game/tools/settings.xml index 540f128a4..a07f63b5d 100644 --- a/Templates/BaseGame/game/tools/settings.xml +++ b/Templates/BaseGame/game/tools/settings.xml @@ -1,254 +1,257 @@ - - DefaultPlayerData - 1 - AIPlayer + + 0.1 + 1 + 1 + 45 + 1 + 180 180 180 255 + 0 0 0 100 + 135 + 1 + 0 + 0 + 1 + 255 255 255 255 + 1 + 40 40 - - 1024 768 - tools/gui/messageBoxes - - 2 - 1 - 8 - 1 - 1 - 0 - 1 - 1 - - - 1 - 1 - - - http://www.garagegames.com/products/torque-3d/documentation/user + + Modern + 50 + 0 + 6 + TTR:DasBootLevel,pbr:PbrMatTestLevel + TTR:DasBootLevel + screenCenter + 40 + AssetWork_Debug.exe + WorldEditorInspectorPlugin + Blank Level + 1 + ../../../Documentation/Official Documentation.html ../../../Documentation/Torque 3D - Script Manual.chm + http://www.garagegames.com/products/torque-3d/documentation/user + http://www.garagegames.com/products/torque-3d/forums - - 0 + + Classic - - 0 - 0 - 0 + + 1 + 1 + 1 + 1 + 1 - - Categorized + + 0.01 + 0 + 0 + 2 + 0 + 0 + 100 + 1 + 1 - - - lowerHeight - - 100 - 10 - 0.1 - 50 - 1 - 0 - 1.000000 0.833333 0.666667 0.500000 0.333333 0.166667 0.000000 - 1.000000 0.833333 0.666667 0.500000 0.333333 0.166667 0.000000 - 1 - 90 + + 255 0 0 255 + 100 100 100 255 + 0 0 255 255 + 255 255 255 255 + 255 255 0 255 + 255 255 0 255 + 0 255 0 255 - - 40 40 - 40 40 - 1 - ellipse - 1 + + 255 + 1 + 8 + 20 + 0 + + + 51 51 51 100 + 1 + 1 + 102 102 102 100 + 255 255 255 100 + + + 50 50 50 255 + 255 255 255 255 + 48 48 48 255 + 215 215 215 255 + 180 180 180 255 + + + tools/worldEditor/images/LockedHandle + tools/worldEditor/images/DefaultHandle + tools/worldEditor/images/SelectHandle + 1 + 0 0.8 100 15 0.8 0 - 1 - 0 - 0 - 1 1 1 - 0 - 1 255 255 255 20 500 + 0 + 0 + 1 1 1 + 1 - - WorldEditorInspectorPlugin - AssetWork_Debug.exe - 40 - screenCenter - 6 - 0 - 50 - Modern - 1 - - 255 255 0 255 - 255 0 0 255 - 0 255 0 255 - 100 100 100 255 - 255 255 0 255 - 255 255 255 255 - 0 0 255 255 - - - 1 - 102 102 102 100 - 51 51 51 100 - 1 - 255 255 255 100 - - - 180 180 180 255 - 48 48 48 255 - 50 50 50 255 - 215 215 215 255 - 255 255 255 255 - - - http://www.garagegames.com/products/torque-3d/documentation/user - ../../../Documentation/Torque 3D - Script Manual.chm - ../../../Documentation/Official Documentation.html - http://www.garagegames.com/products/torque-3d/forums - - - 1 - 1 - 1 - 1 - 1 - - - 0 - 20 - 8 - 1 - 255 - - - tools/worldEditor/images/SelectHandle - tools/worldEditor/images/DefaultHandle - tools/worldEditor/images/LockedHandle - - - 0.01 - 0 - 0 - 1 - 2 - 0 - 1 - 0 - 100 - - - Classic - - - - 135 - 0.1 - 1 - 1 - 0 - 45 - 1 - 1 - 255 255 255 255 - 0 0 0 100 - 40 40 - 1 - 0 - 180 180 180 255 - 1 - - - Grid_512_Orange - - - 10 - 0 255 0 255 - DefaultRoadMaterialOther - 255 0 0 255 - DefaultRoadMaterialTop - 0 0 1 + + DefaultPlayerData + AIPlayer + 1 - TestConfig - <AssetType>/ - <AssetType>/<SpecialAssetTag>/ - <AssetType>/<SpecialAssetTag>/ - <AssetType>/ + <AssetType>/ <AssetType>/<AssetName>/ - <AssetType>/ + <AssetType>/ + <AssetType>/ <AssetType>/ 1 - <AssetType>/ + <AssetType>/ <AssetType>/OtherFolder/ + TestConfig + <AssetType>/<SpecialAssetTag>/ + <AssetType>/<SpecialAssetTag>/ + + + 0 0 1 + 255 0 0 255 + 10 + DefaultRoadMaterialOther + 0 255 0 255 + DefaultRoadMaterialTop + + + lowerHeight + + 1.000000 0.833333 0.666667 0.500000 0.333333 0.166667 0.000000 + 10 + 90 + 1 + 1 + 1.000000 0.833333 0.666667 0.500000 0.333333 0.166667 0.000000 + 50 + 0 + 100 + 0.1 + + + 40 40 + 1 + 1 + 40 40 + ellipse + 5 - 255 255 255 255 - 10 0 255 0 255 - 0 0 1 + 255 255 255 255 255 0 0 255 - - - Small - - - 255 255 255 255 - 0 255 0 255 - DefaultDecalRoadMaterial + 0 0 1 10 - - data/FPSGameplay/levels - - - 25 - - - 5 - - - - - 234 232 230 255 - 255 255 255 255 - 77 77 77 255 - 50 49 48 255 - 43 43 43 255 - 100 98 96 255 - 59 58 57 255 - 50 49 48 255 - 236 234 232 255 - 72 70 68 255 - 32 31 30 255 - 17 16 15 255 - 50 49 48 255 - 72 70 68 255 - 37 36 35 255 - 255 255 255 255 - 96 94 92 255 - 178 175 172 255 - 59 58 57 255 - - TestConfig 1 + TestConfig small + + 236 234 232 255 + 59 58 57 255 + 32 31 30 255 + 50 49 48 255 + 178 175 172 255 + 255 255 255 255 + 43 43 43 255 + 37 36 35 255 + 59 58 57 255 + 72 70 68 255 + 77 77 77 255 + 50 49 48 255 + 17 16 15 255 + 72 70 68 255 + 50 49 48 255 + 234 232 230 255 + 100 98 96 255 + 96 94 92 255 + 255 255 255 255 + + + tools/gui/messageBoxes + 1024 768 + + ../../../Documentation/Torque 3D - Script Manual.chm + ../../../Documentation/Official Documentation.html + http://www.garagegames.com/products/torque-3d/documentation/user + + + 1 + 1 + 1 + 1 + 2 + 0 + 8 + 1 + + + 1 + 1 + + + 0 + + + 0 + 0 + 0 + + + Categorized + + + + data/FPSGameplay/levels + + + 5 + + + 25 + + + + + 10 + 0 255 0 255 + 255 255 255 255 + DefaultDecalRoadMaterial + + + Grid_512_Orange + 1 + + Small + diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.cs b/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.cs index c78b6743f..5e3734fa5 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.cs +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.cs @@ -1439,21 +1439,21 @@ function EWorldEditorAlignPopup::onSelect(%this, %id, %text) function EWorldEditor::onResize(%this, %newPosition, %newExtent) { - //if(EditorSettings.value( "WorldEditor/forceSidebarToSide" ) == 1) - //{ + if(EditorSettings.value( "WorldEditor/forceSidebarToSide" ) == 1) + { %treePos = %this.extent.x - (%this.extent.x * 0.2) SPC EditorGuiToolbar.extent.y; %treeExt = %this.extent.x * 0.2 SPC (%this.extent.y * 0.5) - EditorGuiToolbar.extent.y - EditorGuiStatusBar.extent.y - 25; EWTreeWindow.resize(%treePos.x, %treePos.y, %treeExt.x, %treeExt.y); - //} + } - //if(EditorSettings.value( "WorldEditor/forceSidebarToSide" ) == 1) - //{ + if(EditorSettings.value( "WorldEditor/forceSidebarToSide" ) == 1) + { %inspPos = EWTreeWindow.position.x SPC EWTreeWindow.position.y + EWTreeWindow.extent.y; %inspExt = EWTreeWindow.extent.x SPC %this.extent.y - EWTreeWindow.extent.y - (EditorGuiStatusBar.extent.y * 2); EWInspectorWindow.resize(%inspPos.x, %inspPos.y, %inspExt.x, %inspExt.y); - //} + } } //----------------------------------------------------------------------------- diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/menuHandlers.ed.cs b/Templates/BaseGame/game/tools/worldEditor/scripts/menuHandlers.ed.cs index 221af7944..6af3718d4 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/menuHandlers.ed.cs +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/menuHandlers.ed.cs @@ -225,7 +225,7 @@ function EditorNewLevel( %file ) if( !$missionRunning ) { activatePackage( "BootEditor" ); - StartLevel( %file ); + StartGame( %file ); } else EditorOpenMission(%file); @@ -356,16 +356,47 @@ function EditorOpenMission(%levelAsset) else { //If we got the actual assetdef, just roll with it + %levelAssetId = ""; if(isObject(%levelAsset)) { %assetDef = %levelAsset; + %levelAssetId = %assetDef.getAssetId(); } else { //parse it out if its %assetDef = AssetDatabase.acquireAsset(%levelAsset); + %levelAssetId = %levelAsset; } + EditorSettings.setValue("WorldEditor/lastEditedLevel", %levelAssetId); + + //update the recent levels list + %recentLevels = EditorSettings.value("WorldEditor/recentLevelsList"); + %recentCount = getTokenCount(%recentLevels, ","); + + %updatedRecentList = %levelAssetId; + + %updatedRecentCount = 1; + for(%i=0; %i < %recentCount; %i++) + { + %recentEntry = getToken(%recentLevels, ",", %i); + + if(%levelAssetId $= %recentEntry) + continue; + + %updatedRecentList = %updatedRecentList @ "," @ %recentEntry; + + %updatedRecentCount++; + + if(%updatedRecentCount == 10) + break; + } + + EditorSettings.setValue("WorldEditor/recentLevelsList", %updatedRecentList); + + updateRecentLevelsListing(); + %filename = %assetDef.levelFile; if(%filename $= "") @@ -387,7 +418,7 @@ function EditorOpenMission(%levelAsset) if( !$missionRunning ) { activatePackage( "BootEditor" ); - StartLevel( %filename ); + StartGame( %filename ); } else { @@ -571,6 +602,22 @@ function EditorUnmount() %obj.unmount(); } +//------------------------------------------------------------------------ +function updateRecentLevelsListing() +{ + RecentLevelsPopupMenu.clearItems(); + + %recentLevels = EditorSettings.value("WorldEditor/recentLevelsList"); + %recentCount = getTokenCount(%recentLevels, ","); + + for(%i=0; %i < %recentCount; %i++) + { + %recentEntry = getToken(%recentLevels, ",", %i); + + RecentLevelsPopupMenu.insertItem(%i, %recentEntry, "", "schedule(1,0, \"EditorOpenMission\", " @ %recentEntry @ ");"); + } +} + ////////////////////////////////////////////////////////////////////////// // View Menu Handlers ////////////////////////////////////////////////////////////////////////// @@ -632,8 +679,6 @@ function EditorMenuEditPaste() EditorGui.currentEditor.handlePaste(); } - - ////////////////////////////////////////////////////////////////////////// // Window Menu Handler ////////////////////////////////////////////////////////////////////////// diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/menus.ed.cs b/Templates/BaseGame/game/tools/worldEditor/scripts/menus.ed.cs index 5850fa46c..fcc2887d9 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/menus.ed.cs +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/menus.ed.cs @@ -119,6 +119,12 @@ function EditorGui::buildMenus(%this) profile = "ToolsGuiMenuBarProfile"; }; + %recentLevelsMenu = new PopupMenu(RecentLevelsPopupMenu) + { + superClass = "MenuBuilder"; + class = "EditorFileMenu"; + }; + // File Menu %fileMenu = new PopupMenu() { @@ -127,10 +133,11 @@ function EditorGui::buildMenus(%this) barTitle = "File"; }; - %fileMenu.appendItem("New Level" TAB "" TAB "schedule( 1, 0, \"EditorNewLevel\" );"); %fileMenu.appendItem("Open Level..." TAB %cmdCtrl SPC "O" TAB "schedule( 1, 0, \"EditorOpenMission\" );"); + %fileMenu.appendItem("Open Recent" TAB RecentLevelsPopupMenu); + %fileMenu.appendItem("-"); %fileMenu.appendItem("Save Level" TAB %cmdCtrl SPC "S" TAB "EditorSaveMissionMenu();"); %fileMenu.appendItem("Save Level As..." TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"LevelAsset\", AssetBrowser.selectedModule, \"EditorSaveMissionAs\");"); %fileMenu.appendItem("-"); @@ -164,6 +171,9 @@ function EditorGui::buildMenus(%this) %this.menuBar.insert(%fileMenu); + //Update the recent levels listing + updateRecentLevelsListing(); + // Edit Menu %editMenu = new PopupMenu() {