private void ProcessConstant(Clip clip, AnimationClipBindingConstant bindings, IReadOnlyDictionary <uint, string> tos, int frameCount) { DenseClip dense = clip.DenseClip; ConstantClip constant = clip.ConstantClip; int streamCount = clip.StreamedClip.CurveCount; int denseCount = clip.DenseClip.CurveCount; // only first and last frames for (int frameIndex = 0; frameIndex < frameCount; frameIndex += (frameCount > 1 ? frameCount - 1 : 1)) { float time = frameIndex / dense.SampleRate; for (int curveIndex = 0; curveIndex < constant.Constants.Count;) { int index = streamCount + denseCount + curveIndex; if (!GetGenericBinding(bindings, index, out GenericBinding binding)) { curveIndex++; continue; } string path = GetCurvePath(tos, binding.Path); AddComplexCurve(time, binding.BindingType, constant.Constants, curveIndex, path); curveIndex += binding.BindingType.GetDimension(); } } }
private void ProcessDenses(Clip clip, AnimationClipBindingConstant bindings, IReadOnlyDictionary <uint, string> tos) { DenseClip dense = clip.DenseClip; int streamCount = clip.StreamedClip.CurveCount; float[] slopeValues = new float[4]; // no slopes - 0 values for (int frameIndex = 0; frameIndex < dense.FrameCount; frameIndex++) { float time = frameIndex / dense.SampleRate; int frameOffset = frameIndex * dense.CurveCount; for (int curveIndex = 0; curveIndex < dense.CurveCount;) { int index = streamCount + curveIndex; if (!GetGenericBinding(bindings, index, out GenericBinding binding)) { curveIndex++; continue; } string path = GetCurvePath(tos, binding.Path); AddComplexCurve(time, binding.BindingType, dense.SampleArray, slopeValues, slopeValues, frameOffset + curveIndex, path); curveIndex += binding.BindingType.GetDimension(); } } }