Пример #1
0
        static UndoPropertyModification[] OnPostProcessModifications(UndoPropertyModification[] propertyModifications)
        {
            sceneIsDirty = true;

            string path = Main.GetProjectPath () + EditorApplication.currentScene;
            Main.OnSceneChanged (path);

            return propertyModifications;
        }
 private static void AddRotationPropertyModification(IAnimationRecordingState state, EditorCurveBinding baseBinding, UndoPropertyModification modification)
 {
     if (modification.previousValue != null)
     {
         EditorCurveBinding binding = baseBinding;
         binding.propertyName = modification.previousValue.propertyPath;
         AnimationMode.AddPropertyModification(binding, modification.previousValue, modification.keepPrefabOverride);
     }
 }
 private static bool HasAnyRecordableModifications(GameObject root, UndoPropertyModification[] modifications)
 {
   for (int index = 0; index < modifications.Length; ++index)
   {
     EditorCurveBinding binding;
     if ((modifications[index].currentValue == null || !(modifications[index].currentValue.target is Animator)) && AnimationUtility.PropertyModificationToEditorCurveBinding(modifications[index].previousValue, root, out binding) != null)
       return true;
   }
   return false;
 }
 private static UndoPropertyModification[] CreateUndoPropertyModifications(int count, Object target)
 {
     UndoPropertyModification[] modificationArray = new UndoPropertyModification[count];
     for (int i = 0; i < modificationArray.Length; i++)
     {
         modificationArray[i].previousValue = new PropertyModification();
         modificationArray[i].previousValue.target = target;
     }
     return modificationArray;
 }
		private static UndoPropertyModification[] CreateUndoPropertyModifications(int count, UnityEngine.Object target)
		{
			UndoPropertyModification[] array = new UndoPropertyModification[count];
			for (int i = 0; i < array.Length; i++)
			{
				array[i].propertyModification = new PropertyModification();
				array[i].propertyModification.target = target;
			}
			return array;
		}
 private static UndoPropertyModification[] CreateUndoPropertyModifications(int count, Object target)
 {
   UndoPropertyModification[] propertyModificationArray = new UndoPropertyModification[count];
   for (int index = 0; index < propertyModificationArray.Length; ++index)
   {
     propertyModificationArray[index].previousValue = new PropertyModification();
     propertyModificationArray[index].previousValue.target = target;
   }
   return propertyModificationArray;
 }
