Esempio n. 1
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);
             }
         }
     }
 }
 public void RebuildGraph()
 {
     if (!this.ValidateBreadCrumbs())
     {
         this.UpdateStateMachineSelection();
     }
     this.stateMachineGraph.RebuildGraph();
     if (AnimatorControllerTool.graphDirtyCallback != null)
     {
         AnimatorControllerTool.graphDirtyCallback();
     }
 }
 private void Init()
 {
     if (this.m_LayerEditor == null)
     {
         this.m_LayerEditor = new LayerControllerView();
     }
     this.m_LayerEditor.Init(this);
     if (this.m_ParameterEditor == null)
     {
         this.m_ParameterEditor = new ParameterControllerView();
         this.m_ParameterEditor.Init(this);
     }
     if (this.stateMachineGraph == null)
     {
         this.stateMachineGraph           = ScriptableObject.CreateInstance <UnityEditor.Graphs.AnimationStateMachine.Graph>();
         this.stateMachineGraph.hideFlags = HideFlags.HideAndDontSave;
     }
     if (this.stateMachineGraphGUI == null)
     {
         this.stateMachineGraphGUI = (this.stateMachineGraph.GetEditor() as UnityEditor.Graphs.AnimationStateMachine.GraphGUI);
     }
     if (this.blendTreeGraph == null)
     {
         this.blendTreeGraph           = ScriptableObject.CreateInstance <UnityEditor.Graphs.AnimationBlendTree.Graph>();
         this.blendTreeGraph.hideFlags = HideFlags.HideAndDontSave;
     }
     if (this.blendTreeGraphGUI == null)
     {
         this.blendTreeGraphGUI = (this.blendTreeGraph.GetEditor() as UnityEditor.Graphs.AnimationBlendTree.GraphGUI);
     }
     if (this.m_BreadCrumbs == null)
     {
         this.m_BreadCrumbs = new List <AnimatorControllerTool.BreadCrumbElement>();
         this.ResetBreadCrumbs();
     }
     AnimatorControllerTool.tool = this;
 }