public AnimationWindowKeyframe(AnimationWindowKeyframe key) { this.time = key.time; this.value = key.value; this.curve = key.curve; this.m_InTangent = key.m_InTangent; this.m_OutTangent = key.m_OutTangent; this.m_TangentMode = key.m_TangentMode; }
public static AnimationWindowKeyframe AddKeyframeToCurve(AnimationWindowCurve curve, object value, System.Type type, AnimationKeyTime time) { AnimationWindowKeyframe keyframe = curve.FindKeyAtTime(time); if (keyframe != null) { keyframe.value = value; return keyframe; } AnimationWindowKeyframe key = new AnimationWindowKeyframe { time = time.time }; if (curve.isPPtrCurve) { key.value = value; key.curve = curve; curve.AddKeyframe(key, time); return key; } if ((type == typeof(bool)) || (type == typeof(float))) { AnimationCurve curve2 = curve.ToAnimationCurve(); Keyframe keyframe3 = new Keyframe(time.time, (float) value); if (type == typeof(bool)) { CurveUtility.SetKeyTangentMode(ref keyframe3, 0, TangentMode.Stepped); CurveUtility.SetKeyTangentMode(ref keyframe3, 1, TangentMode.Stepped); CurveUtility.SetKeyBroken(ref keyframe3, true); key.m_TangentMode = keyframe3.tangentMode; key.m_InTangent = float.PositiveInfinity; key.m_OutTangent = float.PositiveInfinity; } else { int keyIndex = curve2.AddKey(keyframe3); if (keyIndex != -1) { CurveUtility.SetKeyModeFromContext(curve2, keyIndex); Keyframe keyframe4 = curve2[keyIndex]; key.m_TangentMode = keyframe4.tangentMode; } } key.value = value; key.curve = curve; curve.AddKeyframe(key, time); } return key; }
public void UnselectKey(AnimationWindowKeyframe keyframe) { int hash = keyframe.GetHash(); if (this.selectedKeyHashes.Contains(hash)) { this.selectedKeyHashes.Remove(hash); } this.m_SelectedKeysCache = null; }
private void Refresh() { if (this.refresh == AnimationWindowState.RefreshType.Everything) { CurveRendererCache.ClearCurveRendererCache(); this.m_ActiveKeyframeCache = null; this.m_AllCurvesCache = null; this.m_ActiveCurvesCache = null; this.m_CurveEditorIsDirty = true; this.m_dopelinesCache = null; this.m_SelectedKeysCache = null; if (this.refresh == AnimationWindowState.RefreshType.Everything && this.m_HierarchyData != null) { this.m_HierarchyData.UpdateData(); } EditorCurveBinding? lastAddedCurveBinding = this.m_lastAddedCurveBinding; if (lastAddedCurveBinding.HasValue) { EditorCurveBinding? lastAddedCurveBinding2 = this.m_lastAddedCurveBinding; this.OnNewCurveAdded(lastAddedCurveBinding2.Value); } if (this.activeCurves.Count == 0 && this.dopelines.Count > 0) { this.SelectHierarchyItem(this.dopelines[0], false, false); } this.m_Refresh = AnimationWindowState.RefreshType.None; } else { if (this.refresh == AnimationWindowState.RefreshType.CurvesOnly) { this.m_ActiveKeyframeCache = null; this.m_ActiveCurvesCache = null; this.m_SelectedKeysCache = null; this.ReloadModifiedAnimationCurveCache(); this.ReloadModifiedDopelineCache(); CurveRendererCache.ClearCurveRendererCache(); this.m_CurveEditorIsDirty = true; this.m_Refresh = AnimationWindowState.RefreshType.None; this.m_ModifiedCurves.Clear(); } } }
public static CurveSelection AnimationWindowKeyframeToCurveSelection(AnimationWindowKeyframe keyframe, CurveEditor curveEditor) { foreach (CurveWrapper animationCurve in curveEditor.animationCurves) { if (animationCurve.binding == keyframe.curve.binding && keyframe.GetIndex() >= 0) return new CurveSelection(animationCurve.id, curveEditor, keyframe.GetIndex()); } return (CurveSelection) null; }
public bool KeyIsSelected(AnimationWindowKeyframe keyframe) { return this.selectedKeyHashes.Contains(keyframe.GetHash()); }
private float GetKeyframeOffset(DopeLine dopeline, AnimationWindowKeyframe keyframe) { return dopeline.isPptrDopeline && dopeline.tallMode && (keyframe == null || keyframe.value != null) ? -1f : -5.5f; }
private void DoValueField(Rect rect, AnimationWindowHierarchyNode node, int row) { bool flag = false; if (node is AnimationWindowHierarchyPropertyNode) { AnimationWindowCurve[] curves = node.curves; if (curves == null || curves.Length == 0) { return; } AnimationWindowCurve animationWindowCurve = curves[0]; object currentValue = CurveBindingUtility.GetCurrentValue(this.state, animationWindowCurve); if (currentValue is float) { float num = (float)currentValue; Rect position = new Rect(rect.xMax - 75f, rect.y, 50f, rect.height); if (Event.current.type == EventType.MouseMove && position.Contains(Event.current.mousePosition)) { AnimationWindowHierarchyGUI.s_WasInsideValueRectFrame = Time.frameCount; } EditorGUI.BeginChangeCheck(); if (animationWindowCurve.valueType == typeof(bool)) { num = (float)((!GUI.Toggle(position, this.m_HierarchyItemValueControlIDs[row], num != 0f, GUIContent.none, EditorStyles.toggle)) ? 0 : 1); } else { int num2 = this.m_HierarchyItemValueControlIDs[row]; bool flag2 = GUIUtility.keyboardControl == num2 && EditorGUIUtility.editingTextField && Event.current.type == EventType.KeyDown && (Event.current.character == '\n' || Event.current.character == '\u0003'); if (EditorGUI.s_RecycledEditor.controlID == num2 && Event.current.type == EventType.MouseDown && position.Contains(Event.current.mousePosition)) { GUIUtility.keyboardControl = num2; } num = EditorGUI.DoFloatField(EditorGUI.s_RecycledEditor, position, new Rect(0f, 0f, 0f, 0f), num2, num, EditorGUI.kFloatFieldFormatString, this.m_AnimationSelectionTextField, false); if (flag2) { GUI.changed = true; Event.current.Use(); } } if (float.IsInfinity(num) || float.IsNaN(num)) { num = 0f; } if (EditorGUI.EndChangeCheck()) { string undoLabel = "Edit Key"; float num3 = this.state.currentTime - animationWindowCurve.timeOffset; AnimationKeyTime time = AnimationKeyTime.Time(num3, animationWindowCurve.clip.frameRate); AnimationWindowKeyframe animationWindowKeyframe = null; foreach (AnimationWindowKeyframe current in animationWindowCurve.m_Keyframes) { if (Mathf.Approximately(current.time, num3)) { animationWindowKeyframe = current; } } if (animationWindowKeyframe == null) { AnimationWindowUtility.AddKeyframeToCurve(animationWindowCurve, num, animationWindowCurve.valueType, time); } else { animationWindowKeyframe.value = num; } this.state.SaveCurve(animationWindowCurve, undoLabel); flag = true; } } } if (flag) { this.state.ResampleAnimation(); } }
public static AnimationWindowKeyframe AddKeyframeToCurve(AnimationWindowCurve curve, object value, Type type, AnimationKeyTime time) { AnimationWindowKeyframe animationWindowKeyframe = curve.FindKeyAtTime(time); if (animationWindowKeyframe != null) { animationWindowKeyframe.value = value; return animationWindowKeyframe; } AnimationWindowKeyframe animationWindowKeyframe2 = new AnimationWindowKeyframe(); animationWindowKeyframe2.time = time.time; if (curve.isPPtrCurve) { animationWindowKeyframe2.value = value; animationWindowKeyframe2.curve = curve; curve.AddKeyframe(animationWindowKeyframe2, time); } else { if (type == typeof(bool) || type == typeof(float)) { AnimationCurve animationCurve = curve.ToAnimationCurve(); Keyframe key = new Keyframe(time.time, (float)value); if (type == typeof(bool)) { CurveUtility.SetKeyTangentMode(ref key, 0, TangentMode.Stepped); CurveUtility.SetKeyTangentMode(ref key, 1, TangentMode.Stepped); CurveUtility.SetKeyBroken(ref key, true); animationWindowKeyframe2.m_TangentMode = key.tangentMode; animationWindowKeyframe2.m_InTangent = float.PositiveInfinity; animationWindowKeyframe2.m_OutTangent = float.PositiveInfinity; } else { int num = animationCurve.AddKey(key); if (num != -1) { CurveUtility.SetKeyModeFromContext(animationCurve, num); animationWindowKeyframe2.m_TangentMode = animationCurve[num].tangentMode; } } animationWindowKeyframe2.value = value; animationWindowKeyframe2.curve = curve; curve.AddKeyframe(animationWindowKeyframe2, time); } } return animationWindowKeyframe2; }
private void Refresh() { if (this.refresh == AnimationWindowState.RefreshType.Everything) { CurveRendererCache.ClearCurveRendererCache(); this.m_ActiveKeyframeCache = (AnimationWindowKeyframe) null; this.m_AllCurvesCache = (List<AnimationWindowCurve>) null; this.m_ActiveCurvesCache = (List<AnimationWindowCurve>) null; this.m_dopelinesCache = (List<DopeLine>) null; this.m_SelectedKeysCache = (List<AnimationWindowKeyframe>) null; this.m_ActiveCurveWrappersCache = (List<CurveWrapper>) null; if (this.hierarchyData != null) this.hierarchyData.UpdateData(); if (this.m_lastAddedCurveBinding.HasValue) this.OnNewCurveAdded(this.m_lastAddedCurveBinding.Value); if (this.activeCurves.Count == 0 && this.dopelines.Count > 0) this.SelectHierarchyItem(this.dopelines[0], false, false); this.m_Refresh = AnimationWindowState.RefreshType.None; } else if (this.refresh == AnimationWindowState.RefreshType.CurvesOnly) { CurveRendererCache.ClearCurveRendererCache(); this.m_ActiveKeyframeCache = (AnimationWindowKeyframe) null; this.m_ActiveCurvesCache = (List<AnimationWindowCurve>) null; this.m_ActiveCurveWrappersCache = (List<CurveWrapper>) null; this.m_SelectedKeysCache = (List<AnimationWindowKeyframe>) null; this.ReloadModifiedAnimationCurveCache(); this.ReloadModifiedDopelineCache(); this.m_Refresh = AnimationWindowState.RefreshType.None; this.m_ModifiedCurves.Clear(); } if (!this.disabled || !this.recording) return; this.recording = false; }
private void DoValueField(Rect rect, AnimationWindowHierarchyNode node, int row) { bool curvesChanged = false; if (node is AnimationWindowHierarchyPropertyNode) { AnimationWindowCurve[] curves = node.curves; if (curves == null || curves.Length == 0) { return; } // We do valuefields for dopelines that only have single curve AnimationWindowCurve curve = curves[0]; object objectValue = CurveBindingUtility.GetCurrentValue(state, curve); if (objectValue is float) { float value = (float)objectValue; Rect valueFieldDragRect = new Rect(rect.xMax - k_ValueFieldOffsetFromRightSide - k_ValueFieldDragWidth, rect.y, k_ValueFieldDragWidth, rect.height); Rect valueFieldRect = new Rect(rect.xMax - k_ValueFieldOffsetFromRightSide, rect.y, k_ValueFieldWidth, rect.height); if (Event.current.type == EventType.MouseMove && valueFieldRect.Contains(Event.current.mousePosition)) { s_WasInsideValueRectFrame = Time.frameCount; } EditorGUI.BeginChangeCheck(); if (curve.valueType == typeof(bool)) { value = GUI.Toggle(valueFieldRect, m_HierarchyItemValueControlIDs[row], value != 0, GUIContent.none, EditorStyles.toggle) ? 1 : 0; } else { int id = m_HierarchyItemValueControlIDs[row]; bool enterInTextField = (EditorGUIUtility.keyboardControl == id && EditorGUIUtility.editingTextField && Event.current.type == EventType.KeyDown && (Event.current.character == '\n' || (int)Event.current.character == 3)); // Force back keyboard focus to float field editor when editing it. // TreeView forces keyboard focus on itself at mouse down and we lose focus here. if (EditorGUI.s_RecycledEditor.controlID == id && Event.current.type == EventType.MouseDown && valueFieldRect.Contains(Event.current.mousePosition)) { GUIUtility.keyboardControl = id; } value = EditorGUI.DoFloatField(EditorGUI.s_RecycledEditor, valueFieldRect, valueFieldDragRect, id, value, "g5", m_AnimationSelectionTextField, true); if (enterInTextField) { GUI.changed = true; Event.current.Use(); } } if (float.IsInfinity(value) || float.IsNaN(value)) { value = 0; } if (EditorGUI.EndChangeCheck()) { string undoLabel = "Edit Key"; AnimationKeyTime newAnimationKeyTime = AnimationKeyTime.Time(state.currentTime, curve.clip.frameRate); AnimationWindowKeyframe existingKeyframe = null; foreach (AnimationWindowKeyframe keyframe in curve.m_Keyframes) { if (Mathf.Approximately(keyframe.time, state.currentTime)) { existingKeyframe = keyframe; } } if (existingKeyframe == null) { AnimationWindowUtility.AddKeyframeToCurve(curve, value, curve.valueType, newAnimationKeyTime); } else { existingKeyframe.value = value; } state.SaveCurve(curve, undoLabel); curvesChanged = true; } } } if (curvesChanged) { state.ResampleAnimation(); } }
public void AddKeyframe(AnimationWindowKeyframe key, AnimationKeyTime keyTime) { this.RemoveKeyframe(keyTime); this.m_Keyframes.Add(key); if (< > f__am$cache3 == null) {
private void DoValueField(Rect rect, AnimationWindowHierarchyNode node, int row) { bool flag = false; if (!AnimationMode.InAnimationMode()) { return; } EditorGUI.BeginDisabledGroup(this.state.animationIsReadOnly); if (node is AnimationWindowHierarchyPropertyNode) { List <AnimationWindowCurve> curves = this.state.GetCurves(node, false); if (curves == null || curves.Count == 0) { return; } AnimationWindowCurve animationWindowCurve = curves[0]; object currentValue = CurveBindingUtility.GetCurrentValue(this.state.activeRootGameObject, animationWindowCurve.binding); Type editorCurveValueType = CurveBindingUtility.GetEditorCurveValueType(this.state.activeRootGameObject, animationWindowCurve.binding); if (currentValue is float) { float num = (float)currentValue; Rect position = new Rect(rect.xMax - 75f, rect.y, 50f, rect.height); if (Event.current.type == EventType.MouseMove && position.Contains(Event.current.mousePosition)) { AnimationWindowHierarchyGUI.s_WasInsideValueRectFrame = Time.frameCount; } EditorGUI.BeginChangeCheck(); if (editorCurveValueType == typeof(bool)) { num = (float)((!EditorGUI.Toggle(position, num != 0f)) ? 0 : 1); } else { int controlID = GUIUtility.GetControlID(123456544, FocusType.Keyboard, position); bool flag2 = GUIUtility.keyboardControl == controlID && EditorGUIUtility.editingTextField && Event.current.type == EventType.KeyDown && (Event.current.character == '\n' || Event.current.character == '\u0003'); num = EditorGUI.DoFloatField(EditorGUI.s_RecycledEditor, position, new Rect(0f, 0f, 0f, 0f), controlID, num, EditorGUI.kFloatFieldFormatString, this.m_AnimationSelectionTextField, false); if (flag2) { GUI.changed = true; Event.current.Use(); } } if (float.IsInfinity(num) || float.IsNaN(num)) { num = 0f; } if (EditorGUI.EndChangeCheck()) { AnimationWindowKeyframe animationWindowKeyframe = null; foreach (AnimationWindowKeyframe current in animationWindowCurve.m_Keyframes) { if (Mathf.Approximately(current.time, this.state.time.time)) { animationWindowKeyframe = current; } } if (animationWindowKeyframe == null) { AnimationWindowUtility.AddKeyframeToCurve(animationWindowCurve, num, editorCurveValueType, this.state.time); } else { animationWindowKeyframe.value = num; } this.state.SaveCurve(animationWindowCurve); flag = true; } } } EditorGUI.EndDisabledGroup(); if (flag) { this.state.ResampleAnimation(); } }
public void AddKeyframe(AnimationWindowKeyframe key, AnimationKeyTime keyTime) { this.RemoveKeyframe(keyTime); this.m_Keyframes.Add(key); this.m_Keyframes.Sort((AnimationWindowKeyframe a, AnimationWindowKeyframe b) => a.time.CompareTo(b.time)); }
public void SelectKey(AnimationWindowKeyframe keyframe) { int hash = keyframe.GetHash(); if (!this.selectedKeyHashes.Contains(hash)) this.selectedKeyHashes.Add(hash); this.m_SelectedKeysCache = (List<AnimationWindowKeyframe>) null; }
public static CurveSelection AnimationWindowKeyframeToCurveSelection(AnimationWindowKeyframe keyframe, CurveEditor curveEditor) { foreach (CurveWrapper wrapper in curveEditor.animationCurves) { if ((wrapper.binding == keyframe.curve.binding) && (keyframe.GetIndex() >= 0)) { return new CurveSelection(wrapper.id, curveEditor, keyframe.GetIndex()); } } return null; }
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); }
private float GetKeyframeOffset(DopeLine dopeline, AnimationWindowKeyframe keyframe) { if ((!dopeline.isPptrDopeline || !dopeline.tallMode) || ((keyframe != null) && (keyframe.value == null))) { return -5.5f; } return -1f; }
public void PasteKeys() { if (AnimationWindowState.s_KeyframeClipboard == null) AnimationWindowState.s_KeyframeClipboard = new List<AnimationWindowKeyframe>(); HashSet<int> intSet = new HashSet<int>((IEnumerable<int>) this.m_SelectedKeyHashes); this.ClearKeySelections(); AnimationWindowCurve animationWindowCurve1 = (AnimationWindowCurve) null; AnimationWindowCurve animationWindowCurve2 = (AnimationWindowCurve) null; float startTime = 0.0f; List<AnimationWindowCurve> source = new List<AnimationWindowCurve>(); using (List<AnimationWindowKeyframe>.Enumerator enumerator = AnimationWindowState.s_KeyframeClipboard.GetEnumerator()) { while (enumerator.MoveNext()) { AnimationWindowKeyframe current = enumerator.Current; if (!source.Any<AnimationWindowCurve>() || source.Last<AnimationWindowCurve>() != current.curve) source.Add(current.curve); } } bool flag = source.Count<AnimationWindowCurve>() == this.activeCurves.Count<AnimationWindowCurve>(); int index = 0; using (List<AnimationWindowKeyframe>.Enumerator enumerator = AnimationWindowState.s_KeyframeClipboard.GetEnumerator()) { while (enumerator.MoveNext()) { AnimationWindowKeyframe current = enumerator.Current; if (animationWindowCurve2 != null && current.curve != animationWindowCurve2) ++index; AnimationWindowKeyframe keyframe = new AnimationWindowKeyframe(current); keyframe.curve = !flag ? AnimationWindowUtility.BestMatchForPaste(keyframe.curve.binding, this.activeCurves) : this.activeCurves[index]; if (keyframe.curve == null) { keyframe.curve = new AnimationWindowCurve(this.activeAnimationClip, current.curve.binding, current.curve.type); keyframe.time = current.time; } keyframe.time += this.time.time; if (keyframe.curve != null) { if (keyframe.curve.HasKeyframe(AnimationKeyTime.Time(keyframe.time, this.frameRate))) keyframe.curve.RemoveKeyframe(AnimationKeyTime.Time(keyframe.time, this.frameRate)); if (animationWindowCurve1 == keyframe.curve) keyframe.curve.RemoveKeysAtRange(startTime, keyframe.time); keyframe.curve.m_Keyframes.Add(keyframe); this.SelectKey(keyframe); this.SaveCurve(keyframe.curve); animationWindowCurve1 = keyframe.curve; startTime = keyframe.time; } animationWindowCurve2 = current.curve; } } if (this.m_SelectedKeyHashes.Count == 0) this.m_SelectedKeyHashes = intSet; else this.ResampleAnimation(); }
private Rect GetKeyframeRect(DopeLine dopeline, AnimationWindowKeyframe keyframe) { return this.GetKeyframeRect(dopeline, this.state.SnapToFrame(keyframe.time)); }
private void HandlePaste() { this.state.ClearKeySelections(); foreach (AnimationWindowKeyframe current in this.m_KeyframeClipboard) { AnimationWindowKeyframe animationWindowKeyframe = new AnimationWindowKeyframe(current); animationWindowKeyframe.time += this.state.GetTimeSeconds(); animationWindowKeyframe.curve.m_Keyframes.Add(animationWindowKeyframe); this.state.SelectKey(animationWindowKeyframe); this.state.SaveCurve(current.curve); } }
private Rect GetKeyframeRect(DopeLine dopeline, AnimationWindowKeyframe keyframe) { float time = keyframe == null ? 0.0f : keyframe.time; float width = 10f; if (dopeline.isPptrDopeline && dopeline.tallMode && (keyframe == null || keyframe.value != null)) width = dopeline.position.height; if (dopeline.isPptrDopeline && dopeline.tallMode) return new Rect(this.state.TimeToPixel(this.state.SnapToFrame(time)) + this.GetKeyframeOffset(dopeline, keyframe), dopeline.position.yMin, width, dopeline.position.height); return new Rect(this.state.TimeToPixel(this.state.SnapToFrame(time)) + this.GetKeyframeOffset(dopeline, keyframe), dopeline.position.yMin, width, dopeline.position.height); }
public static AnimationWindowKeyframe AddKeyframeToCurve(AnimationWindowCurve curve, object value, System.Type type, AnimationKeyTime time) { AnimationWindowKeyframe keyAtTime = curve.FindKeyAtTime(time); if (keyAtTime != null) { keyAtTime.value = value; return keyAtTime; } AnimationWindowKeyframe key1 = new AnimationWindowKeyframe(); key1.time = time.time; if (curve.isPPtrCurve) { key1.value = value; key1.curve = curve; curve.AddKeyframe(key1, time); } else if (type == typeof (bool) || type == typeof (float)) { AnimationCurve animationCurve = curve.ToAnimationCurve(); Keyframe key2 = new Keyframe(time.time, (float) value); if (type == typeof (bool)) { CurveUtility.SetKeyTangentMode(ref key2, 0, TangentMode.Stepped); CurveUtility.SetKeyTangentMode(ref key2, 1, TangentMode.Stepped); CurveUtility.SetKeyBroken(ref key2, true); key1.m_TangentMode = key2.tangentMode; key1.m_InTangent = float.PositiveInfinity; key1.m_OutTangent = float.PositiveInfinity; } else { int keyIndex = animationCurve.AddKey(key2); if (keyIndex != -1) { CurveUtility.SetKeyModeFromContext(animationCurve, keyIndex); key1.m_TangentMode = animationCurve[keyIndex].tangentMode; } } key1.value = value; key1.curve = curve; curve.AddKeyframe(key1, time); } return key1; }
private void CreateNewPPtrKeyframe(float time, UnityEngine.Object value, AnimationWindowCurve targetCurve) { AnimationWindowKeyframe animationWindowKeyframe = new AnimationWindowKeyframe(targetCurve, new ObjectReferenceKeyframe() { time = time, value = value }); AnimationKeyTime keyTime = AnimationKeyTime.Time(animationWindowKeyframe.time, this.state.frameRate); targetCurve.AddKeyframe(animationWindowKeyframe, keyTime); this.state.SelectKey(animationWindowKeyframe); }
private void DoValueField(Rect rect, AnimationWindowHierarchyNode node, int row) { bool flag1 = false; if (!AnimationMode.InAnimationMode()) { return; } EditorGUI.BeginDisabledGroup(this.state.animationIsReadOnly); if (node is AnimationWindowHierarchyPropertyNode) { List <AnimationWindowCurve> curves = this.state.GetCurves(node, false); if (curves == null || curves.Count == 0) { return; } AnimationWindowCurve curve = curves[0]; object currentValue = CurveBindingUtility.GetCurrentValue(this.state.activeRootGameObject, curve.binding); System.Type editorCurveValueType = CurveBindingUtility.GetEditorCurveValueType(this.state.activeRootGameObject, curve.binding); if (currentValue is float) { float num = (float)currentValue; Rect position = new Rect(rect.xMax - 75f, rect.y, 50f, rect.height); if (Event.current.type == EventType.MouseMove && position.Contains(Event.current.mousePosition)) { AnimationWindowHierarchyGUI.s_WasInsideValueRectFrame = Time.frameCount; } EditorGUI.BeginChangeCheck(); float f; if (editorCurveValueType == typeof(bool)) { f = !EditorGUI.Toggle(position, (double)num != 0.0) ? 0.0f : 1f; } else { int controlId = GUIUtility.GetControlID(123456544, FocusType.Keyboard, position); bool flag2 = GUIUtility.keyboardControl == controlId && EditorGUIUtility.editingTextField && Event.current.type == EventType.KeyDown && ((int)Event.current.character == 10 || (int)Event.current.character == 3); f = EditorGUI.DoFloatField(EditorGUI.s_RecycledEditor, position, new Rect(0.0f, 0.0f, 0.0f, 0.0f), controlId, num, EditorGUI.kFloatFieldFormatString, this.m_AnimationSelectionTextField, false); if (flag2) { GUI.changed = true; Event.current.Use(); } } if (float.IsInfinity(f) || float.IsNaN(f)) { f = 0.0f; } if (EditorGUI.EndChangeCheck()) { AnimationWindowKeyframe animationWindowKeyframe = (AnimationWindowKeyframe)null; using (List <AnimationWindowKeyframe> .Enumerator enumerator = curve.m_Keyframes.GetEnumerator()) { while (enumerator.MoveNext()) { AnimationWindowKeyframe current = enumerator.Current; if (Mathf.Approximately(current.time, this.state.time.time)) { animationWindowKeyframe = current; } } } if (animationWindowKeyframe == null) { AnimationWindowUtility.AddKeyframeToCurve(curve, (object)f, editorCurveValueType, this.state.time); } else { animationWindowKeyframe.value = (object)f; } this.state.SaveCurve(curve); flag1 = true; } } } EditorGUI.EndDisabledGroup(); if (!flag1) { return; } this.state.ResampleAnimation(); }