Skip to content

Commit f859d13

Browse files
committed
Merge pull request #108332 from WhalesState/templates
Fix remaining physics and navigation disabling issues.
2 parents e8d5270 + 5eee6d2 commit f859d13

File tree

5 files changed

+28
-11
lines changed

5 files changed

+28
-11
lines changed

modules/gridmap/grid_map.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,27 @@
3131
#include "grid_map.h"
3232

3333
#include "core/io/marshalls.h"
34-
#include "core/math/convex_hull.h"
3534
#include "core/templates/a_hash_map.h"
35+
#include "scene/resources/3d/mesh_library.h"
36+
#include "scene/resources/3d/primitive_meshes.h"
37+
#include "scene/resources/surface_tool.h"
38+
#include "servers/rendering_server.h"
39+
40+
#ifndef PHYSICS_3D_DISABLED
41+
#include "core/math/convex_hull.h"
3642
#include "scene/resources/3d/box_shape_3d.h"
3743
#include "scene/resources/3d/capsule_shape_3d.h"
3844
#include "scene/resources/3d/concave_polygon_shape_3d.h"
3945
#include "scene/resources/3d/convex_polygon_shape_3d.h"
4046
#include "scene/resources/3d/cylinder_shape_3d.h"
4147
#include "scene/resources/3d/height_map_shape_3d.h"
42-
#include "scene/resources/3d/mesh_library.h"
43-
#include "scene/resources/3d/navigation_mesh_source_geometry_data_3d.h"
44-
#include "scene/resources/3d/primitive_meshes.h"
4548
#include "scene/resources/3d/shape_3d.h"
4649
#include "scene/resources/3d/sphere_shape_3d.h"
4750
#include "scene/resources/physics_material.h"
48-
#include "scene/resources/surface_tool.h"
49-
#include "servers/rendering_server.h"
51+
#endif // PHYSICS_3D_DISABLED
5052

5153
#ifndef NAVIGATION_3D_DISABLED
54+
#include "scene/resources/3d/navigation_mesh_source_geometry_data_3d.h"
5255
#include "servers/navigation_server_3d.h"
5356

5457
Callable GridMap::_navmesh_source_geometry_parsing_callback;
@@ -1234,7 +1237,9 @@ void GridMap::_bind_methods() {
12341237
ClassDB::bind_method(D_METHOD("make_baked_meshes", "gen_lightmap_uv", "lightmap_uv_texel_size"), &GridMap::make_baked_meshes, DEFVAL(false), DEFVAL(0.1));
12351238

12361239
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "mesh_library", PROPERTY_HINT_RESOURCE_TYPE, "MeshLibrary"), "set_mesh_library", "get_mesh_library");
1240+
#ifndef PHYSICS_3D_DISABLED
12371241
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "physics_material", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsMaterial"), "set_physics_material", "get_physics_material");
1242+
#endif // PHYSICS_3D_DISABLED
12381243
ADD_GROUP("Cell", "cell_");
12391244
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "cell_size", PROPERTY_HINT_NONE, "suffix:m"), "set_cell_size", "get_cell_size");
12401245
ADD_PROPERTY(PropertyInfo(Variant::INT, "cell_octant_size", PROPERTY_HINT_RANGE, "1,1024,1"), "set_octant_size", "get_octant_size");

