Beispiel #1
0
 /// <summary>
 /// Deserialize an array of animation curves from binary data, ignoring tangents.
 /// </summary>
 public static void ReadBoolCurveArray(BinaryReader reader, AnimationCurve[] curves)
 {
     foreach (AnimationCurve curve in curves)
     {
         InputAnimationSerializationUtils.ReadBoolCurve(reader, curve);
     }
 }
        /// <summary>
        /// Deserialize animation data from a stream.
        /// </summary>
        public void FromStream(Stream stream)
        {
            var reader = new BinaryReader(stream);

            InputAnimationSerializationUtils.ReadHeader(reader, out int versionMajor, out int versionMinor);
            if (versionMajor != 1 || versionMinor != 0)
            {
                Debug.LogError("Only version 1.0 of input animation file format is supported.");
                return;
            }

            PoseCurvesFromStream(reader, cameraCurves);

            InputAnimationSerializationUtils.ReadBoolCurve(reader, handTrackedCurveLeft);
            InputAnimationSerializationUtils.ReadBoolCurve(reader, handTrackedCurveRight);
            InputAnimationSerializationUtils.ReadBoolCurve(reader, handPinchCurveLeft);
            InputAnimationSerializationUtils.ReadBoolCurve(reader, handPinchCurveRight);

            for (int i = 0; i < jointCount; ++i)
            {
                if (!handJointCurvesLeft.TryGetValue((TrackedHandJoint)i, out PoseCurves curves))
                {
                    curves = new PoseCurves();
                    handJointCurvesLeft.Add((TrackedHandJoint)i, curves);
                }
                PoseCurvesFromStream(reader, curves);
            }
            for (int i = 0; i < jointCount; ++i)
            {
                if (!handJointCurvesRight.TryGetValue((TrackedHandJoint)i, out PoseCurves curves))
                {
                    curves = new PoseCurves();
                    handJointCurvesRight.Add((TrackedHandJoint)i, curves);
                }
                PoseCurvesFromStream(reader, curves);
            }

            InputAnimationSerializationUtils.ReadMarkerList(reader, markers);

            ComputeDuration();
        }