Esempio n. 1
0
        public virtual void Init(GraphData graphData)
        {
            GraphData        = graphData;
            SerializedObject = new SerializedObject(GraphData);
            styleSheets.Add(Resources.Load <StyleSheet>("Graph"));

            Insert(0, new GridBackground());

            this.AddManipulator(new ContentDragger());
            this.AddManipulator(new SelectionDragger());
            this.AddManipulator(new RectangleSelector());

            SetupZoom(NodePreference.Setting.min, NodePreference.Setting.max);

            SearchWindow         = BuildSearchWindow();
            nodeCreationRequest += (context =>
            {
                UnityEditor.Experimental.GraphView.SearchWindow.Open(
                    new SearchWindowContext(context.screenMousePosition), SearchWindow);
            });

            RegisterCallbacks();

            GenerateAndLinkNodes();

            foreach (GroupData groupData in GraphData.groups)
            {
                GenerateGroup(groupData);
            }

            Inited = true;
        }
Esempio n. 2
0
        // 构建节点列表窗口
        public virtual NodeSearchWindow BuildSearchWindow()
        {
            NodeSearchWindow searchWindow = ScriptableObject.CreateInstance <NodeSearchWindow>();

            searchWindow.Init(this, GetNodeTypes());
            return(searchWindow);
        }