Ejemplo n.º 1
0
 public void TranslateCurves(float amount)
 {
     base.Firetime += amount;
     for (int i = 0; i < curveData.Count; i++)
     {
         int curveCount = UnityPropertyTypeInfo.GetCurveCount(curveData[i].PropertyType);
         for (int j = 0; j < curveCount; j++)
         {
             AnimationCurve animationCurve = curveData[i].GetCurve(j);
             if (amount > 0)
             {
                 for (int k = animationCurve.length - 1; k >= 0; k--)
                 {
                     Keyframe kf          = animationCurve.keys[k];
                     Keyframe newKeyframe = new Keyframe(kf.time + amount, kf.value, kf.inTangent, kf.outTangent);
                     newKeyframe.tangentMode = kf.tangentMode;
                     AnimationCurveHelper.MoveKey(animationCurve, k, newKeyframe);
                 }
             }
             else
             {
                 for (int k = 0; k < animationCurve.length; k++)
                 {
                     Keyframe kf          = animationCurve.keys[k];
                     Keyframe newKeyframe = new Keyframe(kf.time + amount, kf.value, kf.inTangent, kf.outTangent);
                     newKeyframe.tangentMode = kf.tangentMode;
                     AnimationCurveHelper.MoveKey(animationCurve, k, newKeyframe);
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
        public void AddClipCurveData(Component component, string name, bool isProperty, Type type)
        {
            MemberClipCurveData data = new MemberClipCurveData();

            data.Type         = component.GetType().Name;
            data.PropertyName = name;
            data.IsProperty   = isProperty;
            data.PropertyType = UnityPropertyTypeInfo.GetMappedType(type);
            if (initializeClipCurves(data, component))
            {
                curveData.Add(data);
            }
            else
            {
                Debug.LogError("Could not initialize curve clip, invalid initial values.");
            }
        }
Ejemplo n.º 3
0
        private void updateKeyframeTime(float oldTime, float newTime)
        {
            for (int i = 0; i < curveData.Count; i++)
            {
                int curveCount = UnityPropertyTypeInfo.GetCurveCount(curveData[i].PropertyType);
                for (int j = 0; j < curveCount; j++)
                {
                    AnimationCurve animationCurve = curveData[i].GetCurve(j);
                    for (int k = 0; k < animationCurve.length; k++)
                    {
                        Keyframe kf = animationCurve.keys[k];

                        if (Mathf.Abs(kf.time - oldTime) < 0.00001)
                        {
                            Keyframe newKeyframe = new Keyframe(newTime, kf.value, kf.inTangent, kf.outTangent);
                            newKeyframe.tangentMode = kf.tangentMode;
                            AnimationCurveHelper.MoveKey(animationCurve, k, newKeyframe);
                        }
                    }
                }
            }
        }