private List <AnimationClip> ImportAnimationClips(glTF gltf, Axises invertAxis) { var animationClips = new List <AnimationClip>(); for (var i = 0; i < gltf.animations.Count; ++i) { var clip = new AnimationClip(); clip.ClearCurves(); clip.legacy = true; clip.name = gltf.animations[i].name; if (string.IsNullOrEmpty(clip.name)) { clip.name = $"legacy_{i}"; } clip.wrapMode = WrapMode.Loop; var animation = gltf.animations[i]; if (string.IsNullOrEmpty(animation.name)) { animation.name = $"animation:{i}"; } animationClips.Add(AnimationImporterUtil.ConvertAnimationClip(gltf, animation, invertAxis.Create())); } return(animationClips); }
public virtual async Task LoadAnimationAsync(IAwaitCaller awaitCaller) { if (GLTF.animations != null && GLTF.animations.Any()) { foreach (var(key, gltfAnimation) in Enumerable.Zip(AnimationImporterUtil.EnumerateSubAssetKeys(GLTF), GLTF.animations, (x, y) => (x, y))) { await AnimationClipFactory.LoadAnimationClipAsync(key, async() => { return(AnimationImporterUtil.ConvertAnimationClip(GLTF, gltfAnimation, InvertAxis.Create())); }); } await awaitCaller.NextFrame(); } }
private List <AnimationClip> ImportAnimationClips(glTF gltf, Axises invertAxis) { var animationClips = new List <AnimationClip>(); for (var i = 0; i < gltf.animations.Count; ++i) { var clip = new AnimationClip(); clip.ClearCurves(); clip.legacy = true; clip.name = gltf.animations[i].name; if (string.IsNullOrEmpty(clip.name)) { clip.name = $"legacy_{i}"; } clip.wrapMode = WrapMode.Loop; var animation = gltf.animations[i]; if (string.IsNullOrEmpty(animation.name)) { animation.name = $"animation:{i}"; } AxisInverter inverter = default; switch (invertAxis) { case Axises.X: inverter = AxisInverter.ReverseX; break; case Axises.Z: inverter = AxisInverter.ReverseZ; break; default: throw new System.Exception(); } animationClips.Add(AnimationImporterUtil.ConvertAnimationClip(gltf, animation, inverter)); } return(animationClips); }