//---------------------------------------------------------------------------------------------------------------------- private static bool DrawPlaybackMode(SceneCachePlayer t) { t.ShowPlaybackInInspector(EditorGUILayout.Foldout(t.IsPlaybackInInspectorShown(), "Playback", true, GetDefaultFoldoutStyle())); if (!t.IsPlaybackInInspectorShown()) { return(false); } bool changed = false; changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "SceneCache: Playback Mode", guiFunc: () => (SceneCachePlaybackMode)EditorGUILayout.EnumPopup("Playback Mode", t.GetPlaybackMode()), updateFunc: (SceneCachePlaybackMode mode) => { t.SetPlaybackMode(mode); SceneCachePlayerEditorUtility.RefreshSceneCache(t); } ); ++EditorGUI.indentLevel; changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "SceneCache: Time", guiFunc: () => (EditorGUILayout.FloatField("Time", t.GetTime())), updateFunc: (float time) => { t.SetTime(Mathf.Max(0, time)); }); using (new EditorGUI.DisabledScope(t.GetPlaybackMode() == SceneCachePlaybackMode.Interpolate)) { changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "SceneCache: Frame", guiFunc: () => (EditorGUILayout.IntField("Frame", t.GetFrame())), updateFunc: (int frame) => { t.SetTimeByFrame(Mathf.Max(0, frame)); }); } --EditorGUI.indentLevel; using (new EditorGUI.DisabledScope(t.GetPlaybackMode() == SceneCachePlaybackMode.Interpolate)) { changed |= SceneCachePlayerEditorUtility.DrawLimitedAnimationGUI(t.GetLimitedAnimationController(), t, t); } EditorGUILayout.Space(); return(changed); }
//---------------------------------------------------------------------------------------------------------------------- internal static bool DrawLimitedAnimationGUI(LimitedAnimationController ctrl, Object target, SceneCachePlayer sc) { bool changed = false; const string UNDO_TEXT = "SceneCache: Limited Animation"; //Limited Animation changed |= EditorGUIDrawerUtility.DrawUndoableGUI(target, UNDO_TEXT, guiFunc: () => (EditorGUILayout.Toggle("Limited Animation", ctrl.IsEnabled())), updateFunc: (bool limitedAnimation) => { ctrl.SetEnabled(limitedAnimation); SceneCachePlayerEditorUtility.RefreshSceneCache(sc); }); ++EditorGUI.indentLevel; using (new EditorGUI.DisabledScope(!ctrl.IsEnabled())) { changed |= EditorGUIDrawerUtility.DrawUndoableGUI(target, UNDO_TEXT, guiFunc: () => ( EditorGUILayout.IntField("Num Frames to Hold", ctrl.GetNumFramesToHold()) ), updateFunc: (int frames) => { ctrl.SetNumFramesToHold(frames); SceneCachePlayerEditorUtility.RefreshSceneCache(sc); }); changed |= EditorGUIDrawerUtility.DrawUndoableGUI(target, UNDO_TEXT, guiFunc: () => ( EditorGUILayout.IntField("Frame Offset", ctrl.GetFrameOffset()) ), updateFunc: (int offset) => { ctrl.SetFrameOffset(offset); SceneCachePlayerEditorUtility.RefreshSceneCache(sc); }); } --EditorGUI.indentLevel; EditorGUILayout.Space(); return changed; }