HasAnyRecordableModifications() private static method

private static HasAnyRecordableModifications ( GameObject root, UndoPropertyModification modifications ) : bool
root UnityEngine.GameObject
modifications UnityEditor.UndoPropertyModification
return bool
コード例 #1
0
        public static UndoPropertyModification[] Process(IAnimationRecordingState state, UndoPropertyModification[] modifications)
        {
            GameObject activeRootGameObject = state.activeRootGameObject;

            UndoPropertyModification[] result;
            if (activeRootGameObject == null)
            {
                result = modifications;
            }
            else if (!AnimationRecording.HasAnyRecordableModifications(activeRootGameObject, modifications))
            {
                result = modifications;
            }
            else
            {
                Dictionary <object, AnimationRecording.RotationModification> dictionary  = new Dictionary <object, AnimationRecording.RotationModification>();
                Dictionary <object, AnimationRecording.Vector3Modification>  dictionary2 = new Dictionary <object, AnimationRecording.Vector3Modification>();
                Dictionary <object, AnimationRecording.Vector3Modification>  dictionary3 = new Dictionary <object, AnimationRecording.Vector3Modification>();
                AnimationRecording.CollectRotationModifications(state, ref modifications, ref dictionary);
                UndoPropertyModification[] second = AnimationRecording.FilterRotationModifications(state, ref dictionary);
                UndoPropertyModification[] array  = AnimationRecording.FilterModifications(state, ref modifications);
                AnimationRecording.CollectVector3Modifications(state, ref modifications, ref dictionary3, "m_LocalPosition");
                AnimationRecording.CollectVector3Modifications(state, ref modifications, ref dictionary2, "m_LocalScale");
                AnimationRecording.ProcessAnimatorModifications(state, ref dictionary3, ref dictionary, ref dictionary2);
                AnimationRecording.ProcessVector3Modifications(state, ref dictionary3);
                AnimationRecording.ProcessRotationModifications(state, ref dictionary);
                AnimationRecording.ProcessVector3Modifications(state, ref dictionary2);
                AnimationRecording.ProcessModifications(state, modifications);
                array.Concat(second);
                result = array.ToArray <UndoPropertyModification>();
            }
            return(result);
        }
コード例 #2
0
        public static UndoPropertyModification[] Process(IAnimationRecordingState state, UndoPropertyModification[] modifications)
        {
            GameObject activeRootGameObject = state.activeRootGameObject;

            if (activeRootGameObject == null)
            {
                return(modifications);
            }
            AnimationClip activeAnimationClip = state.activeAnimationClip;
            Animator      component           = activeRootGameObject.GetComponent <Animator>();

            if (!AnimationRecording.HasAnyRecordableModifications(activeRootGameObject, modifications))
            {
                return(modifications);
            }
            AnimationRecording.ProcessRotationModifications(state, ref modifications);
            List <UndoPropertyModification> list = new List <UndoPropertyModification>();

            for (int i = 0; i < modifications.Length; i++)
            {
                EditorCurveBinding   binding       = default(EditorCurveBinding);
                PropertyModification previousValue = modifications[i].previousValue;
                Type type = AnimationUtility.PropertyModificationToEditorCurveBinding(previousValue, activeRootGameObject, out binding);
                if (type != null)
                {
                    if (component != null && component.isHuman && binding.type == typeof(Transform) && component.IsBoneTransform(previousValue.target as Transform))
                    {
                        Debug.LogWarning("Keyframing for humanoid rig is not supported!", previousValue.target as Transform);
                    }
                    else
                    {
                        AnimationMode.AddPropertyModification(binding, previousValue, modifications[i].keepPrefabOverride);
                        EditorCurveBinding[] array = RotationCurveInterpolation.RemapAnimationBindingForAddKey(binding, activeAnimationClip);
                        if (array != null)
                        {
                            for (int j = 0; j < array.Length; j++)
                            {
                                AnimationRecording.AddKey(state, array[j], type, AnimationRecording.FindPropertyModification(activeRootGameObject, modifications, array[j]));
                            }
                        }
                        else
                        {
                            AnimationRecording.AddKey(state, binding, type, previousValue);
                        }
                    }
                }
                else
                {
                    list.Add(modifications[i]);
                }
            }
            return(list.ToArray());
        }
コード例 #3
0
        public static UndoPropertyModification[] Process(AnimationWindowState state, UndoPropertyModification[] modifications)
        {
            GameObject activeRootGameObject = state.activeRootGameObject;

            if ((UnityEngine.Object)activeRootGameObject == (UnityEngine.Object)null)
            {
                return(modifications);
            }
            AnimationClip activeAnimationClip = state.activeAnimationClip;
            Animator      component           = activeRootGameObject.GetComponent <Animator>();

            if (!AnimationRecording.HasAnyRecordableModifications(activeRootGameObject, modifications))
            {
                return(modifications);
            }
            AnimationRecording.ProcessRotationModifications(state, ref modifications);
            List <UndoPropertyModification> propertyModificationList = new List <UndoPropertyModification>();

            for (int index1 = 0; index1 < modifications.Length; ++index1)
            {
                EditorCurveBinding   binding            = new EditorCurveBinding();
                PropertyModification previousValue      = modifications[index1].previousValue;
                System.Type          editorCurveBinding = AnimationUtility.PropertyModificationToEditorCurveBinding(previousValue, activeRootGameObject, out binding);
                if (editorCurveBinding != null && editorCurveBinding != typeof(Animator))
                {
                    if ((UnityEngine.Object)component != (UnityEngine.Object)null && component.isHuman && (binding.type == typeof(Transform) && component.IsBoneTransform(previousValue.target as Transform)))
                    {
                        Debug.LogWarning((object)"Keyframing for humanoid rig is not supported!", (UnityEngine.Object)(previousValue.target as Transform));
                    }
                    else
                    {
                        AnimationMode.AddPropertyModification(binding, previousValue, modifications[index1].keepPrefabOverride);
                        EditorCurveBinding[] editorCurveBindingArray = RotationCurveInterpolation.RemapAnimationBindingForAddKey(binding, activeAnimationClip);
                        if (editorCurveBindingArray != null)
                        {
                            for (int index2 = 0; index2 < editorCurveBindingArray.Length; ++index2)
                            {
                                AnimationRecording.AddKey(state, editorCurveBindingArray[index2], editorCurveBinding, AnimationRecording.FindPropertyModification(activeRootGameObject, modifications, editorCurveBindingArray[index2]));
                            }
                        }
                        else
                        {
                            AnimationRecording.AddKey(state, binding, editorCurveBinding, previousValue);
                        }
                    }
                }
                else
                {
                    propertyModificationList.Add(modifications[index1]);
                }
            }
            return(propertyModificationList.ToArray());
        }
コード例 #4
0
        public static UndoPropertyModification[] Process(IAnimationRecordingState state, UndoPropertyModification[] modifications)
        {
            GameObject activeRootGameObject = state.activeRootGameObject;

            UndoPropertyModification[] result;
            if (activeRootGameObject == null)
            {
                result = modifications;
            }
            else if (!AnimationRecording.HasAnyRecordableModifications(activeRootGameObject, modifications))
            {
                result = modifications;
            }
            else
            {
                UndoPropertyModification[] first  = AnimationRecording.ProcessRotationModifications(state, ref modifications);
                UndoPropertyModification[] second = AnimationRecording.ProcessModifications(state, modifications);
                result = first.Concat(second).ToArray <UndoPropertyModification>();
            }
            return(result);
        }