summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-12-08 17:15:18 +0100
committerGitHub <noreply@github.com>2021-12-08 17:15:18 +0100
commitf1e3c87244f18ab1a507b6e3637c34b2d49c1dc6 (patch)
tree0682072590a0d72378c3d508ffe4a463556e4485 /editor
parente53e357a2bf738d624b1fe29ee967603395efdd0 (diff)
parent9535831866786adeafbff40f8e46f52fdc62538b (diff)
Merge pull request #55709 from raulsntos/expose_script_edit
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_plugin.cpp5
-rw-r--r--editor/editor_plugin.h1
2 files changed, 6 insertions, 0 deletions
diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp
index 61c01993ae..3261e6ddaf 100644
--- a/editor/editor_plugin.cpp
+++ b/editor/editor_plugin.cpp
@@ -166,6 +166,10 @@ void EditorInterface::edit_node(Node *p_node) {
EditorNode::get_singleton()->edit_node(p_node);
}
+void EditorInterface::edit_script(const Ref<Script> &p_script, int p_line, int p_col, bool p_grab_focus) {
+ ScriptEditor::get_singleton()->edit(p_script, p_line, p_col, p_grab_focus);
+}
+
void EditorInterface::open_scene_from_path(const String &scene_path) {
if (EditorNode::get_singleton()->is_changing_scene()) {
return;
@@ -326,6 +330,7 @@ void EditorInterface::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_editor_scale"), &EditorInterface::get_editor_scale);
ClassDB::bind_method(D_METHOD("edit_resource", "resource"), &EditorInterface::edit_resource);
ClassDB::bind_method(D_METHOD("edit_node", "node"), &EditorInterface::edit_node);
+ ClassDB::bind_method(D_METHOD("edit_script", "script", "line", "column", "grab_focus"), &EditorInterface::edit_script, DEFVAL(-1), DEFVAL(0), DEFVAL(true));
ClassDB::bind_method(D_METHOD("open_scene_from_path", "scene_filepath"), &EditorInterface::open_scene_from_path);
ClassDB::bind_method(D_METHOD("reload_scene_from_path", "scene_filepath"), &EditorInterface::reload_scene_from_path);
ClassDB::bind_method(D_METHOD("play_main_scene"), &EditorInterface::play_main_scene);
diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h
index 278059f8c4..a49e1bf229 100644
--- a/editor/editor_plugin.h
+++ b/editor/editor_plugin.h
@@ -74,6 +74,7 @@ public:
Control *get_editor_main_control();
void edit_resource(const Ref<Resource> &p_resource);
void edit_node(Node *p_node);
+ void edit_script(const Ref<Script> &p_script, int p_line = -1, int p_col = 0, bool p_grab_focus = true);
void open_scene_from_path(const String &scene_path);
void reload_scene_from_path(const String &scene_path);