Currently, to access the scene's time in geometry nodes, one has to use a #frame driver.
People have gotten used to doing this, but there is no particular reason it has to be complicated.
Instead, we should add a "Time" node that gives the current scene time, in frames and seconds.
Details
The node should have two single value outputs:
- Frame The current scene frame
- Seconds The current scene time in seconds (the name is the unit since there is no other way to make that clearly visible.
Implementation
Implementation wise the node itself should be fairly trivial. The more complex part is probably making the object reevaluate when the scene time changes.
- To get the current time from the depsgraph use DEG_get_ctime(...).
- To get the current depsgraph use GeoNodeExecParams::depsgraph().
- In updateDepsgraph in MOD_nodes.cc, the node group has to be scanned for a Scene Time node, and if available a relation has to be added to the depsgraph. Maybe a new function next to DEG_add_node_tree_relation has to be added for that (e.g. DEG_add_scene_time_relation).
Further Questions
Node name: "Time" is a bit vague when there could possibly be other sources of time in the future-- simulation time, object time. So Scene Time might be a better more explicit name.