Real-time clock: Prototype Todos #105732
Labels
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
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#105732
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
UI and operators for starting/stopping the real time clock
Add a timer variable likeScreen::animtimer
. If it exists the realtime clock is running.Use the
animtimer
for both anim playback and realtime clock. Separate flag indicates which clocks as currently running.ScreenAnimData
)ED_
functions for creating/destroying the timer and checking state (likeED_screen_animation_play
,ED_screen_animation_playing
)SCREEN_OT_animation_play
,SCREEN_OT_animation_cancel
)Screen.is_animation_playing
)Timer events and depsgraph trigger
animtimer
which just check for running playback with a ED_screen function (except the 2 cases in sound and sequencer which directly access DNA, those need to check theactive_clock
flag).SCREEN_OT_animation_step
). Keymap entry to invoke this operator throughTIMER
events. DoesTIMER0
work here or do we need to useTIMER1
,TIMER2
, or add a new event type?ED_
function to prepare depsgraph updates on realtime clock events (likeED_update_for_newframe
).DEG_graph_time_tag_update
with a time source type to distinguish between updates from animation and from the realtime clock.Depsgraph nodes and relations
TimeSourceNode
to depsgraph that can be distinguished from the current time source. Animated IDs, properties, etc. will keep their relation to the current time source ("animation source"?), while simulations can be moved gradually over to using the new realtime source.A problem i'm trying to solve:
The animation playback timer and the realtime clock timer should be "in phase" as much as possible to avoid very frequent depsgraph updates over tiny time steps.
Note that i'm not talking about tying the playback of the realtime clock to the timeline or vice versa, just the case where both animation and realtime clock are running simultaneously. In this situation the animation clock will use the RenderSettings fps value as usual, but could the realtime clock run at a different interval? (eek!)
Even when both clocks always use the same time step size, they might still be started individually and thus be out of phase. Then the depsgraph has to perform 2 updates over the course of 1 frame because both animation and realtime clock trigger it (albeit with different tagged objects based on dependencies).
The simplest solution would be use the same timer for both clocks. As a consequence there might be a delay of up to 1 frame when starting animation playback or the realtime clock because the timer might already be running, but i think that's acceptable.
Simulation Nodes: Realtime clock documentationto Real-time clock: Prototype TodosCreated a separate task for "locking" the realtime clock to the scene timeline: #106182
On the topic of calculating time steps (aka. "delta time") from absolute values:
The way simulations currently work is based on storing a last update time locally. The naming is different for each simulation system, but the principle is the same, for instance:
RigidBodyWorld::ltime
ParticleSystem::cfra
Cloth::last_frame
When the respective update function is called, each system will compute a time step based on the current scene time (
scene.r.cfra
,BKE_scene_ctime_get
, etc.) and the differencedtime = new_time - old_time
.To get this working with as little change as possible i can store a "cfra" value for the realtime clock as well (somewhere in
Scene
). The current time in seconds can be calculated for the realtime clock just like the scene clock by multiplying with the current fps setting. It must be noted that the realtime clock'scfra
is not a meaningful value by itself, it should only be used to calculate delta time (and possibly for randomization seeds if determinism is not a requirement).There is a risk that changing fps settings could alter the absolute time such that simulations see a sudden jump of the time step, but it seems this would already be a problem with current simulations, so it's not a regression (simulations just need to reset when fps changes). Storing and integrating a float/double time value instead of a frame count might avoid this, but could lead to lower time accuracy the further the simulation progresses.