Closed Mazku closed 7 years ago
I didn't remove these obsolete methods, but these can be removed if my commit is accepted.
private void SetKeys(AnimationCurve curve, TimeLine timeLine, ref Sprite[] sprites, Animation animation)
private int GetIndexOrAdd(ref Sprite[] sprites, Sprite sprite)
The main reason for me getting into making these changes was with animation blending. When using additive blended animation layers the TextureController.DisplayedSprite value was also calculated by adding all animations' values together. This caused wrong sprites to be shown or even index overflow in TextureController.Update (DisplayedSprite > Sprites.Length).
If it works for you the way you want it to, you are encouraged to keep using it in such a way. I will however not merge it into the main project because it conflicts with my intent in NOT using AnimationCurves for the swapping of sprite parts.
Unless you manage to make it into a toggle that the user can choose to use.
Just to be clear: this implementation will create keyframes for swapping sprites similar to when changing the sprite in Unity Editor while in animation record mode.
If this is something that is not wanted I understand it. But what is an alternative way of implementing sprite swapping and what is the reason for it?
It's because animation curves are a bitch to modify at runtime. The SpriteSwapper, or TextureController or w/e I used to call it, can control every part of the sprite at runtime.
Again, if you can turn it into a toggle that the user can turn on and off, it'll be fine.
I implement a support for user to opt in this feature with a toggle in ScmlImportOptionsWindow.
Excellent, I'll add it right away.
Use Unity’s default way of tracking Sprite swapping by adding ObjectReferenceCurves containing ObjectReferenceKeyframes.