Code LoopType does not Override Json LoopTypes
Nyfaria opened this issue ยท 2 comments
When you playAnim in code using a different LoopType than the Json provides, it does not override it and will just use the Json looptype.
Ok so after talking with you further I found the issue
Basically - this has nothing to do with overriding the loop type.
What's happening is that the animation system doesn't try to loop your animation until it knows it's done.
It does this by grabbing the animation length property in your animation json, and storing that.
If it can't find one, it tries to determine it by using the highest-time keyframe your animation has defined.
If none of your keyframes are defined by time (I.E. they're all just molang based), then the system can't tell how long your animation is - so to prevent it from early-terminating, it assumes it's an indefinite animation.
There is really no good way to solve this from Geckolib's side, as I can only come up with the following two possible solutions:
- Make every animation just end after 10 seconds (or some other predetermined length of time). This doesn't really.. solve.. anything, except for preventing excessively long locked loops - but that doesn't really mean much/anything. It also introduces significant problems elsewhere.
- Try to brute-force determine the length of the animation via making the animation compute a resultant position/rotation/scale for every tick up to a pre-determined amount, then see if a pattern emerges, then call that the loop point. This will still fail on even the most modest molang-based animations however, and would significantly increase boot time.
Obviously, neither of these work.
Therefore, the best solution to this, is to just.. put an animation length on your animation.
That's it - that's all you need to do lol