Beispiel #1
0
        //...
        static void ProccessMessage(Logger.Message msg)
        {
            Object unityContext = null;

            var graph = Graph.GetElementGraph(msg.context);

            if (graph != null)
            {
                unityContext = graph.agent != null ? (Object)graph.agent.gameObject : (Object)graph;
            }
            else
            {
                unityContext = msg.context as Object;
            }

            if (unityContext != null)
            {
                Selection.activeObject = unityContext;
                EditorGUIUtility.PingObject(unityContext);
            }

            //cease here if no graph
            if (graph == null)
            {
                return;
            }

            var editor = GraphEditor.current;

            if (editor == null || GraphEditor.currentGraph != graph)
            {
                editor = GraphEditor.OpenWindow(graph);
            }

            IGraphElement element = null;

            if (msg.context is IGraphElement)
            {
                element = (IGraphElement)msg.context;
            }
            if (msg.context is Task)
            {
                element = graph.GetTaskParentElement((Task)msg.context);
            }
            if (msg.context is BBParameter)
            {
                element = graph.GetParameterParentElement((BBParameter)msg.context);
            }

            EditorApplication.delayCall += () => GraphEditor.FocusElement(element, true);
        }
Beispiel #2
0
        ///Focus element. This also Pings it. User click.
        void FocusElement(Hierarchy.Element e)
        {
            var element = e.GetFirstParentReferenceOfType <IGraphElement>();

            EditorApplication.delayCall += () => GraphEditor.FocusElement(element, true);
        }