Move out script editor's initialization from EditorNode.

This commit is contained in:
Relintai 2023-02-17 21:29:44 +01:00
parent 9cd2927fcc
commit 1b30a48d65
3 changed files with 44 additions and 34 deletions

View File

@ -192,10 +192,10 @@
#include "modules/modules_enabled.gen.h"
#ifdef MODULE_CODE_EDITOR_ENABLED
#include "modules/code_editor/script_editor_plugin.h"
#include "modules/code_editor/script_text_editor.h"
#include "modules/code_editor/shader_editor_plugin.h"
#include "modules/code_editor/text_editor.h"
#include "modules/code_editor/script_editor_plugin.h"
#endif
class Camera;
@ -6913,13 +6913,9 @@ EditorNode::EditorNode() {
add_editor_plugin(memnew(AnimationPlayerEditorPlugin(this)));
add_editor_plugin(memnew(CanvasItemEditorPlugin(this)));
add_editor_plugin(memnew(SpatialEditorPlugin(this)));
add_editor_plugin(memnew(ScriptEditorPlugin(this)));
EditorAudioBuses *audio_bus_editor = EditorAudioBuses::register_editor();
ScriptTextEditor::register_editor(); //register one for text scripts
TextEditor::register_editor();
//add interface before adding plugins
editor_interface = memnew(EditorInterface);
@ -6929,8 +6925,6 @@ EditorNode::EditorNode() {
//more visually meaningful to have this later
raise_bottom_panel_item(AnimationPlayerEditor::get_singleton());
add_editor_plugin(memnew(ShaderEditorPlugin(this)));
add_editor_plugin(memnew(CameraEditorPlugin(this)));
add_editor_plugin(memnew(ThemeEditorPlugin(this)));
add_editor_plugin(memnew(MultiMeshEditorPlugin(this)));

View File

@ -1,10 +1,23 @@
#include "register_types.h"
#include "script_editor_plugin.h"
#include "shader_editor_plugin.h"
#include "script_text_editor.h"
#include "text_editor.h"
void register_code_editor_types(ModuleRegistrationLevel p_level) {
if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) {
//ClassDB::register_class<>();
}
#ifdef TOOLS_ENABLED
if (p_level == MODULE_REGISTRATION_LEVEL_EDITOR) {
EditorPlugins::add_by_type<ScriptEditorPlugin>();
EditorPlugins::add_by_type<ShaderEditorPlugin>();
}
#endif
}
void unregister_code_editor_types(ModuleRegistrationLevel p_level) {

View File

@ -30,48 +30,43 @@
#include "script_editor_plugin.h"
#include "core/io/resource_loader.h"
#include "core/os/file_access.h"
#include "core/input/input.h"
#include "core/os/keyboard.h"
#include "core/os/os.h"
#include "core/config/project_settings.h"
#include "editor/editor_node.h"
#include "editor/editor_run_script.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
#include "editor/filesystem_dock.h"
#include "editor/find_in_files.h"
#include "editor/node_dock.h"
#include "shader_editor_plugin.h"
#include "editor/script_editor_debugger.h"
#include "scene/main/viewport.h"
#include "scene/scene_string_names.h"
#include "script_text_editor.h"
#include "text_editor.h"
#include "core/object/class_db.h"
#include "core/math/color.h"
#include "core/variant/dictionary.h"
#include "core/error/error_macros.h"
#include "core/io/config_file.h"
#include "core/io/resource_saver.h"
#include "core/containers/pair.h"
#include "core/containers/rb_map.h"
#include "core/error/error_macros.h"
#include "core/input/input.h"
#include "core/input/input_event.h"
#include "core/io/config_file.h"
#include "core/io/resource_loader.h"
#include "core/io/resource_saver.h"
#include "core/math/color.h"
#include "core/math/math_funcs.h"
#include "core/math/transform_2d.h"
#include "core/input/input_event.h"
#include "core/object/class_db.h"
#include "core/object/undo_redo.h"
#include "core/os/file_access.h"
#include "core/os/keyboard.h"
#include "core/os/main_loop.h"
#include "core/os/memory.h"
#include "core/containers/pair.h"
#include "core/os/os.h"
#include "core/string/string_name.h"
#include "core/object/undo_redo.h"
#include "core/variant/dictionary.h"
#include "core/version_generated.gen.h"
#include "editor/editor_data.h"
#include "editor/editor_file_dialog.h"
#include "editor/editor_file_system.h"
#include "editor/editor_help.h"
#include "editor/editor_help_search.h"
#include "editor/editor_node.h"
#include "editor/editor_run_script.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
#include "editor/filesystem_dock.h"
#include "editor/find_in_files.h"
#include "editor/inspector_dock.h"
#include "editor/node_dock.h"
#include "editor/script_create_dialog.h"
#include "editor/script_editor_debugger.h"
#include "scene/2d/canvas_item.h"
#include "scene/gui/button.h"
#include "scene/gui/control.h"
@ -90,8 +85,13 @@
#include "scene/main/node.h"
#include "scene/main/scene_tree.h"
#include "scene/main/timer.h"
#include "scene/main/viewport.h"
#include "scene/resources/text_file.h"
#include "scene/resources/texture.h"
#include "scene/scene_string_names.h"
#include "script_text_editor.h"
#include "shader_editor_plugin.h"
#include "text_editor.h"
/*** SCRIPT EDITOR ****/
@ -3688,6 +3688,9 @@ void ScriptEditorPlugin::edited_scene_changed() {
}
ScriptEditorPlugin::ScriptEditorPlugin(EditorNode *p_node) {
ScriptTextEditor::register_editor(); //register one for text scripts
TextEditor::register_editor();
editor = p_node;
script_editor = memnew(ScriptEditor(p_node));
editor->get_viewport()->add_child(script_editor);