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

Add separate feature tags for editor runtime #85678

Merged
merged 1 commit into from
Apr 26, 2024

Conversation

KoBeWi
Copy link
Member

@KoBeWi KoBeWi commented Dec 2, 2023

This PR adds 2 new feature tags: editor_hint and editor_runtime. The former is used in the editor, the latter in running project. Both are only available in editor builds.
editor feature tag stays as is, for compatibility reasons and for consistency with template. Documentation will need updating after this is merged.

EDIT:

@RandomShaper
Copy link
Member

Per the Godot jargon, it would have to be tools*_, but maybe that's not very user-friendly. Moreover, shouldn't editor already be used only for the editor itself vs. tools-enabled builds?

@Calinou
Copy link
Member

Calinou commented Dec 4, 2023

editor_main is up to discussion tbh, I couldn't come up with a better word.

Out of curiosity, why not editor_hint for consistency with is_editor_hint()? The downside is that this term is a bit more obscure to people not used to writing @tool scripts, but it should be immediately obvious for people who've written one.

@@ -1337,7 +1337,7 @@ ProjectSettings::ProjectSettings() {
GLOBAL_DEF(PropertyInfo(Variant::INT, "display/window/size/window_height_override", PROPERTY_HINT_RANGE, "0,4320,1,or_greater"), 0); // 8K resolution

GLOBAL_DEF("display/window/energy_saving/keep_screen_on", true);
GLOBAL_DEF("display/window/energy_saving/keep_screen_on.editor", false);
GLOBAL_DEF("display/window/energy_saving/keep_screen_on.editor_main", false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes behavior a little since the project running from the editor will now keep the screen on (this may or may not be desired, especially on a laptop on battery). Just noting this for the future.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the previous behavior was not really intended; it came from a limitation.

Comment on lines 289 to +291
presets.insert("editor");
presets.insert("editor_hint");
presets.insert("editor_runtime");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we shouldn't have just editor and editor_runtime (so keep using editor for what is now editor_hint in this PR).

This would slightly break compat on the behavior of editor, but IMO the current behavior is confusing, and the two new feature tags make it worse as it's not obvious to users what's the difference between editor and editor_hint/editor_runtime.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

editor is useful for any code that's supposed to run only in editor build, so that the code does not accidentally slip to exported project, thus making it closer to editor_runtime. From my experience at least, idk how other people use it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess one could use debug for that? But yeah, I guess it still makes sense to have a feature that matches target=editor specifically. The names are just a bit confusing.

I'm not too fond of editor_hint specifically, though I know that's what we have in Engine. I guess it's the best we can do for now :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess one could use debug for that?

Unless they ship game using debug build (which can happen sometimes ;)

@akien-mga akien-mga modified the milestones: 4.x, 4.3 Apr 26, 2024
@akien-mga akien-mga merged commit bd598d5 into godotengine:master Apr 26, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants