Example #1
0
 /// <inheritdoc />
 protected override void UpdatePartFromModel()
 {
     if (m_Model is IPortModel portModel)
     {
         m_PortContainer?.UpdatePorts(new[] { portModel }, m_OwnerElement.View, m_OwnerElement.CommandDispatcher);
     }
 }
Example #2
0
        /// <inheritdoc />
        protected override void UpdatePartFromModel()
        {
            if (!(m_Model is IInputOutputPortsNodeModel portNode))
            {
                return;
            }

            var ports = (m_PortDirection == PortDirection.Input ? portNode.GetInputPorts() : portNode.GetOutputPorts())
                        .Where(p => p.Orientation == PortOrientation.Vertical);

            m_PortContainer?.UpdatePorts(ports, m_OwnerElement.View, m_OwnerElement.CommandDispatcher);
        }
 /// <inheritdoc />
 protected override void UpdatePartFromModel()
 {
     switch (m_Model)
     {
     // TODO: Reinstate.
     // case ISingleInputPortNode inputPortHolder:
     //     m_InputPortContainer?.UpdatePorts(new[] { inputPortHolder.InputPort }, m_OwnerElement.GraphView, m_OwnerElement.CommandDispatcher);
     //     break;
     // case ISingleOutputPortNode outputPortHolder:
     //     m_OutputPortContainer?.UpdatePorts(new[] { outputPortHolder.OutputPort }, m_OwnerElement.GraphView, m_OwnerElement.CommandDispatcher);
     //     break;
     case IInputOutputPortsNodeModel portHolder:
         m_InputPortContainer?.UpdatePorts(portHolder.GetInputPorts().Where(p => p.Orientation == PortOrientation.Horizontal), m_OwnerElement.View, m_OwnerElement.CommandDispatcher);
         m_OutputPortContainer?.UpdatePorts(portHolder.GetOutputPorts().Where(p => p.Orientation == PortOrientation.Horizontal), m_OwnerElement.View, m_OwnerElement.CommandDispatcher);
         break;
     }
 }
        /// <inheritdoc />
        protected override void BuildPartUI(VisualElement container)
        {
            if (m_Model is IPortNodeModel portHolder)
            {
                m_Root = new VisualElement {
                    name = PartName
                };
                m_Root.AddToClassList(ussClassName);
                m_Root.AddToClassList(m_ParentClassName.WithUssElement(PartName));

                PortContainer = new PortContainer {
                    name = portsUssName
                };
                PortContainer.AddToClassList(m_ParentClassName.WithUssElement(portsUssName));
                m_Root.Add(PortContainer);

                var ports = portHolder.Ports.Where(p => p.Orientation == PortOrientation.Horizontal);
                PortContainer?.UpdatePorts(ports, m_OwnerElement.View, m_OwnerElement.CommandDispatcher);

                container.Add(m_Root);
            }
        }
Example #5
0
        /// <inheritdoc />
        protected override void BuildPartUI(VisualElement container)
        {
            if (m_Model is IInputOutputPortsNodeModel portNode)
            {
                m_Root = new VisualElement {
                    name = PartName
                };
                m_Root.AddToClassList(ussClassName);
                m_Root.AddToClassList(m_ParentClassName.WithUssElement(PartName));

                m_PortContainer = new PortContainer {
                    name = portsUssName
                };
                m_PortContainer.AddToClassList(m_ParentClassName.WithUssElement(portsUssName));
                m_Root.Add(m_PortContainer);

                var ports = (m_PortDirection == PortDirection.Input ? portNode.GetInputPorts() : portNode.GetOutputPorts())
                            .Where(p => p.Orientation == PortOrientation.Vertical);

                m_PortContainer?.UpdatePorts(ports, m_OwnerElement.View, m_OwnerElement.CommandDispatcher);

                container.Add(m_Root);
            }
        }