Exemple #1
0
        internal override void OnHeaderTitleGUI(Rect titleRect, string header)
        {
            base.serializedObject.Update();
            Rect position = titleRect;

            position.height = 16f;
            EditorGUI.BeginChangeCheck();
            EditorGUI.showMixedValue = this.m_Name.hasMultipleDifferentValues;
            string text = EditorGUI.DelayedTextField(position, this.m_Name.stringValue, EditorStyles.textField);

            EditorGUI.showMixedValue = false;
            if (EditorGUI.EndChangeCheck() && !string.IsNullOrEmpty(text) && text != this.m_Name.stringValue)
            {
                AnimatorStateMachine animatorStateMachine = this.controllerContext.FindEffectiveRootStateMachine(this.m_LayerIndexContext);
                UnityEngine.Object[] targets = base.targets;
                for (int i = 0; i < targets.Length; i++)
                {
                    UnityEngine.Object   @object = targets[i];
                    AnimatorStateMachine animatorStateMachine2 = animatorStateMachine.FindStateMachine(@object as AnimatorState);
                    if (animatorStateMachine2 != null)
                    {
                        ObjectNames.SetNameSmart(@object, animatorStateMachine2.MakeUniqueStateName(text));
                    }
                }
            }
            base.serializedObject.ApplyModifiedProperties();
        }
Exemple #2
0
        internal override void OnHeaderTitleGUI(Rect titleRect, string header)
        {
            base.serializedObject.Update();
            Rect position = titleRect;

            position.height = 16f;
            EditorGUI.BeginChangeCheck();
            EditorGUI.showMixedValue = this.m_Name.hasMultipleDifferentValues;
            string str = EditorGUI.DelayedTextField(position, this.m_Name.stringValue, EditorStyles.textField);

            EditorGUI.showMixedValue = false;
            if ((EditorGUI.EndChangeCheck() && !string.IsNullOrEmpty(str)) && (str != this.m_Name.stringValue))
            {
                AnimatorStateMachine machine = this.controllerContext.FindEffectiveRootStateMachine(this.m_LayerIndexContext);
                foreach (UnityEngine.Object obj2 in base.targets)
                {
                    AnimatorStateMachine machine2 = machine.FindStateMachine(obj2 as AnimatorState);
                    if (machine2 != null)
                    {
                        ObjectNames.SetNameSmart(obj2, machine2.MakeUniqueStateName(str));
                    }
                }
            }
            base.serializedObject.ApplyModifiedProperties();
        }