protected override void PopulateSession(IDictionary <string, object> session) { base.PopulateSession(session); session["m_GenerateClipNames"] = m_GenerateClipNames; session["m_GenerateLayerNames"] = m_GenerateLayerNames; session["m_GenerateParamaters"] = m_GenerateParamaters; session["m_EnumName"] = string.Empty; Dictionary <string, List <AnimatorController> > animatorControllerMap = new Dictionary <string, List <AnimatorController> >(); for (int i = 0; i < m_AnimatorsData.Count; i++) { AnimatorData data = m_AnimatorsData[i]; if (!animatorControllerMap.ContainsKey(data.className)) { animatorControllerMap[data.className] = new List <AnimatorController>(); } if (data.controller != null) { if (animatorControllerMap[data.className].Contains(data.controller)) { Debug.LogError("The Animator Controller '" + data.controller.name + "' is already defined."); } else { animatorControllerMap[data.className].Add(data.controller); } } } session["m_AnimatorControllerMap"] = animatorControllerMap; }
private void OnDrawElement(Rect rect, int index, bool isActive, bool isFocused) { Rect classNameRect = rect; classNameRect.width /= 2.0f; Rect animatorRect = classNameRect; animatorRect.x += animatorRect.width; AnimatorData data = m_AnimatorsData[index]; data.className = EditorGUILayoutEx.ClassNameTextField(classNameRect, data.className, "ClassName"); EditorGUI.BeginChangeCheck(); { data.controller = EditorGUI.ObjectField(animatorRect, data.controller, typeof(AnimatorController), false) as AnimatorController; } if (EditorGUI.EndChangeCheck()) { if (string.IsNullOrEmpty(data.className) && data.controller != null) { data.className = data.controller.name; } } m_AnimatorsData[index] = data; }
private void OnAnimatorAdded(ReorderableList list) { AnimatorData data = new AnimatorData(); m_AnimatorsData.Add(data); }