diff --git a/Engine/source/gui/buttons/guiBitmapButtonCtrl.cpp b/Engine/source/gui/buttons/guiBitmapButtonCtrl.cpp index 65672f4e6..c4b059ce8 100644 --- a/Engine/source/gui/buttons/guiBitmapButtonCtrl.cpp +++ b/Engine/source/gui/buttons/guiBitmapButtonCtrl.cpp @@ -138,10 +138,15 @@ void GuiBitmapButtonCtrl::initPersistFields() { addGroup( "Bitmap" ); - INITPERSISTFIELD_IMAGEASSET(Bitmap, GuiBitmapButtonCtrl, "Texture file to display on this button.\n" + addProtectedField("Bitmap", TypeImageFilename, Offset(mBitmapName, GuiBitmapButtonCtrl), _setBitmapFieldData, &defaultProtectedGetFn, "Texture file to display on this button.\n" + "If useStates is false, this will be the file that renders on the control. Otherwise, this will " + "specify the default texture name to which the various state and modifier suffixes are appended " + "to find the per-state and per-modifier (if enabled) textures.", AbstractClassRep::FIELD_HideInInspectors); \ + addProtectedField("BitmapAsset", TypeImageAssetId, Offset(mBitmapAssetId, GuiBitmapButtonCtrl), _setBitmapFieldData, &defaultProtectedGetFn, "Texture file to display on this button.\n" "If useStates is false, this will be the file that renders on the control. Otherwise, this will " "specify the default texture name to which the various state and modifier suffixes are appended " "to find the per-state and per-modifier (if enabled) textures."); + addField("color", TypeColorI, Offset(mColor, GuiBitmapButtonCtrl), "color mul"); addField( "bitmapMode", TYPEID< BitmapMode >(), Offset( mBitmapMode, GuiBitmapButtonCtrl ), diff --git a/Engine/source/gui/buttons/guiBitmapButtonCtrl.h b/Engine/source/gui/buttons/guiBitmapButtonCtrl.h index 910ff2400..e605b15b1 100644 --- a/Engine/source/gui/buttons/guiBitmapButtonCtrl.h +++ b/Engine/source/gui/buttons/guiBitmapButtonCtrl.h @@ -185,6 +185,14 @@ class GuiBitmapButtonCtrl : public GuiButtonCtrl DECLARE_CONOBJECT(GuiBitmapButtonCtrl); DECLARE_DESCRIPTION( "A button control rendered entirely from bitmaps.\n" "The individual button states are represented with separate bitmaps." ); + + //Basically a wrapper function to do our special state handling setup when the fields change + static bool _setBitmapFieldData(void* obj, const char* index, const char* data) + { + GuiBitmapButtonCtrl* object = static_cast(obj); + object->setBitmap(StringTable->insert(data)); + return false; + } }; typedef GuiBitmapButtonCtrl::BitmapMode GuiBitmapMode; diff --git a/Engine/source/gui/containers/guiWindowCtrl.cpp b/Engine/source/gui/containers/guiWindowCtrl.cpp index 74a155b9b..ddd11bd40 100644 --- a/Engine/source/gui/containers/guiWindowCtrl.cpp +++ b/Engine/source/gui/containers/guiWindowCtrl.cpp @@ -66,6 +66,9 @@ IMPLEMENT_CALLBACK( GuiWindowCtrl, onCollapse, void, (), (), "Called when the window is collapsed by clicking its title bar." ); IMPLEMENT_CALLBACK( GuiWindowCtrl, onRestore, void, (), (), "Called when the window is restored from minimized, maximized, or collapsed state." ); +IMPLEMENT_CALLBACK(GuiWindowCtrl, onResize, void, (S32 posX, S32 posY, S32 width, S32 height), (0, 0, 0, 0), + "Called when the window is resized in a regular manner by mouse manipulation."); + //----------------------------------------------------------------------------- @@ -1557,6 +1560,8 @@ bool GuiWindowCtrl::resize(const Point2I &newPosition, const Point2I &newExtent) // Set the button coords positionButtons(); + onResize_callback(newPosition.x, newPosition.y, newExtent.x, newExtent.y); + return true; } diff --git a/Engine/source/gui/containers/guiWindowCtrl.h b/Engine/source/gui/containers/guiWindowCtrl.h index ef1b61751..d484973e6 100644 --- a/Engine/source/gui/containers/guiWindowCtrl.h +++ b/Engine/source/gui/containers/guiWindowCtrl.h @@ -201,6 +201,7 @@ class GuiWindowCtrl : public GuiContainer DECLARE_CALLBACK( void, onMaximize, () ); DECLARE_CALLBACK( void, onCollapse, () ); DECLARE_CALLBACK( void, onRestore, () ); + DECLARE_CALLBACK(void, onResize, (S32 posX, S32 posY, S32 width, S32 height)); /// @} diff --git a/Engine/source/gui/controls/guiGameSettingsCtrl.cpp b/Engine/source/gui/controls/guiGameSettingsCtrl.cpp index 1b6516e4a..f608ea83f 100644 --- a/Engine/source/gui/controls/guiGameSettingsCtrl.cpp +++ b/Engine/source/gui/controls/guiGameSettingsCtrl.cpp @@ -740,7 +740,7 @@ void GuiGameSettingsCtrl::changeOption(S32 delta) if (mScriptCallback != NULL && (mSelectedOption != NO_OPTION && mMode != GuiGameSettingsCtrl::Slider)) { setThisControl(); - StringTableEntry direction = NULL; + StringTableEntry direction = StringTable->EmptyString(); if (delta < 0) { direction = LEFT; @@ -749,7 +749,7 @@ void GuiGameSettingsCtrl::changeOption(S32 delta) { direction = RIGHT; } - if ((direction != NULL) && (Con::isFunction(mScriptCallback))) + if ((direction != StringTable->EmptyString()) && (Con::isFunction(mScriptCallback))) { Con::executef(mScriptCallback, direction); } @@ -849,6 +849,16 @@ void GuiGameSettingsCtrl::setValue(F32 value) mValue = value; } +F32 GuiGameSettingsCtrl::getIncrement() +{ + return mStepSize; +} + +Point2F GuiGameSettingsCtrl::getRange() +{ + return mRange; +} + const char* GuiGameSettingsCtrl::getTooltip() { return mTooltip; @@ -1100,22 +1110,31 @@ DefineEngineMethod(GuiGameSettingsCtrl, addOption, void, (const char* displayTex } DefineEngineMethod(GuiGameSettingsCtrl, getValue, F32, (), , - "Sets the list of options on the given control.\n\n" - "@param optionsList A tab separated list of options for the control.") + "Gets the value of the slider on the given control.") { return object->getValue(); } DefineEngineMethod(GuiGameSettingsCtrl, setValue, void, (F32 value), , - "Sets the list of options on the given control.\n\n" - "@param optionsList A tab separated list of options for the control.") + "Sets the value of the slider on the given control.") { object->setValue(value); } +DefineEngineMethod(GuiGameSettingsCtrl, getIncrement, F32, (), , + "Gets the increment amount of the slider on a given control.") +{ + return object->getIncrement(); +} + +DefineEngineMethod(GuiGameSettingsCtrl, getRange, Point2F, (), , + "Gets the min and max values for the range of the slider on a given control.") +{ + return object->getRange(); +} + DefineEngineMethod(GuiGameSettingsCtrl, getTooltip, const char*, (), , - "Sets the list of options on the given control.\n\n" - "@param optionsList A tab separated list of options for the control.") + "Gets the tooltip on the given control.") { return object->getTooltip(); } diff --git a/Engine/source/gui/controls/guiGameSettingsCtrl.h b/Engine/source/gui/controls/guiGameSettingsCtrl.h index d8aac95e8..86a3465f1 100644 --- a/Engine/source/gui/controls/guiGameSettingsCtrl.h +++ b/Engine/source/gui/controls/guiGameSettingsCtrl.h @@ -214,6 +214,16 @@ public: Mode getMode() { return mMode; } + /// + /// Gets the incremenet amount + /// + F32 getIncrement(); + + /// + /// Gets range of values allowed + /// + Point2F getRange(); + /// Gets the tooltip const char* getTooltip(); diff --git a/Templates/BaseGame/game/core/gameObjects/shapes/Camera.asset.taml b/Templates/BaseGame/game/core/gameObjects/shapes/Camera.asset.taml deleted file mode 100644 index 0f15637ff..000000000 --- a/Templates/BaseGame/game/core/gameObjects/shapes/Camera.asset.taml +++ /dev/null @@ -1 +0,0 @@ - constuctorFileName="@assetFile=camera.tscript" /> diff --git a/Templates/BaseGame/game/core/gui/scripts/canvas.tscript b/Templates/BaseGame/game/core/gui/scripts/canvas.tscript index 5a22d909a..94dde1d84 100644 --- a/Templates/BaseGame/game/core/gui/scripts/canvas.tscript +++ b/Templates/BaseGame/game/core/gui/scripts/canvas.tscript @@ -115,7 +115,7 @@ function configureCanvas() "--Screen Mode : " @ %fsLabel NL "--Bits Per Pixel : " @ %bpp NL "--Refresh Rate : " @ %rate NL - "--FSAA Level : " @ %aa NL + "--FXAA Level : " @ %aa NL "--------------"); // Actually set the new video mode diff --git a/Templates/BaseGame/game/core/postFX/scripts/DepthOfField/DepthOfFieldPostFX.tscript b/Templates/BaseGame/game/core/postFX/scripts/DepthOfField/DepthOfFieldPostFX.tscript index 29e1bb117..74feb289d 100644 --- a/Templates/BaseGame/game/core/postFX/scripts/DepthOfField/DepthOfFieldPostFX.tscript +++ b/Templates/BaseGame/game/core/postFX/scripts/DepthOfField/DepthOfFieldPostFX.tscript @@ -474,7 +474,7 @@ function DepthOfFieldPostFX::populatePostFXSettings(%this) function PostEffectEditorInspector::toggleDepthOfFieldPostFX(%this) { - if($PostFX::DepthOfFieldPostFX::Enabled) + if($PostFX::DepthOfFieldPostFX::Enabled && $pref::PostFX::EnableDOF) DepthOfFieldPostFX.enable(); else DepthOfFieldPostFX.disable(); @@ -482,7 +482,7 @@ function PostEffectEditorInspector::toggleDepthOfFieldPostFX(%this) function DepthOfFieldPostFX::applyFromPreset(%this) { - if($PostFX::DepthOfFieldPostFX::Enabled) + if($PostFX::DepthOfFieldPostFX::Enabled && $pref::PostFX::EnableDOF) DepthOfFieldPostFX.enable(); else DepthOfFieldPostFX.disable(); diff --git a/Templates/BaseGame/game/core/postFX/scripts/LightRays/lightRays.tscript b/Templates/BaseGame/game/core/postFX/scripts/LightRays/lightRays.tscript index 9d029b9b0..b6d34da3b 100644 --- a/Templates/BaseGame/game/core/postFX/scripts/LightRays/lightRays.tscript +++ b/Templates/BaseGame/game/core/postFX/scripts/LightRays/lightRays.tscript @@ -126,7 +126,7 @@ function LightRayPostFX::populatePostFXSettings(%this) function PostEffectEditorInspector::toggleLightRayPostFX(%this) { - if($PostFX::LightRayPostFX::Enabled) + if($PostFX::LightRayPostFX::Enabled && $pref::PostFX::EnableLightRays) LightRayPostFX.enable(); else LightRayPostFX.disable(); @@ -134,7 +134,7 @@ function PostEffectEditorInspector::toggleLightRayPostFX(%this) function LightRayPostFX::applyFromPreset(%this) { - if($PostFX::LightRayPostFX::Enabled) + if($PostFX::LightRayPostFX::Enabled && $pref::PostFX::EnableLightRays) %this.enable(); else %this.disable(); diff --git a/Templates/BaseGame/game/core/postFX/scripts/SSAO/SSAOPostFx.tscript b/Templates/BaseGame/game/core/postFX/scripts/SSAO/SSAOPostFx.tscript index 8c95bff7a..c9a5bec3c 100644 --- a/Templates/BaseGame/game/core/postFX/scripts/SSAO/SSAOPostFx.tscript +++ b/Templates/BaseGame/game/core/postFX/scripts/SSAO/SSAOPostFx.tscript @@ -165,7 +165,7 @@ function SSAOPostFx::populatePostFXSettings(%this) function PostEffectEditorInspector::toggleSSAOPostFx(%this) { - if($PostFX::SSAOPostFx::Enabled) + if($PostFX::SSAOPostFx::Enabled && $pref::PostFX::EnableSSAO) SSAOPostFx.enable(); else SSAOPostFx.disable(); @@ -173,7 +173,7 @@ function PostEffectEditorInspector::toggleSSAOPostFx(%this) function SSAOPostFx::applyFromPreset(%this) { - if($PostFXManager::PostFX::Enable) + if($PostFXManager::PostFX::Enable && $pref::PostFX::EnableSSAO) %this.enable(); else %this.disable(); diff --git a/Templates/BaseGame/game/core/postFX/scripts/Vignette/VignettePostFX.tscript b/Templates/BaseGame/game/core/postFX/scripts/Vignette/VignettePostFX.tscript index 014dc6524..414a3d2ef 100644 --- a/Templates/BaseGame/game/core/postFX/scripts/Vignette/VignettePostFX.tscript +++ b/Templates/BaseGame/game/core/postFX/scripts/Vignette/VignettePostFX.tscript @@ -91,7 +91,7 @@ function VignettePostFX::populatePostFXSettings(%this) //Allow us to easily toggle the postFX and have it respond immediately function PostEffectEditorInspector::toggleVignettePostFX(%this) { - if($PostFX::VignettePostFX::Enabled) + if($PostFX::VignettePostFX::Enabled && $pref::PostFX::EnableVignette) VignettePostFX.enable(); else VignettePostFX.disable(); @@ -102,7 +102,7 @@ function PostEffectEditorInspector::toggleVignettePostFX(%this) //when rendering. This allows us to modify things but still leave room for reverting or temporarily applying them function VignettePostFX::applyFromPreset(%this) { - if($PostFX::VignettePostFX::Enabled) + if($PostFX::VignettePostFX::Enabled && $pref::PostFX::EnableVignette) %this.enable(); else %this.disable(); diff --git a/Templates/BaseGame/game/core/rendering/Core_Rendering.tscript b/Templates/BaseGame/game/core/rendering/Core_Rendering.tscript index eb18dfe8a..ae6168dea 100644 --- a/Templates/BaseGame/game/core/rendering/Core_Rendering.tscript +++ b/Templates/BaseGame/game/core/rendering/Core_Rendering.tscript @@ -56,11 +56,11 @@ function Core_Rendering::initClient(%this) %prefPath = getPrefpath(); if ( isFile( %prefPath @ "/clientPrefs." @ $TorqueScriptFileExtension ) ) exec( %prefPath @ "/clientPrefs." @ $TorqueScriptFileExtension ); + + postFXInit(); configureCanvas(); - postFXInit(); - //Autodetect settings if it's our first time if($pref::Video::autoDetect) AutodetectGraphics(); diff --git a/Templates/BaseGame/game/core/rendering/materials/moon_noglow.asset.taml b/Templates/BaseGame/game/core/rendering/materials/moon_noglow.asset.taml index 76e9d5d00..b4a853da4 100644 --- a/Templates/BaseGame/game/core/rendering/materials/moon_noglow.asset.taml +++ b/Templates/BaseGame/game/core/rendering/materials/moon_noglow.asset.taml @@ -12,7 +12,7 @@ + vertColor="1"/> \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/materials/moon_noglow.tscript b/Templates/BaseGame/game/core/rendering/materials/moon_noglow.tscript deleted file mode 100644 index b9e69c0da..000000000 --- a/Templates/BaseGame/game/core/rendering/materials/moon_noglow.tscript +++ /dev/null @@ -1,9 +0,0 @@ -//--- OBJECT WRITE BEGIN --- -singleton Material(moon_noglow) { - mapTo="moon_noglow"; - DiffuseMapAsset = "Core_Rendering:moon_noglow_image"; - emissive = true; - translucent = true; - vertColor[ 0 ] = true; -}; -//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/core/rendering/materials/moon_noglowMat.asset.taml b/Templates/BaseGame/game/core/rendering/materials/moon_noglowMat.asset.taml deleted file mode 100644 index afb79ab61..000000000 --- a/Templates/BaseGame/game/core/rendering/materials/moon_noglowMat.asset.taml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/materials/moon_wcorona.asset.taml b/Templates/BaseGame/game/core/rendering/materials/moon_wcorona.asset.taml index d3b29de39..28589fb99 100644 --- a/Templates/BaseGame/game/core/rendering/materials/moon_wcorona.asset.taml +++ b/Templates/BaseGame/game/core/rendering/materials/moon_wcorona.asset.taml @@ -1,7 +1,7 @@ + vertColor="1"/> \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/materials/moon_wglow.tscript b/Templates/BaseGame/game/core/rendering/materials/moon_wglow.tscript deleted file mode 100644 index ad87ba5a3..000000000 --- a/Templates/BaseGame/game/core/rendering/materials/moon_wglow.tscript +++ /dev/null @@ -1,9 +0,0 @@ -//--- OBJECT WRITE BEGIN --- -singleton Material(moon_wglow) { - mapTo="moon_wglow"; - DiffuseMapAsset = "Core_Rendering:moon_wglow_image"; - emissive = true; - translucent = true; - vertColor[ 0 ] = true; -}; -//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/core/rendering/materials/moon_wglowMat.asset.taml b/Templates/BaseGame/game/core/rendering/materials/moon_wglowMat.asset.taml deleted file mode 100644 index afb79ab61..000000000 --- a/Templates/BaseGame/game/core/rendering/materials/moon_wglowMat.asset.taml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shapes/noShapeMat.asset.taml b/Templates/BaseGame/game/core/rendering/shapes/noShapeMat.asset.taml index 0a2fb3cb1..d9d9b75e7 100644 --- a/Templates/BaseGame/game/core/rendering/shapes/noShapeMat.asset.taml +++ b/Templates/BaseGame/game/core/rendering/shapes/noShapeMat.asset.taml @@ -7,7 +7,7 @@ diff --git a/Templates/BaseGame/game/data/UI/guis/optionsMenu.gui b/Templates/BaseGame/game/data/UI/guis/optionsMenu.gui index a8fc2fb1e..84c70072f 100644 --- a/Templates/BaseGame/game/data/UI/guis/optionsMenu.gui +++ b/Templates/BaseGame/game/data/UI/guis/optionsMenu.gui @@ -1,296 +1,160 @@ //--- OBJECT WRITE BEGIN --- $guiContent = new GuiControl(OptionsMenu) { - position = "0 0"; extent = "1024 768"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; isContainer = "1"; - canSave = "1"; canSaveDynamicFields = "1"; + currentCategory = "Display"; + optionsCategories = "17177"; pageTabIndex = "0"; returnGui = "MainMenuGui"; tamlReader = "20088"; tile = "0"; + unappliedChanges = "17178"; useVariable = "0"; new GuiControl() { position = "48 56"; extent = "928 655"; - minExtent = "8 2"; horizSizing = "aspectCenter"; vertSizing = "center"; profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; new GuiBitmapBarCtrl() { - percent = "100"; - vertical = "0"; - flipClip = "0"; BitmapAsset = "UI:panel_low_image"; - color = "255 255 255 255"; position = "0 40"; extent = "927 618"; - minExtent = "8 2"; horizSizing = "width"; - vertSizing = "bottom"; profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiBitmapBarCtrl() { - percent = "100"; - vertical = "0"; - flipClip = "0"; BitmapAsset = "UI:panel_image"; - color = "255 255 255 255"; - position = "0 0"; extent = "927 40"; - minExtent = "8 2"; horizSizing = "width"; - vertSizing = "bottom"; profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiTextCtrl() { text = "OPTIONS"; - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; position = "22 7"; extent = "120 28"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "MenuHeaderText"; - visible = "1"; - active = "1"; tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiTextCtrl(OptionName) { - maxLength = "1024"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; position = "3 606"; extent = "293 17"; - minExtent = "8 2"; horizSizing = "width"; - vertSizing = "bottom"; profile = "MenuSubHeaderText"; - visible = "1"; - active = "1"; tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiMLTextCtrl(OptionDescription) { - lineSpacing = "2"; - allowColorChars = "0"; - maxChars = "-1"; text = "This is a placeholder text for an option."; - useURLMouseCursor = "0"; position = "3 625"; extent = "293 14"; - minExtent = "8 2"; horizSizing = "width"; - vertSizing = "bottom"; profile = "GuiMLTextProfile"; - visible = "1"; - active = "1"; tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; }; new GuiSplitContainer() { - orientation = "Vertical"; - splitterSize = "2"; splitPoint = "250 100"; fixedPanel = "FirstPanel"; fixedSize = "250"; - docking = "None"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; position = "0 48"; extent = "928 555"; - minExtent = "64 64"; horizSizing = "width"; - vertSizing = "bottom"; profile = "GuiMenuScrollProfile"; - visible = "1"; - active = "1"; tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; new GuiPanel() { docking = "Client"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "0 0"; extent = "248 555"; - minExtent = "16 16"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "GuiOverlayProfile"; - visible = "1"; - active = "1"; tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; internalName = "Panel1"; - canSave = "1"; - canSaveDynamicFields = "0"; new GuiStackControl(OptionsMenuCategoryList) { - stackingType = "Vertical"; - horizStacking = "Left to Right"; - vertStacking = "Top to Bottom"; padding = "10"; dynamicSize = "0"; - dynamicNonStackExtent = "0"; - dynamicPos = "0"; - changeChildSizeToFit = "1"; - changeChildPosition = "1"; - position = "0 0"; extent = "248 555"; - minExtent = "16 16"; horizSizing = "width"; vertSizing = "height"; profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; class = "MenuList"; - canSave = "1"; - canSaveDynamicFields = "0"; + + new GuiButtonCtrl() { + text = "Display"; + extent = "248 35"; + profile = "GuiMenuButtonProfile"; + command = "populateDisplaySettingsList();"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiButtonCtrl() { + text = "Graphics"; + position = "0 45"; + extent = "248 35"; + profile = "GuiMenuButtonProfile"; + command = "populateGraphicsSettingsList();"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiButtonCtrl() { + text = "Audio"; + position = "0 90"; + extent = "248 35"; + profile = "GuiMenuButtonProfile"; + command = "populateAudioSettingsList();"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiButtonCtrl() { + text = "Keyboard & Mouse"; + position = "0 135"; + extent = "248 35"; + profile = "GuiMenuButtonProfile"; + command = "populateKeyboardMouseSettingsList();"; + tooltipProfile = "GuiToolTipProfile"; + }; + new GuiButtonCtrl() { + text = "Gamepad"; + position = "0 180"; + extent = "248 35"; + profile = "GuiMenuButtonProfile"; + command = "populateGamepadSettingsList();"; + tooltipProfile = "GuiToolTipProfile"; + }; }; }; new GuiPanel() { docking = "Client"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; position = "252 0"; extent = "676 555"; - minExtent = "16 16"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "GuiOverlayProfile"; - visible = "1"; - active = "1"; tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; internalName = "panel2"; - canSave = "1"; - canSaveDynamicFields = "0"; new GuiScrollCtrl() { - willFirstRespond = "1"; hScrollBar = "alwaysOff"; vScrollBar = "dynamic"; - lockHorizScroll = "0"; - lockVertScroll = "0"; - constantThumbHeight = "0"; - childMargin = "0 0"; - mouseWheelScrollSpeed = "-1"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "0 0"; extent = "676 554"; - minExtent = "8 2"; horizSizing = "width"; vertSizing = "height"; profile = "GuiMenuScrollProfile"; - visible = "1"; - active = "1"; tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; new GuiStackControl(OptionsMenuSettingsList) { - stackingType = "Vertical"; - horizStacking = "Left to Right"; - vertStacking = "Top to Bottom"; padding = "5"; - dynamicSize = "1"; - dynamicNonStackExtent = "0"; - dynamicPos = "0"; changeChildSizeToFit = "0"; - changeChildPosition = "1"; position = "1 1"; extent = "661 30"; - minExtent = "16 16"; horizSizing = "width"; vertSizing = "height"; profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; class = "MenuList"; - canSave = "1"; - canSaveDynamicFields = "0"; }; }; }; @@ -299,130 +163,67 @@ $guiContent = new GuiControl(OptionsMenu) { new GuiControl(OptionsButtonHolder) { position = "116 711"; extent = "791 40"; - minExtent = "8 2"; horizSizing = "center"; vertSizing = "top"; profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; isContainer = "1"; class = "MenuInputButtonContainer"; - canSave = "1"; - canSaveDynamicFields = "0"; new GuiIconButtonCtrl() { - buttonMargin = "4 4"; - BitmapAsset = "UI:Keyboard_Black_Return_image"; - iconLocation = "Left"; - sizeIconToButton = "1"; - makeIconSquare = "1"; - textLocation = "Right"; - textMargin = "4"; - autoSize = "0"; - text = "Apply"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "507 0"; - extent = "140 40"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiMenuButtonProfile"; - visible = "1"; - active = "1"; - command = "OptionsMenu.apply();"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - internalName = "applyButton"; - class = "MenuInputButton"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiIconButtonCtrl() { - buttonMargin = "4 4"; - BitmapAsset = "UI:Keyboard_Black_Escape_image"; - iconLocation = "Left"; - sizeIconToButton = "1"; - makeIconSquare = "1"; - textLocation = "Right"; - textMargin = "4"; - autoSize = "0"; - text = "Back"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "651 0"; - extent = "140 40"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiMenuButtonProfile"; - visible = "1"; - active = "1"; - command = "OptionsMenu.backOut();"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - internalName = "backButton"; - class = "MenuInputButton"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiIconButtonCtrl() { - buttonMargin = "4 4"; BitmapAsset = "UI:Keyboard_Black_R_image"; - iconLocation = "Left"; sizeIconToButton = "1"; makeIconSquare = "1"; textLocation = "Right"; - textMargin = "4"; - autoSize = "0"; text = "Reset"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - position = "325 0"; + position = "173 0"; extent = "140 40"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; profile = "GuiMenuButtonProfile"; - visible = "1"; - active = "1"; command = "OptionsMenu.resetToDefaults();"; tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; internalName = "resetButton"; class = "MenuInputButton"; - canSave = "1"; - canSaveDynamicFields = "0"; + }; + new GuiIconButtonCtrl(OptionsMenuSelectButton) { + BitmapAsset = "UI:Keyboard_Black_Return_image"; + sizeIconToButton = "1"; + makeIconSquare = "1"; + textLocation = "Right"; + text = "Select"; + position = "507 0"; + extent = "140 40"; + profile = "GuiMenuButtonProfile"; + command = ""; + tooltipProfile = "GuiToolTipProfile"; + internalName = "SelectButton"; + class = "MenuInputButton"; + }; + new GuiIconButtonCtrl() { + BitmapAsset = "UI:Keyboard_Black_Escape_image"; + sizeIconToButton = "1"; + makeIconSquare = "1"; + textLocation = "Right"; + text = "Back"; + position = "651 0"; + extent = "140 40"; + profile = "GuiMenuButtonProfile"; + command = "OptionsMenu.backOut();"; + tooltipProfile = "GuiToolTipProfile"; + internalName = "backButton"; + class = "MenuInputButton"; }; }; new GuiInputCtrl(OptionsMenuInputHandler) { sendAxisEvents = "1"; sendBreakEvents = "1"; - sendModifierEvents = "0"; ignoreMouseEvents = "1"; - lockMouse = "0"; position = "-50 0"; extent = "10 10"; - minExtent = "8 2"; horizSizing = "left"; vertSizing = "top"; profile = "GuiInputCtrlProfile"; - visible = "1"; - active = "1"; tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; class = "MenuInputHandler"; - canSave = "1"; - canSaveDynamicFields = "0"; }; }; //--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/data/UI/guis/optionsMenu.tscript b/Templates/BaseGame/game/data/UI/guis/optionsMenu.tscript index 23a09236e..7f36bfc0d 100644 --- a/Templates/BaseGame/game/data/UI/guis/optionsMenu.tscript +++ b/Templates/BaseGame/game/data/UI/guis/optionsMenu.tscript @@ -55,9 +55,11 @@ function OptionsMenu::onAdd(%this) if(!isObject(%this.unappliedChanges)) { - %this.unappliedChanges = new ArrayObject(); + %this.unappliedChanges = new ArrayObject(OptionsMenuUnappliedChanges); } + %this.currentCategory = ""; + addOptionsMenuCategory("Display", "populateDisplaySettingsList();"); addOptionsMenuCategory("Graphics", "populateGraphicsSettingsList();"); addOptionsMenuCategory("Audio", "populateAudioSettingsList();"); @@ -121,12 +123,33 @@ function OptionsMenu::onWake(%this) function OptionsButtonHolder::onWake(%this) { %this-->resetButton.set("btn_back", "R", "Reset", "OptionsMenu.resetToDefaults();"); - %this-->applyButton.set("btn_start", "Return", "Apply", "OptionsMenu.apply();"); + %this-->selectButton.set("btn_a", "Return", "Select", "OptionsMenu.select();", true); %this-->backButton.set("btn_b", "Escape", "Back", "OptionsMenu.backOut();"); //OptionsMenuCategoryList.getObject(0).performClick(); } +function OptionsMenu::select(%this) +{ + if(OptionsMenuCategoryList.isActiveMenuList()) + { + OptionsMenuSettingsList.setAsActiveMenuList(); + %this.updateSelectButton(); + } +} + +function OptionsMenu::updateSelectButton(%this) +{ + if(OptionsMenuCategoryList.isActiveMenuList()) + { + %this-->selectButton.setHidden(false); + } + else if(OptionsMenuSettingsList.isActiveMenuList()) + { + %this-->selectButton.setHidden(true); + } +} + function OptionsMenu::apply(%this) { //Now we run through our list of unapplied changes and... apply them. @@ -137,7 +160,7 @@ function OptionsMenu::apply(%this) for(%i=0; %i < %this.unappliedChanges.count(); %i++) { %targetVar = %this.unappliedChanges.getKey(%i); - %newValue = %this.unappliedChanges.getValue(%i); + %newValue = strReplace(%this.unappliedChanges.getValue(%i), "\"", ""); //First, lets just check through our action map names, see if any match %wasKeybind = false; @@ -245,6 +268,9 @@ function OptionsMenu::apply(%this) export("$pref::*", %prefPath @ "/clientPrefs." @ $TorqueScriptFileExtension, false); OptionsMenu.unappliedChanges.empty(); + + //Now we can back out of the options menu + OptionsMenu.doOptionsMenuBackOut(); } function OptionsMenu::resetToDefaults(%this) @@ -252,6 +278,40 @@ function OptionsMenu::resetToDefaults(%this) MessageBoxOKCancel("", "This will set the graphical settings back to the auto-detected defaults. Do you wish to continue?", "AutodetectGraphics();", ""); } +function OptionsMenu::refresh(%this) +{ + if(%this.currentCategory !$= "") + { + %category = %this.optionsCategories.getKey(%this.currentCategory); + %command = %this.optionsCategories.getValue(%this.currentCategory); + eval(%command); + } +} + +function OptionsMenu::getOptionVariableValue(%this, %variableName) +{ + %unappliedPrefIndex = %this.unappliedChanges.getIndexFromKey(%variableName); + if(%unappliedPrefIndex != -1) + { + %value = %this.unappliedChanges.getValue(%unappliedPrefIndex); + return strreplace(%value, "\"", ""); + } + + return getVariable(%variableName); +} + +function OptionsMenuSelectButton::onVisible(%this, %state) +{ + //We're sorta cheating here. + //This button should only be displayed when we're in the categories list + //so whenever the status changes, such as automatically refreshing due to + //navigation events, we'll just do a quick check to ensure we're + //in the right visibility mode + if(%state && OptionsMenuSettingsList.isActiveMenuList()) + { + %this.setHidden(true); + } +} // // // @@ -308,17 +368,16 @@ function populateDisplaySettingsList() else OptionsMenuSettingsList.setRowEnabled(1, false); - %mode = getField($Video::ModeTags, $pref::Video::deviceMode); + %mode = OptionsMenu.getOptionVariableValue("$pref::Video::deviceMode"); + if(isInt(%mode)) + %mode = getField($Video::ModeTags, $pref::Video::deviceMode); OptionsMenuSettingsList.addOptionRow("Window Mode", "$pref::Video::deviceMode", $Video::ModeTags, false, "", true, "", %mode); - %resolutionList = getScreenResolutionList($pref::Video::deviceId, $pref::Video::deviceMode); - OptionsMenuSettingsList.addOptionRow("Resolution", "$pref::Video::Resolution", %resolutionList, false, "onDisplayResChange", true, "Resolution of the game window", _makePrettyResString( $pref::Video::mode )); - - //If they're doing borderless, the window resolution must match the display resolution if(%mode !$= "Borderless") - OptionsMenuSettingsList.setRowEnabled(3, true); - else - OptionsMenuSettingsList.setRowEnabled(3, false); + { + %resolutionList = getScreenResolutionList($pref::Video::deviceId, $pref::Video::deviceMode); + OptionsMenuSettingsList.addOptionRow("Resolution", "$pref::Video::Resolution", %resolutionList, false, "", true, "Resolution of the game window", _makePrettyResString( $pref::Video::mode )); + } OptionsMenuSettingsList.addOptionRow("VSync", "$pref::Video::disableVerticalSync", "No\tYes", false, "", true, "", convertBoolToYesNo(!$pref::Video::disableVerticalSync)); @@ -333,27 +392,6 @@ function populateDisplaySettingsList() OptionsMenuSettingsList.addSliderRow("Contrast", "", 0.5, 0.1, "0 1", ""); } -/*function OptionsMenu::applyDisplaySettings(%this) -{ - %newDevice = OptionsMenuSettingsList.getCurrentOption(0); - - // Change the device. - if ( %newDevice !$= $pref::Video::displayDevice ) - { - $pref::Video::displayDevice = %newDevice; - if( %newDevice !$= getDisplayDeviceInformation() ) - MessageBoxOK( "Change requires restart", "Please restart the game for a display device change to take effect." ); - - $changingDisplayDevice = %newDevice; - } - - updateDisplaySettings(); - - echo("Exporting client prefs"); - %prefPath = getPrefpath(); - export("$pref::*", %prefPath @ "/clientPrefs." @ $TorqueScriptFileExtension, false); -}*/ - // // // @@ -394,6 +432,20 @@ function updateDisplaySettings() //Update the display settings now %deviceName = getDisplayDeviceName(); %newDeviceID = getWord(%deviceName, 0) - 1; + + if(!isInt($pref::Video::deviceMode)) + { + //probably saved out as the mode name, so just translate it back + for(%i=0; %i < getFieldCount($Video::ModeTags); %i++) + { + if(getField($Video::ModeTags, %i) $= $pref::Video::deviceMode) + { + $pref::Video::deviceMode = %i; + break; + } + } + } + %deviceModeName = getField($Video::ModeTags, $pref::Video::deviceMode); %newDeviceMode = 0; foreach$(%modeName in $Video::ModeTags) @@ -403,6 +455,14 @@ function updateDisplaySettings() else %newDeviceMode++; } + + if($pref::Video::deviceMode == $Video::ModeBorderless) + { + //if we're changing to borderless, we swap to the full resolution of the desktop + $pref::Video::mode = Canvas.getBestCanvasRes($pref::Video::deviceId, $pref::Video::deviceMode); + + $pref::Video::Resolution = $pref::Video::mode.x SPC $pref::Video::mode.y; + } %newRes = $pref::Video::Resolution; %newBpp = 32; // ... its not 1997 anymore. @@ -448,7 +508,7 @@ function updateDisplaySettings() function updatePostFXSettings() { PostFXManager.settingsEffectSetEnabled(SSAOPostFx, $pref::PostFX::EnableSSAO); - PostFXManager.settingsEffectSetEnabled(DOFPostEffect, $pref::PostFX::EnableDOF); + PostFXManager.settingsEffectSetEnabled(DepthOfFieldPostFX, $pref::PostFX::EnableDOF); PostFXManager.settingsEffectSetEnabled(LightRayPostFX, $pref::PostFX::EnableLightRays); PostFXManager.settingsEffectSetEnabled(vignettePostFX, $pref::PostFX::EnableVignette); } @@ -583,13 +643,21 @@ function OptionsMenuList::activateRow(%this) function OptionsMenu::backOut(%this) { - if(%this.unappliedChanges.count() != 0) + if(OptionsMenuSettingsList.isActiveMenuList()) { - MessageBoxOKCancel("Discard Changes?", "You have unapplied changes to your settings, do you wish to continue?", "OptionsMenu.doOptionsMenuBackOut();", ""); + OptionsMenuCategoryList.setAsActiveMenuList(); + %this.updateSelectButton(); } else { - %this.doOptionsMenuBackOut(); + if(%this.unappliedChanges.count() != 0) + { + MessageBoxOKCancel("Discard Changes?", "You have unapplied changes to your settings, do you wish to apply or discard them?", "OptionsMenu.apply();", "OptionsMenu.doOptionsMenuBackOut();", "Apply", "Discard"); + } + else + { + %this.doOptionsMenuBackOut(); + } } } @@ -630,7 +698,7 @@ function OptionsMenuSettingsList::addOptionRow(%this, %label, %targetPrefVar, %o %enabled = true; %optionsRowSize = 30; - %optionColumnWidth = %this.extent.x - 450;//todo, calculate off longest option text? + %optionColumnWidth = %this.extent.x * 0.3;//todo, calculate off longest option text? %option = new GuiGameSettingsCtrl() { class = "MenuOptionsButton"; @@ -723,6 +791,7 @@ function OptionsMenuSettingsList::addKeybindRow(%this, %label, %bitmapName, %cal // function OptionsMenuCategoryList::onNavigate(%this, %index) { + OptionsMenu.currentCategory = %index; %this.getObject(%index).performClick(); } @@ -750,83 +819,6 @@ function convertBoolToOnOff(%val) return "Off"; } -function onDisplayModeChange(%val) -{ - // The display device (monitor) or screen mode has changed. Refill the - // resolution list with only available options. - %deviceName = OptionsMenuSettingsList.getCurrentOption(1); - %newDeviceID = getWord(%deviceName, 0) - 1; - %deviceModeName = OptionsMenuSettingsList.getCurrentOption(2); - %newDeviceMode = 0; - foreach$(%modeName in $Video::ModeTags) - { - if (%deviceModeName $= %modeName) - break; - else - %newDeviceMode++; - } - %resolutionList = getScreenResolutionList(%newDeviceID, %newDeviceMode); - - if (%newDeviceMode == $Video::ModeBorderless) - { // If we're switching to borderless, default to monitor res on Windows OS, - // monitor usable area for other platforms. - if ($platform $= "windows") - %newRes = getWords(Canvas.getMonitorRect(%newDeviceID), 2); - else - %newRes = getWords(Canvas.getMonitorUsableRect(%newDeviceID), 2); - } - else - { // Otherwise, if our old resolution is still in the list, attempt to reset it. - %oldRes = getWord(OptionsMenuSettingsList.getCurrentOption(3), 0) SPC getWord(OptionsMenuSettingsList.getCurrentOption(3), 2); - - %found = false; - %retCount = getFieldCount(%resolutionList); - for (%i = 0; %i < %retCount; %i++) - { - %existingEntry = getField(%resolutionList, %i); - if ((%existingEntry.x $= %oldRes.x) && (%existingEntry.z $= %oldRes.y)) - { - %found = true; - %newRes = %oldRes; - break; - } - } - - if (!%found) - { // Pick the best resoltion available for the device and mode - %newRes = Canvas.getBestCanvasRes(%newDeviceID, %newDeviceMode); - } - } - - if(%newDeviceMode == $Video::ModeBorderless) - OptionsMenuSettingsList.setRowEnabled(3, false); - else - OptionsMenuSettingsList.setRowEnabled(3, true); - - OptionsMenuSettingsList.setOptions(3, %resolutionList); - OptionsMenuSettingsList.selectOption(3, _makePrettyResString(%newRes)); -} - -function onDisplayResChange(%val) -{ // The resolution has changed. Setup refresh rates available at this res. - %newRes = getWord(OptionsMenuSettingsList.getCurrentOption(3), 0) SPC getWord(OptionsMenuSettingsList.getCurrentOption(3), 2); - %refreshList = getScreenRefreshList(%newRes); - - // If our old rate still exists, select it - %oldRate = OptionsMenuSettingsList.getCurrentOption(5); - %retCount = getFieldCount(%refreshList); - for (%i = 0; %i < %retCount; %i++) - { - %existingEntry = getField(%refreshList, %i); - %newRate = %existingEntry; - if (%existingEntry $= %oldRate) - break; - } - - OptionsMenuSettingsList.setOptions(5, %refreshList); - OptionsMenuSettingsList.selectOption(5, %newRate); -} - function getDisplayDeviceName() { %numDevices = Canvas.getMonitorCount(); @@ -880,10 +872,16 @@ function MenuOptionsButton::onChange(%this) %prefIndex = OptionsMenu.unappliedChanges.getIndexFromKey(%targetVar); if(%prefIndex == -1) - OptionsMenu.unappliedChanges.add(%targetVar, %saveReadyValue); + { + echo("Setting UnappliedChanges via add: key:" @ %targetVar @", value: " @ %saveReadyValue); + OptionsMenu.unappliedChanges.add(%targetVar, "\"" @ %saveReadyValue @ "\"" ); + } else - OptionsMenu.unappliedChanges.setValue(%saveReadyValue, %prefIndex); + OptionsMenu.unappliedChanges.setValue("\"" @ %saveReadyValue @ "\"", %prefIndex); } + + //Update the UI in case there's responsive logic + schedule(32, OptionsMenu, "refresh"); } function OptionsMenu::onKeybindChanged(%this, %actionMap, %keybind) diff --git a/Templates/BaseGame/game/data/UI/images/groupborder.png b/Templates/BaseGame/game/data/UI/images/group_border.png similarity index 100% rename from Templates/BaseGame/game/data/UI/images/groupborder.png rename to Templates/BaseGame/game/data/UI/images/group_border.png diff --git a/Templates/BaseGame/game/data/UI/images/group_border_image.asset.taml b/Templates/BaseGame/game/data/UI/images/group_border_image.asset.taml index 9b2972e84..47e0228bb 100644 --- a/Templates/BaseGame/game/data/UI/images/group_border_image.asset.taml +++ b/Templates/BaseGame/game/data/UI/images/group_border_image.asset.taml @@ -2,7 +2,7 @@ canSave="true" canSaveDynamicFields="true" AssetName="group_border_image" - imageFile="@assetFile=group-border.png" + imageFile="@assetFile=group_border.png" UseMips="true" isHDRImage="false" imageType="Albedo" /> diff --git a/Templates/BaseGame/game/data/UI/images/nopreview.png b/Templates/BaseGame/game/data/UI/images/no_preview.png similarity index 100% rename from Templates/BaseGame/game/data/UI/images/nopreview.png rename to Templates/BaseGame/game/data/UI/images/no_preview.png diff --git a/Templates/BaseGame/game/data/UI/images/no_preview_image.asset.taml b/Templates/BaseGame/game/data/UI/images/no_preview_image.asset.taml index 1546088dc..56778b0f1 100644 --- a/Templates/BaseGame/game/data/UI/images/no_preview_image.asset.taml +++ b/Templates/BaseGame/game/data/UI/images/no_preview_image.asset.taml @@ -2,7 +2,7 @@ canSave="true" canSaveDynamicFields="true" AssetName="no_preview_image" - imageFile="@assetFile=no-preview.png" + imageFile="@assetFile=no_preview.png" UseMips="true" isHDRImage="false" imageType="Albedo" /> diff --git a/Templates/BaseGame/game/data/UI/images/nopreview_image.asset.taml b/Templates/BaseGame/game/data/UI/images/nopreview_image.asset.taml deleted file mode 100644 index cda718e30..000000000 --- a/Templates/BaseGame/game/data/UI/images/nopreview_image.asset.taml +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/Templates/BaseGame/game/data/UI/images/selectorbutton.png b/Templates/BaseGame/game/data/UI/images/selector_button.png similarity index 100% rename from Templates/BaseGame/game/data/UI/images/selectorbutton.png rename to Templates/BaseGame/game/data/UI/images/selector_button.png diff --git a/Templates/BaseGame/game/data/UI/images/selectorbuttonblank.png b/Templates/BaseGame/game/data/UI/images/selector_button_blank.png similarity index 100% rename from Templates/BaseGame/game/data/UI/images/selectorbuttonblank.png rename to Templates/BaseGame/game/data/UI/images/selector_button_blank.png diff --git a/Templates/BaseGame/game/data/UI/images/selector_button_blank_image.asset.taml b/Templates/BaseGame/game/data/UI/images/selector_button_blank_image.asset.taml index 058b3d4c4..0306109e8 100644 --- a/Templates/BaseGame/game/data/UI/images/selector_button_blank_image.asset.taml +++ b/Templates/BaseGame/game/data/UI/images/selector_button_blank_image.asset.taml @@ -2,7 +2,7 @@ canSave="true" canSaveDynamicFields="true" AssetName="selector_button_blank_image" - imageFile="@assetFile=selector-button-blank.png" + imageFile="@assetFile=selector_button_blank.png" UseMips="true" isHDRImage="false" imageType="Albedo" /> diff --git a/Templates/BaseGame/game/data/UI/images/selectorbuttondark.png b/Templates/BaseGame/game/data/UI/images/selector_button_dark.png similarity index 100% rename from Templates/BaseGame/game/data/UI/images/selectorbuttondark.png rename to Templates/BaseGame/game/data/UI/images/selector_button_dark.png diff --git a/Templates/BaseGame/game/data/UI/images/selector_button_dark_image.asset.taml b/Templates/BaseGame/game/data/UI/images/selector_button_dark_image.asset.taml index a669fe5d6..06a05c86a 100644 --- a/Templates/BaseGame/game/data/UI/images/selector_button_dark_image.asset.taml +++ b/Templates/BaseGame/game/data/UI/images/selector_button_dark_image.asset.taml @@ -2,7 +2,7 @@ canSave="true" canSaveDynamicFields="true" AssetName="selector_button_dark_image" - imageFile="@assetFile=selector-button-dark.png" + imageFile="@assetFile=selector_button_dark.png" UseMips="true" isHDRImage="false" imageType="Albedo" /> diff --git a/Templates/BaseGame/game/data/UI/images/selectorbuttonhighlightonly.png b/Templates/BaseGame/game/data/UI/images/selector_button_highlight_only.png similarity index 100% rename from Templates/BaseGame/game/data/UI/images/selectorbuttonhighlightonly.png rename to Templates/BaseGame/game/data/UI/images/selector_button_highlight_only.png diff --git a/Templates/BaseGame/game/data/UI/images/selector_button_highlight_only_image.asset.taml b/Templates/BaseGame/game/data/UI/images/selector_button_highlight_only_image.asset.taml index 96c16617a..b3ad92ca2 100644 --- a/Templates/BaseGame/game/data/UI/images/selector_button_highlight_only_image.asset.taml +++ b/Templates/BaseGame/game/data/UI/images/selector_button_highlight_only_image.asset.taml @@ -2,7 +2,7 @@ canSave="true" canSaveDynamicFields="true" AssetName="selector_button_highlight_only_image" - imageFile="@assetFile=selector-button-highlight-only.png" + imageFile="@assetFile=selector_button_highlight_only.png" UseMips="true" isHDRImage="false" imageType="Albedo" /> diff --git a/Templates/BaseGame/game/data/UI/images/selector_button_image.asset.taml b/Templates/BaseGame/game/data/UI/images/selector_button_image.asset.taml index ffe4338e5..2ddcbb752 100644 --- a/Templates/BaseGame/game/data/UI/images/selector_button_image.asset.taml +++ b/Templates/BaseGame/game/data/UI/images/selector_button_image.asset.taml @@ -2,7 +2,7 @@ canSave="true" canSaveDynamicFields="true" AssetName="selector_button_image" - imageFile="@assetFile=selector-button.png" + imageFile="@assetFile=selector_button.png" UseMips="true" isHDRImage="false" imageType="Albedo" /> diff --git a/Templates/BaseGame/game/data/UI/images/selectorbutton_image.asset.taml b/Templates/BaseGame/game/data/UI/images/selectorbutton_image.asset.taml deleted file mode 100644 index f53884267..000000000 --- a/Templates/BaseGame/game/data/UI/images/selectorbutton_image.asset.taml +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/Templates/BaseGame/game/data/UI/images/selectorbuttonblank_image.asset.taml b/Templates/BaseGame/game/data/UI/images/selectorbuttonblank_image.asset.taml deleted file mode 100644 index c3f212a24..000000000 --- a/Templates/BaseGame/game/data/UI/images/selectorbuttonblank_image.asset.taml +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/Templates/BaseGame/game/data/UI/images/selectorbuttondark_image.asset.taml b/Templates/BaseGame/game/data/UI/images/selectorbuttondark_image.asset.taml deleted file mode 100644 index 4a24af201..000000000 --- a/Templates/BaseGame/game/data/UI/images/selectorbuttondark_image.asset.taml +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/Templates/BaseGame/game/data/UI/images/selectorbuttonhighlightonly_image.asset.taml b/Templates/BaseGame/game/data/UI/images/selectorbuttonhighlightonly_image.asset.taml deleted file mode 100644 index e359450c4..000000000 --- a/Templates/BaseGame/game/data/UI/images/selectorbuttonhighlightonly_image.asset.taml +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/Templates/BaseGame/game/data/UI/images/tabborder.png b/Templates/BaseGame/game/data/UI/images/tab_border.png similarity index 100% rename from Templates/BaseGame/game/data/UI/images/tabborder.png rename to Templates/BaseGame/game/data/UI/images/tab_border.png diff --git a/Templates/BaseGame/game/data/UI/images/tab_border_image.asset.taml b/Templates/BaseGame/game/data/UI/images/tab_border_image.asset.taml index 9d4db0d2d..c5f250a2d 100644 --- a/Templates/BaseGame/game/data/UI/images/tab_border_image.asset.taml +++ b/Templates/BaseGame/game/data/UI/images/tab_border_image.asset.taml @@ -2,7 +2,7 @@ canSave="true" canSaveDynamicFields="true" AssetName="tab_border_image" - imageFile="@assetFile=tab-border.png" + imageFile="@assetFile=tab_border.png" UseMips="true" isHDRImage="false" imageType="Albedo" /> diff --git a/Templates/BaseGame/game/data/UI/images/tabborder_image.asset.taml b/Templates/BaseGame/game/data/UI/images/tabborder_image.asset.taml deleted file mode 100644 index 0e3102520..000000000 --- a/Templates/BaseGame/game/data/UI/images/tabborder_image.asset.taml +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/Templates/BaseGame/game/data/UI/scripts/menuInputHandling.tscript b/Templates/BaseGame/game/data/UI/scripts/menuInputHandling.tscript index 074bb3675..66d6aaf39 100644 --- a/Templates/BaseGame/game/data/UI/scripts/menuInputHandling.tscript +++ b/Templates/BaseGame/game/data/UI/scripts/menuInputHandling.tscript @@ -412,6 +412,13 @@ function MenuInputHandler::onInputEvent(%this, %device, %action, %state) // Menu List processing // These functions manage the navigation and activation of the Menu Lists //============================================================================== +function MenuList::isActiveMenuList(%this) +{ + if($activeMenuList == %this) + return true; + + return false; +} function MenuList::setAsActiveMenuList(%this, %startPosition, %menuMode) { @@ -485,8 +492,6 @@ function MenuList::navigateDown(%this) function MenuList::navigateLeft() { - echo("Menu list navigated left!"); - //Atm, we're only handling specific control types, namely options entries, but //this could readily be expanded upon to handle grids like for inventory screens //or the like @@ -494,17 +499,54 @@ function MenuList::navigateLeft() %btn = $activeMenuList.getObject($activeMenuListPosition.y); if(%btn.getClassName() $= "GuiGameSettingsCtrl" && %btn.isEnabled()) { - warnf("MenuList::navigateLeft() - actioned the option" @ %btn @ " to the left"); + %mode = %btn.getMode(); + if(%mode == 0) //options list + { + %optionId = %btn.getCurrentOptionIndex() - 1; + %btn.selectOptionByIndex(%optionId); + %btn.onChange(); + } + else if(%mode == 1) //slider + { + %value = %btn.getValue(); + %adjustedValue = %value - %btn.getIncrement(); + %minValue = %btn.getRange().x; + if(%adjustedValue < %minValue) + %adjustedValue = %minValue; + + %btn.setValue(%adjustedValue); + %btn.onChange(); + } } } function MenuList::navigateRight() { - echo("Menu list navigated right!"); - %btn = $activeMenuList.getObject($activeMenuListPosition.y); if(%btn.getClassName() $= "GuiGameSettingsCtrl" && %btn.isEnabled()) { - warnf("MenuList::navigateLeft() - actioned the option" @ %btn @ " to the left"); + %mode = %btn.getMode(); + if(%mode == 0) //options list + { + %optionId = %btn.getCurrentOptionIndex() + 1; + %btn.selectOptionByIndex(%optionId); + %btn.onChange(); + } + else if(%mode == 1) //slider + { + %value = %btn.getValue(); + %adjustedValue = %value + %btn.getIncrement(); + %maxValue = %btn.getRange().y; + if(%adjustedValue > %maxValue) + %adjustedValue = %maxValue; + + %btn.setValue(%adjustedValue); + %btn.onChange(); + } } } + +function MenuList::getActiveRow(%this) +{ + return $activeMenuListPosition.y; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/data/UI/scripts/messageBoxes.tscript b/Templates/BaseGame/game/data/UI/scripts/messageBoxes.tscript index 403463695..f1c3db40e 100644 --- a/Templates/BaseGame/game/data/UI/scripts/messageBoxes.tscript +++ b/Templates/BaseGame/game/data/UI/scripts/messageBoxes.tscript @@ -116,7 +116,7 @@ function MessageBoxOKDlg::onSleep( %this ) MessageBoxCtrl.originalMenuInputContainer.setActive(); } -function MessageBoxOKCancel(%title, %message, %callback, %cancelCallback) +function MessageBoxOKCancel(%title, %message, %callback, %cancelCallback, %okLabelOverride, %cancelLabelOverride) { Canvas.pushDialog(MessageBoxDlg); MessageBoxTitleText.text = %title; @@ -125,8 +125,18 @@ function MessageBoxOKCancel(%title, %message, %callback, %cancelCallback) MessageBoxYNCButtonHolder.hidden = true; MessageBoxOKButtonHolder.hidden = true; - MessageBoxOCButtonHolder-->OKButton.set("btn_a", "Return", "OK", "MessageCallback(MessageBoxDlg,MessageBoxDlg.callback);"); - MessageBoxOCButtonHolder-->CancelButton.set("btn_b", "Escape", "Cancel", "MessageCallback(MessageBoxDlg,MessageBoxDlg.cancelCallback);"); + if(%okLabelOverride $= "") + %okLabel = "OK"; + else + %okLabel = %okLabelOverride; + + if(%cancelLabelOverride $= "") + %cancelLabel = "Cancel"; + else + %cancelLabel = %cancelLabelOverride; + + MessageBoxOCButtonHolder-->OKButton.set("btn_a", "Return", %okLabel, "MessageCallback(MessageBoxDlg,MessageBoxDlg.callback);"); + MessageBoxOCButtonHolder-->CancelButton.set("btn_b", "Escape", %cancelLabel, "MessageCallback(MessageBoxDlg,MessageBoxDlg.cancelCallback);"); MessageBoxCtrl.originalMenuInputContainer = $activeMenuButtonContainer; MessageBoxOCButtonHolder.setActive(); diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/assetBrowser.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/assetBrowser.gui index e03d27ecb..29c282c5b 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/guis/assetBrowser.gui +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/assetBrowser.gui @@ -1089,7 +1089,7 @@ $guiContent = new GuiControl(AssetBrowser) { position = "5 588"; extent = "20 20"; minExtent = "8 2"; - horizSizing = "left"; + horizSizing = "right"; vertSizing = "top"; profile = "ToolsGuiDefaultProfile"; visible = "1"; @@ -1124,13 +1124,14 @@ $guiContent = new GuiControl(AssetBrowser) { class = "assetBrowserPreviewSlider"; canSave = "1"; canSaveDynamicFields = "0"; + command = "AssetBrowser-->previewSlider.onMouseDragged();"; }; new GuiBitmapCtrl() { bitmapAsset = "ToolsModule:larger_image"; position = "103 588"; extent = "20 20"; minExtent = "8 2"; - horizSizing = "left"; + horizSizing = "right"; vertSizing = "top"; profile = "ToolsGuiDefaultProfile"; visible = "1"; diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/addModuleWindow.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/addModuleWindow.tscript index ff085835b..2b38b7459 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/addModuleWindow.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/addModuleWindow.tscript @@ -127,6 +127,8 @@ function AssetBrowserModuleList::refresh(%this) %moduleName = %moduleDef.ModuleId; %this.add(%moduleName, %i); } + + %this.sort(); } function AssetBrowserSelModuleAddBtn::onClick(%this) diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript index 7d0c1e3da..fd71cba2f 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript @@ -360,6 +360,13 @@ function AssetBrowser::buildAssetPreview( %this, %asset, %moduleName ) { %this.previewData = new ScriptObject(); } + else + { + %this.previewData.tooltip = ""; + %this.previewData.assetName = ""; + %this.previewData.previewImage = ""; + %this.previewData.doubleClickCommand = ""; + } AssetPreviewArray.empty(); @@ -493,8 +500,6 @@ function AssetBrowser::buildAssetPreview( %this, %asset, %moduleName ) %tooltip = %assetName; - %doubleClickCommand = "AssetBrowser.editAsset( "@%assetDesc@" );"; - %textBottomPad = 20; %previewButton = new GuiIconButtonCtrl() @@ -535,6 +540,15 @@ function AssetBrowser::buildAssetPreview( %this, %asset, %moduleName ) %previewButton.moduleName = %moduleName; %previewButton.assetType = %assetType; + if(%this.selectMode) + { + %doubleClickCommand = "AssetBrowser.selectAsset( AssetBrowser.selectedAsset );"; + } + else + { + %doubleClickCommand = "AssetBrowser.editAsset( "@%assetDesc@" );"; + } + //Build out the preview %buildCommand = %this @ ".build" @ %assetType @ "Preview(\"" @ %assetDesc @ "\"," @ %this.previewData @ ");"; eval(%buildCommand); @@ -543,7 +557,9 @@ function AssetBrowser::buildAssetPreview( %this, %asset, %moduleName ) %tooltip = %this.previewData.tooltip; %assetName = %this.previewData.assetName; %previewImage = %this.previewData.previewImage; - %doubleClickCommand = %this.previewData.doubleClickCommand; + + if(%this.previewData.doubleClickCommand !$= "") + %doubleClickCommand = %this.previewData.doubleClickCommand; %previewButton.assetName = %assetName; %previewButton.moduleName = %moduleName; diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/material.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/material.tscript index 880ff115e..53d102324 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/material.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/material.tscript @@ -507,6 +507,11 @@ function AssetBrowser::buildMaterialAssetPreview(%this, %assetDef, %previewData) "\nAsset Type: Material Asset" @ "\nAsset Definition ID: " @ %assetDef @ "\nDefinition Path: " @ %assetDef.getScriptPath(); + + if(!%this.selectMode) + { + %previewData.doubleClickCommand = "AssetBrowser.editAsset( "@%assetDef@" );"; + } } function AssetBrowser::onMaterialAssetEditorDropped(%this, %assetDef, %position) diff --git a/Templates/BaseGame/game/tools/convexEditor/convexEditor.tscript b/Templates/BaseGame/game/tools/convexEditor/convexEditor.tscript index deb211fbf..679b3a29d 100644 --- a/Templates/BaseGame/game/tools/convexEditor/convexEditor.tscript +++ b/Templates/BaseGame/game/tools/convexEditor/convexEditor.tscript @@ -27,20 +27,3 @@ singleton GuiControlProfile( ConvexEditorProfile ) fillColor = "192 192 192 192"; category = "Editor"; }; - -singleton GuiControlProfile (GuiDisabledTextEditProfile) -{ - opaque = false; - border = 0; - bitmap = "./textEdit"; - borderColor = "255 255 255 200"; - fontColor = "0 0 0"; - fontColorHL = "255 255 255"; - fontColorNA = "128 128 128"; - textOffset = "4 2"; - autoSizeWidth = false; - autoSizeHeight = false; - tab = false; - canKeyFocus = false; - category = "Editor"; -}; diff --git a/Templates/BaseGame/game/tools/gui/profiles.ed.tscript b/Templates/BaseGame/game/tools/gui/profiles.ed.tscript index 2b2cec671..65d068e8a 100644 --- a/Templates/BaseGame/game/tools/gui/profiles.ed.tscript +++ b/Templates/BaseGame/game/tools/gui/profiles.ed.tscript @@ -39,7 +39,7 @@ new GuiControlProfile (ToolsGuiDefaultProfile) // fill color opaque = false; fillColor = EditorSettings.value("Theme/tabsColor"); - fillColorHL = EditorSettings.value("Theme/tabsGLColor"); + fillColorHL = EditorSettings.value("Theme/tabsHLColor"); fillColorSEL = EditorSettings.value("Theme/tabsSELColor"); fillColorNA = EditorSettings.value("Theme/tabsSELColor"); @@ -355,7 +355,7 @@ new GuiControlProfile( ToolsGuiButtonProfile ) opaque = true; border = true; fillColor = EditorSettings.value("Theme/tabsColor"); - fillColorHL = EditorSettings.value("Theme/tabsGLColor"); + fillColorHL = EditorSettings.value("Theme/tabsHLColor"); fillColorSEL = EditorSettings.value("Theme/tabsSELColor"); fillColorNA = EditorSettings.value("Theme/tabsSELColor"); @@ -1238,3 +1238,20 @@ singleton GuiControlProfile (GuiSimpleBorderProfile) border = 1; category = "Editor"; }; + +singleton GuiControlProfile (GuiDisabledTextEditProfile) +{ + opaque = false; + border = 0; + bitmapAsset = "ToolsModule:textEdit_image"; + borderColor = "255 255 255 200"; + fontColor = "0 0 0"; + fontColorHL = "255 255 255"; + fontColorNA = "128 128 128"; + textOffset = "4 2"; + autoSizeWidth = false; + autoSizeHeight = false; + tab = false; + canKeyFocus = false; + category = "Editor"; +}; \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/meshRoadEditor/meshRoadEditor.tscript b/Templates/BaseGame/game/tools/meshRoadEditor/meshRoadEditor.tscript index eee393d87..20561099f 100644 --- a/Templates/BaseGame/game/tools/meshRoadEditor/meshRoadEditor.tscript +++ b/Templates/BaseGame/game/tools/meshRoadEditor/meshRoadEditor.tscript @@ -26,21 +26,4 @@ singleton GuiControlProfile( MeshRoadEditorProfile ) opaque = true; fillColor = "192 192 192 192"; category = "Editor"; -}; - -singleton GuiControlProfile (GuiDisabledTextEditProfile) -{ - opaque = false; - border = 0; - bitmap = "./textEdit"; - borderColor = "255 255 255 200"; - fontColor = "0 0 0"; - fontColorHL = "255 255 255"; - fontColorNA = "128 128 128"; - textOffset = "4 2"; - autoSizeWidth = false; - autoSizeHeight = false; - tab = false; - canKeyFocus = false; - category = "Editor"; }; \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/settings.xml b/Templates/BaseGame/game/tools/settings.xml index b7103a680..08b21038a 100644 --- a/Templates/BaseGame/game/tools/settings.xml +++ b/Templates/BaseGame/game/tools/settings.xml @@ -38,6 +38,8 @@ name="AutoImport">0 + Edit Asset 1 0 1 - FPSGameplay:EmptyLevel 4.60158 1 - FPSGameplay:EmptyLevel,FPSGameplay:EmptyTerrain,pbr:PbrMatTestLevel,TTR:DasBootLevel Blank Level