ExtractComponentCharacter() public static method

public static ExtractComponentCharacter ( string name ) : char
name string
return char
コード例 #1
0
 public static int GetCurveIndexFromName(string name)
 {
     return((int)RotationCurveInterpolation.ExtractComponentCharacter(name) - 120);
 }
コード例 #2
0
        internal static void SetInterpolation(AnimationClip clip, EditorCurveBinding[] curveBindings, RotationCurveInterpolation.Mode newInterpolationMode)
        {
            Undo.RegisterCompleteObjectUndo(clip, "Rotation Interpolation");
            if (clip.legacy && newInterpolationMode == RotationCurveInterpolation.Mode.RawEuler)
            {
                Debug.LogWarning("Warning, Euler Angles interpolation mode is not fully supported for Legacy animation clips. If you mix clips using Euler Angles interpolation with clips using other interpolation modes (using Animation.CrossFade, Animation.Blend or other methods), you will get erroneous results. Use with caution.", clip);
            }
            List <EditorCurveBinding> list  = new List <EditorCurveBinding>();
            List <AnimationCurve>     list2 = new List <AnimationCurve>();
            List <EditorCurveBinding> list3 = new List <EditorCurveBinding>();

            for (int i = 0; i < curveBindings.Length; i++)
            {
                EditorCurveBinding editorCurveBinding             = curveBindings[i];
                RotationCurveInterpolation.Mode modeFromCurveData = RotationCurveInterpolation.GetModeFromCurveData(editorCurveBinding);
                if (modeFromCurveData != RotationCurveInterpolation.Mode.Undefined)
                {
                    if (modeFromCurveData == RotationCurveInterpolation.Mode.RawQuaternions)
                    {
                        Debug.LogWarning("Can't convert quaternion curve: " + editorCurveBinding.propertyName);
                    }
                    else
                    {
                        AnimationCurve editorCurve = AnimationUtility.GetEditorCurve(clip, editorCurveBinding);
                        if (editorCurve != null)
                        {
                            string propertyName = RotationCurveInterpolation.GetPrefixForInterpolation(newInterpolationMode) + '.' + RotationCurveInterpolation.ExtractComponentCharacter(editorCurveBinding.propertyName);
                            list.Add(new EditorCurveBinding
                            {
                                propertyName = propertyName,
                                type         = editorCurveBinding.type,
                                path         = editorCurveBinding.path
                            });
                            list2.Add(editorCurve);
                            list3.Add(new EditorCurveBinding
                            {
                                propertyName = editorCurveBinding.propertyName,
                                type         = editorCurveBinding.type,
                                path         = editorCurveBinding.path
                            });
                        }
                    }
                }
            }
            Undo.RegisterCompleteObjectUndo(clip, "Rotation Interpolation");
            foreach (EditorCurveBinding current in list3)
            {
                AnimationUtility.SetEditorCurve(clip, current, null);
            }
            foreach (EditorCurveBinding current2 in list)
            {
                AnimationUtility.SetEditorCurve(clip, current2, list2[list.IndexOf(current2)]);
            }
        }
