Exemplo n.º 1
0
        public void OnGUI(Rect rect)
        {
            if (LayerControllerView.s_Styles == null)
            {
                LayerControllerView.s_Styles = new LayerControllerView.Styles();
            }
            this.KeyboardHandling();
            if (this.m_Host.animatorController != null)
            {
                this.m_LayerList.list = this.m_Host.animatorController.layers;
            }
            else if (this.m_LayerList.list.Count != 0)
            {
                this.m_LayerList.list = new UnityEditor.Animations.AnimatorControllerLayer[0];
            }
            Event current = Event.current;

            if (current.type == EventType.MouseDown && rect.Contains(current.mousePosition))
            {
                this.m_HadKeyFocusAtMouseDown = this.m_LayerList.HasKeyboardControl();
            }
            this.m_LayerList.draggable = !this.m_Host.liveLink;
            this.m_LayerScroll         = GUILayout.BeginScrollView(this.m_LayerScroll, new GUILayoutOption[0]);
            this.m_LayerList.DoLayoutList();
            GUILayout.EndScrollView();
            GUILayout.FlexibleSpace();
        }
Exemplo n.º 2
0
 public void OnToolbarGUI()
 {
     if (LayerControllerView.s_Styles == null)
     {
         LayerControllerView.s_Styles = new LayerControllerView.Styles();
     }
     using (new EditorGUI.DisabledScope(this.m_Host.animatorController == null))
     {
         if (GUILayout.Button(LayerControllerView.s_Styles.addIcon, LayerControllerView.s_Styles.invisibleButton, new GUILayoutOption[0]))
         {
             AnimatorControllerTool animatorControllerTool = this.m_Host as AnimatorControllerTool;
             if (animatorControllerTool != null && animatorControllerTool.animatorController != null)
             {
                 animatorControllerTool.AddNewLayer();
                 this.m_LayerList.list   = animatorControllerTool.animatorController.layers;
                 this.m_LayerList.index  = animatorControllerTool.selectedLayerIndex;
                 this.selectedLayerIndex = this.m_LayerList.index;
                 if (this.renameOverlay.IsRenaming())
                 {
                     this.RenameEnd();
                 }
                 this.renameOverlay.BeginRename(animatorControllerTool.animatorController.layers[this.selectedLayerIndex].name, this.selectedLayerIndex, 0.1f);
             }
         }
     }
 }