protected NodePresenter(INodeView nodeView, NodeData nodeData, ConnectionPointPresenter connectionPointInPresenter, ConnectionPointPresenter connectionPointOutPresenter)
        {
            _nodeView = nodeView;
            _nodeData = nodeData;
            _connectionPointInPresenter  = connectionPointInPresenter;
            _connectionPointOutPresenter = connectionPointOutPresenter;

            _nodeView.MouseClicked += OnMouseClicked;

            _connectionPointInPresenter.Selected    += ConnectionPointInPresenterOnSelected;
            _connectionPointOutPresenter.Selected   += ConnectionPointOutPresenterOnSelected;
            _connectionPointInPresenter.UnSelected  += ConnectionPointInPresenterOnUnSelected;
            _connectionPointOutPresenter.UnSelected += ConnectionPointOutPresenterOnUnSelected;

            Id = Guid.NewGuid();
        }
        public ConnectionPointView(INodeView nodeView, ConnectionPointType type)
        {
            _rect     = new Rect(0, 0, Width, Height);
            _nodeView = nodeView;
            _type     = type;

            switch (type)
            {
            case ConnectionPointType.In:
                _style = StylesCollection.GetStyle(VntStyles.ConnectionIn);
                break;

            case ConnectionPointType.Out:
                _style = StylesCollection.GetStyle(VntStyles.ConnectionOut);
                break;
            }
        }
Esempio n. 3
0
        protected NodePresenter(INodeView nodeView, NodeData nodeData,
                                PortPresenter portPresenter, PortPresenter portOutPresenter)
        {
            _nodeView = nodeView;
            NodeData  = nodeData;
            Port      = portPresenter;
            PortOut   = portOutPresenter;

            _nodeView.MouseClicked += OnMouseClicked;
            _nodeView.Selected     += OnSelected;

            Port.Selected      += ConnectionPointInPresenterOnSelected;
            PortOut.Selected   += ConnectionPointOutPresenterOnSelected;
            Port.UnSelected    += ConnectionPointInPresenterOnUnSelected;
            PortOut.UnSelected += ConnectionPointOutPresenterOnUnSelected;

            Id = Guid.NewGuid();
        }
        public QuestionNodePresenter(INodeView nodeView,
                                     NodeData nodeData,
                                     ConnectionPointPresenter connectionPointInPresenter,
                                     ConnectionPointPresenter connectionPointOutPresenter) :
            base(nodeView, nodeData, connectionPointInPresenter, connectionPointOutPresenter)
        {
            _nodeView = nodeView;

            var parameter = new NodeParameter("Texture Path")
            {
                IsClickable = true
            };

            _nodeParametersPanel = new NodeParametersPanel(new List <NodeParameter>
            {
                parameter
            });
        }
 private void CreateValueConnections(INodeView view, INode node)
 {
     foreach (var valueIn in node.ValueInPorts.Values)
     {
         foreach (var connection in Graph.ValueInConnections.SafeGet(valueIn.Id))
         {
             if (!_nodeViewCache.TryGetValue(connection.Node, out var outputView))
             {
                 continue;
             }
             var inputPort  = view.ValueInPortContainer.Q <PortView>(valueIn.Id.Port);
             var outputPort = outputView.ValueOutPortContainer.Q <PortView>(connection.Port);
             if (inputPort != null && outputPort != null)
             {
                 AddElement(outputPort.ConnectTo(inputPort));
             }
         }
     }
 }
