BepInEx / BepInEx.ConfigurationManager

Plugin configuration manager for BepInEx
https://www.patreon.com/ManlyMarco
GNU Lesser General Public License v3.0
231 stars 53 forks source link

Reload ConfigurationManagerAttributes on change #18

Closed bwoebi closed 3 years ago

bwoebi commented 3 years ago

I have some settings which are only relevant when some other setting is set to a specific value.

How would I hide them? I can set Browsable = someNewValue in the SettingChanged handler of the ConfigEntries, but it will only take effect when BuildSettingList() is re-executed (e.g. on re-open, when toggling debugmode ...). I can invoke it myself via reflection as well, but this still is not satisfying because of this https://github.com/BepInEx/BepInEx.ConfigurationManager/blob/636d527f7830cf193f0c2c4c978aa814996a051d/ConfigurationManager/ConfigurationManager.cs#L160 todo item not being implemented yet.

Would it be possible to have that todo item implemented and the settings rebuild ideally publicly accessible?

Alternatively an accessible callback to just rebuild a given mods settings would be also great (and probably the best solution).

ManlyMarco commented 3 years ago

If your settings change a lot depending on what is selected, wouldn't it be better to implement a custom class for the setting? You need to add toml converter pair and custom setting drawer for the setting. That sounds like a much more robust approach that gives you the most flexibility.

bwoebi commented 3 years ago

It's just hiding some settings and displaying some others instead.

Using a custom drawer would be really overkill, e.g. we have some comboboxes, which this extension just provides out of the box. The extension provides everything, except for reloading the display configuration on change of settings.

Definitely possible to roll our own thing, but - you are providing a generallly simple interface, and it covers 99% except that tiny thing about reloading settings. Using a custom drawer would essentially mean doing 95% of what the extension does myself. Seems pointless to me.