Пример #1
0
        private void OnEnable()
        {
            _inspectorObject = target as InspectorObject;
            _inspectorObject.SelectionChanged += SelectionChanged;

            _root = new VisualElement();
            _root.styleSheets.Add(Resources.Load <StyleSheet>("Styles/NodeInspector"));

            SelectionChanged();
        }
Пример #2
0
        public BehaviourGraphView(EditorWindow window, BehaviourGraph graph)
        {
            SetupZoom(ContentZoomer.DefaultMinScale, ContentZoomer.DefaultMaxScale);

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

            graphViewChanged = OnGraphViewChanged;

            _graph = graph;

            _searchWindow = ScriptableObject.CreateInstance <NodeSearchWindow>();
            _searchWindow.Init(window, this);
            nodeCreationRequest = context =>
                                  SearchWindow.Open(new SearchWindowContext(context.screenMousePosition), _searchWindow);

            _inspectorObject           = ScriptableObject.CreateInstance <InspectorObject>();
            _inspectorObject.name      = "Node Inspector";
            _inspectorObject.hideFlags = HideFlags.HideAndDontSave ^ HideFlags.NotEditable;
            _inspectorObject.View      = this;

            Properties = new List <ExposedProperty>();

            RegisterCallback <MouseUpEvent>(OnMouseUp);
            RegisterCallback <MouseDownEvent>(OnMouseDown);

            RegisterCallback <KeyDownEvent>(OnKeyDown);

            styleSheets.Add(Resources.Load <StyleSheet>("Styles/GraphView"));

            Insert(0, new GridBackground());

            Undo.undoRedoPerformed += UpdateInspectorSelection;
        }