mirror of
https://github.com/godotengine/godot-visual-script.git
synced 2026-01-05 22:10:23 +03:00
Optimized ScriptEditor initialization when many scripts are loaded
This change avoids the editor to freeze for several seconds when a project with lots of scripts is loaded in the editor. It focuses on a few heavy operations previously executed on all previously loaded scripts: - Initialize script resource (script validation/parsing) only on focus - ScriptTextEditor: code editor and edit menu are added to the scene only on focus - Add to recent scripts only when opening new scripts (load/save scene metadata)
This commit is contained in:
@@ -2401,7 +2401,8 @@ RES VisualScriptEditor::get_edited_resource() const {
|
||||
}
|
||||
|
||||
void VisualScriptEditor::set_edited_resource(const RES &p_res) {
|
||||
|
||||
ERR_FAIL_COND(script.is_valid());
|
||||
ERR_FAIL_COND(p_res.is_null());
|
||||
script = p_res;
|
||||
signal_editor->script = script;
|
||||
signal_editor->undo_redo = undo_redo;
|
||||
@@ -2422,6 +2423,9 @@ void VisualScriptEditor::set_edited_resource(const RES &p_res) {
|
||||
_update_members();
|
||||
}
|
||||
|
||||
void VisualScriptEditor::enable_editor() {
|
||||
}
|
||||
|
||||
Vector<String> VisualScriptEditor::get_functions() {
|
||||
|
||||
return Vector<String>();
|
||||
|
||||
@@ -295,6 +295,7 @@ public:
|
||||
virtual void apply_code();
|
||||
virtual RES get_edited_resource() const;
|
||||
virtual void set_edited_resource(const RES &p_res);
|
||||
virtual void enable_editor();
|
||||
virtual Vector<String> get_functions();
|
||||
virtual void reload_text();
|
||||
virtual String get_name();
|
||||
|
||||
Reference in New Issue
Block a user