node_edge_validators Module

A module containing the Edge Validator functions which can be registered as callbacks to Edge class.

Example of registering Edge Validator callbacks:

You can register validation callbacks once for example on the bottom of node_edge.py file or on the application start with calling this:

from nodeeditor.node_edge_validators import *

Edge.registerEdgeValidator(edge_validator_debug)
Edge.registerEdgeValidator(edge_cannot_connect_two_outputs_or_two_inputs)
Edge.registerEdgeValidator(edge_cannot_connect_input_and_output_of_same_node)
Edge.registerEdgeValidator(edge_cannot_connect_input_and_output_of_different_type)
nodeeditor.node_edge_validators.print_error(*args)

Helper method which prints to console if DEBUG is set to True

nodeeditor.node_edge_validators.edge_validator_debug(input: Socket, output: Socket) → bool

This will consider edge always valid, however writes bunch of debug stuff into console

nodeeditor.node_edge_validators.edge_cannot_connect_two_outputs_or_two_inputs(input: Socket, output: Socket) → bool

Edge is invalid if it connects 2 output sockets or 2 input sockets

nodeeditor.node_edge_validators.edge_cannot_connect_input_and_output_of_same_node(input: Socket, output: Socket) → bool

Edge is invalid if it connects the same node

nodeeditor.node_edge_validators.edge_cannot_connect_input_and_output_of_different_type(input: Socket, output: Socket) → bool

Edge is invalid if it connects sockets with different colors