Example #1
0
        public RootSOTreeView(RootSO rootSO, EditorWindow editor)
        {
            _rootSO          = rootSO;
            style.flexGrow   = 1;
            style.flexShrink = 1;

            SetupZoom(ContentZoomer.DefaultMinScale, ContentZoomer.DefaultMaxScale);
            Insert(0, new GridBackground());

            var contentDragger = new ContentDragger();

            //default activator requires Alt key. Alt key is tired.
            contentDragger.activators.Add(new ManipulatorActivationFilter()
            {
                button = MouseButton.LeftMouse,
            });
            // item dragging is prior to view dragging.
            this.AddManipulator(new SelectionDragger());
            this.AddManipulator(contentDragger);

            var provider = ScriptableObject.CreateInstance <NodeSearchWindowProvider>();

            provider.Initialize(this, editor);

            nodeCreationRequest += context =>
            {
                SearchWindow.Open(new SearchWindowContext(context.screenMousePosition), provider);
            };
        }
    public ExampleGraphView(EditorWindow editor, ref GraphAsset asset)
    {
        graphAsset   = asset;
        editorWindow = editor;

        //AddElement(new ExampleNode());  //ノードの追加

        //諸々の設定
        this.StretchToParentSize();

        contentDragger   = new ContentDragger();
        selectionDragger = new SelectionDragger();

        SetupZoom(ContentZoomer.DefaultMinScale, ContentZoomer.DefaultMaxScale);
        this.AddManipulator(new ContextualMenuManipulator(OnContextMenuPopulate));

        this.AddManipulator(contentDragger);
        this.AddManipulator(selectionDragger);
        //this.AddManipulator(new RectangleSelector());

        //右クリックでのメニューの表示
        searchWindow = ScriptableObject.CreateInstance <SearchMenuWindow>();
        searchWindow.Init(this, editor, ref graphAsset);

        nodeCreationRequest += context =>
        {
            SearchWindow.Open(new SearchWindowContext(context.screenMousePosition), searchWindow);
        };
    }
Example #3
0
        public TestGraphView()
        {
            SetupZoom(ContentZoomer.DefaultMinScale, ContentZoomer.DefaultMaxScale);

            contentDragger    = new ContentDragger();
            selectionDragger  = new SelectionDragger();
            rectangleSelector = new RectangleSelector();
            freehandSelector  = new FreehandSelector();

            this.AddManipulator(contentDragger);
            this.AddManipulator(selectionDragger);
            this.AddManipulator(rectangleSelector);
            this.AddManipulator(freehandSelector);

            Insert(0, new GridBackground());

            focusable = true;
        }
Example #4
0
    public DialogueGraphView()
    {
        //constructor
        SetupZoom(ContentZoomer.DefaultMinScale, ContentZoomer.DefaultMaxScale);

        this.AddManipulator(new ClickSelector());
        var contentDragger = new ContentDragger
        {
            panSpeed = moveSpeed
        };

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

        //AddElement(GenerateEntryNode());

        style.backgroundColor = new Color(0.16f, 0.16f, 0.16f);
    }
Example #5
0
        public void Initialize()
        {
            graphViewChanged += GraphChanged;

            var contentDragger = new ContentDragger();

            this.AddManipulator(contentDragger);
            var selectionDragger = new SelectionDragger();

            this.AddManipulator(selectionDragger);
            this.AddManipulator(new ClickSelector());
            this.AddManipulator(new ContentZoomer());
            this.AddManipulator(new RectangleSelector());
            _mousePosProvider = new BTMousePosProvider();
            this.AddManipulator(_mousePosProvider);
            SetupZoom(minScale, maxScale);

            serializeGraphElements += SerializeForCopy;
            unserializeAndPaste    += UnserializeAndPaste;
            _isInitialized          = true;
        }