Пример #7
0
 private static bool HasAnyRecordableModifications(GameObject root, UndoPropertyModification[] modifications)
 {
     for (int i = 0; i < modifications.Length; i++)
     {
         EditorCurveBinding binding;
         if (!(modifications[i].currentValue.target is Animator) && (AnimationUtility.PropertyModificationToEditorCurveBinding(modifications[i].previousValue, root, out binding) != null))
         {
             return true;
         }
     }
     return false;
 }
		private static bool HasAnyRecordableModifications(GameObject root, UndoPropertyModification[] modifications)
		{
			for (int i = 0; i < modifications.Length; i++)
			{
				EditorCurveBinding editorCurveBinding;
				if (AnimationUtility.PropertyModificationToEditorCurveBinding(modifications[i].propertyModification, root, out editorCurveBinding) != null)
				{
					return true;
				}
			}
			return false;
		}
		private static PropertyModification FindPropertyModification(GameObject root, UndoPropertyModification[] modifications, EditorCurveBinding binding)
		{
			for (int i = 0; i < modifications.Length; i++)
			{
				EditorCurveBinding lhs;
				AnimationUtility.PropertyModificationToEditorCurveBinding(modifications[i].propertyModification, root, out lhs);
				if (lhs == binding)
				{
					return modifications[i].propertyModification;
				}
			}
			return null;
		}
 private static PropertyModification FindPropertyModification(GameObject root, UndoPropertyModification[] modifications, EditorCurveBinding binding)
 {
   for (int index = 0; index < modifications.Length; ++index)
   {
     if (modifications[index].currentValue == null || !(modifications[index].currentValue.target is Animator))
     {
       EditorCurveBinding binding1;
       AnimationUtility.PropertyModificationToEditorCurveBinding(modifications[index].previousValue, root, out binding1);
       if (binding1 == binding)
         return modifications[index].previousValue;
     }
   }
   return (PropertyModification) null;
 }
 private static void CollectRotationModifications(AnimationWindowState state, ref UndoPropertyModification[] modifications, ref Dictionary<object, AnimationRecording.RotationModification> rotationModifications)
 {
   List<UndoPropertyModification> propertyModificationList = new List<UndoPropertyModification>();
   foreach (UndoPropertyModification propertyModification in modifications)
   {
     EditorCurveBinding binding = new EditorCurveBinding();
     PropertyModification previousValue = propertyModification.previousValue;
     AnimationUtility.PropertyModificationToEditorCurveBinding(previousValue, state.activeRootGameObject, out binding);
     if (binding.propertyName.StartsWith("m_LocalRotation"))
     {
       AnimationRecording.RotationModification rotationModification;
       if (!rotationModifications.TryGetValue((object) previousValue.target, out rotationModification))
       {
         rotationModification = new AnimationRecording.RotationModification();
         rotationModifications[(object) previousValue.target] = rotationModification;
       }
       if (binding.propertyName.EndsWith("x"))
         rotationModification.x = propertyModification;
       else if (binding.propertyName.EndsWith("y"))
         rotationModification.y = propertyModification;
       else if (binding.propertyName.EndsWith("z"))
         rotationModification.z = propertyModification;
       else if (binding.propertyName.EndsWith("w"))
         rotationModification.w = propertyModification;
       rotationModification.lastQuatModification = propertyModification;
     }
     else if (previousValue.propertyPath.StartsWith("m_LocalEulerAnglesHint"))
     {
       AnimationRecording.RotationModification rotationModification;
       if (!rotationModifications.TryGetValue((object) previousValue.target, out rotationModification))
       {
         rotationModification = new AnimationRecording.RotationModification();
         rotationModifications[(object) previousValue.target] = rotationModification;
       }
       if (previousValue.propertyPath.EndsWith("x"))
         rotationModification.eulerX = propertyModification;
       else if (previousValue.propertyPath.EndsWith("y"))
         rotationModification.eulerY = propertyModification;
       else if (previousValue.propertyPath.EndsWith("z"))
         rotationModification.eulerZ = propertyModification;
     }
     else
       propertyModificationList.Add(propertyModification);
   }
   if (propertyModificationList.Count <= 0)
     return;
   modifications = propertyModificationList.ToArray();
 }
Пример #12
0
 private static PropertyModification FindPropertyModification(GameObject root, UndoPropertyModification[] modifications, EditorCurveBinding binding)
 {
     for (int i = 0; i < modifications.Length; i++)
     {
         if (!(modifications[i].currentValue.target is Animator))
         {
             EditorCurveBinding binding2;
             AnimationUtility.PropertyModificationToEditorCurveBinding(modifications[i].previousValue, root, out binding2);
             if (binding2 == binding)
             {
                 return modifications[i].previousValue;
             }
         }
     }
     return null;
 }
		public static UndoPropertyModification[] Process(AnimationWindowState state, UndoPropertyModification[] modifications)
		{
			GameObject rootGameObject = state.m_RootGameObject;
			AnimationClip activeAnimationClip = state.m_ActiveAnimationClip;
			Animator component = rootGameObject.GetComponent<Animator>();
			if (!AnimationRecording.HasAnyRecordableModifications(rootGameObject, modifications))
			{
				return modifications;
			}
			List<UndoPropertyModification> list = new List<UndoPropertyModification>();
			for (int i = 0; i < modifications.Length; i++)
			{
				EditorCurveBinding binding = default(EditorCurveBinding);
				PropertyModification propertyModification = modifications[i].propertyModification;
				Type type = AnimationUtility.PropertyModificationToEditorCurveBinding(propertyModification, rootGameObject, out binding);
				if (type != null)
				{
					if (component != null && component.isHuman && binding.type == typeof(Transform) && component.IsBoneTransform(propertyModification.target as Transform))
					{
						Debug.LogWarning("Keyframing for humanoid rig is not supported!", propertyModification.target as Transform);
					}
					else
					{
						AnimationMode.AddPropertyModification(binding, propertyModification, 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(rootGameObject, modifications, array[j]));
							}
						}
						else
						{
							AnimationRecording.AddKey(state, binding, type, propertyModification);
						}
					}
				}
				else
				{
					list.Add(modifications[i]);
				}
			}
			return list.ToArray();
		}
