1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-24 15:26:15 +00:00

Allow to compile templates without physics servers

This commit is contained in:
Michael Alexsander
2025-02-27 19:01:23 -03:00
parent b13c96b097
commit 5ad414d046
72 changed files with 951 additions and 364 deletions

View File

@@ -43,19 +43,26 @@
#include "scene/gui/control.h"
#include "scene/main/multiplayer_api.h"
#include "scene/main/viewport.h"
#include "scene/main/window.h"
#include "scene/resources/environment.h"
#include "scene/resources/image_texture.h"
#include "scene/resources/material.h"
#include "scene/resources/mesh.h"
#include "scene/resources/packed_scene.h"
#include "scene/resources/world_2d.h"
#include "servers/physics_server_2d.h"
#ifndef _3D_DISABLED
#include "scene/3d/node_3d.h"
#include "scene/resources/3d/world_3d.h"
#include "servers/physics_server_3d.h"
#endif // _3D_DISABLED
#include "window.h"
#ifndef PHYSICS_2D_DISABLED
#include "servers/physics_server_2d.h"
#endif // PHYSICS_2D_DISABLED
#ifndef PHYSICS_3D_DISABLED
#include "servers/physics_server_3d.h"
#endif // PHYSICS_3D_DISABLED
void SceneTreeTimer::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_time_left", "time"), &SceneTreeTimer::set_time_left);
@@ -130,7 +137,7 @@ void SceneTree::ClientPhysicsInterpolation::physics_process() {
}
}
}
#endif
#endif // _3D_DISABLED
void SceneTree::tree_changed() {
emit_signal(tree_changed_name);
@@ -526,7 +533,9 @@ bool SceneTree::physics_process(double p_time) {
emit_signal(SNAME("physics_frame"));
#if !defined(PHYSICS_2D_DISABLED) || !defined(PHYSICS_3D_DISABLED)
call_group(SNAME("_picking_viewports"), SNAME("_process_picking"));
#endif // !defined(PHYSICS_2D_DISABLED) || !defined(PHYSICS_3D_DISABLED)
_process(true);
@@ -970,10 +979,12 @@ void SceneTree::set_pause(bool p_enabled) {
paused = p_enabled;
#ifndef _3D_DISABLED
#ifndef PHYSICS_3D_DISABLED
PhysicsServer3D::get_singleton()->set_active(!p_enabled);
#endif // _3D_DISABLED
#endif // PHYSICS_3D_DISABLED
#ifndef PHYSICS_2D_DISABLED
PhysicsServer2D::get_singleton()->set_active(!p_enabled);
#endif // PHYSICS_2D_DISABLED
if (get_root()) {
get_root()->_propagate_pause_notification(p_enabled);
}
@@ -994,10 +1005,12 @@ void SceneTree::set_suspend(bool p_enabled) {
Engine::get_singleton()->set_freeze_time_scale(p_enabled);
#ifndef _3D_DISABLED
#ifndef PHYSICS_3D_DISABLED
PhysicsServer3D::get_singleton()->set_active(!p_enabled && !paused);
#endif // _3D_DISABLED
#endif // PHYSICS_3D_DISABLED
#ifndef PHYSICS_2D_DISABLED
PhysicsServer2D::get_singleton()->set_active(!p_enabled && !paused);
#endif // PHYSICS_2D_DISABLED
if (get_root()) {
get_root()->_propagate_suspend_notification(p_enabled);
}
@@ -2011,7 +2024,9 @@ SceneTree::SceneTree() {
}
#endif // _3D_DISABLED
#if !defined(PHYSICS_2D_DISABLED) || !defined(PHYSICS_3D_DISABLED)
root->set_physics_object_picking(GLOBAL_DEF("physics/common/enable_object_picking", true));
#endif // !defined(PHYSICS_2D_DISABLED) || !defined(PHYSICS_3D_DISABLED)
root->connect("close_requested", callable_mp(this, &SceneTree::_main_window_close));
root->connect("go_back_requested", callable_mp(this, &SceneTree::_main_window_go_back));