Fix #112085: Not able to insert keys on subframes #112131

Merged
Christoph Lendenfeld merged 6 commits from ChrisLend/blender:fix_subframe_keyframing into main 2023-09-14 15:07:15 +02:00

When subframes were enabled, and the time cursor was at a subframe position, the keying would still insert the key at the full frame.

This was because the value passed to the key insertion functions was just the full frame value and not the subframe part.
Fixing it by using BKE_scene_frame_get() which returns the floating point frame including the subframe part.

I've added unit tests to ensure that inserting keys at subframe values doesn't cause issues.

When subframes were enabled, and the time cursor was at a subframe position, the keying would still insert the key at the full frame. This was because the value passed to the key insertion functions was just the full frame value and not the subframe part. Fixing it by using `BKE_scene_frame_get()` which returns the floating point frame including the subframe part. I've added unit tests to ensure that inserting keys at subframe values doesn't cause issues.
Christoph Lendenfeld added the
Module
Animation & Rigging
label 2023-09-08 12:59:09 +02:00
Christoph Lendenfeld added 1 commit 2023-09-08 12:59:26 +02:00
Christoph Lendenfeld added this to the Animation & Rigging project 2023-09-08 13:01:38 +02:00
Christoph Lendenfeld added 3 commits 2023-09-12 13:21:13 +02:00

I think a million frames is a bit much, realistically. Even at 60FPS that would be a 4.6 hour shot. DNA_scene_types.h has this though:

#define MAXFRAME 1048574

so yeah, even though in practice it'll hardly happen, testing with that high frame count is actually good :)

As for the precision, BEZT_BINARYSEARCH_THRESH = 0.01f, which is currently what defines the practical resolution of subframes. Testing with less than 7 decimal places would be acceptable for sure.

I think a million frames is a bit much, realistically. Even at 60FPS that would be a 4.6 hour shot. `DNA_scene_types.h` has this though: ```c #define MAXFRAME 1048574 ``` so yeah, even though in practice it'll hardly happen, testing with that high frame count is actually good :) As for the precision, `BEZT_BINARYSEARCH_THRESH = 0.01f`, which is currently what defines the practical resolution of subframes. Testing with less than 7 decimal places would be acceptable for sure.
Author
Member

thanks that got me unstuck
I've now realized why the test failed. Floating point numbers don't have sufficient resolution at 1.000.000
I've used this calculator for this https://www.h-schmidt.net/FloatConverter/IEEE754.html
and also confirmed in blender. When you go to that frame and enable subframes, the steps the time cursor takes correspond to the floating point precision steps.

Now the question is what to do.
Soften up the test some more or have it fail correctly.
By the latter I mean insert 50 keys but only expect them to be at the floating point precision steps and also check the amount of keys is not larger than the steps available.
I tend to the latter but am open to suggestions


EDIT: pushed a change that fails correctly to better explain what I mean by that

thanks that got me unstuck I've now realized why the test failed. Floating point numbers don't have sufficient resolution at 1.000.000 I've used this calculator for this https://www.h-schmidt.net/FloatConverter/IEEE754.html and also confirmed in blender. When you go to that frame and enable subframes, the steps the time cursor takes correspond to the floating point precision steps. Now the question is what to do. Soften up the test some more or have it fail correctly. By the latter I mean insert 50 keys but only expect them to be at the floating point precision steps and also check the amount of keys is not larger than the steps available. I tend to the latter but am open to suggestions ---- EDIT: pushed a change that fails correctly to better explain what I mean by that
Christoph Lendenfeld added 1 commit 2023-09-12 15:31:32 +02:00
4d0b805eab change high frame number check
takes floating point resolution into account
Christoph Lendenfeld added 1 commit 2023-09-12 16:51:39 +02:00
Christoph Lendenfeld changed title from WIP: Fix #112085: Not able to insert keys on subframes to Fix #112085: Not able to insert keys on subframes 2023-09-12 17:02:55 +02:00
Christoph Lendenfeld requested review from Sybren A. Stüvel 2023-09-12 17:03:03 +02:00
Sybren A. Stüvel approved these changes 2023-09-14 14:58:12 +02:00
Sybren A. Stüvel left a comment
Member

Excellent! Yes, I prefer this approach too.

Excellent! Yes, I prefer this approach too.
Christoph Lendenfeld merged commit 8f1bd71992 into main 2023-09-14 15:07:15 +02:00
Christoph Lendenfeld deleted branch fix_subframe_keyframing 2023-09-14 15:07:20 +02:00
Christoph Lendenfeld removed this from the Animation & Rigging project 2023-11-21 14:38:27 +01:00
Sign in to join this conversation.
No reviewers
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
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#112131
No description provided.