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

[3.x] Backport Accept global classes for MainLoop type in project settings #52438

Merged
merged 1 commit into from
Sep 17, 2021

Conversation

tommyZZM
Copy link

@tommyZZM tommyZZM commented Sep 6, 2021

This PR backports the feature that acceptting global classes for MainLoop type in project settings, introduced in #41190 on master.

Copy link
Contributor

@Xrayez Xrayez left a comment

Choose a reason for hiding this comment

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

The main.cpp hasn't changed much when comparing to master, so it should be safe to merge, the code looks correct to me in 3.x (haven't tested). Someone from the core developers would have to run CI checks to confirm that this PR compiles.

@YeldhamDev YeldhamDev added this to the 3.4 milestone Sep 6, 2021
} else { // Not based on script path.
if (!editor && !ClassDB::class_exists(main_loop_type) && ScriptServer::is_global_class(main_loop_type)) {
String script_path = ScriptServer::get_global_class_path(main_loop_type);
Ref<Script> script_res = ResourceLoader::load(script_path, "Script", true);
Copy link
Author

Choose a reason for hiding this comment

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

- Ref<Script> script_res = ResourceLoader::load(script_path);
+ Ref<Script> script_res = ResourceLoader::load(script_path, "Script", true);

script_res should be load without any cache

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this shouldn't matter much because not a lot of resources get loaded at engine startup to worry about this I guess.

Copy link
Author

Choose a reason for hiding this comment

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

most of the time, the loading of custom main loop is fine.

some times. if I clike Run Button very fast after opening the editor. then my custom main loop script seems load failed.

QQ20210907001802

After this error happening, script wont be reload until I reopen the editor.

tested by setting no_cache=true here still won't fix this problem.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this feature may just reveal editor problem. According to error, the base type is basically "", which probably means that editor settings could not get loaded (maybe when the file gets locked for reading, and cannot be read again until the previous Godot process shuts down completely).

@akien-mga akien-mga merged commit a727240 into godotengine:3.x Sep 17, 2021
@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
Development

Successfully merging this pull request may close these issues.

4 participants