private static void AddKey(AnimationWindowState state, EditorCurveBinding binding, System.Type type, PropertyModification modification) { GameObject activeRootGameObject = state.activeRootGameObject; AnimationClip activeAnimationClip = state.activeAnimationClip; if ((activeAnimationClip.hideFlags & HideFlags.NotEditable) != HideFlags.None) { return; } AnimationWindowCurve curve = new AnimationWindowCurve(activeAnimationClip, binding, type); object currentValue = CurveBindingUtility.GetCurrentValue(activeRootGameObject, binding); if (curve.length == 0) { object outObject = (object)null; if (!AnimationRecording.ValueFromPropertyModification(modification, binding, out outObject)) { outObject = currentValue; } if (state.frame != 0) { AnimationWindowUtility.AddKeyframeToCurve(curve, outObject, type, AnimationKeyTime.Frame(0, activeAnimationClip.frameRate)); } } AnimationWindowUtility.AddKeyframeToCurve(curve, currentValue, type, AnimationKeyTime.Frame(state.frame, activeAnimationClip.frameRate)); state.SaveCurve(curve); }
public static AnimationWindowKeyframe AddKeyframeToCurve(AnimationWindowState state, AnimationWindowCurve curve, AnimationKeyTime time) { object currentValue = CurveBindingUtility.GetCurrentValue(state.activeRootGameObject, curve.binding); System.Type editorCurveValueType = CurveBindingUtility.GetEditorCurveValueType(state.activeRootGameObject, curve.binding); AnimationWindowKeyframe keyframe = AddKeyframeToCurve(curve, currentValue, editorCurveValueType, time); state.SaveCurve(curve); return keyframe; }
public static void CreateDefaultCurves(AnimationWindowState state, EditorCurveBinding[] properties) { AnimationClip activeAnimationClip = state.activeAnimationClip; GameObject activeRootGameObject = state.activeRootGameObject; properties = RotationCurveInterpolation.ConvertRotationPropertiesToDefaultInterpolation(state.activeAnimationClip, properties); foreach (EditorCurveBinding property in properties) state.SaveCurve(AnimationWindowUtility.CreateDefaultCurve(activeAnimationClip, activeRootGameObject, property)); }
public static AnimationWindowKeyframe AddKeyframeToCurve(AnimationWindowState state, AnimationWindowCurve curve, AnimationKeyTime time) { object currentValue = AnimationWindowUtility.GetCurrentValue(state.m_RootGameObject, curve.binding); Type editorCurveValueType = AnimationUtility.GetEditorCurveValueType(state.m_RootGameObject, curve.binding); AnimationWindowKeyframe result = AnimationWindowUtility.AddKeyframeToCurve(curve, currentValue, editorCurveValueType, time); state.SaveCurve(curve); return(result); }
public static AnimationWindowKeyframe AddKeyframeToCurve(AnimationWindowState state, AnimationWindowCurve curve, AnimationKeyTime time) { object currentValue = CurveBindingUtility.GetCurrentValue(state.activeRootGameObject, curve.binding); Type editorCurveValueType = CurveBindingUtility.GetEditorCurveValueType(state.activeRootGameObject, curve.binding); AnimationWindowKeyframe keyframe = AddKeyframeToCurve(curve, currentValue, editorCurveValueType, time); state.SaveCurve(curve); return(keyframe); }
public static void CreateDefaultCurves(AnimationWindowState state, EditorCurveBinding[] properties) { AnimationClip activeAnimationClip = state.activeAnimationClip; GameObject activeRootGameObject = state.activeRootGameObject; properties = RotationCurveInterpolation.ConvertRotationPropertiesToDefaultInterpolation(state.activeAnimationClip, properties); foreach (EditorCurveBinding property in properties) { state.SaveCurve(AnimationWindowUtility.CreateDefaultCurve(activeAnimationClip, activeRootGameObject, property)); } }
public static void CreateDefaultCurves(AnimationWindowState state, EditorCurveBinding[] properties) { AnimationClip activeAnimationClip = state.m_ActiveAnimationClip; GameObject rootGameObject = state.m_RootGameObject; properties = RotationCurveInterpolation.ConvertRotationPropertiesToDefaultInterpolation(state.m_ActiveAnimationClip, properties); EditorCurveBinding[] array = properties; for (int i = 0; i < array.Length; i++) { EditorCurveBinding binding = array[i]; state.SaveCurve(AnimationWindowUtility.CreateDefaultCurve(activeAnimationClip, rootGameObject, binding)); } }
public static void RemoveKeyframes(AnimationWindowState state, AnimationWindowCurve[] curves, AnimationKeyTime time) { string undoLabel = "Remove Key"; state.SaveKeySelection(undoLabel); for (int i = 0; i < curves.Length; i++) { AnimationWindowCurve animationWindowCurve = curves[i]; if (animationWindowCurve.animationIsEditable) { AnimationKeyTime time2 = AnimationKeyTime.Time(time.time - animationWindowCurve.timeOffset, time.frameRate); animationWindowCurve.RemoveKeyframe(time2); state.SaveCurve(animationWindowCurve, undoLabel); } } }
public static void AddKeyframes(AnimationWindowState state, AnimationWindowCurve[] curves, AnimationKeyTime time) { string undoLabel = "Add Key"; state.SaveKeySelection(undoLabel); state.ClearKeySelections(); foreach (AnimationWindowCurve curve in curves) { if (curve.animationIsEditable) { AnimationKeyTime time2 = AnimationKeyTime.Time(time.time - curve.timeOffset, time.frameRate); object currentValue = CurveBindingUtility.GetCurrentValue(state, curve); AnimationWindowKeyframe keyframe = AddKeyframeToCurve(curve, currentValue, curve.valueType, time2); state.SaveCurve(curve, undoLabel); state.SelectKey(keyframe); } } }
public static void AddKeyframes(AnimationWindowState state, AnimationWindowCurve[] curves, AnimationKeyTime time) { string undoLabel = "Add Key"; state.SaveKeySelection(undoLabel); state.ClearKeySelections(); for (int i = 0; i < curves.Length; i++) { AnimationWindowCurve animationWindowCurve = curves[i]; if (animationWindowCurve.animationIsEditable) { AnimationKeyTime time2 = AnimationKeyTime.Time(time.time - animationWindowCurve.timeOffset, time.frameRate); object currentValue = CurveBindingUtility.GetCurrentValue(state, animationWindowCurve); AnimationWindowKeyframe keyframe = AnimationWindowUtility.AddKeyframeToCurve(animationWindowCurve, currentValue, animationWindowCurve.valueType, time2); state.SaveCurve(animationWindowCurve, undoLabel); state.SelectKey(keyframe); } } }
private static void AddKey(AnimationWindowState state, EditorCurveBinding binding, Type type, PropertyModification modification) { GameObject rootGameObject = state.m_RootGameObject; AnimationClip activeAnimationClip = state.m_ActiveAnimationClip; AnimationWindowCurve animationWindowCurve = new AnimationWindowCurve(activeAnimationClip, binding, type); object currentValue = AnimationWindowUtility.GetCurrentValue(rootGameObject, binding); object value = null; if (animationWindowCurve.length == 0 && state.m_Frame != 0) { if (!AnimationRecording.ValueFromPropertyModification(modification, binding, out value)) { value = currentValue; } AnimationWindowUtility.AddKeyframeToCurve(animationWindowCurve, value, type, AnimationKeyTime.Frame(0, activeAnimationClip.frameRate)); } AnimationWindowUtility.AddKeyframeToCurve(animationWindowCurve, currentValue, type, AnimationKeyTime.Frame(state.m_Frame, activeAnimationClip.frameRate)); state.SaveCurve(animationWindowCurve); }
private static void AddRotationKey(AnimationWindowState state, EditorCurveBinding binding, System.Type type, Vector3 previousEulerAngles, Vector3 currentEulerAngles) { AnimationClip activeAnimationClip = state.activeAnimationClip; if ((activeAnimationClip.hideFlags & HideFlags.NotEditable) != HideFlags.None) { return; } EditorCurveBinding[] editorCurveBindingArray = RotationCurveInterpolation.RemapAnimationBindingForRotationAddKey(binding, activeAnimationClip); for (int index = 0; index < 3; ++index) { AnimationWindowCurve curve = new AnimationWindowCurve(activeAnimationClip, editorCurveBindingArray[index], type); if (curve.length == 0 && state.frame != 0) { AnimationWindowUtility.AddKeyframeToCurve(curve, (object)previousEulerAngles[index], type, AnimationKeyTime.Frame(0, activeAnimationClip.frameRate)); } AnimationWindowUtility.AddKeyframeToCurve(curve, (object)currentEulerAngles[index], type, AnimationKeyTime.Frame(state.frame, activeAnimationClip.frameRate)); state.SaveCurve(curve); } }
private static void AddKey(AnimationWindowState state, EditorCurveBinding binding, System.Type type, PropertyModification modification) { GameObject activeRootGameObject = state.activeRootGameObject; AnimationClip activeAnimationClip = state.activeAnimationClip; AnimationWindowCurve curve = new AnimationWindowCurve(activeAnimationClip, binding, type); object currentValue = CurveBindingUtility.GetCurrentValue(activeRootGameObject, binding); if (curve.length == 0) { object outObject = null; if (!ValueFromPropertyModification(modification, binding, out outObject)) { outObject = currentValue; } if (state.frame != 0) { AnimationWindowUtility.AddKeyframeToCurve(curve, outObject, type, AnimationKeyTime.Frame(0, activeAnimationClip.frameRate)); } } AnimationWindowUtility.AddKeyframeToCurve(curve, currentValue, type, AnimationKeyTime.Frame(state.frame, activeAnimationClip.frameRate)); state.SaveCurve(curve); }
public void OnGUI(AnimationWindowState state, AnimationWindowKeyframe keyframe) { if (keyframe.isPPtrCurve) return; this.backgroundRect = this.position; this.backgroundRect.x = state.TimeToPixel(keyframe.time) + this.position.x - (float) (DopeSheetEditor.DopeSheetPopup.s_width / 2); this.backgroundRect.y += 16f; this.backgroundRect.width = (float) DopeSheetEditor.DopeSheetPopup.s_width; this.backgroundRect.height = (float) DopeSheetEditor.DopeSheetPopup.s_height; Rect backgroundRect1 = this.backgroundRect; backgroundRect1.height = 16f; Rect backgroundRect2 = this.backgroundRect; backgroundRect2.y += 16f; backgroundRect2.height = (float) DopeSheetEditor.DopeSheetPopup.s_width; GUI.Box(this.backgroundRect, string.Empty); GUI.Box(backgroundRect2, (Texture) AssetPreview.GetAssetPreview((UnityEngine.Object) keyframe.value)); EditorGUI.BeginChangeCheck(); UnityEngine.Object @object = EditorGUI.ObjectField(backgroundRect1, (UnityEngine.Object) keyframe.value, keyframe.curve.m_ValueType, false); if (!EditorGUI.EndChangeCheck()) return; keyframe.value = (object) @object; state.SaveCurve(keyframe.curve); }
public static AnimationWindowKeyframe AddKeyframeToCurve(AnimationWindowState state, AnimationWindowCurve curve, AnimationKeyTime time) { object currentValue = AnimationWindowUtility.GetCurrentValue(state.m_RootGameObject, curve.binding); Type editorCurveValueType = AnimationUtility.GetEditorCurveValueType(state.m_RootGameObject, curve.binding); AnimationWindowKeyframe result = AnimationWindowUtility.AddKeyframeToCurve(curve, currentValue, editorCurveValueType, time); state.SaveCurve(curve); return result; }
private static void AddKey(AnimationWindowState state, EditorCurveBinding binding, System.Type type, PropertyModification modification) { GameObject activeRootGameObject = state.activeRootGameObject; AnimationClip activeAnimationClip = state.activeAnimationClip; if ((activeAnimationClip.hideFlags & HideFlags.NotEditable) != HideFlags.None) return; AnimationWindowCurve curve = new AnimationWindowCurve(activeAnimationClip, binding, type); object currentValue = CurveBindingUtility.GetCurrentValue(activeRootGameObject, binding); if (curve.length == 0) { object outObject = (object) null; if (!AnimationRecording.ValueFromPropertyModification(modification, binding, out outObject)) outObject = currentValue; if (state.frame != 0) AnimationWindowUtility.AddKeyframeToCurve(curve, outObject, type, AnimationKeyTime.Frame(0, activeAnimationClip.frameRate)); } AnimationWindowUtility.AddKeyframeToCurve(curve, currentValue, type, AnimationKeyTime.Frame(state.frame, activeAnimationClip.frameRate)); state.SaveCurve(curve); }
private static void AddRotationKey(AnimationWindowState state, EditorCurveBinding binding, System.Type type, Vector3 previousEulerAngles, Vector3 currentEulerAngles) { AnimationClip activeAnimationClip = state.activeAnimationClip; if ((activeAnimationClip.hideFlags & HideFlags.NotEditable) != HideFlags.None) return; EditorCurveBinding[] editorCurveBindingArray = RotationCurveInterpolation.RemapAnimationBindingForRotationAddKey(binding, activeAnimationClip); for (int index = 0; index < 3; ++index) { AnimationWindowCurve curve = new AnimationWindowCurve(activeAnimationClip, editorCurveBindingArray[index], type); if (curve.length == 0 && state.frame != 0) AnimationWindowUtility.AddKeyframeToCurve(curve, (object) previousEulerAngles[index], type, AnimationKeyTime.Frame(0, activeAnimationClip.frameRate)); AnimationWindowUtility.AddKeyframeToCurve(curve, (object) currentEulerAngles[index], type, AnimationKeyTime.Frame(state.frame, activeAnimationClip.frameRate)); state.SaveCurve(curve); } }
public void SaveCurve(AnimationWindowCurve curve) { m_State.SaveCurve(curve.clip, curve); }