GraphView
- class omni.kit.widget.graph.graph_view.GraphView(**kwargs)
Bases:
object
The visualisation layer of omni.kit.widget.graph. It behaves like a regular widget and displays nodes and their connections.
Methods
__init__
(**kwargs)### Keyword Arguments:
destroy
()Called by extension before destroying this object.
filter_upstream
(nodes)Remove nodes that are not upstream of the given nodes
focus_on_nodes
([nodes])Focus the view on nodes
get_bbox_of_nodes
(nodes)Get the bounding box of nodes
Reset positions of all the nodes in the model
set_delegate
(delegate)Replace the delegate of the widget
set_expansion
(state)Open, close or minimize all the nodes in the model.
set_model
(model)Replace the model of the widget.
Return the object that will automatically unsubscribe when destroyed.
Return the object that will automatically unsubscribe when destroyed.
Return the object that will automatically unsubscribe when destroyed.
Attributes
DEFAULT_DISTANCE_BETWEEN_NODES
model
The horizontal offset of the scene
The vertical offset of the scene
raster_nodes
Return selected nodes
Typically source connections go from the left side of the node to the right side of the node.
The zoom level of the scene
The maximum zoom level of the scene
The minminum zoom level of the scene
- __init__(**kwargs)
- ### Keyword Arguments:
- `modelGraphModel`
Model to display the node graph
- `delegateAbstractGraphNodeDelegate`
Delegate to draw the node
- `virtual_portsbool`
True when the model should use reversed output for better look of the graph.
- `port_groupingbool`
True when the widget should use sub-ports for port grouping.
- `draw_curve_top_layerbool`
When True, connections are drawn in 2 passes. The “under” layer is for the opaque curve, and the “top” or “over” layer is meant for floating curve anchor decorations that need to be on top of all nodes, like a value display. Its curve should be drawn transparent. False by default, so both layers are not drawn.
- `allow_same_side_connectionsbool`
When True, connections can happen between two input ports or two output ports. This is only used within one node. We don’t support same side connection between different nodes yet.
All other kwargs are passed to CanvasFrame which is the root widget.
- destroy()
Called by extension before destroying this object. It doesn’t happen automatically. Without this hot reloading doesn’t work.
- filter_upstream(nodes: list)
Remove nodes that are not upstream of the given nodes
- focus_on_nodes(nodes: Optional[List[Any]] = None)
Focus the view on nodes
- get_bbox_of_nodes(nodes: list)
Get the bounding box of nodes
- layout_all()
Reset positions of all the nodes in the model
- set_delegate(delegate: AbstractGraphNodeDelegate)
Replace the delegate of the widget
- set_expansion(state: ExpansionState)
Open, close or minimize all the nodes in the model.
- set_model(model: GraphModel)
Replace the model of the widget. It will refresh all the content.
- subscribe_empty_connection_drop(fn)
Return the object that will automatically unsubscribe when destroyed.
- subscribe_post_delayed_build_layout(fn)
Return the object that will automatically unsubscribe when destroyed.
- subscribe_pre_delayed_build_layout(fn)
Return the object that will automatically unsubscribe when destroyed.
- property pan_x
The horizontal offset of the scene
- property pan_y
The vertical offset of the scene
- property selection
Return selected nodes
- property virtual_ports
Typically source connections go from the left side of the node to the right side of the node. But sometimes it looks messy when circular connections. When `virtual_ports` is true, and the connection is circular, the view draws it from the right side to the left side.
Example: A.out ————-> B.surface A.color [REVERSED] <- B.color
- property zoom
The zoom level of the scene
- property zoom_max
The maximum zoom level of the scene
- property zoom_min
The minminum zoom level of the scene