-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Allow export plugins to override export option values #88291
Allow export plugins to override export option values #88291
Conversation
Could use a similar example you provided in this PR in the documentation in a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Simple, but gets the job done!
My only concern is with regard to the mechanism to enable the overrides; at the moment it's up to the plugin which means the plugin can provide an option as you demonstrate in your example, or it can automatically apply the overrides without allowing the user to control the feature.
I wonder if instead we should make it a core part of the export preset config similar to the runnable
toggle. So we'd add a toggle to allow for options override, and check the value of the toggle before retrieving the options overrides from the plugin.
Thoughts?
@dsnopek How do we resolve plugin overrides conflicts? For example, the example Meta plugin uses:
While for the vendors plugin, we may want to use this capability as well but only return:
|
An alternative that aligns with your current proposal would be automatically add a |
@m4gr3d Thanks for the review!
Personally, I think this is fine. Export plugins already have a ton of power, and they are already responsible for including some way to turn their behaviors on/off. So, I don't think we need to add special safe guards for how this new bit of functionality is used. Also, I could imagine an addon that allows developers to enable some options across the board. For example, I know some people who always use "Embed PCK", so you could make an addon that just forces that option to be on. :-) Or, maybe the addon could add some editor settings to override all export presets?
That's an interesting question! In the current implementation, export plugin will override the overrides added by earlier export plugins, but we don't have any control over the order that they run in. For the specific example you gave, it should be fine, because one is just a subset of the other: they don't have any values that differ, one just has fewer values. We could certainly add some sort of export plugin priority, but i don't know if it makes sense to add that kind of complexity before we know if it's really needed.
I'm not crazy about this alternative, because it limits how addons could potentially use this functionality. And, like I said above, we're already trusting |
To add some examples regarding this point... Even before this PR, any There's also With all that power already, I don't know that we need to try to prevent abuse of overriding export options, which I'd personally even argue is a more modest power than the powers it already has. |
I usually have the opposite opinion.. guidelines that are not enforced are usually overlooked by developers creating a poor user experience for end users, so I usually lean on enforcing the guideline. It's true that export plugins have a lot of power already, though they still need to be enabled through the |
FYI, adding a way to enable/disable GDExtensions in project settings is planned - it just hasn't been implemented yet :-) |
3d32ba6
to
39557ef
Compare
39557ef
to
8b8ae9c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New dynamic feature with a reasonable example!?!?
Satisfactory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
I think we can go ahead and merge this. My comments on the ability to enable/disable the added capability are part of a larger conversation about how much user control we give over plugins capabilities and should not be a blocker for this PR.
8b8ae9c
to
ac88acd
Compare
Thanks! |
This PR allows
EditorExportPlugins
to override export options, setting the given options to specific values. Overridden options will be hidden from the UI.The goal is to allow making addons that customize export presets for specific target platforms/devices, which makes the UI easier to manage (since options that don't apply will be hidden), while not having to hardcode any of this platform-specific information into Godot itself.
Here's an example plugin in GDScript which simplifies the Android export preset when targeting the Meta Quest:
In this example, a new "Configure for Meta Quest" export option is added. If this option is enabled, then a number of other export options will be overridden to specific values and hidden from the UI. This re-uses the existing
update_visibility
property, to allow the changes to take effect immediately in the UI. (The overrides are normally only updated when switching to the preset in the UI, or just before exporting, to allow the export preset UI to remain speedy.)As an alternative to having an export option visible in the UI to enable this "template", I could also imagine an addon that provides a wizard to create the export preset with a hidden option set.
Even though this example is in GDScript, this would work from GDExtension as well.