[4.7.2] Montage not handling playing sequence backwards

Creating a montage with a sequence that has a negative playback rate (backwards) causes the engine to crash with a check() call.

Repro:

  1. Create a montage.
  2. Add a sequence to the montage.
  3. Select the segment in the Montage track to see the details of the sequence.
  4. Set the Play Rate of the sequence to -1.0.
  5. Use the montage within the game.
  6. Notice a crash.

The crash comes from Engine/Source/Runtime/Engine/Private/Animation/AnimCompositeBase.cpp, line 100, where it does a check on the start and end positions. It checks if bPlayingBackwards is set, but this only checks if the montage is playing backwards. It does not handle if the sequence is playing backwards within the montage.

I changed line 100 to these two lines, which should handle the combination of the montage and sequence direction:

const bool bPlayingSequenceBackwards = ( bPlayingBackwards && ValidPlayRate > 0.0f ) || ( !bPlayingBackwards && ValidPlayRate < 0.0f );
check( bPlayingSequenceBackwards ? ( AnimEndPosition <= AnimStartPosition ) : ( AnimStartPosition <= AnimEndPosition ) );

Hi CombatJack,

(Awesome username, btw)

I entered a bug for this a couple weeks ago (UE-12219 for tracking purposes). This thread also contains more information and is where any updates will be made on the topic.

As of right now though, the bug has been marked as fixed and is awaiting verification.

Thanks,

.

EDIT: The other thread I listed wasn’t a crash, but I believe the fix addresses the crash as well

Just wanted to make sure the montage aspect of the issue is caught. This specifically would only happen within a montage, whereas that other bug was playing an instance outside of a montage.

Edit: Sneaky plug for my other anim issue. Can I get someone at Epic’s help on this issue?

I had a run-in getting animmontages to run backward sequences through the editor, and I was told it simply wouldn’t work with the system. Here’s the thread

I don’t know if this is what you’re facing, but it seems relevant.

Thanks Grogger. I was able to get a sequence with -1 playrate to play correctly within a montage when I applied my suggested changes above. This is with 4.7.3.

Hey, have you updated to 4.7.3? I can’t seem to reproduce this there.

This is using 4.7.3. The crash is forced by the check() call at line 100. I believe I was running “Debug Editor”, but I thought check() would still be evaluated in “Development Editor”.

Just checked in our other branch. The fix submission for negative rate scales does not appear to cause a crash with our fix. Thanks for reporting this. :slight_smile:

When this fix is integrated into a release, you’ll no longer need your code workaround.

I found some additional info I wanted to share with everyone on this. After upgrading to 4.7.4, I tried removing my fix from above and played a montage with a anim instance with a -1 play rate and a start time of 0.6667 and end time of 0 and played that montage forward. This still crashes on line 152 of Animation\AnimCompositeBase.cpp. So I’m currently not seeing the Epic changes to animations helping this issue.

After putting my fix back in, I actually found some similar issues in other parts of the same file causing crashes. I wasn’t handling cases of root motion among other things. I applied more fixes and I now appear to have fixed the issues I was having. The little preview window in the montage isn’t updated correctly, but it appears to work in game ok.

If anyone else is having similar issues, you can try my changes in here. They are all marked with // CombatJack Begin…// CombatJack End comments. This is based on version in the 4.7.4 branch.

Hey Jack,

This fix is not in any of the Hotfixes. It is marked for 4.8.

-.