コード例 #3
0
        internal static void SetInterpolation(AnimationClip clip, EditorCurveBinding[] curveBindings, RotationCurveInterpolation.Mode newInterpolationMode)
        {
            Undo.RegisterCompleteObjectUndo((UnityEngine.Object)clip, "Rotation Interpolation");
            if (clip.legacy && newInterpolationMode == RotationCurveInterpolation.Mode.RawEuler)
            {
                Debug.LogWarning((object)"Warning, Euler Angles interpolation mode is not fully supported for Legacy animation clips. If you mix clips using Euler Angles interpolation with clips using other interpolation modes (using Animation.CrossFade, Animation.Blend or other methods), you will get erroneous results. Use with caution.", (UnityEngine.Object)clip);
            }
            List <EditorCurveBinding> editorCurveBindingList1 = new List <EditorCurveBinding>();
            List <AnimationCurve>     animationCurveList      = new List <AnimationCurve>();
            List <EditorCurveBinding> editorCurveBindingList2 = new List <EditorCurveBinding>();

            foreach (EditorCurveBinding curveBinding in curveBindings)
            {
                switch (RotationCurveInterpolation.GetModeFromCurveData(curveBinding))
                {
                case RotationCurveInterpolation.Mode.Undefined:
                    continue;

                case RotationCurveInterpolation.Mode.RawQuaternions:
                    Debug.LogWarning((object)("Can't convert quaternion curve: " + curveBinding.propertyName));
                    continue;

                default:
                    AnimationCurve editorCurve = AnimationUtility.GetEditorCurve(clip, curveBinding);
                    if (editorCurve != null)
                    {
                        string str = RotationCurveInterpolation.GetPrefixForInterpolation(newInterpolationMode) + (object)'.' + (object)RotationCurveInterpolation.ExtractComponentCharacter(curveBinding.propertyName);
                        editorCurveBindingList1.Add(new EditorCurveBinding()
                        {
                            propertyName = str,
                            type         = curveBinding.type,
                            path         = curveBinding.path
                        });
                        animationCurveList.Add(editorCurve);
                        editorCurveBindingList2.Add(new EditorCurveBinding()
                        {
                            propertyName = curveBinding.propertyName,
                            type         = curveBinding.type,
                            path         = curveBinding.path
                        });
                        continue;
                    }
                    continue;
                }
            }
            Undo.RegisterCompleteObjectUndo((UnityEngine.Object)clip, "Rotation Interpolation");
            using (List <EditorCurveBinding> .Enumerator enumerator = editorCurveBindingList2.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    EditorCurveBinding current = enumerator.Current;
                    AnimationUtility.SetEditorCurve(clip, current, (AnimationCurve)null);
                }
            }
            using (List <EditorCurveBinding> .Enumerator enumerator = editorCurveBindingList1.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    EditorCurveBinding current = enumerator.Current;
                    AnimationUtility.SetEditorCurve(clip, current, animationCurveList[editorCurveBindingList1.IndexOf(current)]);
                }
            }
        }
コード例 #4
0
        internal static void SetInterpolation(AnimationClip clip, EditorCurveBinding[] curveBindings, RotationCurveInterpolation.Mode newInterpolationMode)
        {
            Undo.RegisterCompleteObjectUndo(clip, "Rotation Interpolation");
            List <EditorCurveBinding> list  = new List <EditorCurveBinding>();
            List <AnimationCurve>     list2 = new List <AnimationCurve>();
            List <EditorCurveBinding> list3 = new List <EditorCurveBinding>();

            for (int i = 0; i < curveBindings.Length; i++)
            {
                EditorCurveBinding editorCurveBinding             = curveBindings[i];
                RotationCurveInterpolation.Mode modeFromCurveData = RotationCurveInterpolation.GetModeFromCurveData(editorCurveBinding);
                if (modeFromCurveData != RotationCurveInterpolation.Mode.Undefined)
                {
                    if (modeFromCurveData == RotationCurveInterpolation.Mode.RawQuaternions)
                    {
                        Debug.LogWarning("Can't convert quaternion curve: " + editorCurveBinding.propertyName);
                    }
                    else
                    {
                        AnimationCurve editorCurve = AnimationUtility.GetEditorCurve(clip, editorCurveBinding);
                        if (editorCurve != null)
                        {
                            string propertyName = RotationCurveInterpolation.GetPrefixForInterpolation(newInterpolationMode) + '.' + RotationCurveInterpolation.ExtractComponentCharacter(editorCurveBinding.propertyName);
                            list.Add(new EditorCurveBinding
                            {
                                propertyName = propertyName,
                                type         = editorCurveBinding.type,
                                path         = editorCurveBinding.path
                            });
                            list2.Add(editorCurve);
                            list3.Add(new EditorCurveBinding
                            {
                                propertyName = editorCurveBinding.propertyName,
                                type         = editorCurveBinding.type,
                                path         = editorCurveBinding.path
                            });
                        }
                    }
                }
            }
            Undo.RegisterCompleteObjectUndo(clip, "Rotation Interpolation");
            foreach (EditorCurveBinding current in list3)
            {
                AnimationUtility.SetEditorCurve(clip, current, null);
            }
            foreach (EditorCurveBinding current2 in list)
            {
                AnimationUtility.SetEditorCurve(clip, current2, list2[list.IndexOf(current2)]);
            }
        }