Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Allow building the editor with 3D disabled.
  • Loading branch information
WhalesState committed Apr 26, 2026
commit a57326e5708c5d75e8dece7334e39b7f18c359b0
3 changes: 0 additions & 3 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions editor/animation/animation_blend_tree_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -927,6 +929,7 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano
if (path.get_subname_count()) {
String concat = path.get_concatenated_subnames();

#ifndef _3D_DISABLED
Skeleton3D *skeleton = Object::cast_to<Skeleton3D>(node);
if (skeleton && skeleton->find_bone(concat) != -1) {
//path in skeleton
Expand Down Expand Up @@ -967,14 +970,17 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &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);
ti->set_editable(0, !read_only);
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
Expand Down
18 changes: 16 additions & 2 deletions editor/animation/animation_player_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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() {
Expand Down Expand Up @@ -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
Expand All @@ -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;
Expand All @@ -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();
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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));
Expand All @@ -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;
Expand All @@ -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());
Expand Down
4 changes: 4 additions & 0 deletions editor/animation/animation_player_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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();
Expand Down
7 changes: 6 additions & 1 deletion editor/animation/animation_track_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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<Node3D>(node);

Expand Down Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions editor/animation/animation_track_editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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();

Expand Down
21 changes: 20 additions & 1 deletion editor/animation/animation_track_editor_plugins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Texture2D> checked = get_theme_icon(SNAME("checked"), SNAME("CheckBox"));
Expand Down Expand Up @@ -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<Sprite2D>(object) || Object::cast_to<Sprite3D>(object)) {
#else
if (Object::cast_to<Sprite2D>(object)) {
#endif // _3D_DISABLED
Ref<Texture2D> texture = object->call("get_texture");
if (texture.is_null()) {
return AnimationTrackEdit::get_key_rect(p_index, p_pixels_sec);
Expand All @@ -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<AnimatedSprite2D>(object) || Object::cast_to<AnimatedSprite3D>(object)) {
#else
} else if (Object::cast_to<AnimatedSprite2D>(object)) {
#endif // _3D_DISABLED
Ref<SpriteFrames> sf = object->call("get_sprite_frames");
if (sf.is_null()) {
return AnimationTrackEdit::get_key_rect(p_index, p_pixels_sec);
Expand Down Expand Up @@ -468,7 +479,11 @@ void AnimationTrackEditSpriteFrame::draw_key(int p_index, float p_pixels_sec, in
Ref<Texture2D> texture;
Rect2 region;

#ifndef _3D_DISABLED
if (Object::cast_to<Sprite2D>(object) || Object::cast_to<Sprite3D>(object)) {
#else
if (Object::cast_to<Sprite2D>(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);
Expand Down Expand Up @@ -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<AnimatedSprite2D>(object) || Object::cast_to<AnimatedSprite3D>(object)) {
#else
} else if (Object::cast_to<AnimatedSprite2D>(object)) {
#endif // _3D_DISABLED
Ref<SpriteFrames> 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);
Expand Down
9 changes: 7 additions & 2 deletions editor/debugger/script_editor_debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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) {
Expand Down Expand Up @@ -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();
Expand All @@ -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) {
Expand Down
9 changes: 8 additions & 1 deletion editor/docks/filesystem_dock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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) {
Expand Down Expand Up @@ -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<String> importer_exts;
Expand All @@ -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;
Expand Down
Loading
Loading