Exemplo n.º 1
0
        /// <summary>
        /// Draws the state of each animation that is playing or has been played.
        /// </summary>
        protected void DoStatesGUI()
        {
            // If only multiple objects are selected and or the playable isn't initialised, don't draw anything.

            if (targets.Length != 1)
            {
                return;
            }

            var target = _Targets[0];

            if (!target.IsPlayableInitialised)
            {
                DoPlayableNotInitialisedGUI();
                return;
            }

            // Gather the during the layout event and use the same ones during subsequent events to avoid GUI errors
            // in case they change (they shouldn't, but this is also more efficient).
            if (Event.current.type == EventType.Layout)
            {
                AnimancerLayerDrawer.GatherLayerEditors(target.Playable, LayerInfos, out _LayerCount);
                _IsGraphPlaying = target.Playable.IsGraphPlaying;
            }

            if (!_IsGraphPlaying)
            {
                AnimancerEditorUtilities.BeginVerticalBox(GUI.skin.box);
                _IsGraphPlaying = EditorGUILayout.Toggle("Is Graph Playing", _IsGraphPlaying);
                AnimancerEditorUtilities.EndVerticalBox(GUI.skin.box);

                if (_IsGraphPlaying)
                {
                    target.Playable.UnpauseGraph();
                }
            }

            for (int i = 0; i < _LayerCount; i++)
            {
                LayerInfos[i].DoInspectorGUI(target);
            }

            DoLayerWeightWarningGUI();

            if (AnimancerLayerDrawer.ShowUpdatingNodes)
            {
                target.Playable.DoUpdateListGUI();
            }
        }
Exemplo n.º 2
0
        /************************************************************************************************************************/

        /// <summary>Draws the GUI of the <see cref="IAnimancerComponent.Playable"/>.</summary>
        public void DoGUI(IAnimancerComponent target)
        {
            if (!target.IsPlayableInitialised)
            {
                DoPlayableNotInitialisedGUI(target);
                return;
            }

            EditorGUI.BeginChangeCheck();

            // Gather the during the layout event and use the same ones during subsequent events to avoid GUI errors
            // in case they change (they shouldn't, but this is also more efficient).
            if (Event.current.type == EventType.Layout)
            {
                AnimancerLayerDrawer.GatherLayerEditors(target.Playable, LayerInfos, out _LayerCount);
                _IsGraphPlaying = target.Playable.IsGraphPlaying;
            }

            if (!_IsGraphPlaying)
            {
                AnimancerGUI.BeginVerticalBox(GUI.skin.box);
                _IsGraphPlaying = EditorGUILayout.Toggle("Is Graph Playing", _IsGraphPlaying);
                AnimancerGUI.EndVerticalBox(GUI.skin.box);

                if (_IsGraphPlaying)
                {
                    target.Playable.UnpauseGraph();
                }
            }

            for (int i = 0; i < _LayerCount; i++)
            {
                LayerInfos[i].DoGUI(target);
            }

            DoLayerWeightWarningGUI();

            if (AnimancerLayerDrawer.ShowUpdatingNodes)
            {
                target.Playable.DoUpdateListGUI();
            }

            if (EditorGUI.EndChangeCheck() && !_IsGraphPlaying)
            {
                target.Playable.Evaluate();
            }
        }
Exemplo n.º 3
0
        /************************************************************************************************************************/

        /// <summary>Draws the GUI of the <see cref="IAnimancerComponent.Playable"/>.</summary>
        public void DoGUI(IAnimancerComponent target)
        {
            DoNativeAnimatorControllerGUI(target);

            if (!target.IsPlayableInitialized)
            {
                DoPlayableNotInitializedGUI(target);
                return;
            }

            EditorGUI.BeginChangeCheck();

            var playable = target.Playable;

            // Gather the during the layout event and use the same ones during subsequent events to avoid GUI errors
            // in case they change (they shouldn't, but this is also more efficient).
            if (Event.current.type == EventType.Layout)
            {
                AnimancerLayerDrawer.GatherLayerEditors(playable, LayerInfos, out _LayerCount);
            }

            DoRootGUI(playable);

            for (int i = 0; i < _LayerCount; i++)
            {
                LayerInfos[i].DoGUI();
            }

            DoLayerWeightWarningGUI(target);

            if (ShowInternalDetails)
            {
                DoInternalDetailsGUI(playable);
            }

            if (EditorGUI.EndChangeCheck() && !playable.IsGraphPlaying)
            {
                playable.Evaluate();
            }
        }