protected void ComputeTransitionContexts()
        {
            this.m_TransitionContexts = new TransitionEditionContext[base.targets.Length];
            Graph    graph    = (!AnimatorControllerTool.tool) ? null : AnimatorControllerTool.tool.stateMachineGraph;
            GraphGUI graphGUI = (!AnimatorControllerTool.tool) ? null : AnimatorControllerTool.tool.stateMachineGraphGUI;

            for (int i = 0; i < base.targets.Length; i++)
            {
                AnimatorTransitionBase animatorTransitionBase = base.targets[i] as AnimatorTransitionBase;
                this.m_TransitionContexts[i] = new TransitionEditionContext(animatorTransitionBase, null, null, null);
                if (graph != null && graphGUI != null)
                {
                    foreach (int current in graphGUI.edgeGUI.edgeSelection)
                    {
                        EdgeInfo edgeInfo = graph.GetEdgeInfo(graph.edges[current]);
                        foreach (TransitionEditionContext current2 in edgeInfo.transitions)
                        {
                            if (current2.transition == animatorTransitionBase)
                            {
                                this.m_TransitionContexts[i] = current2;
                            }
                        }
                    }
                }
            }
        }
예제 #2
0
        private void HandleContextMenu()
        {
            Event current = Event.current;

            if (current.type != EventType.ContextClick)
            {
                return;
            }
            GenericMenu genericMenu = new GenericMenu();

            genericMenu.AddItem(new GUIContent("Create State/Empty"), false, new GenericMenu.MenuFunction2(this.AddStateEmptyCallback), Event.current.mousePosition);
            if (GraphGUI.HasMotionSelected())
            {
                genericMenu.AddItem(new GUIContent("Create State/From Selected Clip"), false, new GenericMenu.MenuFunction2(this.AddStateFromSelectedMotionCallback), Event.current.mousePosition);
            }
            else
            {
                genericMenu.AddDisabledItem(new GUIContent("Create State/From Selected Clip"));
            }
            genericMenu.AddItem(new GUIContent("Create State/From New Blend Tree"), false, new GenericMenu.MenuFunction2(this.AddStateFromNewBlendTreeCallback), Event.current.mousePosition);
            genericMenu.AddItem(new GUIContent("Create Sub-State Machine"), false, new GenericMenu.MenuFunction2(this.AddStateMachineCallback), Event.current.mousePosition);
            if (Unsupported.HasStateMachineDataInPasteboard())
            {
                genericMenu.AddItem(new GUIContent("Paste"), false, new GenericMenu.MenuFunction2(this.PasteCallback), Event.current.mousePosition);
            }
            else
            {
                genericMenu.AddDisabledItem(new GUIContent("Paste"));
            }
            genericMenu.AddItem(new GUIContent("Copy current StateMachine"), false, new GenericMenu.MenuFunction2(this.CopyStateMachineCallback), Event.current.mousePosition);
            genericMenu.ShowAsContext();
        }
예제 #3
0
파일: Graph.cs 프로젝트: wensincai/Unity5.4
        internal override UnityEditor.Graphs.GraphGUI GetEditor()
        {
            GraphGUI graphGUI = ScriptableObject.CreateInstance <GraphGUI>();

            graphGUI.graph     = this;
            graphGUI.hideFlags = HideFlags.HideAndDontSave;
            return(graphGUI);
        }
	private static void SetGraphGUI(UnityEditor.Graphs.AnimationStateMachine.GraphGUI newGraphGUI) {
		if (animatorControllerWindow != null) {
			var currentGraphGUI = animatorControllerWindow.stateMachineGraphGUI;
			newGraphGUI.graph = currentGraphGUI.graph;
			newGraphGUI.hideFlags = HideFlags.HideAndDontSave;

			animatorControllerWindow.stateMachineGraphGUI = newGraphGUI;
		}
	}
예제 #5
0
 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;
 }