Assertion check triggered when reimporting animation

Situation:

Had an animation showing in Persona/Skeleton view.

Reimported the animation. The new animation had fewer frames than the old one.

check triggered in AnimSequenceBase.cpp line 224 with the following condition being false due to the particular position of the anim before reimporting:

CurrentPosition >= PreviousPosition

Hi Wallenstein,

The check is not a bug but intended behavior to make sure animations keep the same number of frames and playback rates due to whatever programming in the game has been done based off these figures.

Some workarounds you can do are:

  1. Delete the previous version of the animation before importing the new version
  2. Import the animation as a subsequent version (ie Jump, Jump1, Jump2, etc.) and then replace the initial animation once its replacement has been imported.

Ok, In that case I would suggest not a check but a dialog box that pops up. If this is toi defend against a user error, then the program should not crash to the command line but continue to run with a message to the user what his error was.

Hi Wallenstein,

From the initial post I did not understand it was actually crashing the program. If this is the case can you provide the callstack from the crash? Also, have you been hitting “submit” if the crash reporter window is open?

Lastly, did either workarounds resolve this crash?

the crash happened when I changed the animation externally so that it had fewer frames than whet I had imported before.
I was watching the animation in persona editor and the play slider was on a frame after the frame number that is now the last frame in the new animation. At this point I clicked on “reimport”.
When the new animation was reimported, the old one wass till running, but now was on a frame that was beyond the last frame of the new animation that I was reimporting.

Naturally, the above assertion triggered, which would be understandable, if this was still the same animation, because that’s what the assertion is guarding against, a failure within the current animation.

I assume that the Use Case of an animation reimport while the animation is running and the new animation having fewer frames than the old one was not considered.

My suggestion would be, to halt an animation and rewind it to frame 0 when the “reimport” button is clicked.

I tried to reproduce this issue by exporting an animation from the Animation Starter Pack, modifying it so it had significantly less frames, then reimporting while playing the same animation in Persona. I did this numerous times with various settings from Maya and did not get an error or crash and the animation successfully updated with the correct/reduced number of frames.

Can you tell me if there is anything I’m missing to reproduce your case better. Is the animation in your example being referenced somewhere else in the game. If you cannot think of what would be different, can you provide a copy of a blank project with this asset that crashes under these conditions. You can send as a zip file here, via dropbox, or as a private message to me on our forums.

-Thanks

Did you make sure you imported at a time when the play marker was behind the frame that is the last frame of the new animation? the assert condition in the line I gave above was clearly triggering, because the new animation had fewer frames than the fframe that was currently played.
I dont know what’s going on internally in the engine, but I saw the condition in the debugger and checked the variable content.
My animation is a simple one, nothing special to it. I reduced from about 120 frames to 60 I believe

The assertion that triggered was this:
checkf(bPlayingBackwards ? (CurrentPosition <= PreviousPosition) : (CurrentPosition >= PreviousPosition), TEXT(“in Animsequence %s”), *GetName());

and the condition that failed was “CurrentPosition >= PreviousPosition”

Like I said, I dont know the internals, but it looks to me as if the reimport somehow forced the “CurrentPosition” to become smaller, since there are now fewer frames than the current position value is, and then, when the animation continued, the assertion had to fail.

Why and how the CurrentPosition value was reduced to match the new number of frames, I don’t know, but I would start looking there.

I’ve tried this with numerous assets from the AnimStarterPack and have not been able to reproduce the issue. Would you mind sending your project in a zip file here, via dropbox, or as a private message to me on our forums.

I think this issue is related to previously reported one in following link.

I guess, in that post, reimporting might be done while execution is staying in ‘Delay’ node, so the next time when ‘Play Animation’ is executed, CurrentTime can be beyond reimported length of anim sequence.
It’s only my guess not confirmed fact, but Steve, I believe you can check out what was the main cause and how Lina fixed that problem.

Saddly, this problem still exist in ue 4.10.1, though it’s not common case. My project is not using blueprint like in the old post, but crashed at the same line while playing preview in animation editor window right after opened animation is reimported.

I hope this help you to figure out the problem at least a little bit.

Hi Codeption,

The subsequent link that includes a demo project:

https://answers.unrealengine.com/questions/255014/animation-crash-demo-project-included.html

Shows that, according to JIRA [UE-13800], this was fixed for UE 4.9. Using the same demo project, I was able to verify that this specific issue is still corrected for UE 4.10.2.

If you are still experiencing this issue, please provide concise repro steps so that I can recreate the issue on our end. If that is not possible, you can send your project in a zip file directly to me in a private message on our Unreal Engine Forums.

Thanks,

Steve H.

Hi Steve, and thanks for your quick response.

I think I misunderstood contents of the link what I mentioned in my prior comment. I thought it was related with ‘reimporting an anim sequence’ but it was not. It was related with switching 2 other animation sequences and I understand that it’s already fixed. I’m sorry about my misunderstanding, and thank you for kind investigation and sharing more link.

The problem what I tried to describe is related with only the case when an animation sequence is reimported while it’s being played in somewhere like animation editor preview window. And sadly, it was not reproducible on my side but an animator in our team experienced that problem twice yesterday. The code line where the assertion broken was exactly same with where Wallenstein said, so I commented my story in this answer.

As a work-around, I suggested him to stop playing preview and use ‘show ref pose’ mode before reimporting an animation fbx, and he said no more crash. I can’t sure that work-around was valid, because editor had been rarely crashed when reimporting, but he seems satisfied with it. :wink:

This is all I know, and I’m sorry I can’t provide more information or project to reproduce that problem.

I will try to test the crash you’ve described and file a bug report if applicable. If your animator continues to experience this or a similar issue, please have them start a new AnswerHub post and include precise repro steps. Thanks for the follow up and clarification. -Steve H.