private void InitCurvePresets() { if (this.m_CurvePresets == null) { Action<AnimationCurve> presetSelectedCallback = delegate (AnimationCurve presetCurve) { Rect rect; this.ValidateCurveLibraryTypeAndScale(); if (this.GetNormalizationRect(out rect)) { bool realToNormalized = false; this.m_Curve.keys = 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(); } }
public void InitIfNeeded() { if (this.m_CurveLibraryEditorState == null) { this.m_CurveLibraryEditorState = new PresetLibraryEditorState(CurvePresetsContentsForPopupWindow.GetBasePrefText(this.m_CurveLibraryType)); this.m_CurveLibraryEditorState.TransferEditorPrefsState(true); } if (this.m_CurveLibraryEditor == null) { ScriptableObjectSaveLoadHelper <CurvePresetLibrary> helper = new ScriptableObjectSaveLoadHelper <CurvePresetLibrary>(CurvePresetsContentsForPopupWindow.GetExtension(this.m_CurveLibraryType), SaveType.Text); this.m_CurveLibraryEditor = new PresetLibraryEditor <CurvePresetLibrary>(helper, this.m_CurveLibraryEditorState, new Action <int, object>(this.ItemClickedCallback)); PresetLibraryEditor <CurvePresetLibrary> expr_6E = this.m_CurveLibraryEditor; expr_6E.addDefaultPresets = (Action <PresetLibrary>)Delegate.Combine(expr_6E.addDefaultPresets, new Action <PresetLibrary>(this.AddDefaultPresetsToLibrary)); PresetLibraryEditor <CurvePresetLibrary> expr_95 = this.m_CurveLibraryEditor; expr_95.presetsWasReordered = (Action)Delegate.Combine(expr_95.presetsWasReordered, new Action(this.OnPresetsWasReordered)); this.m_CurveLibraryEditor.previewAspect = 4f; this.m_CurveLibraryEditor.minMaxPreviewHeight = new Vector2(24f, 24f); this.m_CurveLibraryEditor.showHeader = true; } }
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(); }
public static string GetBasePrefText(CurveLibraryType curveLibraryType) { return(CurvePresetsContentsForPopupWindow.GetExtension(curveLibraryType)); }