Skip to content

Commit e0a30ad

Browse files
committed
Allow building the editor with 3D disabled.
1 parent 7864ac8 commit e0a30ad

File tree

69 files changed

+768
-132
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+768
-132
lines changed

SConstruct

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -997,12 +997,9 @@ sys.modules.pop("detect")
997997
if env.editor_build:
998998
unsupported_opts = []
999999
for disable_opt in [
1000-
"disable_3d",
10011000
"disable_advanced_gui",
10021001
"disable_physics_2d",
1003-
"disable_physics_3d",
10041002
"disable_navigation_2d",
1005-
"disable_navigation_3d",
10061003
]:
10071004
if env[disable_opt]:
10081005
unsupported_opts.append(disable_opt)

editor/animation/animation_blend_tree_editor_plugin.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@
4040
#include "editor/inspector/editor_properties.h"
4141
#include "editor/settings/editor_settings.h"
4242
#include "editor/themes/editor_scale.h"
43+
#ifndef _3D_DISABLED
4344
#include "scene/3d/skeleton_3d.h"
45+
#endif // _3D_DISABLED
4446
#include "scene/gui/check_box.h"
4547
#include "scene/gui/grid_container.h"
4648
#include "scene/gui/line_edit.h"
@@ -838,6 +840,7 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano
838840
if (path.get_subname_count()) {
839841
String concat = path.get_concatenated_subnames();
840842

843+
#ifndef _3D_DISABLED
841844
Skeleton3D *skeleton = Object::cast_to<Skeleton3D>(node);
842845
if (skeleton && skeleton->find_bone(concat) != -1) {
843846
//path in skeleton
@@ -878,14 +881,17 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano
878881

879882
} else {
880883
//just a property
884+
#endif // _3D_DISABLED
881885
ti = filters->create_item(ti);
882886
ti->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
883887
ti->set_text(0, concat);
884888
ti->set_editable(0, !read_only);
885889
ti->set_selectable(0, true);
886890
ti->set_checked(0, anode->is_path_filtered(path));
887891
ti->set_metadata(0, path);
892+
#ifndef _3D_DISABLED
888893
}
894+
#endif // _3D_DISABLED
889895
} else {
890896
if (ti) {
891897
//just a node, not a property track

editor/animation/animation_player_editor_plugin.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1763,6 +1763,7 @@ void AnimationPlayerEditor::_prepare_onion_layers_2_prolog() {
17631763
_allocate_onion_layers();
17641764
}
17651765

1766+
#ifndef _3D_DISABLED
17661767
// Hide superfluous elements that would make the overlay unnecessary cluttered.
17671768
if (Node3DEditor::get_singleton()->is_visible()) {
17681769
// 3D
@@ -1787,6 +1788,7 @@ void AnimationPlayerEditor::_prepare_onion_layers_2_prolog() {
17871788
Node3DEditor::get_singleton()->set_state(new_state);
17881789
} else {
17891790
// CanvasItemEditor.
1791+
#endif // _3D_DISABLED
17901792
onion.temp.canvas_edit_state = CanvasItemEditor::get_singleton()->get_state();
17911793
Dictionary new_state = onion.temp.canvas_edit_state.duplicate();
17921794
new_state["show_origin"] = false;
@@ -1800,7 +1802,9 @@ void AnimationPlayerEditor::_prepare_onion_layers_2_prolog() {
18001802
new_state["show_transformation_gizmos"] = onion.include_gizmos ? new_state["gizmos"] : Variant(false);
18011803
// TODO: Save/restore only affected entries.
18021804
CanvasItemEditor::get_singleton()->set_state(new_state);
1805+
#ifndef _3D_DISABLED
18031806
}
1807+
#endif // _3D_DISABLED
18041808

18051809
// Tweak the root viewport to ensure it's rendered before our target.
18061810
RID root_vp = get_tree()->get_root()->get_viewport_rid();
@@ -1910,14 +1914,18 @@ void AnimationPlayerEditor::_prepare_onion_layers_2_epilog() {
19101914
player->seek_internal(onion.temp.anim_player_position, true, true, false);
19111915
player->restore(onion.temp.anim_values_backup);
19121916

1917+
#ifndef _3D_DISABLED
19131918
// Restore state of main editors.
19141919
if (Node3DEditor::get_singleton()->is_visible()) {
19151920
// 3D
19161921
Node3DEditor::get_singleton()->set_state(onion.temp.spatial_edit_state);
19171922
} else { // CanvasItemEditor
19181923
// 2D
1924+
#endif // _3D_DISABLED
19191925
CanvasItemEditor::get_singleton()->set_state(onion.temp.canvas_edit_state);
1926+
#ifndef _3D_DISABLED
19201927
}
1928+
#endif // _3D_DISABLED
19211929

19221930
// Update viewports with skin layers overlaid for the actual engine loop render.
19231931
onion.can_overlay = true;
@@ -2312,7 +2320,9 @@ AnimationPlayerEditor::~AnimationPlayerEditor() {
23122320
void AnimationPlayerEditorPlugin::_notification(int p_what) {
23132321
switch (p_what) {
23142322
case NOTIFICATION_ENTER_TREE: {
2323+
#ifndef _3D_DISABLED
23152324
Node3DEditor::get_singleton()->connect(SNAME("transform_key_request"), callable_mp(this, &AnimationPlayerEditorPlugin::_transform_key_request));
2325+
#endif // _3D_DISABLED
23162326
InspectorDock::get_inspector_singleton()->connect(SNAME("property_keyed"), callable_mp(this, &AnimationPlayerEditorPlugin::_property_keyed));
23172327
anim_editor->get_track_editor()->connect(SNAME("keying_changed"), callable_mp(this, &AnimationPlayerEditorPlugin::_update_keying));
23182328
InspectorDock::get_inspector_singleton()->connect(SNAME("edited_object_changed"), callable_mp(anim_editor->get_track_editor(), &AnimationTrackEditor::update_keying));
@@ -2330,6 +2340,7 @@ void AnimationPlayerEditorPlugin::_property_keyed(const String &p_keyed, const V
23302340
te->insert_value_key(p_keyed, p_advance);
23312341
}
23322342

2343+
#ifndef _3D_DISABLED
23332344
void AnimationPlayerEditorPlugin::_transform_key_request(Object *sp, const String &p_sub, const Transform3D &p_key) {
23342345
if (!anim_editor->get_track_editor()->has_keying()) {
23352346
return;
@@ -2342,6 +2353,7 @@ void AnimationPlayerEditorPlugin::_transform_key_request(Object *sp, const Strin
23422353
anim_editor->get_track_editor()->insert_transform_key(s, p_sub, Animation::TYPE_ROTATION_3D, p_key.basis.get_rotation_quaternion());
23432354
anim_editor->get_track_editor()->insert_transform_key(s, p_sub, Animation::TYPE_SCALE_3D, p_key.basis.get_scale());
23442355
}
2356+
#endif // _3D_DISABLED
23452357

23462358
void AnimationPlayerEditorPlugin::_update_keying() {
23472359
InspectorDock::get_inspector_singleton()->set_keying(anim_editor->get_track_editor()->has_keying());

editor/animation/animation_player_editor_plugin.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,9 @@ class AnimationPlayerEditorPlugin : public EditorPlugin {
295295
void _notification(int p_what);
296296

297297
void _property_keyed(const String &p_keyed, const Variant &p_value, bool p_advance);
298+
#ifndef _3D_DISABLED
298299
void _transform_key_request(Object *sp, const String &p_sub, const Transform3D &p_key);
300+
#endif // _3D_DISABLED
299301
void _update_keying();
300302

301303
public:
@@ -310,7 +312,9 @@ class AnimationPlayerEditorPlugin : public EditorPlugin {
310312
virtual void make_visible(bool p_visible) override;
311313

312314
virtual void forward_canvas_force_draw_over_viewport(Control *p_overlay) override { anim_editor->forward_force_draw_over_viewport(p_overlay); }
315+
#ifndef _3D_DISABLED
313316
virtual void forward_3d_force_draw_over_viewport(Control *p_overlay) override { anim_editor->forward_force_draw_over_viewport(p_overlay); }
317+
#endif // _3D_DISABLED
314318

315319
AnimationPlayerEditorPlugin();
316320
~AnimationPlayerEditorPlugin();

editor/animation/animation_track_editor.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@
4747
#include "editor/script/script_editor_plugin.h"
4848
#include "editor/settings/editor_settings.h"
4949
#include "editor/themes/editor_scale.h"
50+
#ifndef _3D_DISABLED
5051
#include "scene/3d/mesh_instance_3d.h"
52+
#endif // _3D_DISABLED
5153
#include "scene/animation/animation_player.h"
5254
#include "scene/animation/tween.h"
5355
#include "scene/gui/check_box.h"
@@ -4358,7 +4360,7 @@ void AnimationTrackEditor::_insert_track(bool p_reset_wanted, bool p_create_bezi
43584360
_edit_menu_pressed(EDIT_GOTO_NEXT_STEP_TIMELINE_ONLY);
43594361
}
43604362
}
4361-
4363+
#ifndef _3D_DISABLED
43624364
void AnimationTrackEditor::insert_transform_key(Node3D *p_node, const String &p_sub, const Animation::TrackType p_type, const Variant &p_value) {
43634365
ERR_FAIL_NULL(root);
43644366
ERR_FAIL_COND_MSG(
@@ -4423,6 +4425,7 @@ bool AnimationTrackEditor::has_track(Node3D *p_node, const String &p_sub, const
44234425
}
44244426
return false;
44254427
}
4428+
#endif // _3D_DISABLED
44264429

44274430
void AnimationTrackEditor::_insert_animation_key(NodePath p_path, const Variant &p_value) {
44284431
String path = String(p_path);
@@ -5749,6 +5752,7 @@ void AnimationTrackEditor::_insert_key_from_track(float p_ofs, int p_track) {
57495752
// id.value is filled in each case handled below.
57505753

57515754
switch (animation->track_get_type(p_track)) {
5755+
#ifndef _3D_DISABLED
57525756
case Animation::TYPE_POSITION_3D: {
57535757
Node3D *base = Object::cast_to<Node3D>(node);
57545758

@@ -5789,6 +5793,7 @@ void AnimationTrackEditor::_insert_key_from_track(float p_ofs, int p_track) {
57895793

57905794
id.value = base->get_blend_shape_value(base->find_blend_shape_by_name(id.path.get_subname(0)));
57915795
} break;
5796+
#endif // _3D_DISABLED
57925797
case Animation::TYPE_VALUE: {
57935798
NodePath bp;
57945799
_find_hint_for_track(p_track, bp, &id.value);

editor/animation/animation_track_editor.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@
3333
#include "editor/editor_data.h"
3434
#include "editor/inspector/editor_properties.h"
3535
#include "editor/inspector/property_selector.h"
36+
#ifndef _3D_DISABLED
3637
#include "scene/3d/node_3d.h"
38+
#endif // _3D_DISABLED
3739
#include "scene/gui/control.h"
3840
#include "scene/gui/menu_button.h"
3941
#include "scene/gui/scroll_bar.h"
@@ -945,8 +947,10 @@ class AnimationTrackEditor : public VBoxContainer {
945947
void set_anim_pos(float p_pos);
946948
void insert_node_value_key(Node *p_node, const String &p_property, bool p_only_if_exists = false, bool p_advance = false);
947949
void insert_value_key(const String &p_property, bool p_advance);
950+
#ifndef _3D_DISABLED
948951
void insert_transform_key(Node3D *p_node, const String &p_sub, const Animation::TrackType p_type, const Variant &p_value);
949952
bool has_track(Node3D *p_node, const String &p_sub, const Animation::TrackType p_type);
953+
#endif // _3D_DISABLED
950954
void make_insert_queue();
951955
void commit_insert_queue();
952956

editor/animation/animation_track_editor_plugins.cpp

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@
3737
#include "editor/themes/editor_scale.h"
3838
#include "scene/2d/animated_sprite_2d.h"
3939
#include "scene/2d/sprite_2d.h"
40+
#ifndef _3D_DISABLED
4041
#include "scene/3d/sprite_3d.h"
42+
#endif // _3D_DISABLED
4143
#include "scene/animation/animation_player.h"
4244
#include "servers/audio/audio_stream.h"
4345

@@ -377,7 +379,11 @@ Rect2 AnimationTrackEditSpriteFrame::get_key_rect(int p_index, float p_pixels_se
377379

378380
Size2 size;
379381

380-
if (Object::cast_to<Sprite2D>(object) || Object::cast_to<Sprite3D>(object)) {
382+
if (Object::cast_to<Sprite2D>(object)
383+
#ifndef _3D_DISABLED
384+
|| Object::cast_to<Sprite3D>(object)
385+
#endif // _3D_DISABLED
386+
) {
381387
Ref<Texture2D> texture = object->call("get_texture");
382388
if (texture.is_null()) {
383389
return AnimationTrackEdit::get_key_rect(p_index, p_pixels_sec);
@@ -398,7 +404,11 @@ Rect2 AnimationTrackEditSpriteFrame::get_key_rect(int p_index, float p_pixels_se
398404
if (vframes > 1) {
399405
size.y /= vframes;
400406
}
401-
} else if (Object::cast_to<AnimatedSprite2D>(object) || Object::cast_to<AnimatedSprite3D>(object)) {
407+
} else if (Object::cast_to<AnimatedSprite2D>(object)
408+
#ifndef _3D_DISABLED
409+
|| Object::cast_to<AnimatedSprite3D>(object)
410+
#endif // _3D_DISABLED
411+
) {
402412
Ref<SpriteFrames> sf = object->call("get_sprite_frames");
403413
if (sf.is_null()) {
404414
return AnimationTrackEdit::get_key_rect(p_index, p_pixels_sec);
@@ -454,7 +464,11 @@ void AnimationTrackEditSpriteFrame::draw_key(int p_index, float p_pixels_sec, in
454464
Ref<Texture2D> texture;
455465
Rect2 region;
456466

457-
if (Object::cast_to<Sprite2D>(object) || Object::cast_to<Sprite3D>(object)) {
467+
if (Object::cast_to<Sprite2D>(object)
468+
#ifndef _3D_DISABLED
469+
|| Object::cast_to<Sprite3D>(object)
470+
#endif // _3D_DISABLED
471+
) {
458472
texture = object->call("get_texture");
459473
if (texture.is_null()) {
460474
AnimationTrackEdit::draw_key(p_index, p_pixels_sec, p_x, p_selected, p_clip_left, p_clip_right);
@@ -489,7 +503,11 @@ void AnimationTrackEditSpriteFrame::draw_key(int p_index, float p_pixels_sec, in
489503
region.position.x += region.size.x * coords.x;
490504
region.position.y += region.size.y * coords.y;
491505

492-
} else if (Object::cast_to<AnimatedSprite2D>(object) || Object::cast_to<AnimatedSprite3D>(object)) {
506+
} else if (Object::cast_to<AnimatedSprite2D>(object)
507+
#ifndef _3D_DISABLED
508+
|| Object::cast_to<AnimatedSprite3D>(object)
509+
#endif // _3D_DISABLED
510+
) {
493511
Ref<SpriteFrames> sf = object->call("get_sprite_frames");
494512
if (sf.is_null()) {
495513
AnimationTrackEdit::draw_key(p_index, p_pixels_sec, p_x, p_selected, p_clip_left, p_clip_right);

editor/debugger/editor_debugger_plugin.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
#pragma once
3232

3333
#include "scene/gui/control.h"
34+
#ifdef _3D_DISABLED
35+
#include "core/object/script_language.h"
36+
#endif
3437

3538
class ScriptEditorDebugger;
3639

editor/debugger/script_editor_debugger.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,10 @@
4848
#include "editor/gui/editor_file_dialog.h"
4949
#include "editor/gui/editor_toaster.h"
5050
#include "editor/inspector/editor_property_name_processor.h"
51-
#include "editor/scene/3d/node_3d_editor_plugin.h"
5251
#include "editor/scene/canvas_item_editor_plugin.h"
5352
#include "editor/settings/editor_settings.h"
5453
#include "editor/themes/editor_scale.h"
5554
#include "main/performance.h"
56-
#include "scene/3d/camera_3d.h"
5755
#include "scene/debugger/scene_debugger.h"
5856
#include "scene/gui/button.h"
5957
#include "scene/gui/dialogs.h"
@@ -68,6 +66,11 @@
6866
#include "servers/debugger/servers_debugger.h"
6967
#include "servers/display/display_server.h"
7068

69+
#ifndef _3D_DISABLED
70+
#include "editor/scene/3d/node_3d_editor_plugin.h"
71+
#include "scene/3d/camera_3d.h"
72+
#endif // _3D_DISABLED
73+
7174
using CameraOverride = EditorDebuggerNode::CameraOverride;
7275

7376
void ScriptEditorDebugger::_put_msg(const String &p_message, const Array &p_data, uint64_t p_thread_id) {
@@ -1120,6 +1123,7 @@ void ScriptEditorDebugger::_notification(int p_what) {
11201123
_put_msg("scene:transform_camera_2d", msg);
11211124
}
11221125

1126+
#ifndef _3D_DISABLED
11231127
// Node3D Editor
11241128
{
11251129
Node3DEditorViewport *viewport = Node3DEditor::get_singleton()->get_last_used_viewport();
@@ -1137,6 +1141,7 @@ void ScriptEditorDebugger::_notification(int p_what) {
11371141
msg.push_back(cam->get_far());
11381142
_put_msg("scene:transform_camera_3d", msg);
11391143
}
1144+
#endif // _3D_DISABLED
11401145
}
11411146

11421147
if (is_breaked() && can_request_idle_draw) {

editor/doc/editor_help_search.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030

3131
#pragma once
3232

33+
#ifdef _3D_DISABLED
34+
#include "core/doc_data.h"
35+
#endif
3336
#include "editor/plugins/editor_plugin.h"
3437
#include "scene/gui/dialogs.h"
3538
#include "scene/gui/option_button.h"

0 commit comments

Comments
 (0)