Animation: Common curve drawing for FCurves #110764
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
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 & 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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
Asset System
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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#110764
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "ChrisLend/blender:graph_common_curve_drawing"
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?
Before this patch, the drawing code iterated the FCurve to see if there are any
curve interpolation types that can't easily be drawn. (Sinusoidal, Bounce, etc)
If it found one, it would fall back to evaluating the FCurve.
That meant in the worst case scenario it would iterate the whole FCurve
before even starting to draw.
This PR unifies the drawing logic for FCurves no matter their interpolation type.
If it encounters a key type that it can't draw, it falls back to samples, but only
for the current key.
To clarify that it renames
draw_fcurve_curve_bezts
todraw_fcurve_curve_keys
Curves with modifiers are still drawn with samples.
Performance
Test setup: 6000f of dense data on 62 bones. Only measuring the average draw time per curve. All measurements were done at the same zoom level.
The performance boost with "only elastic" can be explained by the fact that per key I can skip 1 call to
evaluate_fcurve
. That is because I always start at an existing keyframe so I can use its position.Love this change. Way clearer and simpler this way.
Just one issue with computing the step size of the fcurve evaluation. (Very much the kind of mistake I would make, too!)
@ -1095,0 +1089,4 @@
const float samples_per_pixel = 0.75f;
const float samples_per_frame = (window_width * samples_per_pixel) / v2d_frame_range;
const float evaluation_step = (bezt->vec[1][0] - prevbezt->vec[1][0]) / samples_per_frame;
I played around with a build, and this computation of the
evaluation_step
doesn't seem to be right (it gives very inconsistent drawing resolutions, sometimes extremely low, sometimes very high).I think the issue is that you're effectively double-accounting for the mapping from screen space to fcurve space by using both
v2d_frame_range
and(bezt->vec[1][0] - prevbezt->vec[1][0])
in the computation. I believe you only need one of them.If I replace the
const float samples_per_frame
andconst float evaluation_step
lines with the following:Then it seems to behave as expected. For example, setting
samples_per_pixel
to0.1
then results in a key every ~10 pixels, regardless of zoom.I tested it and your code gives me the exact same
evaluation_step
I still changed the code to your suggestion because I think it reads a bit better
Huh, that's odd. Wonder why it behaved differently on my system. Oh well. :-)
Looks good to me!
Looks good to me!