Update property when adding or removing keyframe #90041

Open
opened 2021-07-22 11:34:41 +02:00 by Richard Antalik · 10 comments

Removing keyframe can cause issues in all editors and adding keyframe needs to update VSE.

When removing keyframe, RNA update function should be called, since property value may change. This is reproducible with simple 3 keyframe animation, place CFRA on middle keyframe, remove (press Shift + Alt +I on propery in side panel) it and no update will happen.

When adding keyframe, sequencer prefetch is not notified about this change. So it works on outdated data until keyframe is added. Simply notifying prefetch is not enough and cache must be cleared too which is currently done from RNA update function.
Similar case is speed effect, where it calculates input frame based on animation, which is integrated over time. Array mapping current to input frames is cached and recalculated in RNA update function.

Removing keyframe can cause issues in all editors and adding keyframe needs to update VSE. When removing keyframe, RNA update function should be called, since property value may change. This is reproducible with simple 3 keyframe animation, place CFRA on middle keyframe, remove (press Shift + Alt +I on propery in side panel) it and no update will happen. When adding keyframe, sequencer prefetch is not notified about this change. So it works on outdated data until keyframe is added. Simply notifying prefetch is not enough and cache must be cleared too which is currently done from RNA update function. Similar case is speed effect, where it calculates input frame based on animation, which is integrated over time. Array mapping current to input frames is cached and recalculated in RNA update function.
Author
Member

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

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

Added subscriber: @iss

Added subscriber: @iss

#98433 was marked as duplicate of this issue

#98433 was marked as duplicate of this issue

Added subscriber: @dr.sybren

Added subscriber: @dr.sybren

Added subscriber: @angavrilov

Added subscriber: @angavrilov

I wonder if it is possible to notify Python add-on code too somehow. Currently something like Cycle-Aware Keying can only be implemented in C since checks have to be added directly into the insertion code.

I wonder if it is possible to notify Python add-on code too somehow. Currently something like Cycle-Aware Keying can only be implemented in C since checks have to be added directly into the insertion code.
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

Removing keyframe can cause issues in all editors and adding keyframe needs to update VSE.

When removing keyframe, RNA update function should be called, since property value may change. This is reproducible with simple 3 keyframe animation, place CFRA on middle keyframe, remove it and no update will happen.

Dont think this is quite right? See my comment from #94542:

In #94542#1282733, @lichtwerk wrote:
There is just no cache invalidation in regards to animation in many places.
Only doing direct RNA property manipulation calls this afaics (so e.g. button tweaking).

This has quite broad reach as all of these (if not more) dont invalidate the cache:

  • clearing keyframes
  • deleting actions
  • removing drivers
  • removing dopsheet channels
  • removing graph editor channels
  • removing nla tracks
  • removing nla strips
  • removing fcurve modifiers

Interestingly, removing a keyframe (in the dopesheet or graph editor) will invalidate the cache correctly.
But this is because delete_graph_keys does ANIM_animdata_update / ANIM_list_elem_update (and that in turn touches the RNA updates, see RNA_property_update_main there... if, and only if ANIM_animdata_update is called with ANIM_UPDATE_DEPS which is included in ANIM_UPDATE_DEFAULT which delete_graph_keys uses)

So removing a single keyframe (or multiple - but not all) will actually touch/fire RNA callbacks afaict, but removing all keyframes (or any of the operations mentioned above) dont.

> Removing keyframe can cause issues in all editors and adding keyframe needs to update VSE. > > When removing keyframe, RNA update function should be called, since property value may change. This is reproducible with simple 3 keyframe animation, place CFRA on middle keyframe, remove it and no update will happen. Dont think this is quite right? See my comment from #94542: > In #94542#1282733, @lichtwerk wrote: > There is just no cache invalidation in regards to animation in many places. > Only doing direct RNA property manipulation calls this afaics (so e.g. button tweaking). > > This has quite broad reach as all of these (if not more) dont invalidate the cache: > - clearing keyframes > - deleting actions > - removing drivers > - removing dopsheet channels > - removing graph editor channels > - removing nla tracks > - removing nla strips > - removing fcurve modifiers > > Interestingly, removing a keyframe (in the dopesheet or graph editor) **will invalidate the cache correctly**. > But this is because `delete_graph_keys` does `ANIM_animdata_update` / `ANIM_list_elem_update` (and that in turn touches the RNA updates, see `RNA_property_update_main` there... if, and only if `ANIM_animdata_update` is called with `ANIM_UPDATE_DEPS` which is included in `ANIM_UPDATE_DEFAULT` which `delete_graph_keys` uses) So removing a single keyframe (or multiple - but not all) will actually touch/fire RNA callbacks afaict, but removing all keyframes (or any of the operations mentioned above) dont.
Author
Member

In #90041#1287515, @lichtwerk wrote:
So removing a single keyframe (or multiple - but not all) will actually touch/fire RNA callbacks afaict, but removing all keyframes (or any of the operations mentioned above) dont.

I saw that comment and I should clarify, this happes when you press Shift + Alt +I on propery in side panel, not when removing keyframe in timeline editor.

> In #90041#1287515, @lichtwerk wrote: > So removing a single keyframe (or multiple - but not all) will actually touch/fire RNA callbacks afaict, but removing all keyframes (or any of the operations mentioned above) dont. I saw that comment and I should clarify, this happes when you press Shift + Alt +I on propery in side panel, not when removing keyframe in timeline editor.
Member

Added subscriber: @OmarEmaraDev

Added subscriber: @OmarEmaraDev
Philipp Oeser removed the
Interest
Animation & Rigging
label 2023-02-09 14:35:33 +01:00
Richard Antalik added this to the Video Sequencer project 2023-02-09 21:00:44 +01:00
Philipp Oeser added the
Interest
VFX & Video
label 2023-02-10 11:36:37 +01:00
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 Assignees
5 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#90041
No description provided.