From f1bef3c592ef18e0877fff913b5c1a8c1bfc9121 Mon Sep 17 00:00:00 2001 From: lawnjelly Date: Wed, 4 May 2022 17:04:22 +0100 Subject: [PATCH] Physics Interpolation - improve warnings with NodePath It has been pointed out to me that it is far more useful to display the NodePath in the warning than the name of the node, as there may be lots of nodes sharing the same name in a project. This PR fixes this. --- servers/visual/rasterizer.cpp | 6 +++--- servers/visual/visual_server_scene.cpp | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/servers/visual/rasterizer.cpp b/servers/visual/rasterizer.cpp index 560a854128e..18c70c01d33 100644 --- a/servers/visual/rasterizer.cpp +++ b/servers/visual/rasterizer.cpp @@ -360,7 +360,7 @@ void RasterizerStorage::multimesh_instance_set_transform(RID p_multimesh, int p_ static int32_t warn_count = 0; warn_count++; if (((warn_count % 2048) == 0) && GLOBAL_GET("debug/settings/physics_interpolation/enable_warnings")) { - WARN_PRINT("Interpolated MultiMesh transform should usually be set during physics process (possibly benign)."); + WARN_PRINT("[Physics interpolation] MultiMesh interpolation is being triggered from outside physics process, this might lead to issues (possibly benign)."); } } #endif @@ -517,7 +517,7 @@ void RasterizerStorage::multimesh_set_as_bulk_array_interpolated(RID p_multimesh static int32_t warn_count = 0; warn_count++; if (((warn_count % 2048) == 0) && GLOBAL_GET("debug/settings/physics_interpolation/enable_warnings")) { - WARN_PRINT("Interpolated MultiMesh transform should usually be set during physics process (possibly benign)."); + WARN_PRINT("[Physics interpolation] MultiMesh interpolation is being triggered from outside physics process, this might lead to issues (possibly benign)."); } } #endif @@ -535,7 +535,7 @@ void RasterizerStorage::multimesh_set_as_bulk_array(RID p_multimesh, const PoolV static int32_t warn_count = 0; warn_count++; if (((warn_count % 2048) == 0) && GLOBAL_GET("debug/settings/physics_interpolation/enable_warnings")) { - WARN_PRINT("Interpolated MultiMesh transform should usually be set during physics process (possibly benign)."); + WARN_PRINT("[Physics interpolation] MultiMesh interpolation is being triggered from outside physics process, this might lead to issues (possibly benign)."); } } #endif diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index 85f2cac0cda..4e615c974a5 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -118,7 +118,7 @@ void VisualServerScene::camera_set_transform(RID p_camera, const Transform &p_tr // Effectively a WARN_PRINT_ONCE but after a certain number of occurrences. static int32_t warn_count = -256; if ((warn_count == 0) && GLOBAL_GET("debug/settings/physics_interpolation/enable_warnings")) { - WARN_PRINT("Interpolated Camera transform should usually be set during physics process (possibly benign)."); + WARN_PRINT("[Physics interpolation] Camera interpolation is being triggered from outside physics process, this might lead to issues (possibly benign)."); } warn_count++; } @@ -128,7 +128,7 @@ void VisualServerScene::camera_set_transform(RID p_camera, const Transform &p_tr if (Engine::get_singleton()->is_in_physics_frame()) { static int32_t warn_count = -256; if ((warn_count == 0) && GLOBAL_GET("debug/settings/physics_interpolation/enable_warnings")) { - WARN_PRINT("Non-interpolated Camera transform should not usually be set during physics process (possibly benign)."); + WARN_PRINT("[Physics interpolation] Non-interpolated Camera is being triggered from physics process, this might lead to issues (possibly benign)."); } warn_count++; } @@ -842,15 +842,15 @@ void VisualServerScene::instance_set_transform(RID p_instance, const Transform & if (id != 0) { if (ObjectDB::get_instance(id)) { Node *node = Object::cast_to(ObjectDB::get_instance(id)); - if (node) { - node_name = "\"" + node->get_name() + "\""; + if (node && node->is_inside_tree()) { + node_name = "\"" + String(node->get_path()) + "\""; } else { node_name = "\"unknown\""; } } } - WARN_PRINT("Non-interpolated Instance " + node_name + " transform should usually not be set during physics process (possibly benign)."); + WARN_PRINT("[Physics interpolation] Non-interpolated Instance is being triggered from physics process, this might lead to issues: " + node_name + " (possibly benign)."); } } #endif @@ -919,15 +919,15 @@ void VisualServerScene::instance_set_transform(RID p_instance, const Transform & if (id != 0) { if (ObjectDB::get_instance(id)) { Node *node = Object::cast_to(ObjectDB::get_instance(id)); - if (node) { - node_name = "\"" + node->get_name() + "\""; + if (node && node->is_inside_tree()) { + node_name = "\"" + String(node->get_path()) + "\""; } else { node_name = "\"unknown\""; } } } - WARN_PRINT("Interpolated Instance " + node_name + " transform should usually be set during physics process (possibly benign)."); + WARN_PRINT("[Physics interpolation] Instance interpolation is being triggered from outside physics process, this might lead to issues: " + node_name + " (possibly benign)."); } } #endif