Пример #14
0
 public static UndoPropertyModification[] Process(AnimationWindowState state, UndoPropertyModification[] modifications)
 {
     GameObject activeRootGameObject = state.activeRootGameObject;
     AnimationClip activeAnimationClip = state.activeAnimationClip;
     Animator component = activeRootGameObject.GetComponent<Animator>();
     if (!HasAnyRecordableModifications(activeRootGameObject, modifications))
     {
         return modifications;
     }
     List<UndoPropertyModification> list = new List<UndoPropertyModification>();
     for (int i = 0; i < modifications.Length; i++)
     {
         EditorCurveBinding binding = new EditorCurveBinding();
         PropertyModification previousValue = modifications[i].previousValue;
         System.Type type = AnimationUtility.PropertyModificationToEditorCurveBinding(previousValue, activeRootGameObject, out binding);
         if ((type != null) && (type != typeof(Animator)))
         {
             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[] bindingArray = RotationCurveInterpolation.RemapAnimationBindingForAddKey(binding, activeAnimationClip);
                 if (bindingArray != null)
                 {
                     for (int j = 0; j < bindingArray.Length; j++)
                     {
                         AddKey(state, bindingArray[j], type, FindPropertyModification(activeRootGameObject, modifications, bindingArray[j]));
                     }
                 }
                 else
                 {
                     AddKey(state, binding, type, previousValue);
                 }
             }
         }
         else
         {
             list.Add(modifications[i]);
         }
     }
     return list.ToArray();
 }
	/// <summary>
	/// Raises the perform undoable action event. Invoked when inspector is modified or context menu item is
	/// selected (e.g., Revert Value to Prefab, Set to Value of).
	/// </summary>
	/// <param name="modifications">Information about what properties were modified by the action.</param>
	private static UndoPropertyModification[] OnPerformUndoableAction(UndoPropertyModification[] modifications)
	{
		HashSet<HashableSerializedProperty> propertyModifications = new HashSet<HashableSerializedProperty>(
#if UNITY_4_6 || UNITY_5_0
			(from mod in modifications select new HashableSerializedProperty(mod.propertyModification)).Where(
#else
			(from mod in modifications select new HashableSerializedProperty(mod.currentValue)).Where(
#endif
				mod => mod.SerializedProperty != null
			)
		);
		// add all upstream properties so parent setters are called
		foreach (HashableSerializedProperty modification in propertyModifications.ToArray())
		{
			foreach (HashableSerializedProperty upstreamProperty in GetUpstreamProperties(modification))
			{
				propertyModifications.Add(upstreamProperty);
			}
		}
		// trigger setters for all modified properties
		TriggerSettersForKnownModifications(propertyModifications);
		return modifications;
	}
 private static void SetupPropertyModification(string name, float value, UndoPropertyModification prop)
 {
     prop.previousValue.propertyPath = "material." + name;
     prop.previousValue.value = value.ToString();
 }
 private static void ProcessRotationModifications(IAnimationRecordingState state, ref UndoPropertyModification[] modifications)
 {
     Dictionary<object, RotationModification> rotationModifications = new Dictionary<object, RotationModification>();
     CollectRotationModifications(state, ref modifications, ref rotationModifications);
     foreach (KeyValuePair<object, RotationModification> pair in rotationModifications)
     {
         RotationModification modification = pair.Value;
         Transform key = pair.Key as Transform;
         if (key != null)
         {
             EditorCurveBinding binding = new EditorCurveBinding();
             Type type = AnimationUtility.PropertyModificationToEditorCurveBinding(modification.lastQuatModification.currentValue, state.activeRootGameObject, out binding);
             if (type != null)
             {
                 AddRotationPropertyModification(state, binding, modification.x);
                 AddRotationPropertyModification(state, binding, modification.y);
                 AddRotationPropertyModification(state, binding, modification.z);
                 AddRotationPropertyModification(state, binding, modification.w);
                 if (modification.useEuler)
                 {
                     object obj2;
                     object obj3;
                     object obj4;
                     AddRotationPropertyModification(state, binding, modification.eulerX);
                     AddRotationPropertyModification(state, binding, modification.eulerY);
                     AddRotationPropertyModification(state, binding, modification.eulerZ);
                     Vector3 localEulerAngles = key.GetLocalEulerAngles(RotationOrder.OrderZXY);
                     Vector3 currentEulerAngles = key.GetLocalEulerAngles(RotationOrder.OrderZXY);
                     if (ValueFromPropertyModification(modification.eulerX.previousValue, binding, out obj2))
                     {
                         localEulerAngles.x = (float) obj2;
                     }
                     if (ValueFromPropertyModification(modification.eulerY.previousValue, binding, out obj3))
                     {
                         localEulerAngles.y = (float) obj3;
                     }
                     if (ValueFromPropertyModification(modification.eulerZ.previousValue, binding, out obj4))
                     {
                         localEulerAngles.z = (float) obj4;
                     }
                     if (ValueFromPropertyModification(modification.eulerX.currentValue, binding, out obj2))
                     {
                         currentEulerAngles.x = (float) obj2;
                     }
                     if (ValueFromPropertyModification(modification.eulerY.currentValue, binding, out obj3))
                     {
                         currentEulerAngles.y = (float) obj3;
                     }
                     if (ValueFromPropertyModification(modification.eulerZ.currentValue, binding, out obj4))
                     {
                         currentEulerAngles.z = (float) obj4;
                     }
                     AddRotationKey(state, binding, type, localEulerAngles, currentEulerAngles);
                 }
                 else
                 {
                     object obj5;
                     object obj6;
                     object obj7;
                     object obj8;
                     Quaternion localRotation = key.localRotation;
                     Quaternion quaternion2 = key.localRotation;
                     if (ValueFromPropertyModification(modification.x.previousValue, binding, out obj5))
                     {
                         localRotation.x = (float) obj5;
                     }
                     if (ValueFromPropertyModification(modification.y.previousValue, binding, out obj6))
                     {
                         localRotation.y = (float) obj6;
                     }
                     if (ValueFromPropertyModification(modification.z.previousValue, binding, out obj7))
                     {
                         localRotation.z = (float) obj7;
                     }
                     if (ValueFromPropertyModification(modification.w.previousValue, binding, out obj8))
                     {
                         localRotation.w = (float) obj8;
                     }
                     if (ValueFromPropertyModification(modification.x.currentValue, binding, out obj5))
                     {
                         quaternion2.x = (float) obj5;
                     }
                     if (ValueFromPropertyModification(modification.y.currentValue, binding, out obj6))
                     {
                         quaternion2.y = (float) obj6;
                     }
                     if (ValueFromPropertyModification(modification.z.currentValue, binding, out obj7))
                     {
                         quaternion2.z = (float) obj7;
                     }
                     if (ValueFromPropertyModification(modification.w.currentValue, binding, out obj8))
                     {
                         quaternion2.w = (float) obj8;
                     }
                     AddRotationKey(state, binding, type, localRotation.eulerAngles, quaternion2.eulerAngles);
                 }
             }
         }
     }
 }
 private static void CollectRotationModifications(IAnimationRecordingState state, ref UndoPropertyModification[] modifications, ref Dictionary<object, RotationModification> rotationModifications)
 {
     List<UndoPropertyModification> list = new List<UndoPropertyModification>();
     foreach (UndoPropertyModification modification in modifications)
     {
         EditorCurveBinding binding = new EditorCurveBinding();
         PropertyModification previousValue = modification.previousValue;
         AnimationUtility.PropertyModificationToEditorCurveBinding(previousValue, state.activeRootGameObject, out binding);
         if (binding.propertyName.StartsWith("m_LocalRotation"))
         {
             RotationModification modification3;
             if (!rotationModifications.TryGetValue(previousValue.target, out modification3))
             {
                 modification3 = new RotationModification();
                 rotationModifications[previousValue.target] = modification3;
             }
             if (binding.propertyName.EndsWith("x"))
             {
                 modification3.x = modification;
             }
             else if (binding.propertyName.EndsWith("y"))
             {
                 modification3.y = modification;
             }
             else if (binding.propertyName.EndsWith("z"))
             {
                 modification3.z = modification;
             }
             else if (binding.propertyName.EndsWith("w"))
             {
                 modification3.w = modification;
             }
             modification3.lastQuatModification = modification;
         }
         else if (previousValue.propertyPath.StartsWith("m_LocalEulerAnglesHint"))
         {
             RotationModification modification4;
             if (!rotationModifications.TryGetValue(previousValue.target, out modification4))
             {
                 modification4 = new RotationModification();
                 rotationModifications[previousValue.target] = modification4;
             }
             modification4.useEuler = true;
             if (previousValue.propertyPath.EndsWith("x"))
             {
                 modification4.eulerX = modification;
             }
             else if (previousValue.propertyPath.EndsWith("y"))
             {
                 modification4.eulerY = modification;
             }
             else if (previousValue.propertyPath.EndsWith("z"))
             {
                 modification4.eulerZ = modification;
             }
         }
         else
         {
             list.Add(modification);
         }
     }
     if (rotationModifications.Count > 0)
     {
         modifications = list.ToArray();
     }
 }
 private static void ProcessRotationModifications(AnimationWindowState state, ref UndoPropertyModification[] modifications)
 {
   Dictionary<object, AnimationRecording.RotationModification> rotationModifications = new Dictionary<object, AnimationRecording.RotationModification>();
   AnimationRecording.CollectRotationModifications(state, ref modifications, ref rotationModifications);
   using (Dictionary<object, AnimationRecording.RotationModification>.Enumerator enumerator = rotationModifications.GetEnumerator())
   {
     while (enumerator.MoveNext())
     {
       AnimationRecording.RotationModification rotationModification = enumerator.Current.Value;
       EditorCurveBinding binding = new EditorCurveBinding();
       System.Type editorCurveBinding = AnimationUtility.PropertyModificationToEditorCurveBinding(rotationModification.lastQuatModification.currentValue, state.activeRootGameObject, out binding);
       Quaternion localRotation1 = state.activeRootGameObject.transform.localRotation;
       Quaternion localRotation2 = state.activeRootGameObject.transform.localRotation;
       object outObject1;
       if (AnimationRecording.ValueFromPropertyModification(rotationModification.x.previousValue, binding, out outObject1))
         localRotation1.x = (float) outObject1;
       object outObject2;
       if (AnimationRecording.ValueFromPropertyModification(rotationModification.y.previousValue, binding, out outObject2))
         localRotation1.y = (float) outObject2;
       object outObject3;
       if (AnimationRecording.ValueFromPropertyModification(rotationModification.z.previousValue, binding, out outObject3))
         localRotation1.z = (float) outObject3;
       object outObject4;
       if (AnimationRecording.ValueFromPropertyModification(rotationModification.w.previousValue, binding, out outObject4))
         localRotation1.w = (float) outObject4;
       if (AnimationRecording.ValueFromPropertyModification(rotationModification.x.currentValue, binding, out outObject1))
         localRotation2.x = (float) outObject1;
       if (AnimationRecording.ValueFromPropertyModification(rotationModification.y.currentValue, binding, out outObject2))
         localRotation2.y = (float) outObject2;
       if (AnimationRecording.ValueFromPropertyModification(rotationModification.z.currentValue, binding, out outObject3))
         localRotation2.z = (float) outObject3;
       if (AnimationRecording.ValueFromPropertyModification(rotationModification.w.currentValue, binding, out outObject4))
         localRotation2.w = (float) outObject4;
       Vector3 eulerAngles1 = localRotation1.eulerAngles;
       Vector3 eulerAngles2 = localRotation2.eulerAngles;
       object outObject5;
       if (AnimationRecording.ValueFromPropertyModification(rotationModification.eulerX.previousValue, binding, out outObject5))
         eulerAngles1.x = (float) outObject5;
       object outObject6;
       if (AnimationRecording.ValueFromPropertyModification(rotationModification.eulerY.previousValue, binding, out outObject6))
         eulerAngles1.y = (float) outObject6;
       object outObject7;
       if (AnimationRecording.ValueFromPropertyModification(rotationModification.eulerZ.previousValue, binding, out outObject7))
         eulerAngles1.z = (float) outObject7;
       if (AnimationRecording.ValueFromPropertyModification(rotationModification.eulerX.currentValue, binding, out outObject5))
         eulerAngles2.x = (float) outObject5;
       if (AnimationRecording.ValueFromPropertyModification(rotationModification.eulerY.currentValue, binding, out outObject6))
         eulerAngles2.y = (float) outObject6;
       if (AnimationRecording.ValueFromPropertyModification(rotationModification.eulerZ.currentValue, binding, out outObject7))
         eulerAngles2.z = (float) outObject7;
       AnimationRecording.AddRotationKey(state, binding, editorCurveBinding, eulerAngles1, eulerAngles2);
     }
   }
 }
Пример #20
0
        //                // Custom Gizmos, Create as many as you'd like
        //                [DrawGizmo(GizmoType.NotSelected | GizmoType.Selected)]
        //                private static void DrawGizmo (Transform aTarget, GizmoType aGizmoType)
        //                {
        //
        //                        if (__gameObjectClipList == null)
        //                                return;
        //
        //                        int gameObjectCount = __gameObjectClipList.count;
        //
        //                        Vector3[] gameObjectPositionsInTime = null;
        //                        Vector3 cubeSize = new Vector3 (0.1f, 0.1f, 0.1f);
        //                        AnimationClip clip = null;
        //                        Color clr = Color.green;
        //            
        //                        for (int i=0; i<gameObjectCount; i++) {
        //
        //                                clip = (__gameObjectClipList.list [i] as EditorClipBinding).clip;
        //
        //                                if (clip != null) {
        //                                        gameObjectPositionsInTime = AnimationUtilityEx.GetPositions (clip);
        //                
        //                                        clr = Gizmos.color;
        //            
        //
        //                                        Gizmos.color = Color.green;
        //
        //                                        for (int j=0; j<gameObjectPositionsInTime.Length; j++)
        //                                                Gizmos.DrawCube (gameObjectPositionsInTime [j], cubeSize);
        //
        //                                        Gizmos.color = clr;
        //
        //                                }
        //                        }
        //                }
        /// <summary>
        /// Postprocesses the animation recording and property modifications.
        /// </summary>
        /// <returns>The animation recording modifications.</returns>
        /// <param name="modifications">Modifications.</param>
        private static UndoPropertyModification[] PostprocessAnimationRecordingModifications(UndoPropertyModification[] modifications)
        {
            List<UndoPropertyModification> propertyModificationList = new List<UndoPropertyModification> ();
                        EditorClipBinding[] clipBindings = clipBindingsSerialized.value as EditorClipBinding[];

                        List<EditorClipBinding> list = clipBindings.ToList ();
                        list.Add (__mecanimNodeClipBinding);

                        list.ForEach ((itm) => {

                                if (itm.gameObject != null && itm.clip != null)
                                        propertyModificationList.Concat (AnimationModeUtility.Process (itm.gameObject, itm.clip, modifications, __timeCurrent));

                        });

                        return propertyModificationList.ToArray ();
        }
Пример #21
0
 private UndoPropertyModification[] PostprocessAnimationRecordingModifications(UndoPropertyModification[] modifications)
 {
     return AnimationModeUtility.Process (animatedObject, clip, modifications, timeCurrent).Concat (AnimationModeUtility.Process (animatedObject1, clip1, modifications, timeCurrent)).ToArray ();
 }
 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();
 }
