WIP: Anim: Implement keyframing functionality for the Animation data-block #119669

Closed
Christoph Lendenfeld wants to merge 19 commits from ChrisLend/blender:baklava_keyframing into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

19 Commits

Author SHA1 Message Date
Christoph Lendenfeld 7c869ae0b4 use boolean logic to check pointers 2024-03-21 16:07:42 +01:00
Christoph Lendenfeld 3039305bdb fix: make work with bones by passing resolved path 2024-03-21 16:05:39 +01:00
Christoph Lendenfeld dfe59ce8f8 move object eval to outer level 2024-03-21 16:02:38 +01:00
Christoph Lendenfeld 25aa82c233 split function 2024-03-19 16:55:53 +01:00
Christoph Lendenfeld 7388211a5f use existing function to create an animation datablock 2024-03-19 16:44:17 +01:00
Christoph Lendenfeld c26c0aa9d4 fix crash 2024-03-19 16:24:54 +01:00
Christoph Lendenfeld d18af9aa43 split into subfunctions 2024-03-19 15:36:38 +01:00
Christoph Lendenfeld ae58f12c1c inserting "works" 2024-03-15 13:23:50 +01:00
Christoph Lendenfeld b9939d81f4 created an animation datablock 2024-03-14 17:37:12 +01:00
Sybren A. Stüvel 5099db0f8e Properly tag Animation for updates in `ANIM_list_elem_update()`
This is called by the graph editor transform code, and is necessary to
see the effect of moving keyframes.
2024-03-14 15:05:39 +01:00
Sybren A. Stüvel 9cb1ea3ffb Refactor: use animfilter_fcurves_span in more places 2024-03-14 14:56:15 +01:00
Sybren A. Stüvel 20ec4906f1 Anim: add Animation data-block to filtering code
It seems to be working like this, but more testing is necessary.
2024-03-14 14:56:15 +01:00
Sybren A. Stüvel f9547aa690 Anim: show animated properties with the appropriate color in the GUI
Use the `Animation` data-block to find F-Curves, for drawing the
background color of properties in the GUI (green for 'animated', yellow
for 'keyed on this frame', etc.).

This assumes (correctly) that the `Animation` is limited to a single
layer with a single strip. As such, there is only one set of F-Curves
for every animated ID, which means that the correct F-Curve will be
found. This will need adjustment when the same property can have
multiple F-Curves (due to layers) or when an F-Curve may not be
applicable for each point in time (due to the use of finite strips).
2024-03-14 14:56:15 +01:00
Sybren A. Stüvel e351378c68 Anim: add evaluation of Animation data-blocks
Include Animation data-block handling in Blender's animation evaluation
stack. If an `Animation` is assigned to an `ID`, it will take precedence
over the NLA and/or any `Action` that might be assigned as well.

For more info, see #113594.
2024-03-14 14:56:15 +01:00
Sybren A. Stüvel fc89c10782 Anim: allow inserting keys in Animation data-block
Allow inserting keys into Keyframe strips (which is the only type of
strip that is currently implemented).

Note that the data model is currently limited to a single layer, with a
single infinite strip. Because of this, the strip will not be shown in
any UI, as there is no way to manipulate it anyway.

Note that the inserted keys are not yet evaluated, so the animation
isn't visible in the 3D viewport yet. That's for an upcoming commit.

For more info, see #113594.
2024-03-14 14:56:15 +01:00
Sybren A. Stüvel d6dc36f48f Anim: Add a simple GUI for assigning Animation data-blocks
Add a 'Baklava' panel to the 3D Viewport side-panel. It's a
developer-GUI, not meant for animators (or for inclusion beyond the
experimental feature, for that matter).

Note that this GUI shows all layer properties, even though the data
model is currently limited to a single layer. This means that things
like 'influence' and 'mix mode' are irrelevant, as there is no
underlying layer to mix with.

Also key insertion and animation evaluation are not implemented yet (but
will be in upcoming commits).

For more info, see #113594.
2024-03-14 14:56:15 +01:00
Sybren A. Stüvel 37613cfb12 Anim: allow assigning Animation data-blocks
Expand the `AnimData` struct with an `Animation *` + an
`binding_stable_index` field, and properly handle those relations.

This also adds functionality for actually pointing animated IDs to
`Animation` data-blocks, and automatically hooking up the relevant
`Binding`.

The Depsgraph code is extended to take these new relations into account,
but doesn't trigger any animation evaluation yet.

For more info, see #113594.
2024-03-14 14:56:15 +01:00
Sybren A. Stüvel 02f3fad1c0 Anim: add Animation data-block management functions
Add code (including RNA wrappers) for:

- Creating, removing, and accessing `Animation` data-blocks.
- Creating and removing layers, strips, and bindings on those `Animation`
  data-blocks.
- Accessing those via RNA.

Note that this does not include assignment to any animated data-block,
so it is of limited practical use.

For more info, see #113594.
2024-03-14 14:56:15 +01:00
Sybren A. Stüvel f740332275 Refactor: reduce indentation in `ANIM_nla_mapping_get()`
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
Flip conditions and use early returns to simplify `ANIM_nla_mapping_get()`.

No functional changes.
2024-03-14 14:45:16 +01:00