Ejemplo n.º 1
0
        public void Initialize(BaseGraphView owner, BaseNode node)
        {
            nodeTarget = node;
            this.owner = owner;

            owner.computeOrderUpdated += ComputeOrderUpdatedCallback;
            node.onMessageAdded       += AddMessageView;
            node.onMessageRemoved     += RemoveMessageView;
            node.onPortsUpdated       += UpdatePortsForField;

            styleSheets.Add(Resources.Load <StyleSheet>(baseNodeStyle));

            if (!string.IsNullOrEmpty(node.layoutStyle))
            {
                styleSheets.Add(Resources.Load <StyleSheet>(node.layoutStyle));
            }

            InitializePorts();
            InitializeView();
            InitializeDebug();

            // If the standard Enable method is still overwritten, we call it
            if (GetType().GetMethod(nameof(Enable), new Type[] {}).DeclaringType != typeof(BaseNodeView))
            {
                ExceptionToLog.Call(() => Enable());
            }
            else
            {
                ExceptionToLog.Call(() => Enable(false));
            }

            InitializeSettings();

            RefreshExpandedState();

            this.RefreshPorts();

            RegisterCallback <GeometryChangedEvent>(OnGeometryChanged);
            OnGeometryChanged(null);
        }
Ejemplo n.º 2
0
        public void Initialize(BaseGraphView owner, BaseNode node)
        {
            nodeTarget = node;
            this.owner = owner;

            owner.computeOrderUpdated += ComputeOrderUpdatedCallback;

            styleSheets.Add(Resources.Load <StyleSheet>(baseNodeStyle));

            if (!string.IsNullOrEmpty(node.layoutStyle))
            {
                styleSheets.Add(Resources.Load <StyleSheet>(node.layoutStyle));
            }

            InitializePorts();
            InitializeView();
            InitializeDebug();

            Enable();

            this.RefreshPorts();
        }
Ejemplo n.º 3
0
        public void InitializeGraph(BaseGraph graph)
        {
            this.graph = graph;

            if (graphView != null)
            {
                rootView.Remove(graphView);
            }

            //Initialize will provide the BaseGraphView
            Initialize(graph);

            graphView = rootView.Children().FirstOrDefault(e => e is BaseGraphView) as BaseGraphView;

            if (graphView == null)
            {
                Debug.LogError("GraphView has not been added to the BaseGraph root view !");
                return;
            }

            graphView.Initialize(graph);
        }
Ejemplo n.º 4
0
        protected override void Initialize(BaseGraphView graphView)
        {
            this.graphView = graphView;
            base.title     = title;
            scrollable     = true;

            graphView.onExposedParameterListChanged += UpdateParameterList;
            graphView.initialized  += UpdateParameterList;
            Undo.undoRedoPerformed += UpdateParameterList;

            RegisterCallback <DragUpdatedEvent>(OnDragUpdatedEvent);
            RegisterCallback <DragPerformEvent>(OnDragPerformEvent);
            RegisterCallback <MouseDownEvent>(OnMouseDownEvent, TrickleDown.TrickleDown);

            UpdateParameterList();

            // Add exposed parameter button
            header.Add(new Button(OnAddClicked)
            {
                text = "+"
            });
        }
Ejemplo n.º 5
0
        public void Initialize(BaseGraphView graphView, Group block)
        {
            group = block;
            owner = graphView;

            title = block.title;
            SetPosition(block.position);

            headerContainer.Q <TextField>().RegisterCallback <ChangeEvent <string> >(TitleChangedCallback);
            titleLabel = headerContainer.Q <Label>();

            colorField = new ColorField {
                value = group.color, name = "headerColorPicker"
            };
            colorField.RegisterValueChangedCallback(e =>
            {
                UpdateGroupColor(e.newValue);
            });
            UpdateGroupColor(group.color);

            headerContainer.Add(colorField);

            InitializeInnerNodes();
        }
Ejemplo n.º 6
0
 protected virtual void InitializeGraphView(BaseGraphView view)
 {
 }
Ejemplo n.º 7
0
 public BaseEdgeConnector(IEdgeConnectorListener listener) : base()
 {
     graphView = (listener as BaseEdgeConnectorListener)?.graphView;
     active    = false;
     InitEdgeConnector(listener);
 }
Ejemplo n.º 8
0
 public BaseEdgeConnectorListener(BaseGraphView graphView)
 {
     this.graphView = graphView;
 }
Ejemplo n.º 9
0
 public MiniMapView(BaseGraphView baseGraphView)
 {
     this.graphView = baseGraphView;
     SetPosition(new Rect(0, 0, 100, 100));
     size = new Vector2(100, 100);
 }
 protected abstract void Initialize(BaseGraphView graphView);
Ejemplo n.º 11
0
        public ExposedParameterPropertyView(BaseGraphView graphView, ExposedParameter param, string shortType) : base()
        {
            baseGraphView = graphView;
            parameter     = param;
            graphView.graph.onExposedParameterModified += UpdateSettingsVisibility;

            thisIsDynamicParameter = new Label("This is Dynamic");
            thisIsDynamicParameter.style.marginBottom = -5;
            Add(thisIsDynamicParameter);

            hideInInspector = new Toggle
            {
                text  = "Hide in Inspector",
                value = parameter.settings.isHidden
            };

            hideInInspector.RegisterValueChangedCallback(e =>
            {
                baseGraphView.graph.UpdateExposedParameterVisibility(parameter, e.newValue);
                UpdateSliderOption();
            });

            Add(hideInInspector);

            if (shortType != "Single" && shortType != "Int32")
            {
                UpdateSettingsVisibility(param.name);
                return;
            }

            thisIsDynamicParameter.style.marginBottom = -10;

            canBeSlider = true;

            showAsSlider = new Toggle
            {
                text  = "Show as Slider",
                value = parameter.settings.isSlider
            };
            showAsSlider.RegisterValueChangedCallback(e =>
            {
                baseGraphView.graph.UpdateExposedSliderVisibility(parameter, e.newValue);
                UpdateSliderFields();
            });

            sliderMin = new FloatField
            {
                label = "Min Value",
                value = parameter.settings.sliderMinValue
            };
            sliderMin.RegisterValueChangedCallback(e => baseGraphView.graph.UpdateExposedSliderMinValue(parameter, e.newValue));

            sliderMax = new FloatField
            {
                label = "Max Value",
                value = parameter.settings.sliderMaxValue
            };
            sliderMax.RegisterValueChangedCallback(e => baseGraphView.graph.UpdateExposedSliderMaxValue(parameter, e.newValue));

            Add(showAsSlider);
            Add(sliderMin);
            Add(sliderMax);
            UpdateSliderFields();
            UpdateSettingsVisibility(param.name);
        }
Ejemplo n.º 12
0
 public MiniMapView(BaseGraphView baseGraphView)
 {
     this.graphView = baseGraphView;
     SetPosition(new Rect(2, 20, 100, 100));
 }