Esempio n. 6
0
        public void ConvertToNodes(IViewWrapper customView, INodeView node, InspectorViewMode viewMode)
        {
            var current     = new NodeView(customView);
            var nodeWrapper = new MacNodeWrapper(current);

            node.AddChild(nodeWrapper);

            if (customView.HasConstraints)
            {
                var contraintContainer              = new MacConstrainContainerWrapper(customView);
                var constraintsContainerNodeView    = new NodeView(contraintContainer);
                var constraintsContainerNodeWrapper = new MacNodeWrapper(constraintsContainerNodeView);
                nodeWrapper.AddChild(constraintsContainerNodeWrapper);

                foreach (var item in customView.Constraints)
                {
                    var constraintNodeView = new NodeView(item);
                    var constraintWrapper  = new MacNodeWrapper(constraintNodeView);
                    constraintsContainerNodeWrapper.AddChild(constraintWrapper);
                }
            }

            if (customView.Subviews == null)
            {
                return;
            }

            foreach (var item in customView.Subviews)
            {
                try
                {
                    ConvertToNodes(item, nodeWrapper, viewMode);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                }
            }
        }
 private void CreateFlowConnections(INodeView view, INode flowNode)
 {
     foreach (var flowOut in flowNode.FlowOutPorts.Values)
     {
         foreach (var connection in Graph.FlowOutConnections.SafeGet(flowOut.Id))
         {
             if (!_nodeViewCache.TryGetValue(connection.Node, out var inputView))
             {
                 Debug.Log($"Unable To Find Node View for {connection.Node}");
                 continue;
             }
             var inputPort  = inputView.FlowInPortContainer.Q <PortView>(connection.Port);
             var outputPort = view.FlowOutPortContainer.Q <PortView>(flowOut.Id.Port);
             if (inputPort != null && outputPort != null)
             {
                 AddElement(outputPort.ConnectTo(inputPort));
             }
             else
             {
                 Debug.Log($"Unable To Make a Flow Port Connection | {flowOut} => {connection.Node}.{connection.Port}");
             }
         }
     }
 }
Esempio n. 8
0
 public void BindNodeView(INodeView nodeView)
 {
     nodeView.SetPresenter(this);
     _nodeView = nodeView;
 }
Esempio n. 9
0
 public void AddChild(INodeView nodel)
 {
     this.nodel.AddChild(nodel.NativeObject as NodeView);
 }
Esempio n. 10
0
 /// <summary>
 /// this function sets the style information of the node GUI
 /// </summary>
 /// <param name="gui">the Gui item you want to setup</param>
 private void SetStyleInfo(INodeView gui)
 {
     try
     {
         gui.StyleDrawingInformation = this.style.DrawingInformation;
     }
     catch (System.Exception)
     {
         /* Create an error message */
         this.viewManager.AddDebugMessage("An Error occured in the UserControl \"" +
         gui.GetType().FullName +
         "\" when the program tried to change the \"StyleDrawingInformation\" property.");
     }
 }
Esempio n. 11
0
        /// <summary>
        /// this function sets the GUI component from the node and is's style
        /// </summary>
        private void SetGUIComponent()
        {
            INodeView gui;
            try
            {
                gui = this.style.GetNewNodeView();
            }
            catch (Exception)
            {
                this.viewManager.AddDebugMessage("The imported Theme \"" + style.ViewConstructor.DeclaringType.FullName + "\" cannot be used. You should rebuild the corresponding library with the current version of ICE XAP file, and try again.");
                gui = new view.NodeView();
            }

            this.SetStyleInfo(gui);

            if (this.guiComponent != null && this.viewManager.IsInGraph((UserControl)this.guiComponent))
            {
                this.viewManager.ReplaceGraphComponent((UserControl)this.guiComponent, (UserControl)gui);
            }

            this.guiComponent = gui;

            // set the event on the node view
            this.SetViewManagement();

            // set the scale tool
            ScaleTransform scaleTransform = new ScaleTransform();
            ((FrameworkElement)this.guiComponent).RenderTransform = scaleTransform;

            // set the center
            ((FrameworkElement)this.guiComponent).Measure(new Size(double.MaxValue, double.MaxValue));
            scaleTransform.CenterX = ((FrameworkElement)this.guiComponent).DesiredSize.Width / 2;
            scaleTransform.CenterY = ((FrameworkElement)this.guiComponent).DesiredSize.Height / 2;

            this.UpdateGUIComponentSize();
        }