Skip to content

NodeGraphQt.Port.add_accept_port_type()  #342

@snorthman

Description

@snorthman

Once a constrain has been added only ports of that type specified will be allowed a pipe connection.

from the docs of the titular function.

I have (these are snips):

class SimulationNode(BaseSimulatorNode):
   def __init__(self):   
      ...
      self.out_simulation = self.add_output('sim', color=PortType.SIMULATION.color())
      ...

and

class SimulatorNode(BaseSimulatorNode):
   def __init__(self):   
        self.in_simulation = self.add_input('sim', display_name=False, color=PortType.SIMULATION.color())
        self.in_simulation.add_accept_port_type(port_name='sim',
                                                port_type=PortTypeEnum.OUT.value,
                                                node_type='simulator.SimulationNode')

My assumption is now, that my SimulationNode.out_simulation is the only port type that can connect to the SimulatorNode.in_simulation.

This is however, not the case, and everything is still accepted by SimulatorNode.in_simulation.

NodeGraphQt.Port.add_reject_port_type() does work in line with expectations, but its unfeasible to start rejecting every possible port except a particular port.

Is this a bug, or did I do something wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions