GraphNodeDelegateRouter

class omni.kit.widget.graph.graph_node_delegate_router.GraphNodeDelegateRouter

Bases: AbstractGraphNodeDelegate

The delegate that keeps multiple delegates and pick them depending on the routing conditions.

It’s possible to add the routing conditions with `add_route`, and conditions could be a type or a lambda expression.

The latest added routing is stronger than previously added. Routing added without conditions is the default.

We use type routing to make the specific kind of nodes unique, and also we can use the lambda function to make the particular state of nodes unique (ex. full/collapsed).

It’s possible to use type and lambda routing at the same time.

Usage examples:

delegate.add_route(TextureDelegate(), type=”Texture2d”) delegate.add_route(CollapsedDelegate(), expressipon=is_collapsed)

Methods

__init__()

add_route(delegate[, type, expression])

Add delegate to the routing tablle

connection(model, source, target[, foreground])

Called to create the connection between ports

destroy()

get_node_layout(model, node_desc)

Called to determine the node layout

node_background(model, node_desc)

Called to create widgets of the node background

node_footer(model, node_desc)

Called to create widgets of the bottom of the node

node_header(model, node_desc)

Called to create widgets of the top of the node

node_header_input(model, node_desc)

Called to create the left part of the header that will be used as input when the node is collapsed

node_header_output(model, node_desc)

Called to create the right part of the header that will be used as output when the node is collapsed

port(model, node_desc, port_desc)

Called to create the middle part of the port

port_input(model, node_desc, port_desc)

Called to create the left part of the port that will be used as input

port_output(model, node_desc, port_desc)

Called to create the right part of the port that will be used as output

__init__()
add_route(delegate: AbstractGraphNodeDelegate, type=None, expression=None)

Add delegate to the routing tablle

connection(model, source: GraphConnectionDescription, target: GraphConnectionDescription, foreground: bool = False)

Called to create the connection between ports

get_node_layout(model, node_desc: GraphNodeDescription)

Called to determine the node layout

node_background(model, node_desc: GraphNodeDescription)

Called to create widgets of the node background

Called to create widgets of the bottom of the node

node_header(model, node_desc: GraphNodeDescription)

Called to create widgets of the top of the node

node_header_input(model, node_desc: GraphNodeDescription)

Called to create the left part of the header that will be used as input when the node is collapsed

node_header_output(model, node_desc: GraphNodeDescription)

Called to create the right part of the header that will be used as output when the node is collapsed

port(model, node_desc: GraphNodeDescription, port_desc: GraphPortDescription)

Called to create the middle part of the port

port_input(model, node_desc: GraphNodeDescription, port_desc: GraphPortDescription)

Called to create the left part of the port that will be used as input

port_output(model, node_desc: GraphNodeDescription, port_desc: GraphPortDescription)

Called to create the right part of the port that will be used as output