From 27920ca1a7ce802c3a54846931f915458f1f510a Mon Sep 17 00:00:00 2001 From: Relintai Date: Sun, 19 Mar 2023 11:02:20 +0100 Subject: [PATCH] Make sure that the script editor is the 3rd tab. I implemented the simplest solution I could think for now. If more control is needed in the future, EditorPlugins will likely need a priority queue (or some different, more generic solution). --- editor/editor_plugin.h | 13 +++++++++++++ .../editor_code_editor/register_types.cpp | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h index fd417a46d..4c8286b78 100644 --- a/editor/editor_plugin.h +++ b/editor/editor_plugin.h @@ -330,6 +330,19 @@ public: ERR_FAIL_COND(creation_func_count >= MAX_CREATE_FUNCS); creation_funcs[creation_func_count++] = p_func; } + + template + static void add_by_type_front() { + ERR_FAIL_COND(creation_func_count >= MAX_CREATE_FUNCS); + + for (int i = creation_func_count - 1; i >= 0; --i) { + creation_funcs[i + 1] = creation_funcs[i]; + } + + ++creation_func_count; + + creation_funcs[0] = creator; + } }; #endif diff --git a/editor_modules/editor_code_editor/register_types.cpp b/editor_modules/editor_code_editor/register_types.cpp index 2a0e1d3d5..ffe59b5ae 100644 --- a/editor_modules/editor_code_editor/register_types.cpp +++ b/editor_modules/editor_code_editor/register_types.cpp @@ -25,7 +25,7 @@ void register_editor_code_editor_types(ModuleRegistrationLevel p_level) { #ifdef TOOLS_ENABLED if (p_level == MODULE_REGISTRATION_LEVEL_EDITOR) { - EditorPlugins::add_by_type(); + EditorPlugins::add_by_type_front(); } #endif }