scene/3d/audio_stream_player_3d.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,10 +410,10 @@ Vector<AudioFrame> AudioStreamPlayer3D::_update_panning() {
410410

411411
float dist = local_pos.length();
412412

413+
#ifndef PHYSICS_3D_DISABLED
413414
Vector3 area_sound_pos;
414415
Vector3 listener_area_pos;
415416

416-
#ifndef PHYSICS_3D_DISABLED
417417
Area3D *area = _get_overriding_area();
418418
if (area && area->is_using_reverb_bus() && area->get_reverb_uniformity() > 0) {
419419
area_sound_pos = space_state->get_closest_point_to_object_volume(area->get_rid(), listener_node->get_global_transform().origin);

scene/debugger/scene_debugger.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1634,8 +1634,8 @@ void RuntimeNodeSelect::_root_window_input(const Ref<InputEvent> &p_event) {
16341634
if (camera_override) {
16351635
if (node_select_type == NODE_TYPE_2D) {
16361636
is_dragging_camera = panner->gui_input(p_event, Rect2(Vector2(), root->get_visible_rect().get_size()));
1637-
} else if (node_select_type == NODE_TYPE_3D && selection_drag_state == SELECTION_DRAG_NONE) {
16381637
#ifndef _3D_DISABLED
1638+
} else if (node_select_type == NODE_TYPE_3D && selection_drag_state == SELECTION_DRAG_NONE) {
16391639
if (_handle_3d_input(p_event)) {
16401640
return;
16411641
}
@@ -1807,8 +1807,8 @@ void RuntimeNodeSelect::_physics_frame() {
18071807
}
18081808
}
18091809
}
1810-
} else if (node_select_type == NODE_TYPE_3D) {
18111810
#ifndef _3D_DISABLED
1811+
} else if (node_select_type == NODE_TYPE_3D) {
18121812
if (selection_drag_valid) {
18131813
_find_3d_items_at_rect(selection_drag_area, items);
18141814
} else {
@@ -2175,15 +2175,15 @@ void RuntimeNodeSelect::_update_selection() {
21752175
if (visual_instance) {
21762176
bounds = visual_instance->get_aabb();
21772177
} else {
2178-
#ifndef PHYSICS_2D_DISABLED
2178+
#ifndef PHYSICS_3D_DISABLED
21792179
CollisionShape3D *collision_shape = Object::cast_to<CollisionShape3D>(node_3d);
21802180
if (collision_shape) {
21812181
Ref<Shape3D> shape = collision_shape->get_shape();
21822182
if (shape.is_valid()) {
21832183
bounds = shape->get_debug_mesh()->get_aabb();
21842184
}
21852185
}
2186-
#endif // PHYSICS_2D_DISABLED
2186+
#endif // PHYSICS_3D_DISABLED
21872187
}
21882188

21892189
Transform3D xform_to_top_level_parent_space = node_3d->get_global_transform().affine_inverse() * node_3d->get_global_transform();

scene/resources/3d/world_3d.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@
3434
#include "scene/3d/camera_3d.h"
3535
#include "scene/resources/camera_attributes.h"
3636
#include "scene/resources/environment.h"
37+
#ifndef NAVIGATION_3D_DISABLED
3738
#include "servers/navigation_server_3d.h"
39+
#endif // NAVIGATION_3D_DISABLED
3840

3941
void World3D::_register_camera(Camera3D *p_camera) {
4042
cameras.insert(p_camera);
@@ -58,6 +60,7 @@ RID World3D::get_space() const {
5860
return space;
5961
}
6062

63+
#ifndef NAVIGATION_3D_DISABLED
6164
RID World3D::get_navigation_map() const {
6265
if (navigation_map.is_null()) {
6366
navigation_map = NavigationServer3D::get_singleton()->map_create();
@@ -72,6 +75,7 @@ RID World3D::get_navigation_map() const {
7275
}
7376
return navigation_map;
7477
}
78+
#endif // NAVIGATION_3D_DISABLED
7579

7680
RID World3D::get_scenario() const {
7781
return scenario;
@@ -149,7 +153,9 @@ PhysicsDirectSpaceState3D *World3D::get_direct_space_state() {
149153

150154
void World3D::_bind_methods() {
151155
ClassDB::bind_method(D_METHOD("get_space"), &World3D::get_space);
156+
#ifndef NAVIGATION_3D_DISABLED
152157
ClassDB::bind_method(D_METHOD("get_navigation_map"), &World3D::get_navigation_map);
158+
#endif // NAVIGATION_3D_DISABLED
153159
ClassDB::bind_method(D_METHOD("get_scenario"), &World3D::get_scenario);
154160
ClassDB::bind_method(D_METHOD("set_environment", "env"), &World3D::set_environment);
155161
ClassDB::bind_method(D_METHOD("get_environment"), &World3D::get_environment);
@@ -164,7 +170,9 @@ void World3D::_bind_methods() {
164170
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "fallback_environment", PROPERTY_HINT_RESOURCE_TYPE, "Environment"), "set_fallback_environment", "get_fallback_environment");
165171
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "camera_attributes", PROPERTY_HINT_RESOURCE_TYPE, "CameraAttributesPractical,CameraAttributesPhysical"), "set_camera_attributes", "get_camera_attributes");
166172
ADD_PROPERTY(PropertyInfo(Variant::RID, "space", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "", "get_space");
173+
#ifndef NAVIGATION_3D_DISABLED
167174
ADD_PROPERTY(PropertyInfo(Variant::RID, "navigation_map", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "", "get_navigation_map");
175+
#endif // NAVIGATION_3D_DISABLED
168176
ADD_PROPERTY(PropertyInfo(Variant::RID, "scenario", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "", "get_scenario");
169177
#ifndef PHYSICS_3D_DISABLED
170178
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "direct_space_state", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsDirectSpaceState3D", PROPERTY_USAGE_NONE), "", "get_direct_space_state");

scene/resources/3d/world_3d.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ class World3D : public Resource {
4848
private:
4949
RID scenario;
5050
mutable RID space;
51+
#ifndef NAVIGATION_3D_DISABLED
5152
mutable RID navigation_map;
53+
#endif // NAVIGATION_3D_DISABLED
5254

5355
Ref<Environment> environment;
5456
Ref<Environment> fallback_environment;
@@ -67,7 +69,9 @@ class World3D : public Resource {
6769

6870
public:
6971
RID get_space() const;
72+
#ifndef NAVIGATION_3D_DISABLED
7073
RID get_navigation_map() const;
74+
#endif // NAVIGATION_3D_DISABLED
7175
RID get_scenario() const;
7276

7377
void set_environment(const Ref<Environment> &p_environment);

0 commit comments

Comments
 (0)