Beispiel #1
0
 public TagsTreeView(TreeViewState state, TransitionProfile profile)
     : base(state)
 {
     this.profile = profile;
     showAlternatingRowBackgrounds = true;
     Reload();
 }
Beispiel #2
0
        public void BeginEdit(TransitionProfile profile)
        {
            statePanelView      = paramPanelView = tagsPanelView = null;
            transitionPanelView = null;
            OnEnable();

            this.profile = profile;
        }
Beispiel #3
0
            public TransitionTreeView(TreeViewState state, TransitionProfile profile)
                : base(state, new MultiColumnHeader(CreateColumnHeaderState()))
            {
                this.profile                  = profile;
                multiColumnHeader.height      = MultiColumnHeader.DefaultGUI.minimumHeight;
                showAlternatingRowBackgrounds = true;

                Reload();
            }
Beispiel #4
0
        void FromStateFilterInspector(TransitionProfile profile, FromStateFilter filter, ref Rect stateRect)
        {
            EGL.BeginHorizontal();
            filter.type = (FromStateType)EGL.EnumPopup(filter.type, GL.Width(70));

            if (filter.type == FromStateType.State)
            {
                EditorGUIUtil.AutoCompleteList(filter.stateOrTagName, allStateNames, str => filter.stateOrTagName = str, ref stateRect);
            }
            else if (filter.type == FromStateType.Tag)
            {
                EditorGUIUtil.AutoCompleteList(filter.stateOrTagName, transition.profile.tags, str => filter.stateOrTagName = str, ref stateRect);
            }

            if (filter.type == FromStateType.State)
            {
                var state = transition.profile.FindState(filter.stateOrTagName);
                if (state == null)
                {
                    EGL.EndHorizontal();
                    EGL.HelpBox("No Source State", MessageType.Error);
                }
                else
                {
                    List <string> portionSelections = new List <string>();
                    portionSelections.Add("<any>");
                    foreach (var p in state.allPortions)
                    {
                        portionSelections.Add(p.name);
                    }

                    var prevIndex = portionSelections.IndexOf(filter.portionName);
                    if (prevIndex == -1)
                    {
                        prevIndex = 0;
                    }

                    prevIndex          = EGL.Popup(prevIndex, portionSelections.ToArray());
                    filter.portionName = prevIndex == 0 ? "" : portionSelections[prevIndex];

                    if (GL.Button("Focus"))
                    {
                        Utils.FocusEditingAnimation(profile, state.stateName);
                    }
                    EGL.EndHorizontal();
                }
            }
            else
            {
                EGL.EndHorizontal();
            }
        }
        State CloneState(TransitionProfile p, State s)
        {
            var ret = Instantiate(s) as State;

            ret.profile    = p;
            ret.behaviours = CloneBehaviourList(ret.behaviours, s);

            foreach (var portion in ret.portions)
            {
                portion.behaviours = CloneBehaviourList(portion.behaviours, s);
            }

            return(ret);
        }
        public TransitionProfile CreateRuntimeClone()
        {
            TransitionProfile ret = Instantiate(this) as TransitionProfile;

            // Deep clone states and parameters
            for (int i = 0; i < ret.states.Count; ++i)
            {
                ret.states[i] = CloneState(ret, ret.states[i]);
            }

            for (int i = 0; i < ret.parameters.Count; ++i)
            {
                ret.parameters[i] = new Param(ret.parameters[i]);
            }

            return(ret);
        }
Beispiel #7
0
        public static void FocusEditingAnimation(TransitionProfile profile, string stateName)
        {
            var target = AnimationReflection.inst.GetEditTarget();

            if (target != null && target.animator && profile.controller == target.animator.runtimeAnimatorController)
            {
                var clip = Utils.FindState(profile.controller.layers[0].stateMachine, stateName)?.motion as AnimationClip;
                if (clip)
                {
                    AnimationReflection.inst.ChangeSelection(clip);
                }
                else
                {
                    Debug.LogWarning("No corresponding animation clip for state " + stateName);
                }
            }
        }
        private void Awake()
        {
            _animator = GetComponent <Animator>();
            profile   = profile.CreateRuntimeClone();

            foreach (var p in profile.parameters)
            {
                paramTable.Add(new Param(p));
            }

            // 初始化condition的name index
            foreach (var trans in profile.transitions)
            {
                foreach (var cond in trans.conditions)
                {
                    cond.nameIndex = GetParamIndex(cond.name);
                }
            }
        }
Beispiel #9
0
            public AddBehaviourPopup(TransitionProfile _profile, List <StateBehaviour> _list)
            {
                profile     = _profile;
                list        = _list;
                searchField = new SearchField();
                searchField.SetFocus();

                var scripts = (MonoScript[])Resources.FindObjectsOfTypeAll(typeof(MonoScript));

                foreach (var script in scripts)
                {
                    var type = script.GetClass();

                    if (type != null && typeof(StateBehaviour).IsAssignableFrom(type) && !type.IsAbstract)
                    {
                        behaviourTypes.Add(script.name);
                    }
                }
            }