godot icon indicating copy to clipboard operation
godot copied to clipboard

Add track validator to AnimationPlayerEditor to detect tracks which have error

Open TokageItLab opened this issue 3 years ago • 5 comments

Fixes #64340

Unnormalized quaternion keys will cause problems in playing back animations, but it is hard to know which track has the problem just from the error The start/end quaternion must be normalized.

However, checking for error tracks at runtime will reduce the performance, so to notify us the problematic track, the validation is run only at the moment the animation playback button is pressed in the editor.

image

TokageItLab avatar Nov 17 '22 06:11 TokageItLab

Do you handle basis value tracks?

fire avatar Nov 17 '22 14:11 fire

Basis does not need to be checked since basis allows skew and basis animation is not using slerp. But Transform3D/2D can be checked, I will check it.

TokageItLab avatar Nov 17 '22 14:11 TokageItLab

@fire

  • Transform2D seems not to need the check since the slerp is hard-coded within Transform2D and no error occurs in it
  • Transform3D does implicit orthogonalization, but in the case of that it has a corrupted basis (some axes are too close other axis or scaled by zero), the error occurs because it cannot be normalized, so I added a check for that in the validator

Well, in any case, keying Transform2D/3D directly is a corner case, so we may not need to be too sensitive about it. If necessary, we can add checks other than normalization later.

TokageItLab avatar Nov 17 '22 16:11 TokageItLab

I think the isfinite function is useful for checking for nan and infinities that cause corruption.

fire avatar Nov 17 '22 16:11 fire

nan and infinities

Those invalid values will be prevented from being keyed due to errors at a previous step of the keying process. Can they be keyed when keying in a script?

For now, I think it is enough to check as long as the error occurs on keying possible in the normal operation. And, I made it stop playback to avoid spamming if there is a validation error.

TokageItLab avatar Nov 17 '22 17:11 TokageItLab

Thanks!

akien-mga avatar Dec 04 '22 23:12 akien-mga