Esempio n. 1
0
        public static PortView Create(
            NodePort port,
            Type type,
            IEdgeConnectorListener connectorListener
            )
        {
            var view = new PortView(
                Orientation.Horizontal,
                port.isInput ? Direction.Input : Direction.Output,
                port.isMulti ? Capacity.Multi : Capacity.Single,
                type
                )
            {
                m_EdgeConnector = new EdgeConnector <Edge>(connectorListener),
                portName        = port.portName,
                target          = port
            };

            // Override default connector text with the human-readable port name
            // TODO: Apparently the edge connector (Edge.output.portName) is based on whatever
            // is in this label. So re-labeling it will inadvertedly change the port name.
            // (or it might be a two way binding). So natively, we won't be able to have multiple
            // ports with the same name.
            // view.m_ConnectorText.text = refPort.displayName;

            view.AddManipulator(view.m_EdgeConnector);
            return(view);
        }
Esempio n. 2
0
        public static PortView Create(
            NodePort port,
            SerializedProperty prop,
            Type type,
            IEdgeConnectorListener connectorListener
            )
        {
            var view = new PortView(
                Orientation.Horizontal,
                port.isInput ? Direction.Input : Direction.Output,
                port.isMulti ? Capacity.Multi : Capacity.Single,
                type
                )
            {
                m_EdgeConnector = new EdgeConnector <Edge>(connectorListener),
                portName        = port.portName,
                target          = port
            };

            // Override default connector text with the human-readable port name
            // TODO: Apparently the edge connector (Edge.output.portName) is based on whatever
            // is in this label. So re-labeling it will inadvertedly change the port name.
            // (or it might be a two way binding). So natively, we won't be able to have multiple
            // ports with the same name.
            // view.m_ConnectorText.text = refPort.displayName;

            view.AddManipulator(view.m_EdgeConnector);

            // Bind to the underlying field
            if (prop != null && port.isInput) // TODO refPort.isEditable)
            {
                view.m_PropertyField = new PropertyField(prop, " ");
                view.m_PropertyField.Bind(prop.serializedObject);
                view.m_ConnectorBox.parent.Add(view.m_PropertyField);
            }

            return(view);
        }