Skip to content

Commit 185bf9c

Browse files
committed
Allow building the editor with 3D disabled.
1 parent 825ef23 commit 185bf9c

File tree

70 files changed

+769
-136
lines changed

Some content is hidden

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

70 files changed

+769
-136
lines changed

SConstruct

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,12 +1003,9 @@ sys.modules.pop("detect")
10031003
if env.editor_build:
10041004
unsupported_opts = []
10051005
for disable_opt in [
1006-
"disable_3d",
10071006
"disable_advanced_gui",
10081007
"disable_physics_2d",
1009-
"disable_physics_3d",
10101008
"disable_navigation_2d",
1011-
"disable_navigation_3d",
10121009
]:
10131010
if env[disable_opt]:
10141011
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
@@ -1742,6 +1742,7 @@ void AnimationPlayerEditor::_prepare_onion_layers_2_prolog() {
17421742
_allocate_onion_layers();
17431743
}
17441744

1745+
#ifndef _3D_DISABLED
17451746
// Hide superfluous elements that would make the overlay unnecessary cluttered.
17461747
if (Node3DEditor::get_singleton()->is_visible()) {
17471748
// 3D
@@ -1766,6 +1767,7 @@ void AnimationPlayerEditor::_prepare_onion_layers_2_prolog() {
17661767
Node3DEditor::get_singleton()->set_state(new_state);
17671768
} else {
17681769
// CanvasItemEditor.
1770+
#endif // _3D_DISABLED
17691771
onion.temp.canvas_edit_state = CanvasItemEditor::get_singleton()->get_state();
17701772
Dictionary new_state = onion.temp.canvas_edit_state.duplicate();
17711773
new_state["show_origin"] = false;
@@ -1779,7 +1781,9 @@ void AnimationPlayerEditor::_prepare_onion_layers_2_prolog() {
17791781
new_state["show_transformation_gizmos"] = onion.include_gizmos ? new_state["gizmos"] : Variant(false);
17801782
// TODO: Save/restore only affected entries.
17811783
CanvasItemEditor::get_singleton()->set_state(new_state);
1784+
#ifndef _3D_DISABLED
17821785
}
1786+
#endif // _3D_DISABLED
17831787

17841788
// Tweak the root viewport to ensure it's rendered before our target.
17851789
RID root_vp = get_tree()->get_root()->get_viewport_rid();
@@ -1889,14 +1893,18 @@ void AnimationPlayerEditor::_prepare_onion_layers_2_epilog() {
18891893
player->seek_internal(onion.temp.anim_player_position, true, true, false);
18901894
player->restore(onion.temp.anim_values_backup);
18911895

1896+
#ifndef _3D_DISABLED
18921897
// Restore state of main editors.
18931898
if (Node3DEditor::get_singleton()->is_visible()) {
18941899
// 3D
18951900
Node3DEditor::get_singleton()->set_state(onion.temp.spatial_edit_state);
18961901
} else { // CanvasItemEditor
18971902
// 2D
1903+
#endif // _3D_DISABLED
18981904
CanvasItemEditor::get_singleton()->set_state(onion.temp.canvas_edit_state);
1905+
#ifndef _3D_DISABLED
18991906
}
1907+
#endif // _3D_DISABLED
19001908

19011909
// Update viewports with skin layers overlaid for the actual engine loop render.
19021910
onion.can_overlay = true;
@@ -2291,7 +2299,9 @@ AnimationPlayerEditor::~AnimationPlayerEditor() {
22912299
void AnimationPlayerEditorPlugin::_notification(int p_what) {
22922300
switch (p_what) {
22932301
case NOTIFICATION_ENTER_TREE: {
2302+
#ifndef _3D_DISABLED
22942303
Node3DEditor::get_singleton()->connect(SNAME("transform_key_request"), callable_mp(this, &AnimationPlayerEditorPlugin::_transform_key_request));
2304+
#endif // _3D_DISABLED
22952305
InspectorDock::get_inspector_singleton()->connect(SNAME("property_keyed"), callable_mp(this, &AnimationPlayerEditorPlugin::_property_keyed));
22962306
anim_editor->get_track_editor()->connect(SNAME("keying_changed"), callable_mp(this, &AnimationPlayerEditorPlugin::_update_keying));
22972307
InspectorDock::get_inspector_singleton()->connect(SNAME("edited_object_changed"), callable_mp(anim_editor->get_track_editor(), &AnimationTrackEditor::update_keying));
@@ -2309,6 +2319,7 @@ void AnimationPlayerEditorPlugin::_property_keyed(const String &p_keyed, const V
23092319
te->insert_value_key(p_keyed, p_advance);
23102320
}
23112321

2322+
#ifndef _3D_DISABLED
23122323
void AnimationPlayerEditorPlugin::_transform_key_request(Object *sp, const String &p_sub, const Transform3D &p_key) {
23132324
if (!anim_editor->get_track_editor()->has_keying()) {
23142325
return;
@@ -2321,6 +2332,7 @@ void AnimationPlayerEditorPlugin::_transform_key_request(Object *sp, const Strin
23212332
anim_editor->get_track_editor()->insert_transform_key(s, p_sub, Animation::TYPE_ROTATION_3D, p_key.basis.get_rotation_quaternion());
23222333
anim_editor->get_track_editor()->insert_transform_key(s, p_sub, Animation::TYPE_SCALE_3D, p_key.basis.get_scale());
23232334
}
2335+
#endif // _3D_DISABLED
23242336

23252337
void AnimationPlayerEditorPlugin::_update_keying() {
23262338
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
@@ -294,7 +294,9 @@ class AnimationPlayerEditorPlugin : public EditorPlugin {
294294
void _notification(int p_what);
295295

296296
void _property_keyed(const String &p_keyed, const Variant &p_value, bool p_advance);
297+
#ifndef _3D_DISABLED
297298
void _transform_key_request(Object *sp, const String &p_sub, const Transform3D &p_key);
299+
#endif // _3D_DISABLED
298300
void _update_keying();
299301

300302
public:
@@ -309,7 +311,9 @@ class AnimationPlayerEditorPlugin : public EditorPlugin {
309311
virtual void make_visible(bool p_visible) override;
310312

311313
virtual void forward_canvas_force_draw_over_viewport(Control *p_overlay) override { anim_editor->forward_force_draw_over_viewport(p_overlay); }
314+
#ifndef _3D_DISABLED
312315
virtual void forward_3d_force_draw_over_viewport(Control *p_overlay) override { anim_editor->forward_force_draw_over_viewport(p_overlay); }
316+
#endif // _3D_DISABLED
313317

314318
AnimationPlayerEditorPlugin();
315319
~AnimationPlayerEditorPlugin();

editor/animation/animation_track_editor.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@
4646
#include "editor/script/script_editor_plugin.h"
4747
#include "editor/settings/editor_settings.h"
4848
#include "editor/themes/editor_scale.h"
49+
#ifndef _3D_DISABLED
4950
#include "scene/3d/mesh_instance_3d.h"
51+
#endif // _3D_DISABLED
5052
#include "scene/animation/animation_player.h"
5153
#include "scene/animation/tween.h"
5254
#include "scene/gui/check_box.h"
@@ -4355,7 +4357,7 @@ void AnimationTrackEditor::_insert_track(bool p_reset_wanted, bool p_create_bezi
43554357
_edit_menu_pressed(EDIT_GOTO_NEXT_STEP_TIMELINE_ONLY);
43564358
}
43574359
}
4358-
4360+
#ifndef _3D_DISABLED
43594361
void AnimationTrackEditor::insert_transform_key(Node3D *p_node, const String &p_sub, const Animation::TrackType p_type, const Variant &p_value) {
43604362
ERR_FAIL_NULL(root);
43614363
ERR_FAIL_COND_MSG(
@@ -4420,6 +4422,7 @@ bool AnimationTrackEditor::has_track(Node3D *p_node, const String &p_sub, const
44204422
}
44214423
return false;
44224424
}
4425+
#endif // _3D_DISABLED
44234426

44244427
void AnimationTrackEditor::_insert_animation_key(NodePath p_path, const Variant &p_value) {
44254428
String path = String(p_path);
@@ -5726,6 +5729,7 @@ void AnimationTrackEditor::_insert_key_from_track(float p_ofs, int p_track) {
57265729
// id.value is filled in each case handled below.
57275730

57285731
switch (animation->track_get_type(p_track)) {
5732+
#ifndef _3D_DISABLED
57295733
case Animation::TYPE_POSITION_3D: {
57305734
Node3D *base = Object::cast_to<Node3D>(node);
57315735

@@ -5766,6 +5770,7 @@ void AnimationTrackEditor::_insert_key_from_track(float p_ofs, int p_track) {
57665770

57675771
id.value = base->get_blend_shape_value(base->find_blend_shape_by_name(id.path.get_subname(0)));
57685772
} break;
5773+
#endif // _3D_DISABLED
57695774
case Animation::TYPE_VALUE: {
57705775
NodePath bp;
57715776
_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"
@@ -939,8 +941,10 @@ class AnimationTrackEditor : public VBoxContainer {
939941
void set_anim_pos(float p_pos);
940942
void insert_node_value_key(Node *p_node, const String &p_property, bool p_only_if_exists = false, bool p_advance = false);
941943
void insert_value_key(const String &p_property, bool p_advance);
944+
#ifndef _3D_DISABLED
942945
void insert_transform_key(Node3D *p_node, const String &p_sub, const Animation::TrackType p_type, const Variant &p_value);
943946
bool has_track(Node3D *p_node, const String &p_sub, const Animation::TrackType p_type);
947+
#endif // _3D_DISABLED
944948
void make_insert_queue();
945949
void commit_insert_queue();
946950

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_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) {
@@ -1097,6 +1100,7 @@ void ScriptEditorDebugger::_notification(int p_what) {
10971100
_put_msg("scene:transform_camera_2d", msg);
10981101
}
10991102

1103+
#ifndef _3D_DISABLED
11001104
// Node3D Editor
11011105
{
11021106
Node3DEditorViewport *viewport = Node3DEditor::get_singleton()->get_last_used_viewport();
@@ -1114,6 +1118,7 @@ void ScriptEditorDebugger::_notification(int p_what) {
11141118
msg.push_back(cam->get_far());
11151119
_put_msg("scene:transform_camera_3d", msg);
11161120
}
1121+
#endif // _3D_DISABLED
11171122
}
11181123

11191124
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)