-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
Defer addons loading after the first file scan/import #86453
Closed
adamscott
wants to merge
1
commit into
godotengine:master
from
adamscott:load-addons-after-files-import
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -704,24 +704,6 @@ void EditorNode::_notification(int p_what) { | |
} break; | ||
|
||
case NOTIFICATION_READY: { | ||
{ | ||
started_timestamp = Time::get_singleton()->get_unix_time_from_system(); | ||
_initializing_plugins = true; | ||
Vector<String> addons; | ||
if (ProjectSettings::get_singleton()->has_setting("editor_plugins/enabled")) { | ||
addons = GLOBAL_GET("editor_plugins/enabled"); | ||
} | ||
|
||
for (int i = 0; i < addons.size(); i++) { | ||
set_addon_plugin_enabled(addons[i], true); | ||
} | ||
_initializing_plugins = false; | ||
|
||
if (!pending_addons.is_empty()) { | ||
EditorFileSystem::get_singleton()->connect("script_classes_updated", callable_mp(this, &EditorNode::_enable_pending_addons)); | ||
} | ||
} | ||
|
||
RenderingServer::get_singleton()->viewport_set_disable_2d(get_scene_root()->get_viewport_rid(), true); | ||
RenderingServer::get_singleton()->viewport_set_environment_mode(get_viewport()->get_viewport_rid(), RenderingServer::VIEWPORT_ENVIRONMENT_DISABLED); | ||
|
||
|
@@ -740,6 +722,8 @@ void EditorNode::_notification(int p_what) { | |
CanvasItemEditor::ThemePreviewMode theme_preview_mode = (CanvasItemEditor::ThemePreviewMode)(int)EditorSettings::get_singleton()->get_project_metadata("2d_editor", "theme_preview", CanvasItemEditor::THEME_PREVIEW_PROJECT); | ||
update_preview_themes(theme_preview_mode); | ||
|
||
started_timestamp = Time::get_singleton()->get_unix_time_from_system(); | ||
|
||
/* DO NOT LOAD SCENES HERE, WAIT FOR FILE SCANNING AND REIMPORT TO COMPLETE */ | ||
} break; | ||
|
||
|
@@ -1073,35 +1057,51 @@ void EditorNode::_resources_reimported(const Vector<String> &p_resources) { | |
} | ||
|
||
void EditorNode::_sources_changed(bool p_exist) { | ||
if (waiting_for_first_scan) { | ||
waiting_for_first_scan = false; | ||
if (!waiting_for_first_scan) { | ||
return; | ||
} | ||
Comment on lines
+1060
to
+1062
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here, I just early exited instead of wrapping the whole contents of the function inside an if block. |
||
|
||
OS::get_singleton()->benchmark_end_measure("Editor", "First Scan"); | ||
waiting_for_first_scan = false; | ||
|
||
// Reload the global shader variables, but this time | ||
// loading textures, as they are now properly imported. | ||
RenderingServer::get_singleton()->global_shader_parameters_load_settings(true); | ||
OS::get_singleton()->benchmark_end_measure("Editor", "First Scan"); | ||
|
||
_load_editor_layout(); | ||
// Reload the global shader variables, but this time | ||
// loading textures, as they are now properly imported. | ||
RenderingServer::get_singleton()->global_shader_parameters_load_settings(true); | ||
|
||
if (!defer_load_scene.is_empty()) { | ||
OS::get_singleton()->benchmark_begin_measure("Editor", "Load Scene"); | ||
_load_editor_layout(); | ||
|
||
load_scene(defer_load_scene); | ||
defer_load_scene = ""; | ||
if (!defer_load_scene.is_empty()) { | ||
OS::get_singleton()->benchmark_begin_measure("Editor", "Load Scene"); | ||
|
||
OS::get_singleton()->benchmark_end_measure("Editor", "Load Scene"); | ||
OS::get_singleton()->benchmark_dump(); | ||
} | ||
load_scene(defer_load_scene); | ||
defer_load_scene = ""; | ||
|
||
OS::get_singleton()->benchmark_end_measure("Editor", "Load Scene"); | ||
OS::get_singleton()->benchmark_dump(); | ||
} | ||
|
||
if (SurfaceUpgradeTool::get_singleton()->is_show_requested()) { | ||
SurfaceUpgradeTool::get_singleton()->show_popup(); | ||
} | ||
|
||
if (SurfaceUpgradeTool::get_singleton()->is_show_requested()) { | ||
SurfaceUpgradeTool::get_singleton()->show_popup(); | ||
// Start preview thread now that it's safe. | ||
if (!singleton->cmdline_export_mode) { | ||
EditorResourcePreview::get_singleton()->start(); | ||
} | ||
|
||
// Load the addons. | ||
{ | ||
_initializing_plugins = true; | ||
Vector<String> addons; | ||
if (ProjectSettings::get_singleton()->has_setting("editor_plugins/enabled")) { | ||
addons = GLOBAL_GET("editor_plugins/enabled"); | ||
} | ||
|
||
// Start preview thread now that it's safe. | ||
if (!singleton->cmdline_export_mode) { | ||
EditorResourcePreview::get_singleton()->start(); | ||
for (int i = 0; i < addons.size(); i++) { | ||
set_addon_plugin_enabled(addons[i], true); | ||
} | ||
_initializing_plugins = false; | ||
} | ||
} | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I'm currently thinking if we should still import the addons here when were not in the "editor". We cannot import resources outside the editor, so we should import plugins faster for games.
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.
Not sure what do you mean by "editor", but this code never executes at runtime.