private static CopyAndScaleCurveKeys ( |
||
orgKeys | ||
rect | ||
realToNormalized | bool | |
return | UnityEngine.Keyframe[] |
private void PresetDropDown(Rect rect) { if (EditorGUI.ButtonMouseDown(rect, EditorGUI.GUIContents.titleSettingsIcon, FocusType.Passive, EditorStyles.inspectorTitlebarText)) { if (this.m_Curve != null) { if (this.m_CurvePresets == null) { Debug.LogError("Curve presets error"); } else { this.ValidateCurveLibraryTypeAndScale(); AnimationCurve animationCurve = new AnimationCurve(); Rect rect2; if (this.GetNormalizationRect(out rect2)) { bool realToNormalized = true; animationCurve.keys = CurveEditorWindow.CopyAndScaleCurveKeys(this.m_Curve.keys, rect2, realToNormalized); } else { animationCurve = new AnimationCurve(this.m_Curve.keys); } animationCurve.postWrapMode = this.m_Curve.postWrapMode; animationCurve.preWrapMode = this.m_Curve.preWrapMode; this.m_CurvePresets.curveToSaveAsPreset = animationCurve; PopupWindow.Show(rect, this.m_CurvePresets); } } } }
private void InitCurvePresets() { if (this.m_CurvePresets == null) { Action <AnimationCurve> presetSelectedCallback = delegate(AnimationCurve presetCurve) { this.ValidateCurveLibraryTypeAndScale(); Rect rect; if (this.GetNormalizationRect(out rect)) { bool realToNormalized = false; this.m_Curve.keys = CurveEditorWindow.CopyAndScaleCurveKeys(presetCurve.keys, rect, realToNormalized); } else { this.m_Curve.keys = presetCurve.keys; } this.m_Curve.postWrapMode = presetCurve.postWrapMode; this.m_Curve.preWrapMode = presetCurve.preWrapMode; this.m_CurveEditor.SelectNone(); this.RefreshShownCurves(); this.SendEvent("CurveChanged", true); }; AnimationCurve animCurve = null; this.m_CurvePresets = new CurvePresetsContentsForPopupWindow(animCurve, this.curveLibraryType, presetSelectedCallback); this.m_CurvePresets.InitIfNeeded(); } }
private void InitCurvePresets() { if (this.m_CurvePresets != null) { return; } this.m_CurvePresets = new CurvePresetsContentsForPopupWindow((AnimationCurve)null, this.curveLibraryType, (System.Action <AnimationCurve>)(presetCurve => { this.ValidateCurveLibraryTypeAndScale(); Rect normalizationRect; if (this.GetNormalizationRect(out normalizationRect)) { bool realToNormalized = false; this.m_Curve.keys = CurveEditorWindow.CopyAndScaleCurveKeys(presetCurve.keys, normalizationRect, realToNormalized); } else { this.m_Curve.keys = presetCurve.keys; } this.m_Curve.postWrapMode = presetCurve.postWrapMode; this.m_Curve.preWrapMode = presetCurve.preWrapMode; this.m_CurveEditor.SelectNone(); this.RefreshShownCurves(); this.SendEvent("CurveChanged", true); })); this.m_CurvePresets.InitIfNeeded(); }
private Keyframe[] NormalizeKeys(Keyframe[] sourceKeys, CurveEditorWindow.NormalizationMode normalization) { Rect rect; if (!this.GetNormalizationRect(out rect)) { normalization = CurveEditorWindow.NormalizationMode.None; } return(CurveEditorWindow.CopyAndScaleCurveKeys(sourceKeys, rect, normalization)); }