Пример #23
0
		private UndoPropertyModification[] PostprocessAnimationRecordingModifications(UndoPropertyModification[] modifications)
		{
			return AnimationRecording.Process(this.state, modifications);
		}
Пример #24
0
 private static UndoPropertyModification[] PostProcessModifications(UndoPropertyModification[] propertyModifications) {
   EditorApplicationUtil.SceneDirtied();
   return propertyModifications;
 }
    private UndoPropertyModification[] OnUndoRedoEvent(UndoPropertyModification[] modifications)
    {
        /*
        //Debug.Log("Undo Event Registered in SDF Material Editor. # of Properties affected is " + modifications.Length);
        
        PropertyModification modifiedProperties = modifications[0].propertyModification;
        System.Type objType = modifiedProperties.target.GetType();

        if (objType == typeof(MeshRenderer) || objType == typeof(Material)) // && UndoEventID != LastUndoEventID)
        {
            
            //Debug.Log("OnUndoRedoEvent() received in Material Editor."); // Event ID:" + UndoEventID + ".  Target ID: " + m_modifiedProperties.target.GetInstanceID() + "  Current Material: " + m_modifiedProperties.objectReference + "  New Material: " + (m_modifiedProperties.target as Renderer).sharedMaterial);
            TMPro_EventManager.ON_MATERIAL_PROPERTY_CHANGED(true, target as Material);
        }

        if (target != null)
            EditorUtility.SetDirty(target);

        */
        return modifications;
    }
Пример #26
0
        /// <summary>
        /// Postprocesses the animation recording and property modifications.
        /// </summary>
        /// <returns>The animation recording modifications.</returns>
        /// <param name="modifications">Modifications.</param>
        private static UndoPropertyModification[] PostprocessAnimationRecordingModifications(UndoPropertyModification[] modifications)
        {
            SequenceNode node = __sequence.selectedNode;

                        if (node != null && node.channel.target != null && node.channel.type == SequenceChannel.SequenceChannelType.Animation) {

                                modifications.Concat (AnimationModeUtility.Process (node.channel.target, node.source as AnimationClip, modifications, (float)(__sequence.timeCurrent - node.startTime)));

                        }

                        return modifications;
        }