Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

Don't include `physics_server_2d.h` in `world_2d.h`

Aaron Franke8dfba77a599b
diff --git a/scene/2d/audio_stream_player_2d.cpp b/scene/2d/audio_stream_player_2d.cpp
index 28368b8e85f..11938cf3757 100644
--- a/scene/2d/audio_stream_player_2d.cpp
+++ b/scene/2d/audio_stream_player_2d.cpp
@@ -40,10 +40,11 @@
#include "scene/resources/world_2d.h"
#include "servers/audio/audio_server.h"
#include "servers/audio/audio_stream.h"
-#include "servers/physics_2d/direct_states/physics_direct_space_state_2d.h"
#ifndef PHYSICS_2D_DISABLED
#include "scene/2d/physics/area_2d.h"
+#include "servers/physics_2d/direct_states/physics_direct_space_state_2d.h"
+#include "servers/physics_2d/physics_server_2d.h"
#endif // PHYSICS_2D_DISABLED
void AudioStreamPlayer2D::_notification(int p_what) {
diff --git a/scene/2d/physics/collision_object_2d.cpp b/scene/2d/physics/collision_object_2d.cpp
index 3eb98a82a77..f080f5182ec 100644
--- a/scene/2d/physics/collision_object_2d.cpp
+++ b/scene/2d/physics/collision_object_2d.cpp
@@ -32,6 +32,7 @@
#include "core/object/class_db.h"
#include "scene/resources/world_2d.h"
+#include "servers/physics_2d/physics_server_2d.h"
void CollisionObject2D::_notification(int p_what) {
switch (p_what) {
diff --git a/scene/2d/physics/ray_cast_2d.cpp b/scene/2d/physics/ray_cast_2d.cpp
index d14caa523c9..9406a02ea65 100644
--- a/scene/2d/physics/ray_cast_2d.cpp
+++ b/scene/2d/physics/ray_cast_2d.cpp
@@ -36,6 +36,7 @@
#include "scene/main/scene_tree.h"
#include "scene/resources/world_2d.h"
#include "servers/physics_2d/direct_states/physics_direct_space_state_2d.h"
+#include "servers/physics_2d/physics_server_2d.h"
void RayCast2D::set_target_position(const Vector2 &p_point) {
target_position = p_point;
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 38ff65b1c7c..e93e50c4170 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -72,6 +72,7 @@ STATIC_ASSERT_INCOMPLETE_TYPE(class, RenderingServer);
#ifndef PHYSICS_2D_DISABLED
#include "scene/2d/physics/collision_object_2d.h"
#include "servers/physics_2d/direct_states/physics_direct_space_state_2d.h"
+#include "servers/physics_2d/physics_server_2d.h"
#endif // PHYSICS_2D_DISABLED
#ifndef PHYSICS_3D_DISABLED
diff --git a/scene/resources/2d/skeleton/skeleton_modification_2d_jiggle.cpp b/scene/resources/2d/skeleton/skeleton_modification_2d_jiggle.cpp
index b26d1eeb0db..c8d82157270 100644
--- a/scene/resources/2d/skeleton/skeleton_modification_2d_jiggle.cpp
+++ b/scene/resources/2d/skeleton/skeleton_modification_2d_jiggle.cpp
@@ -34,6 +34,10 @@
#include "scene/2d/skeleton_2d.h"
#include "scene/resources/world_2d.h"
+#ifndef PHYSICS_2D_DISABLED
+#include "servers/physics_2d/physics_server_2d.h"
+#endif // PHYSICS_2D_DISABLED
+
bool SkeletonModification2DJiggle::_set(const StringName &p_path, const Variant &p_value) {
String path = p_path;
diff --git a/scene/resources/world_2d.cpp b/scene/resources/world_2d.cpp
index 1d31092ffa5..f3f74630fa3 100644
--- a/scene/resources/world_2d.cpp
+++ b/scene/resources/world_2d.cpp
@@ -39,6 +39,10 @@
#include "servers/navigation_2d/navigation_server_2d.h"
#endif // NAVIGATION_2D_DISABLED
+#ifndef PHYSICS_2D_DISABLED
+#include "servers/physics_2d/physics_server_2d.h"
+#endif // PHYSICS_2D_DISABLED
+
RID World2D::get_canvas() const {
return canvas;
}
diff --git a/scene/resources/world_2d.h b/scene/resources/world_2d.h
index c95d3dbde8c..ddade38cf9e 100644
--- a/scene/resources/world_2d.h
+++ b/scene/resources/world_2d.h
@@ -33,7 +33,7 @@
#include "core/io/resource.h"
#ifndef PHYSICS_2D_DISABLED
-#include "servers/physics_2d/physics_server_2d.h"
+class PhysicsDirectSpaceState2D;
#endif // PHYSICS_2D_DISABLED
class VisibleOnScreenNotifier2D;