public void RemoveCurve(PropertyModification[] modifications) { EditorCurveBinding[] array = AnimationWindowUtility.PropertyModificationsToEditorCurveBindings(modifications, this.state.activeRootGameObject, this.state.activeAnimationClip); if (array.Length != 0) { this.BeginKeyModification(); Undo.RegisterCompleteObjectUndo(this.state.activeAnimationClip, "Remove Curve"); for (int i = 0; i < array.Length; i++) { EditorCurveBinding binding = array[i]; if (binding.isPPtrCurve) { AnimationUtility.SetObjectReferenceCurve(this.state.activeAnimationClip, binding, null); } else { AnimationUtility.SetEditorCurve(this.state.activeAnimationClip, binding, null); } } this.EndKeyModification(); this.RemoveFromCandidates(modifications); this.ResampleAnimation(); this.state.Repaint(); } }
private List <AnimationWindowKeyframe> GetKeys(PropertyModification[] modifications) { List <AnimationWindowKeyframe> list = new List <AnimationWindowKeyframe>(); EditorCurveBinding[] array = AnimationWindowUtility.PropertyModificationsToEditorCurveBindings(modifications, this.state.activeRootGameObject, this.state.activeAnimationClip); List <AnimationWindowKeyframe> result; if (array.Length == 0) { result = list; } else { for (int i = 0; i < this.state.allCurves.Count; i++) { AnimationWindowCurve curve = this.state.allCurves[i]; if (Array.Exists <EditorCurveBinding>(array, (EditorCurveBinding binding) => curve.binding.Equals(binding))) { int keyframeIndex = curve.GetKeyframeIndex(this.state.time); if (keyframeIndex >= 0) { list.Add(curve.m_Keyframes[keyframeIndex]); } } } result = list; } return(result); }
public bool CurveExists(PropertyModification[] modifications) { EditorCurveBinding[] array = AnimationWindowUtility.PropertyModificationsToEditorCurveBindings(modifications, this.state.activeRootGameObject, this.state.activeAnimationClip); bool result; if (array.Length == 0) { result = false; } else { EditorCurveBinding[] clipBindings = AnimationUtility.GetCurveBindings(this.state.activeAnimationClip); if (clipBindings.Length == 0) { result = false; } else if (Array.Exists <EditorCurveBinding>(array, (EditorCurveBinding binding) => Array.Exists <EditorCurveBinding>(clipBindings, (EditorCurveBinding clipBinding) => clipBinding.Equals(binding)))) { result = true; } else { EditorCurveBinding[] objectReferenceCurveBindings = AnimationUtility.GetObjectReferenceCurveBindings(this.state.activeAnimationClip); result = (objectReferenceCurveBindings.Length != 0 && Array.Exists <EditorCurveBinding>(objectReferenceCurveBindings, (EditorCurveBinding binding) => Array.Exists <EditorCurveBinding>(clipBindings, (EditorCurveBinding clipBinding) => clipBinding.Equals(binding)))); } } return(result); }
private List <AnimationWindowKeyframe> GetKeys(PropertyModification[] modifications) { var keys = new List <AnimationWindowKeyframe>(); EditorCurveBinding[] bindings = AnimationWindowUtility.PropertyModificationsToEditorCurveBindings(modifications, state.activeRootGameObject, state.activeAnimationClip); if (bindings.Length == 0) { return(keys); } for (int i = 0; i < state.allCurves.Count; ++i) { AnimationWindowCurve curve = state.allCurves[i]; if (Array.Exists(bindings, binding => curve.binding.Equals(binding))) { int keyIndex = curve.GetKeyframeIndex(state.time); if (keyIndex >= 0) { keys.Add(curve.m_Keyframes[keyIndex]); } } } return(keys); }
private void RemoveFromCandidates(PropertyModification[] modifications) { if (!(this.m_CandidateClip == null)) { EditorCurveBinding[] array = AnimationWindowUtility.PropertyModificationsToEditorCurveBindings(modifications, this.state.activeRootGameObject, this.m_CandidateClip); if (array.Length != 0) { Undo.RegisterCompleteObjectUndo(this.m_CandidateClip, "Edit Candidate Curve"); for (int i = 0; i < array.Length; i++) { EditorCurveBinding binding = array[i]; if (binding.isPPtrCurve) { AnimationUtility.SetObjectReferenceCurve(this.m_CandidateClip, binding, null); } else { AnimationUtility.SetEditorCurve(this.m_CandidateClip, binding, null); } } if (AnimationUtility.GetCurveBindings(this.m_CandidateClip).Length == 0 && AnimationUtility.GetObjectReferenceCurveBindings(this.m_CandidateClip).Length == 0) { this.ClearCandidates(); } } } }
private void RemoveFromCandidates(PropertyModification[] modifications) { EditorCurveBinding[] bindings = AnimationWindowUtility.PropertyModificationsToEditorCurveBindings(modifications, state.activeRootGameObject, m_CandidateClip); if (bindings.Length == 0) { return; } // Remove entry from candidate clip. Undo.RegisterCompleteObjectUndo(m_CandidateClip, "Edit Candidate Curve"); for (int i = 0; i < bindings.Length; ++i) { EditorCurveBinding binding = bindings[i]; if (binding.isPPtrCurve) { AnimationUtility.SetObjectReferenceCurve(m_CandidateClip, binding, null); } else { AnimationUtility.SetEditorCurve(m_CandidateClip, binding, null); } } // Clear out candidate clip if it's empty. if (AnimationUtility.GetCurveBindings(m_CandidateClip).Length == 0 && AnimationUtility.GetObjectReferenceCurveBindings(m_CandidateClip).Length == 0) { ClearCandidates(); } }
public void GoToNextKeyframe(PropertyModification[] modifications) { EditorCurveBinding[] bindings = AnimationWindowUtility.PropertyModificationsToEditorCurveBindings(modifications, state.activeRootGameObject, state.activeAnimationClip); if (bindings.Length == 0) { return; } List <AnimationWindowCurve> curves = new List <AnimationWindowCurve>(); for (int i = 0; i < state.allCurves.Count; ++i) { AnimationWindowCurve curve = state.allCurves[i]; if (Array.Exists(bindings, binding => curve.binding.Equals(binding))) { curves.Add(curve); } } float newTime = AnimationWindowUtility.GetNextKeyframeTime(curves.ToArray(), time.time, state.clipFrameRate); SetCurrentTime(state.SnapToFrame(newTime, AnimationWindowState.SnapMode.SnapToClipFrame)); state.Repaint(); }
public void RemoveCurve(PropertyModification[] modifications) { EditorCurveBinding[] bindings = AnimationWindowUtility.PropertyModificationsToEditorCurveBindings(modifications, state.activeRootGameObject, state.activeAnimationClip); if (bindings.Length == 0) { return; } BeginKeyModification(); Undo.RegisterCompleteObjectUndo(state.activeAnimationClip, "Remove Curve"); for (int i = 0; i < bindings.Length; ++i) { EditorCurveBinding binding = bindings[i]; if (binding.isPPtrCurve) { AnimationUtility.SetObjectReferenceCurve(state.activeAnimationClip, binding, null); } else { AnimationUtility.SetEditorCurve(state.activeAnimationClip, binding, null); } } EndKeyModification(); RemoveFromCandidates(modifications); ResampleAnimation(); state.Repaint(); }
public bool CurveExists(PropertyModification[] modifications) { EditorCurveBinding[] bindings = AnimationWindowUtility.PropertyModificationsToEditorCurveBindings(modifications, state.activeRootGameObject, state.activeAnimationClip); if (bindings.Length == 0) { return(false); } EditorCurveBinding[] clipBindings = AnimationUtility.GetCurveBindings(state.activeAnimationClip); if (clipBindings.Length == 0) { return(false); } if (Array.Exists(bindings, binding => Array.Exists(clipBindings, clipBinding => clipBinding.Equals(binding)))) { return(true); } EditorCurveBinding[] objectCurveBindings = AnimationUtility.GetObjectReferenceCurveBindings(state.activeAnimationClip); if (objectCurveBindings.Length == 0) { return(false); } return(Array.Exists(objectCurveBindings, binding => Array.Exists(clipBindings, clipBinding => clipBinding.Equals(binding)))); }
public void GoToNextKeyframe(PropertyModification[] modifications) { EditorCurveBinding[] array = AnimationWindowUtility.PropertyModificationsToEditorCurveBindings(modifications, this.state.activeRootGameObject, this.state.activeAnimationClip); if (array.Length != 0) { List <AnimationWindowCurve> list = new List <AnimationWindowCurve>(); for (int i = 0; i < this.state.allCurves.Count; i++) { AnimationWindowCurve curve = this.state.allCurves[i]; if (Array.Exists <EditorCurveBinding>(array, (EditorCurveBinding binding) => curve.binding.Equals(binding))) { list.Add(curve); } } float nextKeyframeTime = AnimationWindowUtility.GetNextKeyframeTime(list.ToArray(), this.time.time, this.state.clipFrameRate); this.SetCurrentTime(this.state.SnapToFrame(nextKeyframeTime, AnimationWindowState.SnapMode.SnapToClipFrame)); this.state.Repaint(); } }