private void RenderSelectionOverlay(Rect rect) { if (m_State.showCurveEditor && !m_CurveEditor.hasSelection) { return; } if (!m_State.showCurveEditor && m_State.selectedKeys.Count == 0) { return; } const int kOverlayMinWidth = 14; Bounds bounds = m_State.showCurveEditor ? m_CurveEditor.selectionBounds : m_State.selectionBounds; float startPixel = m_State.TimeToPixel(bounds.min.x) + rect.xMin; float endPixel = m_State.TimeToPixel(bounds.max.x) + rect.xMin; if ((endPixel - startPixel) < kOverlayMinWidth) { float centerPixel = (startPixel + endPixel) * 0.5f; startPixel = centerPixel - kOverlayMinWidth * 0.5f; endPixel = centerPixel + kOverlayMinWidth * 0.5f; } AnimationWindowUtility.DrawSelectionOverlay(rect, selectionRangeColor, startPixel, endPixel); }
public float TimeToPixel(float time) { return(state.TimeToPixel(time)); }
public void OnGUI(AnimationWindowState state, AnimationWindowKeyframe keyframe) { if (!keyframe.isPPtrCurve) { this.backgroundRect = this.position; this.backgroundRect.x = (state.TimeToPixel(keyframe.time) + this.position.x) - (s_width / 2); this.backgroundRect.y += 16f; this.backgroundRect.width = s_width; this.backgroundRect.height = s_height; Rect backgroundRect = this.backgroundRect; backgroundRect.height = 16f; Rect position = this.backgroundRect; position.y += 16f; position.height = s_width; GUI.Box(this.backgroundRect, string.Empty); GUI.Box(position, AssetPreview.GetAssetPreview((UnityEngine.Object) keyframe.value)); EditorGUI.BeginChangeCheck(); UnityEngine.Object obj2 = EditorGUI.ObjectField(backgroundRect, (UnityEngine.Object) keyframe.value, keyframe.curve.m_ValueType, false); if (EditorGUI.EndChangeCheck()) { keyframe.value = obj2; state.SaveCurve(keyframe.curve); } } }