Esempio n. 1
0
        public BaseGraphView(EditorWindow window)
        {
            serializeGraphElements = SerializeGraphElementsCallback;
            canPasteSerializedData = CanPasteSerializedDataCallback;
            unserializeAndPaste    = UnserializeAndPasteCallback;
            graphViewChanged       = GraphViewChangedCallback;
            viewTransformChanged   = ViewTransformChangedCallback;
            elementResized         = ElementResizedCallback;

            RegisterCallback <KeyDownEvent>(KeyDownCallback);
            RegisterCallback <DragPerformEvent>(DragPerformedCallback);
            RegisterCallback <DragUpdatedEvent>(DragUpdatedCallback);
            RegisterCallback <MouseDownEvent>(MouseDownCallback);
            RegisterCallback <MouseUpEvent>(MouseUpCallback);

            InitializeManipulators();

            SetupZoom(0.05f, 2f);

            Undo.undoRedoPerformed += ReloadView;

            createNodeMenu = ScriptableObject.CreateInstance <CreateNodeMenuWindow>();
            createNodeMenu.Initialize(this, window);

            if (nodeInspector == null)
            {
                nodeInspector = CreateNodeInspectorObject();
            }

            this.StretchToParentSize();
        }
 protected virtual void OnEnable()
 {
     inspector = target as NodeInspectorObject;
     inspector.nodeSelectionUpdated += UpdateNodeInspectorList;
     root             = new VisualElement();
     selectedNodeList = new VisualElement();
     selectedNodeList.styleSheets.Add(Resources.Load <StyleSheet>("GraphProcessorStyles/InspectorView"));
     root.Add(selectedNodeList);
     placeholder = new Label("Select a node to show it's settings in the inspector");
     placeholder.AddToClassList("PlaceHolder");
     UpdateNodeInspectorList();
 }