GetCurveIndexFromName() public static method

public static GetCurveIndexFromName ( string name ) : int
name string
return int
 public static void UpdateTangentsFromMode(AnimationCurve curve, AnimationClip clip, EditorCurveBinding curveBinding)
 {
     if (RotationCurveInterpolation.GetModeFromCurveData(curveBinding) == RotationCurveInterpolation.Mode.NonBaked)
     {
         QuaternionCurveTangentCalculation quaternionCurveTangentCalculation = default(QuaternionCurveTangentCalculation);
         int curveIndexFromName = RotationCurveInterpolation.GetCurveIndexFromName(curveBinding.propertyName);
         for (int i = 0; i < 3; i++)
         {
             if (i == curveIndexFromName)
             {
                 quaternionCurveTangentCalculation.SetCurve(i, curve);
             }
             else
             {
                 EditorCurveBinding binding = curveBinding;
                 binding.propertyName = "localEulerAngles." + RotationCurveInterpolation.kPostFix[i];
                 AnimationCurve editorCurve = AnimationUtility.GetEditorCurve(clip, binding);
                 if (editorCurve == null)
                 {
                     return;
                 }
                 quaternionCurveTangentCalculation.SetCurve(i, editorCurve);
             }
         }
         quaternionCurveTangentCalculation.UpdateTangentsFromMode(curveIndexFromName);
     }
     else
     {
         CurveUtility.UpdateTangentsFromMode(curve);
     }
 }
Exemplo n.º 2
0
        public static CurveRenderer GetCurveRenderer(AnimationClip clip, EditorCurveBinding curveBinding)
        {
            if (curveBinding.type == typeof(Transform) && curveBinding.propertyName.StartsWith("localEulerAngles."))
            {
                int    curveIndexFromName = RotationCurveInterpolation.GetCurveIndexFromName(curveBinding.propertyName);
                string key = CurveUtility.GetCurveGroupID(clip, curveBinding).ToString();
                EulerCurveCombinedRenderer eulerCurveCombinedRenderer = (EulerCurveCombinedRenderer)CurveRendererCache.m_CombiRenderers[key];
                if (eulerCurveCombinedRenderer == null)
                {
                    eulerCurveCombinedRenderer = new EulerCurveCombinedRenderer(AnimationUtility.GetEditorCurve(clip, EditorCurveBinding.FloatCurve(curveBinding.path, typeof(Transform), "m_LocalRotation.x")), AnimationUtility.GetEditorCurve(clip, EditorCurveBinding.FloatCurve(curveBinding.path, typeof(Transform), "m_LocalRotation.y")), AnimationUtility.GetEditorCurve(clip, EditorCurveBinding.FloatCurve(curveBinding.path, typeof(Transform), "m_LocalRotation.z")), AnimationUtility.GetEditorCurve(clip, EditorCurveBinding.FloatCurve(curveBinding.path, typeof(Transform), "m_LocalRotation.w")), AnimationUtility.GetEditorCurve(clip, EditorCurveBinding.FloatCurve(curveBinding.path, typeof(Transform), "localEulerAngles.x")), AnimationUtility.GetEditorCurve(clip, EditorCurveBinding.FloatCurve(curveBinding.path, typeof(Transform), "localEulerAngles.y")), AnimationUtility.GetEditorCurve(clip, EditorCurveBinding.FloatCurve(curveBinding.path, typeof(Transform), "localEulerAngles.z")));
                    CurveRendererCache.m_CombiRenderers.Add(key, eulerCurveCombinedRenderer);
                }
                return(new EulerCurveRenderer(curveIndexFromName, eulerCurveCombinedRenderer));
            }
            string key2 = CurveUtility.GetCurveID(clip, curveBinding).ToString();
            NormalCurveRenderer normalCurveRenderer = (NormalCurveRenderer)CurveRendererCache.m_NormalRenderers[key2];

            if (normalCurveRenderer == null)
            {
                normalCurveRenderer = new NormalCurveRenderer(AnimationUtility.GetEditorCurve(clip, curveBinding));
                CurveRendererCache.m_NormalRenderers.Add(key2, normalCurveRenderer);
            }
            return(normalCurveRenderer);
        }