Skip to content
This repository was archived by the owner on Jan 1, 2025. It is now read-only.

Conversation

apple1417
Copy link
Contributor

@apple1417 apple1417 commented Jul 29, 2020

Rewrites most of the mod menu adding new features and cleaning up existing ones, as well as adds a few minor tweaks to the dll. This contains a few breaking changes, but only to features not yet widely used.

Major Changes (aka Update Notes)

Moved some files around, to update you must delete the Mods\General folder and all loose .py files in the Mods folder before copying the new files over.

Re-enabled loading of custom dlls from the Plugins folder - Command Injector and Borderlands Commander will now be compatible.
Added favoriting of mods. Favorites appear at the top of the mods list.
Moved all modded keybinds to their own "Modded Keybinds" menu, and allowed unbinding modded keybinds - just try bind to the key it's already bound to.
Fixed that the mod options menu would just open the gameplay menu if your game's language wasn't English.

All Changes

DLL Changes

unrealsdk.Log() now accepts varargs, printed as a space-separated string.
py commands now have unrealsdk and Mods imported by default.
The Mods directory is no longer appended to sys.path.
Increased the version number to 0.7.8.
Re-enabled loading of custom dlls from the Plugins folder.

General Python Changes

Moved all mod-manager specific files into the ModMenu folder.
Reformatted all code to mostly follow pep 8 and have type hints.
Added/updated docstrings everywhere. Read them, they're probably more accurate than this changelog.
Increased unrealsdk.PythonManagerVersion to 2.

General\__init__.py

Merged into ModMenu\MenuManager.py.
Removed the ability to reload mods, as most are not designed with this in mind and cause issues.
Redirected help link to http://borderlandsmodding.com/sdk-mods/.

Util.py

Entirely removed.

__init__.py

Now prints the SDK version on launch.
Prevented attempting to import __pycache__, as well as any folder starting with a ..
Print an extra line of traceback when a mod throws an exception while importing, this contains the line number where it was thrown.

ModMenu\__init__.py

Added VERSION_MAJOR and VERSION_MINOR fields - deprecating unrealsdk.PythonManagerVersion. This is printed on launch.
Added explicit exports.
Added a lot of aliasing to allow compatibility with existing mods, most of which should be considered deprecated.

ModMenu\DeprecationManager.py

Added some helper functions to print deprecation messages only once - so your console doesn't get spammed when loading an old mod.

ModMenu\KeybindManager.py

Deprecated the use of lists for keybinds, now provides the dataclass Keybind instead.
Added an InputEvent enum, which holds the various unreal engine input event types.
Moved all custom keybinds to their own "Modded Keybinds" menu. The "Keybinds" menu now only stores the default ones.
Attempted to fix an issue where modded keybinds would occasionally have their keys fail localization.
Allowed unbinding modded keybinds - just bind to the same key.
Made resetting default keybinds also reset all keybinds using the new Keybind class. Legacy keybinds will not be reset.

ModMenu\MenuManager.py

Renamed from ModMenuManager.py.
Added favoriting of mods. Favorites appear at the top of the mods list.
Added priorities to mods. Mods of higher priority appear higher up the mod list. Equal priorities are ordered alphabetically by name.
Added a function GetOrderedModList() to get a list of mods in the same order that they appear in the menu.
Added an extra mod type for libraries.
Moved the ability to filter mods to just the General mod that appears at the top of the list.
Fixed that mod statuses would only ever display as exactly Enabled or Disabled.
Changed where mod author is displayed, and also display mod version.
Removed the [Escape] Cancel tooltip from all mods, so they have more space to add their own binds.
Updated the control hints at the bottom right of the main menu to also mention the keybind to open the mods menu. In BL2 it will also display the network/character hints like in TPS.

ModMenu\ModObjects.py

Renamed from ModManager.py.
Added ModPriorities, EnabledSaveType, and Game enums.
Converted the ModTypes enum to a flag enum.
Renamed BL2MOD to SDKMod.
Made SDKMod abstract, though with no abstract methods.
Added a custom metaclass to SDKMod, so that subclassing it creates copies of all attributes rather than references, preventing individual mods from affecting other.
Removed the getModModule function.
Removed the ModMenuOpened list.

