コード例 #1
0
 public void OnToolbarGUI()
 {
     if (s_Styles == null)
     {
         s_Styles = new Styles();
     }
     if (this.m_Host != null)
     {
         using (new EditorGUI.DisabledScope(this.m_Host.animatorController == null))
         {
             string[] names = Enum.GetNames(typeof(SearchMode));
             int searchMode = this.m_SearchMode;
             GUI.SetNextControlName("ParameterSearch");
             if (((Event.current.type == EventType.KeyDown) && (Event.current.keyCode == KeyCode.Escape)) && (GUI.GetNameOfFocusedControl() == "ParameterSearch"))
             {
                 this.m_Search = "";
                 this.CreateSearchParameterList(this.m_Search, this.m_SearchMode);
             }
             EditorGUI.BeginChangeCheck();
             string str = EditorGUILayout.ToolbarSearchField(this.m_Search, names, ref searchMode, new GUILayoutOption[0]);
             if (EditorGUI.EndChangeCheck())
             {
                 this.m_Search = str;
                 this.m_SearchMode = searchMode;
                 this.CreateSearchParameterList(this.m_Search, this.m_SearchMode);
             }
             GUILayout.Space(10f);
             using (new EditorGUI.DisabledScope(this.m_Host.liveLink))
             {
                 Rect position = GUILayoutUtility.GetRect(s_Styles.iconToolbarPlusMore, s_Styles.invisibleButton);
                 if (GUI.Button(position, s_Styles.iconToolbarPlusMore, s_Styles.invisibleButton))
                 {
                     this.OnAddParameter(position);
                 }
             }
         }
     }
 }
コード例 #2
0
 internal void OnGUI()
 {
     if (s_Styles == null)
     {
         s_Styles = new Styles();
     }
     if (this.m_Layer != null)
     {
         bool flag = false;
         GUI.Box(new Rect(0f, 0f, base.position.width, base.position.height), GUIContent.none, new GUIStyle("grey_border"));
         AnimatorControllerLayer[] layers = this.m_Controller.layers;
         EditorGUIUtility.labelWidth = 100f;
         using (new EditorGUI.DisabledScope(this.m_LayerIndex == 0))
         {
             if (AnimatorControllerTool.tool.liveLink)
             {
                 float num = (this.m_LayerIndex != 0) ? AnimatorControllerTool.tool.previewAnimator.GetLayerWeight(this.m_LayerIndex) : 1f;
                 AnimatorControllerTool.tool.previewAnimator.SetLayerWeight(this.m_LayerIndex, EditorGUILayout.Slider(s_Styles.weight, num, 0f, 1f, new GUILayoutOption[0]));
             }
             else
             {
                 EditorGUI.BeginChangeCheck();
                 float num2 = (this.m_LayerIndex != 0) ? this.m_Layer.defaultWeight : 1f;
                 num2 = EditorGUILayout.Slider(s_Styles.weight, num2, 0f, 1f, new GUILayoutOption[0]);
                 if (EditorGUI.EndChangeCheck() && (this.m_LayerIndex != 0))
                 {
                     this.m_Layer.defaultWeight = num2;
                     flag = true;
                 }
             }
         }
         EditorGUI.BeginChangeCheck();
         this.m_Layer.avatarMask = EditorGUILayout.ObjectField(s_Styles.mask, this.m_Layer.avatarMask, typeof(AvatarMask), false, new GUILayoutOption[0]) as AvatarMask;
         this.m_Layer.blendingMode = (AnimatorLayerBlendingMode) EditorGUILayout.EnumPopup(s_Styles.blending, this.m_Layer.blendingMode, new GUILayoutOption[0]);
         if (EditorGUI.EndChangeCheck())
         {
             flag = true;
         }
         int selectedIndex = 0;
         List<GUIContent> list = new List<GUIContent>();
         List<int> list2 = new List<int>();
         for (int i = 0; i < layers.Length; i++)
         {
             AnimatorControllerLayer layer = layers[i];
             if ((this.m_LayerIndex != i) && (layer.syncedLayerIndex == -1))
             {
                 list.Add(new GUIContent(layer.name));
                 list2.Add(i);
                 if (i == this.m_Layer.syncedLayerIndex)
                 {
                     selectedIndex = list.Count - 1;
                 }
             }
         }
         using (new EditorGUI.DisabledScope(list.Count == 0))
         {
             GUILayout.BeginHorizontal(new GUILayoutOption[0]);
             bool flag2 = EditorGUILayout.Toggle(s_Styles.sync, this.m_Layer.syncedLayerIndex > -1, new GUILayoutOption[0]);
             GUILayout.Space(10f);
             GUI.enabled = flag2 && (this.m_Layer.blendingMode == AnimatorLayerBlendingMode.Override);
             EditorGUI.BeginChangeCheck();
             this.m_Layer.syncedLayerAffectsTiming = EditorGUILayout.Toggle(s_Styles.timing, this.m_Layer.syncedLayerAffectsTiming, new GUILayoutOption[0]);
             if (EditorGUI.EndChangeCheck())
             {
                 flag = true;
             }
             GUI.enabled = true;
             GUILayout.EndHorizontal();
             if (flag2)
             {
                 int num5 = EditorGUILayout.Popup(s_Styles.sourceLayer, selectedIndex, list.ToArray(), new GUILayoutOption[0]);
                 if ((num5 < list2.Count) && (list2[num5] != this.m_Layer.syncedLayerIndex))
                 {
                     this.m_Layer.syncedLayerIndex = list2[num5];
                     flag = true;
                 }
             }
             else if (this.m_Layer.syncedLayerIndex != -1)
             {
                 this.m_Layer.syncedLayerIndex = -1;
                 flag = true;
             }
         }
         EditorGUI.BeginChangeCheck();
         this.m_Layer.iKPass = EditorGUILayout.Toggle(s_Styles.ik, this.m_Layer.iKPass, new GUILayoutOption[0]);
         if (EditorGUI.EndChangeCheck())
         {
             flag = true;
         }
         if (flag)
         {
             Undo.RegisterCompleteObjectUndo(this.m_Controller, "Layer settings Changed");
             layers[this.m_LayerIndex] = this.m_Layer;
             this.m_Controller.layers = layers;
             this.m_Layer = this.m_Controller.layers[this.m_LayerIndex];
             AnimatorControllerTool.tool.ResetUI();
         }
     }
 }
コード例 #3
0
 public void OnGUI(Rect rect)
 {
     if (s_Styles == null)
     {
         s_Styles = new Styles();
     }
     Event current = Event.current;
     if ((current.type == EventType.MouseDown) && rect.Contains(current.mousePosition))
     {
         this.m_HadKeyFocusAtMouseDown = this.m_ParameterList.HasKeyboardControl();
     }
     this.KeyboardHandling();
     if (this.m_Host.animatorController != null)
     {
         this.DoParameterList();
     }
 }
コード例 #4
0
 private static void InitStyles()
 {
     if (s_Styles == null)
     {
         s_Styles = new Styles();
     }
 }