Skip to content

Commit bfbe95e

Browse files
authored
Merge pull request #117098 from akien-mga/decouple-node-scenetree
Decouple `node.h` from `scene_tree.h`, minimize its other includes
2 parents b12b7bc + 2dd1f4e commit bfbe95e

File tree

122 files changed

+179
-60
lines changed

Some content is hidden

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

122 files changed

+179
-60
lines changed

core/input/input_event.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@
3232

3333
#include "core/input/input_map.h"
3434
#include "core/input/shortcut.h"
35+
#include "core/math/transform_2d.h"
3536
#include "core/object/class_db.h"
3637
#include "core/os/keyboard.h"
3738
#include "core/os/os.h"
39+
#include "core/string/ustring.h"
3840

3941
void InputEvent::set_device(int p_device) {
4042
device = p_device;

core/input/input_event.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@
3232

3333
#include "core/input/input_enums.h"
3434
#include "core/io/resource.h"
35-
#include "core/math/transform_2d.h"
3635
#include "core/os/keyboard.h"
37-
#include "core/string/ustring.h"
3836
#include "core/typedefs.h"
3937

4038
/**
@@ -43,6 +41,8 @@
4341
*/
4442

4543
class Shortcut;
44+
class String;
45+
struct Transform2D;
4646

4747
/**
4848
* Input Modifier Status

core/io/resource.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#include "core/io/resource_uid.h"
3434
#include "core/object/gdvirtual.gen.h"
3535
#include "core/object/ref_counted.h"
36-
#include "core/templates/safe_refcount.h"
3736
#include "core/templates/self_list.h"
3837

3938
class Node;
@@ -68,7 +67,6 @@ class Resource : public RefCounted {
6867
};
6968

7069
private:
71-
friend class ResBase;
7270
friend class ResourceCache;
7371

7472
String name;

core/io/resource_uid.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030

3131
#pragma once
3232

33-
#include "core/object/ref_counted.h"
34-
#include "core/string/string_name.h"
33+
#include "core/object/object.h"
34+
#include "core/string/ustring.h"
3535
#include "core/templates/hash_map.h"
3636

3737
class FileAccess;

core/object/message_queue.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#pragma once
3232

3333
#include "core/object/object_id.h"
34-
#include "core/os/thread_safe.h"
34+
#include "core/os/mutex.h"
3535
#include "core/templates/local_vector.h"
3636
#include "core/templates/paged_allocator.h"
3737
#include "core/variant/variant.h"

core/os/keyboard.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "keyboard.h"
3232

3333
#include "core/os/os.h"
34+
#include "core/string/ustring.h"
3435

3536
struct _KeyCodeText {
3637
Key code;

core/os/keyboard.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030

3131
#pragma once
3232

33-
#include "core/string/ustring.h"
33+
class String;
34+
35+
#include <cstdint>
3436

3537
// Keep the values in this enum in sync with `_keycodes` in `keyboard.cpp`,
3638
// and the bindings in `core_constants.cpp`.

editor/animation/animation_library_editor.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#include "scene/animation/animation_mixer.h"
4747
#include "scene/gui/line_edit.h"
4848
#include "scene/gui/margin_container.h"
49+
#include "scene/main/scene_tree.h"
4950
#include "scene/resources/packed_scene.h"
5051

5152
void AnimationLibraryEditor::set_animation_mixer(Object *p_mixer) {

editor/animation/animation_player_editor_plugin.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
#include "editor/themes/editor_theme_manager.h"
5353
#include "scene/animation/animation_tree.h"
5454
#include "scene/gui/separator.h"
55+
#include "scene/main/scene_tree.h"
5556
#include "scene/main/window.h"
5657
#include "scene/resources/animation.h"
5758
#include "scene/resources/image_texture.h"
@@ -471,12 +472,12 @@ void AnimationPlayerEditor::_animation_selected(int p_which) {
471472
Node *root = player->get_node_or_null(player->get_root_node());
472473

473474
// Player shouldn't access parent if it's the scene root.
474-
if (!root || (player == get_tree()->get_edited_scene_root() && player->get_root_node() == SceneStringName(path_pp))) {
475+
if (!root || (player == get_tree()->get_edited_scene_root() && player->get_root_node() == NodePath(".."))) {
475476
NodePath cached_root_path = player->get_path_to(get_cached_root_node());
476477
if (player->get_node_or_null(cached_root_path) != nullptr) {
477478
player->set_root_node(cached_root_path);
478479
} else {
479-
player->set_root_node(SceneStringName(path_pp)); // No other choice, preventing crash.
480+
player->set_root_node(NodePath("..")); // No other choice, preventing crash.
480481
}
481482
} else {
482483
cached_root_node_id = root->get_instance_id(); // Caching as `track_editor` can lose track of player's root node.

editor/animation/animation_track_editor.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
#include "scene/gui/spin_box.h"
6565
#include "scene/gui/texture_rect.h"
6666
#include "scene/gui/view_panner.h"
67+
#include "scene/main/scene_tree.h"
6768
#include "scene/main/window.h"
6869
#include "servers/audio/audio_stream.h"
6970

0 commit comments

Comments
 (0)