summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-05-16 23:06:01 +0200
committerGitHub <noreply@github.com>2021-05-16 23:06:01 +0200
commit37c3b332538c81ef02c8e5b8d1be979b78d1aaa4 (patch)
treebf76c1bd73e13b9c49e68e596e3cbe229ab066f7 /editor/plugins
parent2dadcde361d4f9e62f24a2cb9cb334b09b25bbcd (diff)
parent2b30728ebf266956ebe2d6e3b26d0eb4a729d25a (diff)
Merge pull request #48605 from sent44/scripteditor_get_codeedit
Add `get_base_editor` to `ScriptEditorBase`
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/script_editor_plugin.cpp2
-rw-r--r--editor/plugins/script_editor_plugin.h2
-rw-r--r--editor/plugins/script_text_editor.cpp4
-rw-r--r--editor/plugins/script_text_editor.h2
-rw-r--r--editor/plugins/text_editor.cpp4
-rw-r--r--editor/plugins/text_editor.h2
6 files changed, 16 insertions, 0 deletions
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 8c4c5a3461..893a9356a2 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -218,6 +218,8 @@ Ref<EditorSyntaxHighlighter> EditorPlainTextSyntaxHighlighter::_create() const {
/*** SCRIPT EDITOR ****/
void ScriptEditorBase::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("get_base_editor"), &ScriptEditorBase::get_base_editor);
+
ADD_SIGNAL(MethodInfo("name_changed"));
ADD_SIGNAL(MethodInfo("edited_script_changed"));
ADD_SIGNAL(MethodInfo("request_help", PropertyInfo(Variant::STRING, "topic")));
diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h
index 570ebfba4e..9ae63b7c4f 100644
--- a/editor/plugins/script_editor_plugin.h
+++ b/editor/plugins/script_editor_plugin.h
@@ -163,6 +163,8 @@ public:
virtual Control *get_edit_menu() = 0;
virtual void clear_edit_menu() = 0;
+ virtual Control *get_base_editor() const = 0;
+
virtual void validate() = 0;
ScriptEditorBase() {}
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index edf540bf48..25755cc6cc 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -1402,6 +1402,10 @@ void ScriptTextEditor::set_tooltip_request_func(String p_method, Object *p_obj)
void ScriptTextEditor::set_debugger_active(bool p_active) {
}
+Control *ScriptTextEditor::get_base_editor() const {
+ return code_editor->get_text_editor();
+}
+
Variant ScriptTextEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from) {
return Variant();
}
diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h
index 17abfcf4cc..f79abc60ab 100644
--- a/editor/plugins/script_text_editor.h
+++ b/editor/plugins/script_text_editor.h
@@ -233,6 +233,8 @@ public:
virtual void clear_edit_menu() override;
static void register_editor();
+ virtual Control *get_base_editor() const override;
+
virtual void validate() override;
ScriptTextEditor();
diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp
index 2b8bfe067d..e6fb2710ae 100644
--- a/editor/plugins/text_editor.cpp
+++ b/editor/plugins/text_editor.cpp
@@ -171,6 +171,10 @@ void TextEditor::add_callback(const String &p_function, PackedStringArray p_args
void TextEditor::set_debugger_active(bool p_active) {
}
+Control *TextEditor::get_base_editor() const {
+ return code_editor->get_text_editor();
+}
+
Array TextEditor::get_breakpoints() {
return Array();
}
diff --git a/editor/plugins/text_editor.h b/editor/plugins/text_editor.h
index c066d51b18..abb75cc9d8 100644
--- a/editor/plugins/text_editor.h
+++ b/editor/plugins/text_editor.h
@@ -142,6 +142,8 @@ public:
virtual void validate() override;
+ virtual Control *get_base_editor() const override;
+
static void register_editor();
TextEditor();