Page MenuHome

T91299 - Fix NLA strips not splitting properly when repeated
AbandonedPublic

Authored by Thibault de Villèle (thibaulltt) on Sep 23 2021, 5:09 PM.

Details

Summary

Hopefully fixes T91299, where splitting a NLA track with a repeat property would not properly update the strip's different attributes (notably the repeat property which stayed unchanged) and lead to confusion when changing the repeat property after splitting. This way, the track would go back to its original length and repeat n times from its starting point (more info and steps to reproduce on the task page).

The behaviour of the split operation has been changed to split all repeats of the same NLA strip at the same frame relative to the action clip's frame. It leads to splitting all repeats of the source strip in their own single-repeat strip, and split those strips at the chosen frame within the action clip.

As such, the frame to split the strip at is determined one of two ways :

  • if the timeline cursor is not over the strip, take the middle frame (unchanged from previous revision)
  • if it is, compute the frame under the cursor relative to the source action clip, not the action strip.

Since the original strip uses a certain action clip within frames [actstart, actend] the split strips will use their 'respective parts' of the action clip, and have a repeat of 1. This allows to repeat only the split part of the strip 'n' times after the split.

The only drawback is it splits all repeats of the strip. I personally prefer it this way, since the source strip is a repeat of a single action clip and as such it made more sense to me to split all repeats at the same point.

Some other solutions would include :

  • split all repeats into single strips which use the whole action clip, save for the one under the cursor which would be split in twain at the cursor's position
    • but then how do you decide where and which one to split when the cursor is not over the track ?
  • split the left-hand part of the strip into a single strip with updated repeat property, and let the rest into a single other strip which starts later in the action clip and then repeats the rest of the way from the original strip
    • as far as I know, there's no way for a NLA strip to start at a specific actstart for the first repeat, and repeat at the original actstart for the following repeats.

Ran through clang-format, and introduces no new warnings/errors.
Tested quite thouroughly on my side, with the usual caveat that since I was the developer and the tester, there might have been some glaring ommissions from my testing. So external testing is more than encouraged!

Diff Detail

Repository
rB Blender

Event Timeline

Thibault de Villèle (thibaulltt) created this revision.

This patch was done on the blender-v2.93-release branch, since it made more sense to push it in a dot update rather than wait for 3.0 given the size of the patch.

It introduces no new warnings/errors when compiling on my machine, with the default compilation options provided in the makefile, while using the precompiled libraries.

And I don't think it needs new documentation since it's just a slight behaviour change but correct me if I'm wrong.

Updated diff for the master branch, as I was informed the changes are backported to blender-v2.93-release instead of being submitted directly.

Update for a small oversight : I had accounted the strips could start with a start frame different than one, but I had not accounted it for the action clip the strip is using.

Should be fixed now.

It seems I messed up my patch submission yesterday, oh well. Since I also need to change the behaviour of my fix (misunderstood the original reporter's expected workflow) I'll fix it later.

A better solution has come up, which is also more inline with the original reporter's needs. Thus, I'm closing this.