diff --git a/SConstruct b/SConstruct index 3c772df6a29e..4069fc745c79 100644 --- a/SConstruct +++ b/SConstruct @@ -1071,12 +1071,9 @@ sys.modules.pop("detect") if env.editor_build: unsupported_opts = [] for disable_opt in [ - "disable_3d", "disable_advanced_gui", "disable_physics_2d", - "disable_physics_3d", "disable_navigation_2d", - "disable_navigation_3d", ]: if env[disable_opt]: unsupported_opts.append(disable_opt) diff --git a/editor/animation/animation_blend_tree_editor_plugin.cpp b/editor/animation/animation_blend_tree_editor_plugin.cpp index 10a69833cba1..869170f976be 100644 --- a/editor/animation/animation_blend_tree_editor_plugin.cpp +++ b/editor/animation/animation_blend_tree_editor_plugin.cpp @@ -42,7 +42,9 @@ #include "editor/inspector/editor_properties.h" #include "editor/settings/editor_settings.h" #include "editor/themes/editor_scale.h" +#ifndef _3D_DISABLED #include "scene/3d/skeleton_3d.h" +#endif // _3D_DISABLED #include "scene/gui/check_box.h" #include "scene/gui/grid_container.h" #include "scene/gui/line_edit.h" @@ -927,6 +929,7 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref &ano if (path.get_subname_count()) { String concat = path.get_concatenated_subnames(); +#ifndef _3D_DISABLED Skeleton3D *skeleton = Object::cast_to(node); if (skeleton && skeleton->find_bone(concat) != -1) { //path in skeleton @@ -967,6 +970,7 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref &ano } else { //just a property +#endif // _3D_DISABLED ti = filters->create_item(ti); ti->set_cell_mode(0, TreeItem::CELL_MODE_CHECK); ti->set_text(0, concat); @@ -974,7 +978,9 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref &ano ti->set_selectable(0, true); ti->set_checked(0, anode->is_path_filtered(path)); ti->set_metadata(0, path); +#ifndef _3D_DISABLED } +#endif // _3D_DISABLED } else { if (ti) { //just a node, not a property track diff --git a/editor/animation/animation_player_editor_plugin.cpp b/editor/animation/animation_player_editor_plugin.cpp index a186955be779..a1b698098545 100644 --- a/editor/animation/animation_player_editor_plugin.cpp +++ b/editor/animation/animation_player_editor_plugin.cpp @@ -44,7 +44,6 @@ #include "editor/editor_undo_redo_manager.h" #include "editor/gui/editor_file_dialog.h" #include "editor/gui/editor_validation_panel.h" -#include "editor/scene/3d/node_3d_editor_plugin.h" // For onion skinning. #include "editor/scene/canvas_item_editor_plugin.h" // For onion skinning. #include "editor/settings/editor_command_palette.h" #include "editor/settings/editor_settings.h" @@ -53,12 +52,15 @@ #include "scene/animation/animation_tree.h" #include "scene/gui/separator.h" #include "scene/main/scene_tree.h" -#include "scene/main/window.h" #include "scene/resources/animation.h" #include "scene/resources/image_texture.h" #include "servers/display/display_server.h" #include "servers/rendering/rendering_server.h" +#ifndef _3D_DISABLED +#include "editor/scene/3d/node_3d_editor_plugin.h" // For onion skinning. +#endif + /////////////////////////////////// void AnimationPlayerEditor::_find_player() { @@ -1795,6 +1797,7 @@ void AnimationPlayerEditor::_prepare_onion_layers_2_prolog() { _allocate_onion_layers(); } +#ifndef _3D_DISABLED // Hide superfluous elements that would make the overlay unnecessary cluttered. if (Node3DEditor::get_singleton()->is_visible()) { // 3D @@ -1819,6 +1822,7 @@ void AnimationPlayerEditor::_prepare_onion_layers_2_prolog() { Node3DEditor::get_singleton()->set_state(new_state); } else { // CanvasItemEditor. +#endif // _3D_DISABLED onion.temp.canvas_edit_state = CanvasItemEditor::get_singleton()->get_state(); Dictionary new_state = onion.temp.canvas_edit_state.duplicate(); new_state["show_origin"] = false; @@ -1832,7 +1836,9 @@ void AnimationPlayerEditor::_prepare_onion_layers_2_prolog() { new_state["show_transformation_gizmos"] = onion.include_gizmos ? new_state["gizmos"] : Variant(false); // TODO: Save/restore only affected entries. CanvasItemEditor::get_singleton()->set_state(new_state); +#ifndef _3D_DISABLED } +#endif // _3D_DISABLED // Tweak the root viewport to ensure it's rendered before our target. RID root_vp = get_tree()->get_root()->get_viewport_rid(); @@ -1942,14 +1948,18 @@ void AnimationPlayerEditor::_prepare_onion_layers_2_epilog() { player->seek_internal(onion.temp.anim_player_position, true, true, false); player->restore(onion.temp.anim_values_backup); +#ifndef _3D_DISABLED // Restore state of main editors. if (Node3DEditor::get_singleton()->is_visible()) { // 3D Node3DEditor::get_singleton()->set_state(onion.temp.spatial_edit_state); } else { // CanvasItemEditor // 2D +#endif // _3D_DISABLED CanvasItemEditor::get_singleton()->set_state(onion.temp.canvas_edit_state); +#ifndef _3D_DISABLED } +#endif // _3D_DISABLED // Update viewports with skin layers overlaid for the actual engine loop render. onion.can_overlay = true; @@ -2349,7 +2359,9 @@ AnimationPlayerEditor::~AnimationPlayerEditor() { void AnimationPlayerEditorPlugin::_notification(int p_what) { switch (p_what) { case NOTIFICATION_READY: { +#ifndef _3D_DISABLED Node3DEditor::get_singleton()->connect(SNAME("transform_key_request"), callable_mp(this, &AnimationPlayerEditorPlugin::_transform_key_request)); +#endif // _3D_DISABLED InspectorDock::get_inspector_singleton()->connect(SNAME("property_keyed"), callable_mp(this, &AnimationPlayerEditorPlugin::_property_keyed)); anim_editor->get_track_editor()->connect(SNAME("keying_changed"), callable_mp(this, &AnimationPlayerEditorPlugin::_update_keying)); InspectorDock::get_inspector_singleton()->connect(SNAME("edited_object_changed"), callable_mp(anim_editor->get_track_editor(), &AnimationTrackEditor::update_keying)); @@ -2367,6 +2379,7 @@ void AnimationPlayerEditorPlugin::_property_keyed(const String &p_keyed, const V te->insert_value_key(p_keyed, p_advance); } +#ifndef _3D_DISABLED void AnimationPlayerEditorPlugin::_transform_key_request(Object *sp, const String &p_sub, const Transform3D &p_key) { if (!anim_editor->get_track_editor()->has_keying()) { return; @@ -2379,6 +2392,7 @@ void AnimationPlayerEditorPlugin::_transform_key_request(Object *sp, const Strin anim_editor->get_track_editor()->insert_transform_key(s, p_sub, Animation::TYPE_ROTATION_3D, p_key.basis.get_rotation_quaternion()); anim_editor->get_track_editor()->insert_transform_key(s, p_sub, Animation::TYPE_SCALE_3D, p_key.basis.get_scale()); } +#endif // _3D_DISABLED void AnimationPlayerEditorPlugin::_update_keying() { InspectorDock::get_inspector_singleton()->set_keying(anim_editor->get_track_editor()->has_keying()); diff --git a/editor/animation/animation_player_editor_plugin.h b/editor/animation/animation_player_editor_plugin.h index b178dd0f9a80..46a16264f0cb 100644 --- a/editor/animation/animation_player_editor_plugin.h +++ b/editor/animation/animation_player_editor_plugin.h @@ -296,7 +296,9 @@ class AnimationPlayerEditorPlugin : public EditorPlugin { void _notification(int p_what); void _property_keyed(const String &p_keyed, const Variant &p_value, bool p_advance); +#ifndef _3D_DISABLED void _transform_key_request(Object *sp, const String &p_sub, const Transform3D &p_key); +#endif // _3D_DISABLED void _update_keying(); public: @@ -310,7 +312,9 @@ class AnimationPlayerEditorPlugin : public EditorPlugin { virtual void make_visible(bool p_visible) override; virtual void forward_canvas_force_draw_over_viewport(Control *p_overlay) override { anim_editor->forward_force_draw_over_viewport(p_overlay); } +#ifndef _3D_DISABLED virtual void forward_3d_force_draw_over_viewport(Control *p_overlay) override { anim_editor->forward_force_draw_over_viewport(p_overlay); } +#endif // _3D_DISABLED AnimationPlayerEditorPlugin(); ~AnimationPlayerEditorPlugin(); diff --git a/editor/animation/animation_track_editor.cpp b/editor/animation/animation_track_editor.cpp index db2d8f097aff..d3aefeaf7e1a 100644 --- a/editor/animation/animation_track_editor.cpp +++ b/editor/animation/animation_track_editor.cpp @@ -51,7 +51,9 @@ #include "editor/script/script_editor_plugin.h" #include "editor/settings/editor_settings.h" #include "editor/themes/editor_scale.h" +#ifndef _3D_DISABLED #include "scene/3d/mesh_instance_3d.h" +#endif // _3D_DISABLED #include "scene/animation/animation_player.h" #include "scene/animation/tween.h" #include "scene/gui/check_box.h" @@ -4551,7 +4553,7 @@ void AnimationTrackEditor::_insert_track(bool p_reset_wanted, bool p_create_bezi _edit_menu_pressed(EDIT_GOTO_NEXT_STEP_TIMELINE_ONLY); } } - +#ifndef _3D_DISABLED void AnimationTrackEditor::insert_transform_key(Node3D *p_node, const String &p_sub, const Animation::TrackType p_type, const Variant &p_value) { if (read_only) { popup_read_only_dialog(); @@ -4621,6 +4623,7 @@ bool AnimationTrackEditor::has_track(Node3D *p_node, const String &p_sub, const } return false; } +#endif // _3D_DISABLED void AnimationTrackEditor::_insert_animation_key(NodePath p_path, const Variant &p_value) { if (read_only) { @@ -6054,6 +6057,7 @@ void AnimationTrackEditor::_insert_key_from_track(float p_ofs, int p_track) { // id.value is filled in each case handled below. switch (animation->track_get_type(p_track)) { +#ifndef _3D_DISABLED case Animation::TYPE_POSITION_3D: { Node3D *base = Object::cast_to(node); @@ -6094,6 +6098,7 @@ void AnimationTrackEditor::_insert_key_from_track(float p_ofs, int p_track) { id.value = base->get_blend_shape_value(base->find_blend_shape_by_name(id.path.get_subname(0))); } break; +#endif // _3D_DISABLED case Animation::TYPE_VALUE: { NodePath bp; _find_hint_for_track(p_track, bp, &id.value); diff --git a/editor/animation/animation_track_editor.h b/editor/animation/animation_track_editor.h index 1d2fe00d8f87..534f3bf65c9f 100644 --- a/editor/animation/animation_track_editor.h +++ b/editor/animation/animation_track_editor.h @@ -34,7 +34,9 @@ #include "editor/editor_data.h" #include "editor/inspector/editor_properties.h" #include "editor/inspector/property_selector.h" +#ifndef _3D_DISABLED #include "scene/3d/node_3d.h" +#endif // _3D_DISABLED #include "scene/gui/control.h" #include "scene/gui/menu_button.h" #include "scene/gui/scroll_bar.h" @@ -972,8 +974,10 @@ class AnimationTrackEditor : public VBoxContainer { void set_anim_pos(float p_pos); void insert_node_value_key(Node *p_node, const String &p_property, bool p_only_if_exists = false, bool p_advance = false); void insert_value_key(const String &p_property, bool p_advance); +#ifndef _3D_DISABLED void insert_transform_key(Node3D *p_node, const String &p_sub, const Animation::TrackType p_type, const Variant &p_value); bool has_track(Node3D *p_node, const String &p_sub, const Animation::TrackType p_type); +#endif // _3D_DISABLED void make_insert_queue(); void commit_insert_queue(); diff --git a/editor/animation/animation_track_editor_plugins.cpp b/editor/animation/animation_track_editor_plugins.cpp index 61a5d0a50305..3f0986316468 100644 --- a/editor/animation/animation_track_editor_plugins.cpp +++ b/editor/animation/animation_track_editor_plugins.cpp @@ -39,11 +39,14 @@ #include "editor/themes/editor_scale.h" #include "scene/2d/animated_sprite_2d.h" #include "scene/2d/sprite_2d.h" -#include "scene/3d/sprite_3d.h" #include "scene/animation/animation_player.h" #include "servers/audio/audio_stream.h" #include "servers/rendering/rendering_server.h" +#ifndef _3D_DISABLED +#include "scene/3d/sprite_3d.h" +#endif // _3D_DISABLED + /// BOOL /// int AnimationTrackEditBool::get_key_height() const { Ref checked = get_theme_icon(SNAME("checked"), SNAME("CheckBox")); @@ -383,7 +386,11 @@ Rect2 AnimationTrackEditSpriteFrame::get_key_rect(int p_index, float p_pixels_se Size2 size; +#ifndef _3D_DISABLED if (Object::cast_to(object) || Object::cast_to(object)) { +#else + if (Object::cast_to(object)) { +#endif // _3D_DISABLED Ref texture = object->call("get_texture"); if (texture.is_null()) { return AnimationTrackEdit::get_key_rect(p_index, p_pixels_sec); @@ -404,7 +411,11 @@ Rect2 AnimationTrackEditSpriteFrame::get_key_rect(int p_index, float p_pixels_se if (vframes > 1) { size.y /= vframes; } +#ifndef _3D_DISABLED } else if (Object::cast_to(object) || Object::cast_to(object)) { +#else + } else if (Object::cast_to(object)) { +#endif // _3D_DISABLED Ref sf = object->call("get_sprite_frames"); if (sf.is_null()) { return AnimationTrackEdit::get_key_rect(p_index, p_pixels_sec); @@ -468,7 +479,11 @@ void AnimationTrackEditSpriteFrame::draw_key(int p_index, float p_pixels_sec, in Ref texture; Rect2 region; +#ifndef _3D_DISABLED if (Object::cast_to(object) || Object::cast_to(object)) { +#else + if (Object::cast_to(object)) { +#endif // _3D_DISABLED texture = object->call("get_texture"); if (texture.is_null()) { AnimationTrackEdit::draw_key(p_index, p_pixels_sec, p_x, p_selected, p_clip_left, p_clip_right); @@ -503,7 +518,11 @@ void AnimationTrackEditSpriteFrame::draw_key(int p_index, float p_pixels_sec, in region.position.x += region.size.x * coords.x; region.position.y += region.size.y * coords.y; +#ifndef _3D_DISABLED } else if (Object::cast_to(object) || Object::cast_to(object)) { +#else + } else if (Object::cast_to(object)) { +#endif // _3D_DISABLED Ref sf = object->call("get_sprite_frames"); if (sf.is_null()) { AnimationTrackEdit::draw_key(p_index, p_pixels_sec, p_x, p_selected, p_clip_left, p_clip_right); diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index 5c73772f14b5..7d28cc5cda04 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -54,12 +54,10 @@ #include "editor/gui/editor_file_dialog.h" #include "editor/gui/editor_toaster.h" #include "editor/inspector/editor_property_name_processor.h" -#include "editor/scene/3d/node_3d_editor_plugin.h" #include "editor/scene/canvas_item_editor_plugin.h" #include "editor/settings/editor_settings.h" #include "editor/themes/editor_scale.h" #include "main/performance.h" -#include "scene/3d/camera_3d.h" #include "scene/debugger/scene_debugger_object.h" #include "scene/gui/button.h" #include "scene/gui/dialogs.h" @@ -74,6 +72,11 @@ #include "servers/debugger/servers_debugger.h" #include "servers/display/display_server.h" +#ifndef _3D_DISABLED +#include "editor/scene/3d/node_3d_editor_plugin.h" +#include "scene/3d/camera_3d.h" +#endif // _3D_DISABLED + using CameraOverride = EditorDebuggerNode::CameraOverride; void ScriptEditorDebugger::_put_msg(const String &p_message, const Array &p_data, uint64_t p_thread_id) { @@ -1172,6 +1175,7 @@ void ScriptEditorDebugger::_notification(int p_what) { _put_msg("scene:transform_camera_2d", msg); } +#ifndef _3D_DISABLED // Node3D Editor { Node3DEditorViewport *viewport = Node3DEditor::get_singleton()->get_last_used_viewport(); @@ -1189,6 +1193,7 @@ void ScriptEditorDebugger::_notification(int p_what) { msg.push_back(cam->get_far()); _put_msg("scene:transform_camera_3d", msg); } +#endif // _3D_DISABLED } if (is_breaked() && can_request_idle_draw) { diff --git a/editor/docks/filesystem_dock.cpp b/editor/docks/filesystem_dock.cpp index 7ccf5396893e..b4db1819efba 100644 --- a/editor/docks/filesystem_dock.cpp +++ b/editor/docks/filesystem_dock.cpp @@ -53,7 +53,6 @@ #include "editor/gui/create_dialog.h" #include "editor/gui/directory_create_dialog.h" #include "editor/gui/editor_dir_dialog.h" -#include "editor/import/3d/scene_import_settings.h" #include "editor/inspector/editor_context_menu_plugin.h" #include "editor/inspector/editor_resource_preview.h" #include "editor/inspector/editor_resource_tooltip_plugins.h" @@ -75,6 +74,10 @@ #include "scene/resources/packed_scene.h" #include "servers/display/display_server.h" +#ifndef _3D_DISABLED +#include "editor/import/3d/scene_import_settings.h" +#endif // _3D_DISABLED + Control *FileSystemTree::make_custom_tooltip(const String &p_text) const { TreeItem *item = get_item_at_position(get_local_mouse_position()); if (!item) { @@ -1327,6 +1330,7 @@ void FileSystemDock::_select_file(const String &p_path, bool p_select_in_favorit String resource_type = ResourceLoader::get_resource_type(fpath); if (resource_type == "PackedScene" || resource_type == "AnimationLibrary") { +#ifndef _3D_DISABLED bool is_imported = false; { List importer_exts; @@ -1343,8 +1347,11 @@ void FileSystemDock::_select_file(const String &p_path, bool p_select_in_favorit if (is_imported) { SceneImportSettingsDialog::get_singleton()->open_settings(p_path, resource_type); } else { +#endif // _3D_DISABLED EditorNode::get_singleton()->load_scene_or_resource(fpath); +#ifndef _3D_DISABLED } +#endif // _3D_DISABLED } else if (ResourceLoader::is_imported(fpath)) { // If the importer has advanced settings, show them. int order; diff --git a/editor/docks/scene_tree_dock.cpp b/editor/docks/scene_tree_dock.cpp index 125b862771f8..ed06046dae21 100644 --- a/editor/docks/scene_tree_dock.cpp +++ b/editor/docks/scene_tree_dock.cpp @@ -53,7 +53,6 @@ #include "editor/gui/editor_quick_open_dialog.h" #include "editor/inspector/editor_context_menu_plugin.h" #include "editor/inspector/multi_node_edit.h" -#include "editor/scene/3d/node_3d_editor_plugin.h" #include "editor/scene/canvas_item_editor_plugin.h" #include "editor/scene/rename_dialog.h" #include "editor/scene/reparent_dialog.h" @@ -74,6 +73,10 @@ #include "scene/resources/packed_scene.h" #include "servers/display/display_server.h" +#ifndef _3D_DISABLED +#include "editor/scene/3d/node_3d_editor_plugin.h" +#endif // _3D_DISABLED + void SceneTreeDock::_nodes_drag_begin() { pending_click_select = nullptr; edited_object_at_drag_start = InspectorDock::get_inspector_singleton()->get_edited_object(); @@ -396,8 +399,10 @@ void SceneTreeDock::_perform_create_audio_stream_players(const Vector &p if (Input::get_singleton()->is_key_pressed(Key::SHIFT)) { if (Object::cast_to(p_parent)) { node_type = "AudioStreamPlayer2D"; +#ifndef _3D_DISABLED } else if (Object::cast_to(p_parent)) { node_type = "AudioStreamPlayer3D"; +#endif // _3D_DISABLED } } @@ -486,6 +491,7 @@ void SceneTreeDock::_replace_with_branch_scene(const String &p_file, Node *p_bas copy_2d->set_scale(base_2d->get_scale()); } +#ifndef _3D_DISABLED Node3D *copy_3d = Object::cast_to(instantiated_scene); Node3D *base_3d = Object::cast_to(p_base); if (copy_3d && base_3d) { @@ -493,6 +499,7 @@ void SceneTreeDock::_replace_with_branch_scene(const String &p_file, Node *p_bas copy_3d->set_rotation(base_3d->get_rotation()); copy_3d->set_scale(base_3d->get_scale()); } +#endif // _3D_DISABLED // Ensure that local signals are still connected. List signal_list; @@ -656,7 +663,9 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { if (preferred_types.is_empty()) { preferred_types.push_back("Control"); preferred_types.push_back("Node2D"); +#ifndef _3D_DISABLED preferred_types.push_back("Node3D"); +#endif // _3D_DISABLED } for (int i = 0; i < preferred_types.size(); i++) { @@ -1599,7 +1608,9 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { new_node = memnew(Node2D); break; case TOOL_CREATE_3D_SCENE: +#ifndef _3D_DISABLED new_node = memnew(Node3D); +#endif // _3D_DISABLED break; case TOOL_CREATE_USER_INTERFACE: { Control *node = memnew(Control); @@ -1688,9 +1699,11 @@ void SceneTreeDock::_notification(int p_what) { scene_tree->connect("node_changed", callable_mp((CanvasItem *)canvas_item_plugin->get_canvas_item_editor()->get_viewport_control(), &CanvasItem::queue_redraw)); } +#ifndef _3D_DISABLED Node3DEditorPlugin *spatial_editor_plugin = Object::cast_to(editor_data->get_editor_by_name("3D")); spatial_editor_plugin->get_spatial_editor()->connect("item_lock_status_changed", callable_mp(scene_tree, &SceneTreeEditor::_update_tree).bind(false)); spatial_editor_plugin->get_spatial_editor()->connect("item_group_status_changed", callable_mp(scene_tree, &SceneTreeEditor::_update_tree).bind(false)); +#endif // _3D_DISABLED filter->set_clear_button_enabled(true); @@ -1733,11 +1746,13 @@ void SceneTreeDock::_notification(int p_what) { button_2d->set_button_icon(get_editor_theme_icon(SNAME("Node2D"))); button_2d->connect(SceneStringName(pressed), callable_mp(this, &SceneTreeDock::_tool_selected).bind(TOOL_CREATE_2D_SCENE, false)); +#ifndef _3D_DISABLED button_3d = memnew(Button); beginner_node_shortcuts->add_child(button_3d); button_3d->set_text(TTR("3D Scene")); button_3d->set_button_icon(get_editor_theme_icon(SNAME("Node3D"))); button_3d->connect(SceneStringName(pressed), callable_mp(this, &SceneTreeDock::_tool_selected).bind(TOOL_CREATE_3D_SCENE, false)); +#endif // _3D_DISABLED button_ui = memnew(Button); beginner_node_shortcuts->add_child(button_ui); @@ -1800,9 +1815,11 @@ void SceneTreeDock::_notification(int p_what) { if (button_2d) { button_2d->set_button_icon(get_editor_theme_icon(SNAME("Node2D"))); } +#ifndef _3D_DISABLED if (button_3d) { button_3d->set_button_icon(get_editor_theme_icon(SNAME("Node3D"))); } +#endif // _3D_DISABLED if (button_ui) { button_ui->set_button_icon(get_editor_theme_icon(SNAME("Control"))); } @@ -2577,9 +2594,11 @@ void SceneTreeDock::_do_reparent(Node *p_new_parent, int p_position_in_parent, V if (Object::cast_to(node)) { undo_redo->add_do_method(node, "set_global_transform", Object::cast_to(node)->get_global_transform()); } +#ifndef _3D_DISABLED if (Object::cast_to(node)) { undo_redo->add_do_method(node, "set_global_transform", Object::cast_to(node)->get_global_transform()); } +#endif // _3D_DISABLED if (Object::cast_to(node)) { undo_redo->add_do_method(node, "set_global_position", Object::cast_to(node)->get_global_position()); } @@ -2622,9 +2641,11 @@ void SceneTreeDock::_do_reparent(Node *p_new_parent, int p_position_in_parent, V if (Object::cast_to(node)) { undo_redo->add_undo_method(node, "set_transform", Object::cast_to(node)->get_transform()); } +#ifndef _3D_DISABLED if (Object::cast_to(node)) { undo_redo->add_undo_method(node, "set_transform", Object::cast_to(node)->get_transform()); } +#endif // _3D_DISABLED if (!reparented_to_container && Object::cast_to(node)) { undo_redo->add_undo_method(node, "set_position", Object::cast_to(node)->get_position()); } @@ -2776,15 +2797,19 @@ void SceneTreeDock::_reparent_nodes_to_paths_with_transform_and_name(Node *p_roo node->get_owned_by(p_owner, &owned); node->reparent(parent_node); node->set_name(p_names[i]); +#ifndef _3D_DISABLED Node3D *node_3d = Object::cast_to(node); if (node_3d) { node_3d->set_transform(p_transforms[i]); } else { +#endif // _3D_DISABLED Node2D *node_2d = Object::cast_to(node); if (node_2d) { node_2d->set_transform(p_transforms[i]); } +#ifndef _3D_DISABLED } +#endif // _3D_DISABLED for (Node *F : owned) { F->set_owner(p_owner); @@ -2826,17 +2851,21 @@ void SceneTreeDock::_toggle_editable_children(Node *p_node) { owned_nodes_array.push_back(owned_node); paths_array.push_back(p_node->get_path_to(owned_node->get_parent())); name_array.push_back(owned_node->get_name()); +#ifndef _3D_DISABLED Node3D *node_3d = Object::cast_to(owned_node); if (node_3d) { transform_array.push_back(node_3d->get_transform()); } else { +#endif // _3D_DISABLED Node2D *node_2d = Object::cast_to(owned_node); if (node_2d) { transform_array.push_back(node_2d->get_transform()); } else { transform_array.push_back(Variant()); } +#ifndef _3D_DISABLED } +#endif // _3D_DISABLED } } @@ -2846,8 +2875,10 @@ void SceneTreeDock::_toggle_editable_children(Node *p_node) { } } +#ifndef _3D_DISABLED undo_redo->add_undo_method(Node3DEditor::get_singleton(), "update_all_gizmos", p_node); undo_redo->add_do_method(Node3DEditor::get_singleton(), "update_all_gizmos", p_node); +#endif // _3D_DISABLED undo_redo->add_undo_method(scene_tree, "update_tree"); undo_redo->add_do_method(scene_tree, "update_tree"); @@ -3196,7 +3227,8 @@ void SceneTreeDock::_create() { } if (center_parent) { - // Find parent type and only average positions of relevant nodes. +// Find parent type and only average positions of relevant nodes. +#ifndef _3D_DISABLED Node3D *parent_node_3d = Object::cast_to(last_created); if (parent_node_3d) { Vector3 position; @@ -3213,6 +3245,7 @@ void SceneTreeDock::_create() { parent_node_3d->set_global_position(position / node_count); } } +#endif // _3D_DISABLED Node2D *parent_node_2d = Object::cast_to(last_created); if (parent_node_2d) { @@ -3524,6 +3557,7 @@ void SceneTreeDock::_new_scene_from(const String &p_file) { copy_2d->set_scale(Size2(1, 1)); } } +#ifndef _3D_DISABLED Node3D *copy_3d = Object::cast_to(copy); if (copy_3d != nullptr) { if (reset_position) { @@ -3536,6 +3570,7 @@ void SceneTreeDock::_new_scene_from(const String &p_file) { copy_3d->set_scale(Vector3(1, 1, 1)); } } +#endif // _3D_DISABLED Ref sdata = memnew(PackedScene); Error err = sdata->pack(copy); @@ -4262,8 +4297,10 @@ void SceneTreeDock::_focus_node() { CanvasItemEditorPlugin *editor = Object::cast_to(editor_data->get_editor_by_name("2D")); editor->get_canvas_item_editor()->focus_selection(); } else { +#ifndef _3D_DISABLED Node3DEditorPlugin *editor = Object::cast_to(editor_data->get_editor_by_name("3D")); editor->get_spatial_editor()->get_editor_viewport(0)->focus_selection(); +#endif // _3D_DISABLED } } @@ -4720,15 +4757,19 @@ void SceneTreeDock::_feature_profile_changed() { if (profile.is_valid()) { profile_allow_editing = !profile->is_feature_disabled(EditorFeatureProfile::FEATURE_SCENE_TREE); profile_allow_script_editing = !profile->is_feature_disabled(EditorFeatureProfile::FEATURE_SCRIPT); +#ifndef _3D_DISABLED bool profile_allow_3d = !profile->is_feature_disabled(EditorFeatureProfile::FEATURE_3D); button_3d->set_visible(profile_allow_3d); +#endif // _3D_DISABLED button_add->set_visible(profile_allow_editing); button_instance->set_visible(profile_allow_editing); scene_tree->set_can_rename(profile_allow_editing); } else { +#ifndef _3D_DISABLED button_3d->set_visible(true); +#endif // _3D_DISABLED button_add->set_visible(true); button_instance->set_visible(true); scene_tree->set_can_rename(true); diff --git a/editor/docks/scene_tree_dock.h b/editor/docks/scene_tree_dock.h index 2dcd4699f785..9846a5715478 100644 --- a/editor/docks/scene_tree_dock.h +++ b/editor/docks/scene_tree_dock.h @@ -123,7 +123,9 @@ class SceneTreeDock : public EditorDock { VBoxContainer *favorite_node_shortcuts = nullptr; Button *button_2d = nullptr; +#ifndef _3D_DISABLED Button *button_3d = nullptr; +#endif // _3D_DISABLED Button *button_ui = nullptr; Button *button_custom = nullptr; Button *button_clipboard = nullptr; diff --git a/editor/editor_interface.cpp b/editor/editor_interface.cpp index d5d1b5e025eb..a2468d623bad 100644 --- a/editor/editor_interface.cpp +++ b/editor/editor_interface.cpp @@ -49,7 +49,6 @@ #include "editor/inspector/editor_resource_preview.h" #include "editor/inspector/property_selector.h" #include "editor/run/editor_run_bar.h" -#include "editor/scene/3d/node_3d_editor_plugin.h" #include "editor/scene/editor_scene_tabs.h" #include "editor/scene/scene_tree_editor.h" #include "editor/settings/editor_command_palette.h" @@ -57,8 +56,6 @@ #include "editor/settings/editor_settings.h" #include "editor/themes/editor_scale.h" #include "main/main.h" -#include "scene/3d/light_3d.h" -#include "scene/3d/mesh_instance_3d.h" #include "scene/gui/box_container.h" #include "scene/gui/control.h" #include "scene/main/window.h" @@ -68,6 +65,12 @@ #include "servers/display/display_server.h" #include "servers/rendering/rendering_server.h" +#ifndef _3D_DISABLED +#include "editor/scene/3d/node_3d_editor_plugin.h" +#include "scene/3d/light_3d.h" +#include "scene/3d/mesh_instance_3d.h" +#endif // _3D_DISABLED + EditorInterface *EditorInterface::singleton = nullptr; void EditorInterface::restart_editor(bool p_save) { @@ -111,6 +114,7 @@ EditorUndoRedoManager *EditorInterface::get_editor_undo_redo() const { return EditorUndoRedoManager::get_singleton(); } +#ifndef _3D_DISABLED AABB EditorInterface::_calculate_aabb_for_scene(Node *p_node, AABB &p_scene_aabb) { MeshInstance3D *mesh_node = Object::cast_to(p_node); if (mesh_node && mesh_node->get_mesh().is_valid()) { @@ -370,6 +374,7 @@ void EditorInterface::make_scene_preview(const String &p_path, Node *p_scene, in EditorResourcePreview::get_singleton()->check_for_invalidation(p_path); EditorFileSystem::get_singleton()->emit_signal(SNAME("filesystem_changed")); } +#endif // _3D_DISABLED void EditorInterface::add_root_node(Node *p_node) { if (EditorNode::get_singleton()->get_edited_scene()) { @@ -423,10 +428,12 @@ SubViewport *EditorInterface::get_editor_viewport_2d() const { return EditorNode::get_singleton()->get_scene_root(); } +#ifndef _3D_DISABLED SubViewport *EditorInterface::get_editor_viewport_3d(int p_idx) const { ERR_FAIL_INDEX_V(p_idx, static_cast(Node3DEditor::VIEWPORTS_COUNT), nullptr); return Node3DEditor::get_singleton()->get_editor_viewport(p_idx)->get_viewport_node(); } +#endif // _3D_DISABLED void EditorInterface::set_main_screen_editor(const String &p_name) { EditorNode::get_singleton()->get_editor_main_screen()->select_by_name(p_name); @@ -452,6 +459,7 @@ String EditorInterface::get_editor_language() const { return EditorSettings::get_singleton()->get_language(); } +#ifndef _3D_DISABLED bool EditorInterface::is_node_3d_snap_enabled() const { return Node3DEditor::get_singleton()->is_snap_enabled(); } @@ -467,6 +475,7 @@ real_t EditorInterface::get_node_3d_rotate_snap() const { real_t EditorInterface::get_node_3d_scale_snap() const { return Node3DEditor::get_singleton()->get_scale_snap(); } +#endif // _3D_DISABLED void EditorInterface::popup_dialog(Window *p_dialog, const Rect2i &p_screen_rect) { p_dialog->popup_exclusive(EditorNode::get_singleton(), p_screen_rect); @@ -830,10 +839,12 @@ void EditorInterface::get_argument_options(const StringName &p_function, int p_i for (String E : { "\"2D\"", "\"3D\"", "\"Script\"", "\"Game\"", "\"AssetLib\"" }) { r_options->push_back(E); } +#ifndef _3D_DISABLED } else if (pf == "get_editor_viewport_3d") { for (uint32_t i = 0; i < Node3DEditor::VIEWPORTS_COUNT; i++) { r_options->push_back(String::num_int64(i)); } +#endif // _3D_DISABLED } } Object::get_argument_options(p_function, p_idx, r_options); @@ -855,7 +866,9 @@ void EditorInterface::_bind_methods() { ClassDB::bind_method(D_METHOD("get_editor_toaster"), &EditorInterface::get_editor_toaster); ClassDB::bind_method(D_METHOD("get_editor_undo_redo"), &EditorInterface::get_editor_undo_redo); +#ifndef _3D_DISABLED ClassDB::bind_method(D_METHOD("make_mesh_previews", "meshes", "preview_size"), &EditorInterface::_make_mesh_previews); +#endif // _3D_DISABLED ClassDB::bind_method(D_METHOD("set_plugin_enabled", "plugin", "enabled"), &EditorInterface::set_plugin_enabled); ClassDB::bind_method(D_METHOD("is_plugin_enabled", "plugin"), &EditorInterface::is_plugin_enabled); @@ -867,7 +880,9 @@ void EditorInterface::_bind_methods() { 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); +#ifndef _3D_DISABLED ClassDB::bind_method(D_METHOD("get_editor_viewport_3d", "idx"), &EditorInterface::get_editor_viewport_3d, DEFVAL(0)); +#endif // _3D_DISABLED 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); @@ -877,10 +892,12 @@ void EditorInterface::_bind_methods() { ClassDB::bind_method(D_METHOD("get_editor_scale"), &EditorInterface::get_editor_scale); ClassDB::bind_method(D_METHOD("get_editor_language"), &EditorInterface::get_editor_language); +#ifndef _3D_DISABLED ClassDB::bind_method(D_METHOD("is_node_3d_snap_enabled"), &EditorInterface::is_node_3d_snap_enabled); ClassDB::bind_method(D_METHOD("get_node_3d_translate_snap"), &EditorInterface::get_node_3d_translate_snap); ClassDB::bind_method(D_METHOD("get_node_3d_rotate_snap"), &EditorInterface::get_node_3d_rotate_snap); ClassDB::bind_method(D_METHOD("get_node_3d_scale_snap"), &EditorInterface::get_node_3d_scale_snap); +#endif // _3D_DISABLED ClassDB::bind_method(D_METHOD("popup_dialog", "dialog", "rect"), &EditorInterface::popup_dialog, DEFVAL(Rect2i())); ClassDB::bind_method(D_METHOD("popup_dialog_centered", "dialog", "minsize"), &EditorInterface::popup_dialog_centered, DEFVAL(Size2i())); diff --git a/editor/editor_interface.h b/editor/editor_interface.h index 9bb588f86ba9..da6069827a08 100644 --- a/editor/editor_interface.h +++ b/editor/editor_interface.h @@ -79,8 +79,10 @@ class EditorInterface : public Object { // Editor tools. +#ifndef _3D_DISABLED TypedArray _make_mesh_previews(const TypedArray &p_meshes, int p_preview_size); AABB _calculate_aabb_for_scene(Node *p_node, AABB &p_scene_aabb); +#endif // _3D_DISABLED protected: static void _bind_methods(); @@ -108,9 +110,6 @@ class EditorInterface : public Object { EditorToaster *get_editor_toaster() const; EditorUndoRedoManager *get_editor_undo_redo() const; - Vector> make_mesh_previews(const Vector> &p_meshes, Vector *p_transforms, int p_preview_size); - void make_scene_preview(const String &p_path, Node *p_scene, int p_preview_size); - void set_plugin_enabled(const String &p_plugin, bool p_enabled); bool is_plugin_enabled(const String &p_plugin) const; @@ -122,7 +121,6 @@ class EditorInterface : public Object { VBoxContainer *get_editor_main_screen() const; ScriptEditor *get_script_editor() const; SubViewport *get_editor_viewport_2d() const; - SubViewport *get_editor_viewport_3d(int p_idx = 0) const; void set_main_screen_editor(const String &p_name); void set_distraction_free_mode(bool p_enter); @@ -132,10 +130,16 @@ class EditorInterface : public Object { float get_editor_scale() const; String get_editor_language() const; +#ifndef _3D_DISABLED + Vector> make_mesh_previews(const Vector> &p_meshes, Vector *p_transforms, int p_preview_size); + void make_scene_preview(const String &p_path, Node *p_scene, int p_preview_size); + SubViewport *get_editor_viewport_3d(int p_idx = 0) const; + bool is_node_3d_snap_enabled() const; real_t get_node_3d_translate_snap() const; real_t get_node_3d_rotate_snap() const; real_t get_node_3d_scale_snap() const; +#endif // _3D_DISABLED void popup_dialog(Window *p_dialog, const Rect2i &p_screen_rect = Rect2i()); void popup_dialog_centered(Window *p_dialog, const Size2i &p_minsize = Size2i()); diff --git a/editor/editor_main_screen.cpp b/editor/editor_main_screen.cpp index 730be32eadcd..4ef1014160eb 100644 --- a/editor/editor_main_screen.cpp +++ b/editor/editor_main_screen.cpp @@ -43,11 +43,18 @@ void EditorMainScreen::_notification(int p_what) { switch (p_what) { case NOTIFICATION_READY: { set_accessibility_region(true); +#ifndef _3D_DISABLED if (EDITOR_3D < buttons.size() && buttons[EDITOR_3D]->is_visible()) { // If the 3D editor is enabled, use this as the default. select(EDITOR_3D); return; } +#else + if (buttons[EDITOR_2D]->is_visible()) { + select(EDITOR_2D); + return; + } +#endif // _3D_DISABLED // Switch to the first main screen plugin that is enabled. Usually this is // 2D, but may be subsequent ones if 2D is disabled in the feature profile. diff --git a/editor/editor_main_screen.h b/editor/editor_main_screen.h index 78ec4992feb9..a9ae2967e1f2 100644 --- a/editor/editor_main_screen.h +++ b/editor/editor_main_screen.h @@ -44,7 +44,9 @@ class EditorMainScreen : public PanelContainer { public: enum EditorTable { EDITOR_2D = 0, +#ifndef _3D_DISABLED EDITOR_3D, +#endif // _3D_DISABLED EDITOR_SCRIPT, EDITOR_GAME, EDITOR_ASSETLIB, diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index c0eb3efd44f8..38b7ce2ed836 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -88,10 +88,6 @@ #include "editor/gui/editor_toaster.h" #include "editor/gui/progress_dialog.h" #include "editor/gui/window_wrapper.h" -#include "editor/import/3d/editor_import_collada.h" -#include "editor/import/3d/resource_importer_obj.h" -#include "editor/import/3d/resource_importer_scene.h" -#include "editor/import/3d/scene_import_settings.h" #include "editor/import/audio_stream_import_settings.h" #include "editor/import/dynamic_font_import_settings.h" #include "editor/import/fbx_importer_manager.h" @@ -123,10 +119,6 @@ #include "editor/run/editor_run.h" #include "editor/run/editor_run_bar.h" #include "editor/run/game_view_plugin.h" -#include "editor/scene/3d/material_3d_conversion_plugins.h" -#include "editor/scene/3d/mesh_library_editor_plugin.h" -#include "editor/scene/3d/node_3d_editor_plugin.h" -#include "editor/scene/3d/root_motion_editor_plugin.h" #include "editor/scene/canvas_item_editor_plugin.h" #include "editor/scene/editor_scene_tabs.h" #include "editor/scene/material_editor_plugin.h" @@ -151,7 +143,6 @@ #include "editor/version_control/version_control_editor_plugin.h" #include "main/main.h" #include "scene/2d/node_2d.h" -#include "scene/3d/bone_attachment_3d.h" #include "scene/animation/animation_tree.h" #include "scene/gui/color_picker.h" #include "scene/gui/dialogs.h" @@ -176,8 +167,10 @@ #include "servers/audio/audio_server.h" #include "servers/display/display_server.h" #include "servers/navigation_2d/navigation_server_2d.h" -#include "servers/navigation_3d/navigation_server_3d.h" #include "servers/rendering/rendering_server.h" +#ifndef NAVIGATION_3D_DISABLED +#include "servers/navigation_3d/navigation_server_3d.h" +#endif // NAVIGATION_3D_DISABLED #ifdef VULKAN_ENABLED #include "editor/shader/shader_baker/shader_baker_export_plugin_platform_vulkan.h" @@ -205,6 +198,18 @@ #include "modules/modules_enabled.gen.h" // For gdscript, mono. +#ifndef _3D_DISABLED +#include "editor/import/3d/editor_import_collada.h" +#include "editor/import/3d/resource_importer_obj.h" +#include "editor/import/3d/resource_importer_scene.h" +#include "editor/import/3d/scene_import_settings.h" +#include "editor/scene/3d/material_3d_conversion_plugins.h" +#include "editor/scene/3d/mesh_library_editor_plugin.h" +#include "editor/scene/3d/node_3d_editor_plugin.h" +#include "editor/scene/3d/root_motion_editor_plugin.h" +#include "scene/3d/bone_attachment_3d.h" +#endif // _3D_DISABLED + #include EditorNode *EditorNode::singleton = nullptr; @@ -414,8 +419,10 @@ void EditorNode::shortcut_input(const Ref &p_event) { FileSystemDock::get_singleton()->focus_on_filter(); } else if (ED_IS_SHORTCUT("editor/editor_2d", p_event)) { editor_main_screen->select(EditorMainScreen::EDITOR_2D); +#ifndef _3D_DISABLED } else if (ED_IS_SHORTCUT("editor/editor_3d", p_event)) { editor_main_screen->select(EditorMainScreen::EDITOR_3D); +#endif // _3D_DISABLED } else if (ED_IS_SHORTCUT("editor/editor_script", p_event)) { editor_main_screen->select(EditorMainScreen::EDITOR_SCRIPT); } else if (ED_IS_SHORTCUT("editor/editor_game", p_event)) { @@ -441,10 +448,14 @@ void EditorNode::shortcut_input(const Ref &p_event) { Node *node_with_visibility; node_with_visibility = Object::cast_to(E); if (!node_with_visibility || !node_with_visibility->is_inside_tree()) { +#ifndef _3D_DISABLED node_with_visibility = Object::cast_to(E); if (!node_with_visibility || !node_with_visibility->is_inside_tree()) { +#endif // _3D_DISABLED continue; +#ifndef _3D_DISABLED } +#endif // _3D_DISABLED } undo_redo->add_do_method(node_with_visibility, "set_visible", !node_with_visibility->get("visible")); @@ -607,6 +618,7 @@ void EditorNode::_update_from_settings() { NavigationServer2D::get_singleton()->set_debug_navigation_enable_edge_lines(GLOBAL_GET("debug/shapes/navigation/2d/enable_edge_lines")); NavigationServer2D::get_singleton()->set_debug_navigation_enable_geometry_face_random_color(GLOBAL_GET("debug/shapes/navigation/2d/enable_geometry_face_random_color")); +#ifndef NAVIGATION_3D_DISABLED NavigationServer3D::get_singleton()->set_debug_navigation_edge_connection_color(GLOBAL_GET("debug/shapes/navigation/3d/edge_connection_color")); NavigationServer3D::get_singleton()->set_debug_navigation_geometry_edge_color(GLOBAL_GET("debug/shapes/navigation/3d/geometry_edge_color")); NavigationServer3D::get_singleton()->set_debug_navigation_geometry_face_color(GLOBAL_GET("debug/shapes/navigation/3d/geometry_face_color")); @@ -617,6 +629,7 @@ void EditorNode::_update_from_settings() { NavigationServer3D::get_singleton()->set_debug_navigation_enable_edge_lines(GLOBAL_GET("debug/shapes/navigation/3d/enable_edge_lines")); NavigationServer3D::get_singleton()->set_debug_navigation_enable_edge_lines_xray(GLOBAL_GET("debug/shapes/navigation/3d/enable_edge_lines_xray")); NavigationServer3D::get_singleton()->set_debug_navigation_enable_geometry_face_random_color(GLOBAL_GET("debug/shapes/navigation/3d/enable_geometry_face_random_color")); +#endif // NAVIGATION_3D_DISABLED #endif // DEBUG_ENABLED } @@ -936,7 +949,9 @@ void EditorNode::_notification(int p_what) { _update_theme(true); OS::get_singleton()->set_low_processor_usage_mode_sleep_usec(int(EDITOR_GET("interface/editor/timers/low_processor_mode_sleep_usec"))); +#ifndef _3D_DISABLED get_tree()->get_root()->set_as_audio_listener_3d(false); +#endif // _3D_DISABLED get_tree()->get_root()->set_as_audio_listener_2d(false); get_tree()->get_root()->set_snap_2d_transforms_to_pixel(false); get_tree()->get_root()->set_snap_2d_vertices_to_pixel(false); @@ -1004,9 +1019,10 @@ void EditorNode::_notification(int p_what) { } default_layout->set_value("docks", "dock_9", String(",").join(bottom_docks)); +#ifndef _3D_DISABLED RenderingServer::get_singleton()->viewport_set_disable_2d(get_scene_root()->get_viewport_rid(), true); +#endif // _3D_DISABLED RenderingServer::get_singleton()->viewport_set_environment_mode(get_viewport()->get_viewport_rid(), RSE::VIEWPORT_ENVIRONMENT_DISABLED); - DisplayServer::get_singleton()->screen_set_keep_on(EDITOR_GET("interface/editor/display/keep_screen_on")); feature_profile_manager->notify_changed(); @@ -2246,8 +2262,10 @@ void EditorNode::_find_node_types(Node *p_node, int &count_2d, int &count_3d) { if (p_node->is_class("CanvasItem")) { count_2d++; +#ifndef _3D_DISABLED } else if (p_node->is_class("Node3D")) { count_3d++; +#endif // _3D_DISABLED } for (int i = 0; i < p_node->get_child_count(); i++) { @@ -2281,6 +2299,7 @@ void EditorNode::_save_scene_with_preview(String p_file, int p_idx) { if (viewport_texture->get_width() > 0 && viewport_texture->get_height() > 0) { img = viewport_texture->get_image(); } +#ifndef _3D_DISABLED } else { // The 3D editor may be disabled as a feature, but scenes can still be opened. // This check prevents the preview from regenerating in case those scenes are then saved. @@ -2289,6 +2308,7 @@ void EditorNode::_save_scene_with_preview(String p_file, int p_idx) { if (profile.is_null() || !profile->is_feature_disabled(EditorFeatureProfile::FEATURE_3D)) { img = Node3DEditor::get_singleton()->get_editor_viewport(0)->get_viewport_node()->get_texture()->get_image(); } +#endif // _3D_DISABLED } if (img.is_valid() && img->get_width() > 0 && img->get_height() > 0) { @@ -2484,7 +2504,9 @@ void EditorNode::_save_scene(String p_file, int idx) { scene->propagate_notification(NOTIFICATION_EDITOR_PRE_SAVE); editor_data.apply_changes_in_editors(); +#ifndef _3D_DISABLED save_default_environment(); +#endif // _3D_DISABLED List>> anim_backups; _reset_animation_mixers(scene, &anim_backups); _save_editor_states(p_file, idx); @@ -2632,7 +2654,9 @@ void EditorNode::_save_all_scenes() { _save_scene(scene_path, i); } } +#ifndef _3D_DISABLED save_default_environment(); +#endif // _3D_DISABLED if (!scenes_to_save_as.is_empty()) { _proceed_save_asing_scene_tabs(); @@ -2728,7 +2752,9 @@ void EditorNode::_dialog_action(String p_file) { return; } +#ifndef _3D_DISABLED save_default_environment(); +#endif // _3D_DISABLED _save_scene_with_preview(p_file, scene_idx); _add_to_recent_scenes(p_file); save_editor_layout_delayed(); @@ -2752,7 +2778,9 @@ void EditorNode::_dialog_action(String p_file) { case SAVE_AND_RUN: { if (file->get_file_mode() == EditorFileDialog::FILE_MODE_SAVE_FILE) { +#ifndef _3D_DISABLED save_default_environment(); +#endif // _3D_DISABLED _save_scene_with_preview(p_file); project_run_bar->play_custom_scene(p_file); } @@ -2763,12 +2791,15 @@ void EditorNode::_dialog_action(String p_file) { ProjectSettings::get_singleton()->save(); if (file->get_file_mode() == EditorFileDialog::FILE_MODE_SAVE_FILE) { +#ifndef _3D_DISABLED save_default_environment(); +#endif // _3D_DISABLED _save_scene_with_preview(p_file); project_run_bar->play_main_scene((bool)pick_main_scene->get_meta("from_native", false)); } } break; +#ifndef _3D_DISABLED case FILE_EXPORT_MESH_LIBRARY: { const Dictionary &fd_options = file_export_lib->get_selected_options(); bool merge_with_existing_library = fd_options.get(TTR("Merge With Existing"), true); @@ -2800,6 +2831,7 @@ void EditorNode::_dialog_action(String p_file) { } } break; +#endif // _3D_DISABLED case PROJECT_PACK_AS_ZIP: { ProjectZIPPacker::pack_project_zip(p_file); @@ -3036,6 +3068,7 @@ void EditorNode::push_item_no_inspector(Object *p_object) { _edit_current(false, true); } +#ifndef _3D_DISABLED void EditorNode::save_default_environment() { Ref fallback = get_tree()->get_root()->get_world_3d()->get_fallback_environment(); @@ -3045,6 +3078,7 @@ void EditorNode::save_default_environment() { save_resource_in_path(fallback, fallback->get_path()); } } +#endif // _3D_DISABLED void EditorNode::hide_unused_editors(const Object *p_editing_owner) { if (p_editing_owner) { @@ -4114,6 +4148,7 @@ void EditorNode::_tool_menu_option(int p_idx) { } void EditorNode::_export_as_menu_option(int p_idx) { +#ifndef _3D_DISABLED if (p_idx == 0) { // MeshLibrary current_menu_option = FILE_EXPORT_MESH_LIBRARY; @@ -4133,6 +4168,7 @@ void EditorNode::_export_as_menu_option(int p_idx) { file_export_lib->set_title(TTR("Export Mesh Library")); file_export_lib->popup_file_dialog(); } else { // Custom menu options added by plugins +#endif // _3D_DISABLED if (export_as_menu->get_item_submenu(p_idx).is_empty()) { // If not a submenu Callable callback = export_as_menu->get_item_metadata(p_idx); Callable::CallError ce; @@ -4144,7 +4180,9 @@ void EditorNode::_export_as_menu_option(int p_idx) { ERR_PRINT("Error calling function from export_as menu: " + err); } } +#ifndef _3D_DISABLED } +#endif // _3D_DISABLED } int EditorNode::_next_unsaved_scene(bool p_valid_filename, int p_start) { @@ -5218,10 +5256,12 @@ void EditorNode::get_preload_scene_modification_table( if (node_2d) { new_additive_node_entry.transform_2d = node_2d->get_transform(); } +#ifndef _3D_DISABLED Node3D *node_3d = Object::cast_to(p_node); if (node_3d) { new_additive_node_entry.transform_3d = node_3d->get_transform(); } +#endif // _3D_DISABLED p_instance_modifications.addition_list.push_back(new_additive_node_entry); } @@ -7087,6 +7127,7 @@ void EditorNode::_file_access_close_error_notify_impl(const String &p_str) { // tree so that editor scripts which create transient nodes will have the opportunity // to recreate them. void EditorNode::_notify_nodes_scene_reimported(Node *p_node, Array p_reimported_nodes) { +#ifndef _3D_DISABLED Skeleton3D *skel_3d = Object::cast_to(p_node); if (skel_3d) { skel_3d->reset_bone_poses(); @@ -7096,6 +7137,7 @@ void EditorNode::_notify_nodes_scene_reimported(Node *p_node, Array p_reimported attachment->notify_rebind_required(); } } +#endif // _3D_DISABLED if (p_node->has_method("_nodes_scene_reimported")) { p_node->call("_nodes_scene_reimported", p_reimported_nodes); @@ -7535,10 +7577,12 @@ void EditorNode::reload_instances_with_path_in_edited_scenes() { node_2d->set_transform(additive_node_entry.transform_2d); } +#ifndef _3D_DISABLED Node3D *node_3d = Object::cast_to(additive_node_entry.node); if (node_3d) { node_3d->set_transform(additive_node_entry.transform_3d); } +#endif // _3D_DISABLED } } @@ -7850,7 +7894,9 @@ void EditorNode::_feature_profile_changed() { editor_dock_manager->set_dock_enabled(ImportDock::get_singleton(), !fs_dock_disabled && !profile->is_feature_disabled(EditorFeatureProfile::FEATURE_IMPORT_DOCK)); editor_dock_manager->set_dock_enabled(history_dock, !profile->is_feature_disabled(EditorFeatureProfile::FEATURE_HISTORY_DOCK)); +#ifndef _3D_DISABLED editor_main_screen->set_button_enabled(EditorMainScreen::EDITOR_3D, !profile->is_feature_disabled(EditorFeatureProfile::FEATURE_3D)); +#endif // _3D_DISABLED editor_main_screen->set_button_enabled(EditorMainScreen::EDITOR_SCRIPT, !profile->is_feature_disabled(EditorFeatureProfile::FEATURE_SCRIPT)); if (!Engine::get_singleton()->is_recovery_mode_hint()) { editor_main_screen->set_button_enabled(EditorMainScreen::EDITOR_GAME, !profile->is_feature_disabled(EditorFeatureProfile::FEATURE_GAME)); @@ -7864,7 +7910,9 @@ void EditorNode::_feature_profile_changed() { editor_dock_manager->set_dock_enabled(GroupsDock::get_singleton(), true); editor_dock_manager->set_dock_enabled(FileSystemDock::get_singleton(), true); editor_dock_manager->set_dock_enabled(history_dock, true); +#ifndef _3D_DISABLED editor_main_screen->set_button_enabled(EditorMainScreen::EDITOR_3D, true); +#endif // _3D_DISABLED editor_main_screen->set_button_enabled(EditorMainScreen::EDITOR_SCRIPT, true); if (!Engine::get_singleton()->is_recovery_mode_hint()) { editor_main_screen->set_button_enabled(EditorMainScreen::EDITOR_GAME, true); @@ -8019,7 +8067,9 @@ void EditorNode::_build_file_menu() { if (!export_as_menu) { export_as_menu = memnew(PopupMenu); +#ifndef _3D_DISABLED export_as_menu->add_shortcut(ED_GET_SHORTCUT("editor/export_as_mesh_library"), FILE_EXPORT_MESH_LIBRARY); +#endif // _3D_DISABLED export_as_menu->connect("index_pressed", callable_mp(this, &EditorNode::_export_as_menu_option)); } file_menu->add_submenu_node_item(TTRC("Export As..."), export_as_menu, SCENE_EXPORT_AS); @@ -8361,12 +8411,14 @@ EditorNode::EditorNode() { AudioServer::get_singleton()->set_enable_tagging_used_audio_streams(true); +#ifndef NAVIGATION_3D_DISABLED // No navigation by default if in editor. if (NavigationServer3D::get_singleton()->get_debug_enabled()) { NavigationServer3D::get_singleton()->set_active(true); } else { NavigationServer3D::get_singleton()->set_active(false); } +#endif // NAVIGATION_3D_DISABLED // No physics by default if in editor. #ifndef PHYSICS_3D_DISABLED @@ -8554,14 +8606,17 @@ EditorNode::EditorNode() { import_wav.instantiate(); ResourceFormatImporter::get_singleton()->add_importer(import_wav); +#ifndef _3D_DISABLED Ref import_obj; import_obj.instantiate(); ResourceFormatImporter::get_singleton()->add_importer(import_obj); +#endif // _3D_DISABLED Ref import_shader_file; import_shader_file.instantiate(); ResourceFormatImporter::get_singleton()->add_importer(import_shader_file); +#ifndef _3D_DISABLED Ref import_model_as_scene; import_model_as_scene.instantiate("PackedScene"); ResourceFormatImporter::get_singleton()->add_importer(import_model_as_scene); @@ -8588,7 +8643,12 @@ EditorNode::EditorNode() { Ref import_escn; import_escn.instantiate(); ResourceImporterScene::add_scene_importer(import_escn); + + Ref rmp; + rmp.instantiate(); + EditorInspector::add_inspector_plugin(rmp); } +#endif // _3D_DISABLED Ref import_bitmap; import_bitmap.instantiate(); @@ -8600,10 +8660,6 @@ EditorNode::EditorNode() { eidp.instantiate(); EditorInspector::add_inspector_plugin(eidp); - Ref rmp; - rmp.instantiate(); - EditorInspector::add_inspector_plugin(rmp); - Ref ppm; ppm.instantiate(); EditorInspector::add_inspector_plugin(ppm); @@ -8858,7 +8914,9 @@ EditorNode::EditorNode() { scene_root->set_auto_translate_mode(AUTO_TRANSLATE_MODE_ALWAYS); scene_root->set_translation_domain(StringName()); scene_root->set_embedding_subwindows(true); +#ifndef _3D_DISABLED scene_root->set_disable_3d(true); +#endif // _3D_DISABLED scene_root->set_disable_input(true); scene_root->set_as_audio_listener_2d(true); @@ -8884,8 +8942,10 @@ EditorNode::EditorNode() { project_settings_editor = memnew(ProjectSettingsEditor(&editor_data)); gui_base->add_child(project_settings_editor); +#ifndef _3D_DISABLED scene_import_settings = memnew(SceneImportSettingsDialog); gui_base->add_child(scene_import_settings); +#endif // _3D_DISABLED audio_stream_import_settings = memnew(AudioStreamImportSettingsDialog); gui_base->add_child(audio_stream_import_settings); @@ -8939,7 +8999,9 @@ EditorNode::EditorNode() { ED_SHORTCUT_AND_COMMAND("editor/quick_open_scene", TTRC("Quick Open Scene..."), KeyModifierMask::CMD_OR_CTRL + KeyModifierMask::SHIFT + Key::O); ED_SHORTCUT_AND_COMMAND("editor/quick_open_script", TTRC("Quick Open Script..."), KeyModifierMask::CMD_OR_CTRL + KeyModifierMask::ALT + Key::O); +#ifndef _3D_DISABLED ED_SHORTCUT("editor/export_as_mesh_library", TTRC("MeshLibrary...")); +#endif // _3D_DISABLED ED_SHORTCUT_AND_COMMAND("editor/reload_saved_scene", TTRC("Reload Saved Scene")); ED_SHORTCUT_AND_COMMAND("editor/close_scene", TTRC("Close Scene"), KeyModifierMask::CMD_OR_CTRL + KeyModifierMask::SHIFT + Key::W); @@ -9379,7 +9441,9 @@ EditorNode::EditorNode() { gui_base->add_child(project_data_missing); add_editor_plugin(memnew(CanvasItemEditorPlugin)); +#ifndef _3D_DISABLED add_editor_plugin(memnew(Node3DEditorPlugin)); +#endif // _3D_DISABLED add_editor_plugin(memnew(ScriptEditorPlugin)); if (!Engine::get_singleton()->is_recovery_mode_hint()) { @@ -9433,6 +9497,7 @@ EditorNode::EditorNode() { resource_preview->add_preview_generator(Ref(memnew(EditorGradientPreviewPlugin))); { +#ifndef _3D_DISABLED Ref spatial_mat_convert; spatial_mat_convert.instantiate(); resource_conversion_plugins.push_back(spatial_mat_convert); @@ -9440,6 +9505,7 @@ EditorNode::EditorNode() { Ref orm_mat_convert; orm_mat_convert.instantiate(); resource_conversion_plugins.push_back(orm_mat_convert); +#endif // _3D_DISABLED Ref canvas_item_mat_convert; canvas_item_mat_convert.instantiate(); @@ -9453,6 +9519,7 @@ EditorNode::EditorNode() { particles_mat_convert.instantiate(); resource_conversion_plugins.push_back(particles_mat_convert); +#ifndef _3D_DISABLED Ref procedural_sky_mat_convert; procedural_sky_mat_convert.instantiate(); resource_conversion_plugins.push_back(procedural_sky_mat_convert); @@ -9468,6 +9535,7 @@ EditorNode::EditorNode() { Ref fog_mat_convert; fog_mat_convert.instantiate(); resource_conversion_plugins.push_back(fog_mat_convert); +#endif // _3D_DISABLED } update_spinner_step_msec = OS::get_singleton()->get_ticks_msec(); @@ -9590,8 +9658,10 @@ EditorNode::EditorNode() { ResourceSaver::set_save_callback(_resource_saved); ResourceLoader::set_load_callback(_resource_loaded); +#ifndef _3D_DISABLED // Apply setting presets in case the editor_settings file is missing values. EditorSettingsDialog::update_navigation_preset(); +#endif // _3D_DISABLED screenshot_timer = memnew(Timer); screenshot_timer->set_one_shot(true); @@ -9623,7 +9693,9 @@ EditorNode::EditorNode() { EditorNode::~EditorNode() { EditorInspector::cleanup_plugins(); EditorTranslationParser::get_singleton()->clean_parsers(); +#ifndef _3D_DISABLED ResourceImporterScene::clean_up_importer_plugins(); +#endif // _3D_DISABLED EditorContextMenuPluginManager::cleanup(); remove_print_handler(&print_handler); diff --git a/editor/editor_node.h b/editor/editor_node.h index 337c7484a5f7..607d6e520655 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -162,7 +162,9 @@ class EditorNode : public Node { SCENE_CLOSE_ALL, SCENE_QUIT, +#ifndef _3D_DISABLED FILE_EXPORT_MESH_LIBRARY, +#endif // _3D_DISABLED // Project menu. PROJECT_OPEN_SETTINGS, @@ -990,7 +992,9 @@ class EditorNode : public Node { bool is_scene_in_use(const String &p_path); void save_editor_layout_delayed(); +#ifndef _3D_DISABLED void save_default_environment(); +#endif // _3D_DISABLED void open_export_template_manager(); diff --git a/editor/export/shader_baker_export_plugin.cpp b/editor/export/shader_baker_export_plugin.cpp index 0f51b22c1766..f8a8bca2aa18 100644 --- a/editor/export/shader_baker_export_plugin.cpp +++ b/editor/export/shader_baker_export_plugin.cpp @@ -36,18 +36,22 @@ #include "core/string/string_builder.h" #include "core/version.h" #include "editor/editor_node.h" -#include "scene/3d/label_3d.h" -#include "scene/3d/sprite_3d.h" +#include "scene/resources/material.h" #include "servers/rendering/renderer_rd/renderer_scene_render_rd.h" #include "servers/rendering/renderer_rd/storage_rd/material_storage.h" #include "servers/rendering/rendering_shader_container.h" +#ifndef _3D_DISABLED +#include "scene/3d/label_3d.h" +#include "scene/3d/sprite_3d.h" + // Ensure that AlphaCut is the same between the two classes so we can share the code to detect transparency. static_assert(ENUM_MEMBERS_EQUAL(SpriteBase3D::ALPHA_CUT_DISABLED, Label3D::ALPHA_CUT_DISABLED)); static_assert(ENUM_MEMBERS_EQUAL(SpriteBase3D::ALPHA_CUT_DISCARD, Label3D::ALPHA_CUT_DISCARD)); static_assert(ENUM_MEMBERS_EQUAL(SpriteBase3D::ALPHA_CUT_OPAQUE_PREPASS, Label3D::ALPHA_CUT_OPAQUE_PREPASS)); static_assert(ENUM_MEMBERS_EQUAL(SpriteBase3D::ALPHA_CUT_HASH, Label3D::ALPHA_CUT_HASH)); static_assert(ENUM_MEMBERS_EQUAL(SpriteBase3D::ALPHA_CUT_MAX, Label3D::ALPHA_CUT_MAX)); +#endif // _3D_DISABLED String ShaderBakerExportPlugin::get_name() const { return "ShaderBaker"; @@ -296,6 +300,7 @@ Ref ShaderBakerExportPlugin::_customize_resource(const Ref & } Node *ShaderBakerExportPlugin::_customize_scene(Node *p_root, const String &p_path) { +#ifndef _3D_DISABLED LocalVector nodes_to_visit; nodes_to_visit.push_back(p_root); while (!nodes_to_visit.is_empty()) { @@ -362,6 +367,7 @@ Node *ShaderBakerExportPlugin::_customize_scene(Node *p_root, const String &p_pa nodes_to_visit.push_back(node->get_child(i)); } } +#endif // _3D_DISABLED return nullptr; } diff --git a/editor/import/3d/resource_importer_scene.cpp b/editor/import/3d/resource_importer_scene.cpp index 814f52fa0b2e..8ee32af6081f 100644 --- a/editor/import/3d/resource_importer_scene.cpp +++ b/editor/import/3d/resource_importer_scene.cpp @@ -42,25 +42,31 @@ #include "editor/settings/editor_settings.h" #include "scene/3d/importer_mesh_instance_3d.h" #include "scene/3d/mesh_instance_3d.h" -#include "scene/3d/navigation/navigation_region_3d.h" #include "scene/3d/occluder_instance_3d.h" -#include "scene/3d/physics/area_3d.h" -#include "scene/3d/physics/collision_shape_3d.h" -#include "scene/3d/physics/static_body_3d.h" -#include "scene/3d/physics/vehicle_body_3d.h" #include "scene/animation/animation_player.h" -#include "scene/resources/3d/box_shape_3d.h" #include "scene/resources/3d/importer_mesh.h" #include "scene/resources/3d/mesh_library.h" -#include "scene/resources/3d/separation_ray_shape_3d.h" -#include "scene/resources/3d/sphere_shape_3d.h" -#include "scene/resources/3d/world_boundary_shape_3d.h" #include "scene/resources/animation.h" #include "scene/resources/bone_map.h" #include "scene/resources/packed_scene.h" #include "scene/resources/physics_material.h" #include "scene/resources/resource_format_text.h" +#ifndef NAVIGATION_3D_DISABLED +#include "scene/3d/navigation/navigation_region_3d.h" +#endif // NAVIGATION_3D_DISABLED + +#ifndef PHYSICS_3D_DISABLED +#include "scene/3d/physics/area_3d.h" +#include "scene/3d/physics/collision_shape_3d.h" +#include "scene/3d/physics/static_body_3d.h" +#include "scene/3d/physics/vehicle_body_3d.h" +#include "scene/resources/3d/box_shape_3d.h" +#include "scene/resources/3d/separation_ray_shape_3d.h" +#include "scene/resources/3d/sphere_shape_3d.h" +#include "scene/resources/3d/world_boundary_shape_3d.h" +#endif // PHYSICS_3D_DISABLED + void EditorSceneFormatImporter::get_extensions(List *r_extensions) const { Vector arr; GDVIRTUAL_CALL(_get_extensions, arr); @@ -470,6 +476,7 @@ static String _fixstr(const String &p_what, const String &p_str) { return what; } +#ifndef PHYSICS_3D_DISABLED static void _pre_gen_shape_list(Ref &mesh, Vector> &r_shape_list, bool p_convex) { ERR_FAIL_COND_MSG(mesh.is_null(), "Cannot generate shape list with null mesh value."); if (!p_convex) { @@ -485,6 +492,7 @@ static void _pre_gen_shape_list(Ref &mesh, Vector> &r } } } +#endif // PHYSICS_3D_DISABLED struct ScalableNodeCollection { HashSet node_3ds; @@ -809,6 +817,7 @@ Node *ResourceImporterScene::_pre_fix_node(Node *p_node, Node *p_root, HashMap(p_node); if (mi) { Ref mesh = mi->get_mesh(); @@ -942,7 +951,9 @@ Node *ResourceImporterScene::_pre_fix_node(Node *p_node, Node *p_root, HashMap(p_node)) { if (isroot) { return p_node; @@ -963,6 +974,7 @@ Node *ResourceImporterScene::_pre_fix_node(Node *p_node, Node *p_root, HashMapset_owner(nullptr); memdelete(p_node); p_node = nmi; +#endif // NAVIGATION_3D_DISABLED } else if (_teststr(name, "occ") || _teststr(name, "occonly")) { if (isroot) { return p_node; @@ -989,6 +1001,7 @@ Node *ResourceImporterScene::_pre_fix_node(Node *p_node, Node *p_root, HashMap(p_node)) { ImporterMeshInstance3D *mi = Object::cast_to(p_node); @@ -1829,6 +1846,7 @@ Node *ResourceImporterScene::_post_fix_node(Node *p_node, Node *p_root, HashMap< } } } +#endif // NAVIGATION_3D_DISABLED if (Object::cast_to(p_node)) { ImporterMeshInstance3D *mi = Object::cast_to(p_node); @@ -2893,6 +2911,7 @@ Node *ResourceImporterScene::_generate_meshes(Node *p_node, const Dictionary &p_ return p_node; } +#ifndef PHYSICS_3D_DISABLED void ResourceImporterScene::_add_shapes(Node *p_node, const Vector> &p_shapes) { for (const Ref &E : p_shapes) { CollisionShape3D *cshape = memnew(CollisionShape3D); @@ -2902,6 +2921,7 @@ void ResourceImporterScene::_add_shapes(Node *p_node, const Vector> cshape->set_owner(p_node->get_owner()); } } +#endif // PHYSICS_3D_DISABLED void ResourceImporterScene::_copy_meta(Object *p_src_object, Object *p_dst_object) { List meta_list; diff --git a/editor/import/3d/resource_importer_scene.h b/editor/import/3d/resource_importer_scene.h index aee97bcb1bdc..0c5c0fb9de2c 100644 --- a/editor/import/3d/resource_importer_scene.h +++ b/editor/import/3d/resource_importer_scene.h @@ -34,13 +34,18 @@ #include "core/io/resource_importer.h" #include "core/variant/dictionary.h" #include "scene/3d/importer_mesh_instance_3d.h" +#include "scene/resources/3d/importer_mesh.h" +#include "scene/resources/animation.h" +#include "scene/resources/mesh.h" + +#ifndef PHYSICS_3D_DISABLED #include "scene/resources/3d/box_shape_3d.h" #include "scene/resources/3d/capsule_shape_3d.h" #include "scene/resources/3d/cylinder_shape_3d.h" -#include "scene/resources/3d/importer_mesh.h" #include "scene/resources/3d/sphere_shape_3d.h" -#include "scene/resources/animation.h" -#include "scene/resources/mesh.h" +#else +using Shape3D = RefCounted; +#endif // PHYSICS_3D_DISABLED class AnimationPlayer; class ImporterMesh; @@ -212,7 +217,9 @@ class ResourceImporterScene : public ResourceImporter { Array _get_skinned_pose_transforms(ImporterMeshInstance3D *p_src_mesh_node); void _replace_owner(Node *p_node, Node *p_scene, Node *p_new_owner); Node *_generate_meshes(Node *p_node, const Dictionary &p_mesh_data, bool p_generate_lods, bool p_create_shadow_meshes, LightBakeMode p_light_bake_mode, float p_lightmap_texel_size, const Vector &p_src_lightmap_cache, Vector> &r_lightmap_caches); +#ifndef PHYSICS_3D_DISABLED void _add_shapes(Node *p_node, const Vector> &p_shapes); +#endif // PHYSICS_3D_DISABLED void _copy_meta(Object *p_src_object, Object *p_dst_object); Node *_replace_node_with_type_and_script(Node *p_node, String p_node_type, Ref