private void SetAnimationsData() { SceneData.Current.fps = AnimationEngine.Instance.fps; SceneData.Current.startFrame = AnimationEngine.Instance.StartFrame; SceneData.Current.endFrame = AnimationEngine.Instance.EndFrame; SceneData.Current.currentFrame = AnimationEngine.Instance.CurrentFrame; foreach (AnimationSet animSet in AnimationEngine.Instance.GetAllAnimations().Values) { AnimationData animData = new AnimationData(); Utils.GetTransformRelativePathTo(animSet.transform, rootTransform, out animData.objectPath); foreach (Curve curve in animSet.curves.Values) { CurveData curveData = new CurveData { property = curve.property }; foreach (AnimationKey key in curve.keys) { KeyframeData keyData = new KeyframeData { frame = key.frame, value = key.value, interpolation = key.interpolation }; curveData.keyframes.Add(keyData); } animData.curves.Add(curveData); } SceneData.Current.animations.Add(animData); } }
public void FromBytes(byte[] buffer, ref int index) { objectPath = Converter.GetString(buffer, ref index); int curvesCount = Converter.GetInt(buffer, ref index); for (int i = 0; i < curvesCount; ++i) { CurveData curveData = new CurveData(); curveData.FromBytes(buffer, ref index); curves.Add(curveData); } }