コード例 #1
0
        public void RebuildGraphIfNecessary(bool evaluate = true)
        {
            if (state == null || state.editSequence.director == null || state.editSequence.asset == null)
            {
                return;
            }

            if (state.rebuildGraph)
            {
                // rebuilding the graph resets the time
                double time = state.editSequence.time;

                var wasPlaying = false;

                // disable preview mode,
                if (!EditorApplication.isPlaying)
                {
                    wasPlaying = state.playing;

                    state.previewMode = false;
                    state.GatherProperties(state.masterSequence.director);
                }
                state.RebuildPlayableGraph();
                state.editSequence.time = time;

                if (wasPlaying)
                {
                    state.Play();
                }

                if (evaluate)
                {
                    state.EvaluateImmediate();

                    // this is necessary to see accurate results when inspector refreshes
                    if (state.masterSequence.director != null && state.masterSequence.director.playableGraph.IsValid() && !state.playing)
                    {
                        state.masterSequence.director.DeferredEvaluate();
                        PreviewEditorWindow.RepaintAll();
                        SceneView.RepaintAll();
                    }
                }

                Repaint();
            }

            state.rebuildGraph = false;
        }
コード例 #2
0
        public static void SetShowGizmos(bool value)
        {
            var view = PreviewEditorWindow.GetMainPreviewWindow();

            if (view == null)
            {
                view = PreviewEditorWindow.GetRenderingPreview();
            }

            if (view == null)
            {
                return;
            }

            view.SetShowGizmos(value);
        }
コード例 #3
0
ファイル: WindowState.cs プロジェクト: ADRC4-2019-2020/Lith
        public void Evaluate()
        {
            if (masterSequence.director != null)
            {
                if (!EditorApplication.isPlaying && !previewMode)
                {
                    GatherProperties(masterSequence.director);
                }

                ForceTimeOnDirector(masterSequence.director);
                masterSequence.director.DeferredEvaluate();

                if (EditorApplication.isPlaying == false)
                {
                    PreviewEditorWindow.RepaintAll();
                    SceneView.RepaintAll();
                    AudioMixerWindow.RepaintAudioMixerWindow();
                }
            }
        }