4848#include " editor/gui/editor_toaster.h"
4949#include " editor/gui/scene_tree_editor.h"
5050#include " editor/inspector_dock.h"
51- #include " editor/plugins/node_3d_editor_plugin.h"
5251#include " editor/property_selector.h"
5352#include " editor/themes/editor_scale.h"
5453#include " main/main.h"
5554#include " plugins/editor_preview_plugins.h"
56- #include " scene/3d/light_3d.h"
57- #include " scene/3d/mesh_instance_3d.h"
5855#include " scene/gui/box_container.h"
5956#include " scene/gui/control.h"
6057#include " scene/main/window.h"
6158#include " scene/resources/theme.h"
6259
60+ #ifndef _3D_DISABLED
61+ #include " editor/plugins/node_3d_editor_plugin.h"
62+ #include " scene/3d/light_3d.h"
63+ #include " scene/3d/mesh_instance_3d.h"
64+ #endif // _3D_DISABLED
65+
6366EditorInterface *EditorInterface::singleton = nullptr ;
6467
6568void EditorInterface::restart_editor (bool p_save) {
@@ -103,6 +106,7 @@ EditorUndoRedoManager *EditorInterface::get_editor_undo_redo() const {
103106 return EditorUndoRedoManager::get_singleton ();
104107}
105108
109+ #ifndef _3D_DISABLED
106110AABB EditorInterface::_calculate_aabb_for_scene (Node *p_node, AABB &p_scene_aabb) {
107111 MeshInstance3D *mesh_node = Object::cast_to<MeshInstance3D>(p_node);
108112 if (mesh_node && mesh_node->get_mesh ().is_valid ()) {
@@ -359,6 +363,7 @@ void EditorInterface::make_scene_preview(const String &p_path, Node *p_scene, in
359363 EditorResourcePreview::get_singleton ()->check_for_invalidation (p_path);
360364 EditorFileSystem::get_singleton ()->emit_signal (SNAME (" filesystem_changed" ));
361365}
366+ #endif // _3D_DISABLED
362367
363368void EditorInterface::set_plugin_enabled (const String &p_plugin, bool p_enabled) {
364369 EditorNode::get_singleton ()->set_addon_plugin_enabled (p_plugin, p_enabled, true );
@@ -390,10 +395,12 @@ SubViewport *EditorInterface::get_editor_viewport_2d() const {
390395 return EditorNode::get_singleton ()->get_scene_root ();
391396}
392397
398+ #ifndef _3D_DISABLED
393399SubViewport *EditorInterface::get_editor_viewport_3d (int p_idx) const {
394400 ERR_FAIL_INDEX_V (p_idx, static_cast <int >(Node3DEditor::VIEWPORTS_COUNT), nullptr );
395401 return Node3DEditor::get_singleton ()->get_editor_viewport (p_idx)->get_viewport_node ();
396402}
403+ #endif // _3D_DISABLED
397404
398405void EditorInterface::set_main_screen_editor (const String &p_name) {
399406 EditorNode::get_singleton ()->get_editor_main_screen ()->select_by_name (p_name);
@@ -754,10 +761,12 @@ void EditorInterface::get_argument_options(const StringName &p_function, int p_i
754761 for (String E : { " \" 2D\" " , " \" 3D\" " , " \" Script\" " , " \" Game\" " , " \" AssetLib\" " }) {
755762 r_options->push_back (E);
756763 }
764+ #ifndef _3D_DISABLED
757765 } else if (pf == " get_editor_viewport_3d" ) {
758766 for (uint32_t i = 0 ; i < Node3DEditor::VIEWPORTS_COUNT; i++) {
759767 r_options->push_back (String::num_int64 (i));
760768 }
769+ #endif // _3D_DISABLED
761770 }
762771 }
763772 Object::get_argument_options (p_function, p_idx, r_options);
@@ -779,7 +788,9 @@ void EditorInterface::_bind_methods() {
779788 ClassDB::bind_method (D_METHOD (" get_editor_toaster" ), &EditorInterface::get_editor_toaster);
780789 ClassDB::bind_method (D_METHOD (" get_editor_undo_redo" ), &EditorInterface::get_editor_undo_redo);
781790
791+ #ifndef _3D_DISABLED
782792 ClassDB::bind_method (D_METHOD (" make_mesh_previews" , " meshes" , " preview_size" ), &EditorInterface::_make_mesh_previews);
793+ #endif // _3D_DISABLED
783794
784795 ClassDB::bind_method (D_METHOD (" set_plugin_enabled" , " plugin" , " enabled" ), &EditorInterface::set_plugin_enabled);
785796 ClassDB::bind_method (D_METHOD (" is_plugin_enabled" , " plugin" ), &EditorInterface::is_plugin_enabled);
@@ -791,7 +802,9 @@ void EditorInterface::_bind_methods() {
791802 ClassDB::bind_method (D_METHOD (" get_editor_main_screen" ), &EditorInterface::get_editor_main_screen);
792803 ClassDB::bind_method (D_METHOD (" get_script_editor" ), &EditorInterface::get_script_editor);
793804 ClassDB::bind_method (D_METHOD (" get_editor_viewport_2d" ), &EditorInterface::get_editor_viewport_2d);
805+ #ifndef _3D_DISABLED
794806 ClassDB::bind_method (D_METHOD (" get_editor_viewport_3d" , " idx" ), &EditorInterface::get_editor_viewport_3d, DEFVAL (0 ));
807+ #endif // _3D_DISABLED
795808
796809 ClassDB::bind_method (D_METHOD (" set_main_screen_editor" , " name" ), &EditorInterface::set_main_screen_editor);
797810 ClassDB::bind_method (D_METHOD (" set_distraction_free_mode" , " enter" ), &EditorInterface::set_distraction_free_mode);
0 commit comments