• Editor
  • 'Animation Clean Up' Bug? Or maybe I'm misunderstanding something. . .

  • Изменено

I've got an animation called 🎬 Bonus_On and 🎬 Bonus_Off that affects 3 slots, let's call em:

⚪ Bonus_Glow
⚪ Bonus_Star
⚪ Bonus_Text

When I play 🎬 Bonus_On, I keyframe attach images like so:

⚪ Bonus_Glow
📎(attach) Bonus_Glow.png
⚪ Bonus_Star
📎(attach) Bonus_Star.png
⚪ Bonus_Text
📎(attach) Bonus_x2.png

When I play 🎬 Bonus_Off, I keyframe detaching all the images like so:

⚪ Bonus_Glow
📎(attachment nothing)
⚪ Bonus_Star
📎(attachment nothing)
⚪ Bonus_Text
📎(attachment nothing)

The error in my JSON is on the 🎬 Bonus_Off animation. The JSON says:
"Bonus_Off":{"slots":{"Bonus_Text":{"attachment":[{}]}}},

But that's only 1 of my 3 slots. 😨

If I turn off Animation clean up in my Export settings this appears to fix the error. Now my JSON properly says:

"Bonus_Off":{"slots":{"Bonus_Glow":{"attachment":[{}]},"Bonus_Star":{"attachment":[{}]},"Bonus_Text":{"attachment":[{}]}}},

So I'm keeping Animation clean up unchecked to make any animations work correctly. Is this a bug? Or am I setting up something wrong? Any help would be greatly appreciated! 🙂

Related Discussions
...

The issue you're experiencing with the Animation clean up option is not a bug, but rather a feature of how this option works. When Animation clean up is enabled during export, it removes keys that are identical to the setup pose. This means that if your 🎬 Bonus_Off animation has keys that match the setup pose, they will be removed, which is why only one of your slots appears in the JSON. By disabling Animation clean up, you ensure that all keys, even those identical to the setup pose, are retained in the exported JSON, which is why your animation works correctly when this option is unchecked. It's important to disable Animation clean up if you need to retain all keys for your animations to function as expected.

Thank you Spinebot! I had wondered if something like that might be the case. Interesting that it still kept the Bonus_Text slot in the JSON -- because Bonus_Text already has nothing attached to it in it's setup pose.

Maybe the JSON needs to put something in there, so it just glommed onto the last slot with a keyframe? I'm not sure.

In any case, I'm glad to know what Animation clean up is doing! Thanks! 🙂

Animation clean up will remove keys you don't (shouldn't) need. When you are applying an animation on a single track, that should be the case. If you are applying an animation on a higher track, you should check Layered in the animation properties so clean up will avoid removing certain keys that are needed when an animation is applied on a track above other animations. Don't miss the docs here:
https://esotericsoftware.com/spine-keys#Clean-Up

I'd need to see your .spine project file to be sure what is happening. Reading just the JSON is difficult!