SDKMod Changes

Added a string Version field to be displayed in the mods menu.
Added a SupportedGames field that prevents the user from enabling the mod when loaded in an unsupported game.
Changed Types to be a ModTypes instance rather than a list, since that was changed to a flag enum.
Added a Priority field to adjust where in the mods list the mod displays by default.
Added a SaveEnabledState field, which will save the enabled state across game launches. This is disabled by default. Closes #56
Added a boolean IsEnabled field, which should be used to check enabled state rather than checking status.
Changed the default SettingsInputPressed method to not overwrite the entire SettingsInputs dictionary.
Added an extra argument event to GameInputPressed. For compatibility reasons, if a mod does not define this argument it will only be called when it is equal to InputEvent.Pressed.
Removed the GameInputReleased and GameInputRebound callbacks.
Changed the ModOptionChanged callback to be called before the CurrentValue field on the option is changed.

ModMenu\OptionManager.py

Moved the Options class out into it's own module.
Made the mod options menu always be shown, but be disabled if no enabled mods define any options.
Fixed #72 - that the options menu would only properly open in english.
Added header fields and nested menus.
No longer prefixes every option with the mod's name, instead adds a mod header before any of it's options.
Changed a lot of specific type checks to isinstance checks, allowing you to subclass options.

ModMenu\Options.py

Added inheritance between different option types. All options eventually inherit from Option.Base. All options that store a value inherit from Options.Value.
Standardized all field names - e.g. all constructors have StartingValue fields, spinners no longer use StartingChoice.
Add a IsHidden field to all options, to easily hide it from the menu.
Add Field and Nested classes to display a header field and a field leading to a nested menu respectively. These do not store values.

ModMenu\SettingsManager.py

Renamed from SaveManager.py.
Added a GetSettingsFilePath function which a mod can use to easily get it's own path.
Added a SaveModSettings function to save settings for a single mod.
Made the old function storeModSettings a deprecated alias for SaveAllModSettings, which serves the same purpose.
Added a LoadModSettings function to load a single mod's settings. This used to only be in RegisterMod, it's now a separate function that RegisterMod calls.

@apple1417
Copy link
Contributor Author

And here's the new release zip:
PythonSDK.zip

@apple1417
Copy link
Contributor Author

Here's a new release zip with those tweaks.
PythonSDK.zip

@FromDarkHell FromDarkHell merged commit e083718 into bl-sdk:master Aug 7, 2020
apple1417 added a commit that referenced this pull request Jul 23, 2022
* Mod Menu Rewrite

* Few small tweaks

* Minor cpp changes

* Print versions on launch

* Fix mod menu hint showing on pause menu

* Move SDK Version to be printed from the DLL

* Fix option change callback
apple1417 added a commit that referenced this pull request Jul 23, 2022
* Update to handle TPS version update

* Mod Manager Rewrite (#73)

* Mod Menu Rewrite

* Few small tweaks

* Minor cpp changes

* Print versions on launch

* Fix mod menu hint showing on pause menu

* Move SDK Version to be printed from the DLL

* Fix option change callback

* Fixed UMaterialInstanceConstant::SetVectorParameterValue (#70)

* Minor string improvements / Remove RegisterHook arg/annotation requirements (#81)

* keybind improvements

add `IsRebindable` and `IsHidden` fields, along with per-bind callback `OnPress`

* Fix unicode string bug

Fixes #76, #79
Still a lot of places that can/do cast to char*, but this should catch everything from python.

* fix farray/fstruct repr

* remove annotations/arg name requirements from registerhook

* better exe detection errors

Co-authored-by: FromDarkHell FromDarkHell@users.noreply.github.com

* support static array properties

originally cherry-picked from f5d8296, but lot of extra work ontop of it to update ue4

* Add len() to FArray (#105)

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* try re-add ue3 support

compiles, does not work

Co-authored-by: Matt-Hurd <sabahbob@gmail.com>
Co-authored-by: Justin Sostmann <39841117+juso40@users.noreply.github.com>
Co-authored-by: ZetaDaemon <53562820+ZetaDaemon@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mod options menu does not open in langages other than English Autoexec
2 participants