Scene time input node #93098

Closed
opened 2021-11-15 18:44:11 +01:00 by Hans Goudey · 13 comments
Member

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.

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.
Author
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Author
Member

Added subscriber: @HooglyBoogly

Added subscriber: @HooglyBoogly
Hans Goudey changed title from Time input node to Scene time input node 2021-11-15 18:44:28 +01:00
Member

Added subscriber: @Blendify

Added subscriber: @Blendify
Member

Sounds good 👍🏻 a reminder to me or someone else to rename the compositor time node to "time curve node".

https://docs.blender.org/manual/en/latest/compositing/types/input/time.html

Sounds good 👍🏻 a reminder to me or someone else to rename the compositor time node to "time curve node". https://docs.blender.org/manual/en/latest/compositing/types/input/time.html

Added subscriber: @GeorgiaPacific

Added subscriber: @GeorgiaPacific
Member

Can we add the scene framerate also? This way we can easily calculate time in seconds (or any other unit) rather than in frames.

Can we add the scene framerate also? This way we can easily calculate time in seconds (or any other unit) rather than in frames.
Author
Member

In #93098#1254043, @Blendify wrote:
This way we can easily calculate time in seconds (or any other unit) rather than in frames.

Isn't that what the seconds output is for though? Anyway, I don't really think framerate should be exposed that way, since it can be problematic if changing the framerate for rendering can change arbitrary things in some node tree.

> In #93098#1254043, @Blendify wrote: > This way we can easily calculate time in seconds (or any other unit) rather than in frames. Isn't that what the seconds output is for though? Anyway, I don't really think framerate should be exposed that way, since it can be problematic if changing the framerate for rendering can change arbitrary things in some node tree.
Member

My bad I didn't see the seconds output, I thought there was only frames.

My bad I didn't see the seconds output, I thought there was only frames.

Added subscriber: @MiroHorvath

Added subscriber: @MiroHorvath
Johnny Matthews was assigned by Jacques Lucke 2021-12-07 19:17:51 +01:00

This issue was referenced by bd3bd776c8

This issue was referenced by bd3bd776c8938dbae29c6cb764195124ca59641b

Added subscriber: @Blendork

Added subscriber: @Blendork

@guitargeek @HooglyBoogly will this stay a Geometry Nodes exclusive? It would be useful in Shader Nodes too(like a few other GN exclusives)

@guitargeek @HooglyBoogly will this stay a Geometry Nodes exclusive? It would be useful in Shader Nodes too(like a few other GN exclusives)
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
7 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#93098
No description provided.