1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-14 13:41:12 +00:00

Add "Game" editor for better runtime debugging

This commit is contained in:
Michael Alexsander
2024-09-18 18:07:18 -03:00
parent 8004c7524f
commit 16524a8a01
45 changed files with 2378 additions and 274 deletions

View File

@@ -954,11 +954,14 @@ Ref<ArrayMesh> SceneTree::get_debug_contact_mesh() {
void SceneTree::set_pause(bool p_enabled) {
ERR_FAIL_COND_MSG(!Thread::is_main_thread(), "Pause can only be set from the main thread.");
ERR_FAIL_COND_MSG(suspended, "Pause state cannot be modified while suspended.");
if (p_enabled == paused) {
return;
}
paused = p_enabled;
#ifndef _3D_DISABLED
PhysicsServer3D::get_singleton()->set_active(!p_enabled);
#endif // _3D_DISABLED
@@ -972,6 +975,30 @@ bool SceneTree::is_paused() const {
return paused;
}
void SceneTree::set_suspend(bool p_enabled) {
ERR_FAIL_COND_MSG(!Thread::is_main_thread(), "Suspend can only be set from the main thread.");
if (p_enabled == suspended) {
return;
}
suspended = p_enabled;
Engine::get_singleton()->set_freeze_time_scale(p_enabled);
#ifndef _3D_DISABLED
PhysicsServer3D::get_singleton()->set_active(!p_enabled && !paused);
#endif // _3D_DISABLED
PhysicsServer2D::get_singleton()->set_active(!p_enabled && !paused);
if (get_root()) {
get_root()->_propagate_suspend_notification(p_enabled);
}
}
bool SceneTree::is_suspended() const {
return suspended;
}
void SceneTree::_process_group(ProcessGroup *p_group, bool p_physics) {
// When reading this function, keep in mind that this code must work in a way where
// if any node is removed, this needs to continue working.