// parses keypoint curve data and adds to keypoint private void addToKeys(AnimationClipCurveData curveData) { string prop = curveData.propertyName.Split('.')[0]; string vec = curveData.propertyName.Split('.')[1]; LoziAnimationKeyPoints point = getKeyPoint(curveData.path); switch (prop) { case "m_LocalPosition": { parsePoint(vec, point.pos, curveData.curve.keys); break; } case "m_LocalRotation": { parsePoint(vec, point.rot, curveData.curve.keys); break; } case "m_LocalScale": { parsePoint(vec, point.scl, curveData.curve.keys); break; } } }
// sorts curves by time private void mergeTimes() { for (int num1 = 0; num1 < keys.Count; num1++) { LoziAnimationKeyPoints point = keys[num1]; point.times = new List <float>(); if (point.pos.time != null) { for (int num2 = 0; num2 < point.pos.time.Length; num2++) { if (!point.times.Contains(point.pos.time[num2])) { point.times.Add(point.pos.time[num2]); } } } if (point.rot.time != null) { for (int num2 = 0; num2 < point.rot.time.Length; num2++) { if (!point.times.Contains(point.rot.time[num2])) { point.times.Add(point.rot.time[num2]); } } } if (point.scl.time != null) { for (int num2 = 0; num2 < point.scl.time.Length; num2++) { if (!point.times.Contains(point.scl.time[num2])) { point.times.Add(point.scl.time[num2]); } } } point.times.Sort(); } }
// creates or gets exiting point by path and returns private LoziAnimationKeyPoints getKeyPoint(string path) { LoziAnimationKeyPoints point = null; for (int num = 0; num < keys.Count; num++) { if (keys[num].path == path) { point = keys[num]; break; } } if (point == null) { point = new LoziAnimationKeyPoints(); point.pos = new LoziAnimationKeyPoint(); point.rot = new LoziAnimationKeyPoint(); point.scl = new LoziAnimationKeyPoint(); point.path = path; keys.Add(point); } return(point); }