Anim: Fix legacy/layered choice in action_fcurve_ensure()

Fix the code that decides whether to create a new F-Curve in a legacy or
layered style. The old code went for layered if:

- The experimental feature is enabled AND the Action is already layered.

The new code goes for layered if:

- The experimental feature is enabled AND the Action is empty, OR
- The Action is already layered.

Pull Request: https://projects.blender.org/blender/blender/pulls/128036
This commit is contained in:
Sybren A. Stüvel
2024-09-24 09:48:45 +02:00
committed by Gitea
parent 4a1bf5f172
commit 6d8e3959b0

View File

@@ -2229,7 +2229,9 @@ FCurve *action_fcurve_ensure(Main *bmain,
}
Action &action = act->wrap();
if (USER_EXPERIMENTAL_TEST(&U, use_animation_baklava) && action.is_action_layered()) {
if ((USER_EXPERIMENTAL_TEST(&U, use_animation_baklava) && action.is_empty()) ||
!action.is_action_legacy())
{
/* NOTE: for layered actions we require the following:
*
* - `ptr` is non-null.