Commit: 620b190e521e9e7fd21115126cc5733a06ca4e6f
Author: Hans Goudey
Date:   Sat Dec 10 14:07:09 2022 -0600
Branches: geometry-nodes-simulation
https://developer.blender.org/rB620b190e521e9e7fd21115126cc5733a06ca4e6f

Fix delta time output

Output time in seconds rather than frame units

===================================================================

M       source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc

===================================================================

diff --git a/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc 
b/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc
index c8c038b748b..d4ca1ae22c3 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc
@@ -84,7 +84,9 @@ static void node_geo_exec(GeoNodeExecParams params)
   }
 
   if (params.lazy_output_is_required("Delta Time")) {
-    const float delta_time = cache->is_empty() ? 0.0f : scene_ctime - 
cache->last_run_time()->time;
+    const float time_diff = cache->is_empty() ? 0.0f : scene_ctime - 
cache->last_run_time()->time;
+    const double frame_rate = (double(scene->r.frs_sec) / 
double(scene->r.frs_sec_base));
+    const float delta_time = float(std::max(0.0f, time_diff) / frame_rate);
     params.set_output("Delta Time", delta_time);
   }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to