/************************************************************************************************************************/ /// <summary> /// Called by the Unity editor to draw the custom Inspector GUI elements. /// </summary> public override void OnInspectorGUI() { // Normally the targets wouldn't change after OnEnable, but the trick AnimancerComponent.Reset uses to // swap the type of an existing component when a new one is added causes the old target to be destroyed. GatherTargets(); serializedObject.Update(); var area = GUILayoutUtility.GetRect(0, 0); _AnimatorEditor.DoInspectorGUI(); DoOtherFieldsGUI(); PlayableDrawer.DoGUI(_Targets); area.yMax = GUILayoutUtility.GetLastRect().yMax; AnimancerLayerDrawer.HandleDragAndDropAnimations(area, _Targets[0], 0); serializedObject.ApplyModifiedProperties(); }
/************************************************************************************************************************/ #region Preview Tab /************************************************************************************************************************/ private void DoPreviewInspectorGUI() { if (!_Instance._TransitionProperty.IsValid()) { GUILayout.Label("No target property"); _Instance.DestroyTransitionProperty(); return; } DoTransitionPropertyGUI(); DoTransitionGUI(); DoPreviewSettingsGUI(); var animancer = _Instance._Scene.InstanceAnimancer; if (animancer != null) { PlayableDrawer.DoGUI(animancer.Component); if (animancer.IsGraphPlaying) { GUI.changed = true; } } }
/************************************************************************************************************************/ private void DoPreviewInspectorGUI() { if (!Target._TransitionProperty.IsValid()) { EditorGUILayout.HelpBox("No target property", MessageType.Info, true); Target.DestroyTransitionProperty(); return; } DoTransitionPropertyGUI(); DoTransitionGUI(); Target._Animations.DoGUI(); var animancer = Target._Scene.Animancer; if (animancer != null) { PlayableDrawer.DoGUI(animancer.Component); if (animancer.IsGraphPlaying) { GUI.changed = true; } } }