summaryrefslogtreecommitdiffstats
path: root/editor/editor_interface.cpp
diff options
context:
space:
mode:
authorCory Petkovsek <632766+TokisanGames@users.noreply.github.com>2023-08-14 01:57:23 +0700
committerCory Petkovsek <632766+TokisanGames@users.noreply.github.com>2023-10-01 22:04:17 +0700
commit110130bb6957070f24dcd4c654000f5ba7ae5f56 (patch)
tree9c5f1f114a7dc41c085cafff7e046e8d59daa702 /editor/editor_interface.cpp
parent0ca8542329888e8dccba89d59d3b728090c29991 (diff)
downloadredot-engine-110130bb6957070f24dcd4c654000f5ba7ae5f56.tar.gz
Expose editor viewports
Diffstat (limited to 'editor/editor_interface.cpp')
-rw-r--r--editor/editor_interface.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/editor/editor_interface.cpp b/editor/editor_interface.cpp
index cb8f910074..e179a0e18a 100644
--- a/editor/editor_interface.cpp
+++ b/editor/editor_interface.cpp
@@ -41,6 +41,7 @@
#include "editor/filesystem_dock.h"
#include "editor/gui/editor_run_bar.h"
#include "editor/inspector_dock.h"
+#include "editor/plugins/node_3d_editor_plugin.h"
#include "main/main.h"
#include "scene/gui/box_container.h"
#include "scene/gui/control.h"
@@ -213,6 +214,15 @@ ScriptEditor *EditorInterface::get_script_editor() const {
return ScriptEditor::get_singleton();
}
+SubViewport *EditorInterface::get_editor_viewport_2d() const {
+ return EditorNode::get_singleton()->get_scene_root();
+}
+
+SubViewport *EditorInterface::get_editor_viewport_3d(int p_idx) const {
+ ERR_FAIL_INDEX_V(p_idx, static_cast<int>(Node3DEditor::VIEWPORTS_COUNT), nullptr);
+ return Node3DEditor::get_singleton()->get_editor_viewport(p_idx)->get_viewport_node();
+}
+
void EditorInterface::set_main_screen_editor(const String &p_name) {
EditorNode::get_singleton()->select_editor_by_name(p_name);
}
@@ -414,6 +424,8 @@ void EditorInterface::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_base_control"), &EditorInterface::get_base_control);
ClassDB::bind_method(D_METHOD("get_editor_main_screen"), &EditorInterface::get_editor_main_screen);
ClassDB::bind_method(D_METHOD("get_script_editor"), &EditorInterface::get_script_editor);
+ ClassDB::bind_method(D_METHOD("get_editor_viewport_2d"), &EditorInterface::get_editor_viewport_2d);
+ ClassDB::bind_method(D_METHOD("get_editor_viewport_3d", "idx"), &EditorInterface::get_editor_viewport_3d, DEFVAL(0));
ClassDB::bind_method(D_METHOD("set_main_screen_editor", "name"), &EditorInterface::set_main_screen_editor);
ClassDB::bind_method(D_METHOD("set_distraction_free_mode", "enter"), &EditorInterface::set_distraction_free_mode);