//----------------------------------------------------------------------------------------------------------------------
    
    private void DrawLimitedAnimationGUI(SceneCachePlayableAsset scPlayableAsset) {
        SceneCachePlayer scPlayer = scPlayableAsset.GetSceneCachePlayer();
        
        bool disableScope = null == scPlayer;
        
        if (null != scPlayer) {
            disableScope |= (!scPlayer.IsLimitedAnimationOverrideable());
        }

        if (disableScope) {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.HelpBox(
                "Disabled because Limited Animation settings on the SceneCache GameObject is enabled, or the playback mode is set to interpolate", 
                MessageType.Warning
            );
            if (GUILayout.Button("Fix", GUILayout.Width(64), GUILayout.Height(36))) {
                scPlayer.AllowLimitedAnimationOverride();
                Repaint();
            }
            EditorGUILayout.EndHorizontal();
            
        }

        using (new EditorGUI.DisabledScope(disableScope)) {
            SceneCachePlayerEditorUtility.DrawLimitedAnimationGUI(scPlayableAsset.GetOverrideLimitedAnimationController(),
                m_scPlayableAsset, scPlayer);
        }
        
    }
예제 #2
0
//----------------------------------------------------------------------------------------------------------------------
        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);
        }