Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to override views without editing scripts? #2

Open
Mondanzo opened this issue Jul 28, 2024 · 1 comment
Open

Option to override views without editing scripts? #2

Mondanzo opened this issue Jul 28, 2024 · 1 comment
Milestone

Comments

@Mondanzo
Copy link

Hey there, trying out this settings plugin and one thing I'm struggling with at the moment is the UI.

I have a very strong core ideology of not overriding any third-party extension files, because of the potential of breaking something.
Now I also want to edit the theme and maybe even replace some controls with slight variations, but from what I'm getting that's only possible through editing the direct files?

Is there a way to override painters without editing the loaded files directly?

@albinaask
Copy link
Owner

I wholesomely agree with your ideology. Regarding the theme, it is meant to be changed. The Idea is the following:

  1. You create a Dialog either through code or as a node in a scene.
  2. You set the theme property to your project's theme.
  3. If you have no theme yet, you can just duplicate the standard theme, place it outside the addon folder and make your changes.

If you'd like to make small changes to a painter, I'd do the following:

  1. Make a new script that extends the SettingsPanel script.
  2. Use set_script([your_script]) or set the script manually for your dialog.
  3. Override the _on_panel_visibility_changed()
  4. Call super() as your first action in that method.
  5. Acess the painters as children of the SettingsPanel. So looping thrgough get_children() and filter on SettingsPainter, will get a basic filter.
  6. Make the changes to the painters you want in code.

An option is to do the following, for example changing the boolSettingsPainter from a checkbox to a CheckButton:

  1. Create a derived scene from the BoolSettingsPainter Scene or make a new one that fits your liking and save it outside your plugin.
  2. Create a new script that extends BoolSetting.
  3. Override the get_settings_painter_scene() to point to your new scene.
  4. Call it something different for _TYPE.
  5. Register it as a new type according to the documentation.
  6. (If you use the addon without protocol backing, you also need to update the static initializer from creating a BoolSetting to your new type).

Another option, if you feel like other people would benefit from your work, add your code to the painter scene directly and make an option for it in the setting, just like "use_alpha" in ColorSettings&Painter, make a PR, and I'll just add it as part of the addon.

Feel free to continue asking since it only makes it more clear what is not good enough in the documentation and something I have to document better ;)

To finish off, I'll say that I don't think I'll be changing any of the core code in the coming years except for adding more functionality in the form of more setting types. So there shouldn't be any major breakages. My core Ideology as an addon developer is "Make no breaking changes".

@albinaask albinaask added this to the 1.1 milestone Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants