/************************************************************************************************************************/ /// <summary>Draws the target's runtime details.</summary> private void DoRuntimeDetailsGUI() { if (!UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode || targets.Length != 1) { return; } AnimancerEditorUtilities.BeginVerticalBox(GUI.skin.box); var target = (SoloAnimation)this.target; if (!target.IsInitialised) { GUILayout.Label("Not Initialised"); } else { UnityEditor.EditorGUI.BeginChangeCheck(); var isPlaying = UnityEditor.EditorGUILayout.Toggle("Is Playing", target.IsPlaying); if (UnityEditor.EditorGUI.EndChangeCheck()) { target.IsPlaying = isPlaying; } UnityEditor.EditorGUI.BeginChangeCheck(); var time = UnityEditor.EditorGUILayout.FloatField("Time", target.Time); if (UnityEditor.EditorGUI.EndChangeCheck()) { target.Time = time; } time = Mathf.Repeat(target.NormalizedTime, 1); if (time == 0 && target.Time != 0) { time = 1; } UnityEditor.EditorGUI.BeginChangeCheck(); time = UnityEditor.EditorGUILayout.Slider("Normalized Time", time, 0, 1); if (UnityEditor.EditorGUI.EndChangeCheck()) { target.NormalizedTime = time; } } AnimancerEditorUtilities.EndVerticalBox(GUI.skin.box); Repaint(); }
/// <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(); } }
/************************************************************************************************************************/ /// <summary>Draws all states in the given layer.</summary> public void DoInspectorGUI(IAnimancerComponent owner) { AnimancerEditorUtilities.BeginVerticalBox(GUI.skin.box); DoHeaderGUI(); if (HideInactiveStates) { DoStatesGUI("Active States", ActiveStates, owner); } else if (SeparateActiveFromInactiveStates) { DoStatesGUI("Active States", ActiveStates, owner); DoStatesGUI("Inactive States", InactiveStates, owner); } else { DoStatesGUI("States", ActiveStates, owner); } if (Layer.PortIndex == 0 && Layer.Weight != 0 && !Layer.IsAdditive && !Mathf.Approximately(Layer.GetTotalWeight(), 1)) { EditorGUILayout.HelpBox( "The total Weight of all states in this layer does not equal 1, which will likely give undesirable results." + " Click here for more information.", MessageType.Warning); if (AnimancerEditorUtilities.TryUseClickInLastRect()) { EditorUtility.OpenWithDefaultApp( AnimancerPlayable.APIDocumentationURL + "/docs/manual/smooth-transitions"); } } AnimancerEditorUtilities.EndVerticalBox(GUI.skin.box); var totalArea = GUILayoutUtility.GetLastRect(); HandleDragAndDropAnimations(totalArea, owner, Layer.PortIndex); CheckContextMenu(totalArea); }
/// <summary> /// Draws the animator reference field followed by its fields that are relevant to Animancer. /// </summary> public void DoInspectorGUI() { _OnEndGUI = null; DoAnimatorGUI(); GatherAnimatorProperties(); if (_SerializedAnimator == null) { return; } _SerializedAnimator.Update(); AnimancerEditorUtilities.BeginVerticalBox(EditorStyles.helpBox); { if (!_IsAnimatorOnSameObject) { EditorGUILayout.HelpBox("It is recommended that you keep this component on the same GameObject" + " as its target Animator so that they get enabled and disabled at the same time.", MessageType.Info); } DoControllerGUI(); EditorGUILayout.PropertyField(_Avatar, AnimancerEditorUtilities.TempContent("Avatar", "The Avatar used by the Animator")); DoRootMotionGUI(); DoUpdateModeGUI(true); DoCullingModeGUI(); DoStopOnDisableGUI(_KeepStateOnDisable, false); } AnimancerEditorUtilities.EndVerticalBox(EditorStyles.helpBox); _SerializedAnimator.ApplyModifiedProperties(); if (_OnEndGUI != null) { _OnEndGUI(); _OnEndGUI = null; } }