NodeGraph

NodeGraphQt.NodeGraph([parent])

The NodeGraph class is the main controller for managing all nodes and the node graph.

 1from Qt import QtWidgets
 2from NodeGraphQt import NodeGraph
 3
 4if __name__ == '__main__':
 5    app = QtWidgets.QApplication([])
 6
 7    node_graph = NodeGraph()
 8
 9    widget = node_graph.widget
10    widget.show()
11
12    app.exec_()

—

class NodeGraphQt.NodeGraph(parent=None, **kwargs)

The NodeGraph class is the main controller for managing all nodes and the node graph.

Inheritance diagram of NodeGraphQt.NodeGraph
../_images/graph.png

Attributes:

nodes_registered(*args, **kwargs)

Signal triggered when a node is registered into the node graph.

node_created(*args, **kwargs)

Signal triggered when a node is created in the node graph.

nodes_deleted(*args, **kwargs)

Signal triggered when nodes have been deleted from the node graph.

node_selected(*args, **kwargs)

Signal triggered when a node is clicked with the LMB.

node_selection_changed(*args, **kwargs)

Signal triggered when the node selection has changed.

node_double_clicked(*args, **kwargs)

Signal triggered when a node is double clicked and emits the node.

port_connected(*args, **kwargs)

Signal triggered when a node port has been connected.

port_disconnected(*args, **kwargs)

Signal triggered when a node port has been disconnected.

property_changed(*args, **kwargs)

Signal is triggered when a property has changed on a node.

data_dropped(*args, **kwargs)

Signal is triggered when data has been dropped to the graph.

session_changed(*args, **kwargs)

Signal is triggered when session has been changed.

context_menu_prompt(*args, **kwargs)

Signal is triggered just before a context menu is shown.

model

The model used for storing the node graph data.

node_factory

Return the node factory object used by the node graph.

widget

The node graph widget for adding into a layout.

undo_view

Returns node graph undo history list widget.

is_root

Returns if the node graph controller is the root graph.

sub_graphs

Returns expanded group node sub graphs.

Methods:

cursor_pos()

Returns the cursor last position in the node graph.

toggle_node_search()

toggle the node search widget visibility.

show()

Show node graph widget this is just a convenience function to NodeGraph.widget.show().

close()

Close node graph NodeViewer widget this is just a convenience function to NodeGraph.widget.close().

viewer()

Returns the internal view interface used by the node graph.

scene()

Returns the QGraphicsScene object used in the node graph.

background_color()

Return the node graph background color.

set_background_color(r, g, b)

Set node graph background color.

grid_color()

Return the node graph grid color.

set_grid_color(r, g, b)

Set node graph grid color.

set_grid_mode([mode])

Set node graph background grid mode.

add_properties_bin(prop_bin)

Wire up a properties bin widget to the node graph.

undo_stack()

Returns the undo stack used in the node graph.

clear_undo_stack()

Clears the undo stack.

begin_undo(name)

Start of an undo block followed by a NodeGraph.end_undo().

end_undo()

End of an undo block started by NodeGraph.begin_undo().

context_menu()

Returns the context menu for the node graph.

context_nodes_menu()

Returns the context menu for the nodes.

get_context_menu(menu)

Returns the context menu specified by the name.

set_context_menu(menu_name, data[, anchor_path])

Populate a context menu from serialized data.

set_context_menu_from_file(file_path[, menu])

Populate a context menu from a serialized json file.

disable_context_menu([disabled, name])

Disable/Enable context menus from the node graph.

acyclic()

Returns true if the current node graph is acyclic.

set_acyclic([mode])

Enable the node graph to be a acyclic graph.

pipe_collision()

Returns if pipe collision is enabled.

set_pipe_collision([mode])

Enable/Disable pipe collision.

pipe_slicing()

Returns if pipe slicing is enabled.

set_pipe_slicing([mode])

Enable/Disable pipe slicer.

pipe_style()

Returns the current pipe layout style.

set_pipe_style([style])

Set node graph pipes to be drawn as curved (default), straight or angled.

layout_direction()

Return the current node graph layout direction.

set_layout_direction(direction)

Sets the node graph layout direction to horizontal or vertical.

fit_to_selection()

Sets the zoom level to fit selected nodes.

reset_zoom()

Reset the zoom level

set_zoom([zoom])

Set the zoom factor of the Node Graph the default is 0.0

get_zoom()

Get the current zoom level of the node graph.

center_on([nodes])

Center the node graph on the given nodes or all nodes by default.

center_selection()

Centers on the current selected nodes.

registered_nodes()

Return a list of all node types that have been registered.

register_node(node[, alias])

Register the node to the NodeGraph.node_factory()

register_nodes(nodes)

Register the nodes to the NodeGraph.node_factory()

create_node(node_type[, name, selected, ...])

Create a new node in the node graph.

add_node(node[, pos, selected, push_undo])

Add a node into the node graph.

delete_node(node[, push_undo])

Remove the node from the node graph.

remove_node(node[, push_undo])

Remove the node from the node graph.

delete_nodes(nodes[, push_undo])

Remove a list of specified nodes from the node graph.

extract_nodes(nodes[, push_undo, prompt_warning])

Extract select nodes from its connections.

all_nodes()

Return all nodes in the node graph.

selected_nodes()

Return all selected nodes that are in the node graph.

select_all()

Select all nodes in the node graph.

clear_selection()

Clears the selection in the node graph.

invert_selection()

Inverts the current node selection.

get_node_by_id([node_id])

Returns the node from the node id string.

get_node_by_name(name)

Returns node that matches the name.

get_nodes_by_type(node_type)

Return all nodes by their node type identifier.

get_unique_name(name)

Creates a unique node name to avoid having nodes with the same name.

current_session()

Returns the file path to the currently loaded session.

clear_session()

Clears the current node graph session.

serialize_session()

Serializes the current node graph layout to a dictionary.

deserialize_session(layout_data[, ...])

Load node graph session from a dictionary object.

save_session(file_path)

Saves the current node graph session layout to a JSON formatted file.

load_session(file_path)

Load node graph session layout file.

import_session(file_path[, clear_undo_stack])

Import node graph into the current session.

copy_nodes([nodes])

Copy nodes to the clipboard as a JSON formatted str.

cut_nodes([nodes])

Cut nodes to the clipboard as a JSON formatted str.

paste_nodes()

Pastes nodes copied from the clipboard.

duplicate_nodes(nodes)

Create duplicate copy from the list of nodes.

disable_nodes(nodes[, mode])

Toggle nodes to be either disabled or enabled state.

use_OpenGL()

Set the viewport to use QOpenGLWidget widget to draw the graph.

auto_layout_nodes([nodes, down_stream, ...])

Auto layout the nodes in the node graph.

question_dialog(text[, title, dialog_icon, ...])

Prompts a question open dialog with "Yes" and "No" buttons in the node graph.

message_dialog(text[, title, dialog_icon, ...])

Prompts a file open dialog in the node graph.

load_dialog([current_dir, ext, parent])

Prompts a file open dialog in the node graph.

save_dialog([current_dir, ext, parent])

Prompts a file save dialog in the node graph.

expand_group_node(node)

Expands a group node session in a new tab.

collapse_group_node(node)

Collapse a group node session tab and it's expanded child sub graphs.

nodes_registered(*args, **kwargs)

Signal triggered when a node is registered into the node graph.

Parameters:

list[NodeGraphQt.NodeObject]

Emits:

registered nodes

node_created(*args, **kwargs)

Signal triggered when a node is created in the node graph.

Parameters:

NodeGraphQt.NodeObject

Emits:

created node

nodes_deleted(*args, **kwargs)

Signal triggered when nodes have been deleted from the node graph.

Parameters:

list[str]

Emits:

list of deleted node ids.

node_selected(*args, **kwargs)

Signal triggered when a node is clicked with the LMB.

Parameters:

NodeGraphQt.NodeObject

Emits:

selected node

node_selection_changed(*args, **kwargs)

Signal triggered when the node selection has changed.

Parameters:

list[NodeGraphQt.NodeObject], list[NodeGraphQt.NodeObject]

Emits:

selected node, deselected nodes.

node_double_clicked(*args, **kwargs)

Signal triggered when a node is double clicked and emits the node.

Parameters:

NodeGraphQt.NodeObject

Emits:

selected node

port_connected(*args, **kwargs)

Signal triggered when a node port has been connected.

Parameters:

NodeGraphQt.Port, NodeGraphQt.Port

Emits:

input port, output port

port_disconnected(*args, **kwargs)

Signal triggered when a node port has been disconnected.

Parameters:

NodeGraphQt.Port, NodeGraphQt.Port

Emits:

input port, output port

property_changed(*args, **kwargs)

Signal is triggered when a property has changed on a node.

Parameters:

NodeGraphQt.BaseNode, str, object

Emits:

triggered node, property name, property value

data_dropped(*args, **kwargs)

Signal is triggered when data has been dropped to the graph.

Parameters:

PySide2.QtCore.QMimeData, PySide2.QtCore.QPoint

Emits:

mime data, node graph position

session_changed(*args, **kwargs)

Signal is triggered when session has been changed.

Parameters:

str

Emits:

new session path

context_menu_prompt(*args, **kwargs)

Signal is triggered just before a context menu is shown.

Parameters:

NodeGraphQt.NodeGraphMenu or NodeGraphQt.NodesMenu, NodeGraphQt.BaseNode

Emits:

triggered context menu, node object.

property model

The model used for storing the node graph data.

Returns:

node graph model.

Return type:

NodeGraphQt.base.model.NodeGraphModel

property node_factory

Return the node factory object used by the node graph.

Returns:

node factory.

Return type:

NodeFactory

property widget

The node graph widget for adding into a layout.

Returns:

node graph widget.

Return type:

NodeGraphWidget

property undo_view

Returns node graph undo history list widget.

Returns:

node graph undo view.

Return type:

PySide2.QtWidgets.QUndoView

cursor_pos()

Returns the cursor last position in the node graph.

Returns:

cursor x,y coordinates of the scene.

Return type:

tuple(float, float)

toggle the node search widget visibility.

show()

Show node graph widget this is just a convenience function to NodeGraph.widget.show().

close()

Close node graph NodeViewer widget this is just a convenience function to NodeGraph.widget.close().

viewer()

Returns the internal view interface used by the node graph.

Warning

Methods in the NodeViewer are used internally by NodeGraphQt components to get the widget use NodeGraph.widget.

See also

NodeGraph.widget to add the node graph widget into a PySide2.QtWidgets.QLayout.

Returns:

viewer interface.

Return type:

NodeGraphQt.widgets.viewer.NodeViewer

scene()

Returns the QGraphicsScene object used in the node graph.

Returns:

node scene.

Return type:

NodeGraphQt.widgets.scene.NodeScene

background_color()

Return the node graph background color.

Returns:

r, g ,b

Return type:

tuple

set_background_color(r, g, b)

Set node graph background color.

Parameters:
  • r (int) – red value.

  • g (int) – green value.

  • b (int) – blue value.

grid_color()

Return the node graph grid color.

Returns:

r, g ,b

Return type:

tuple

set_grid_color(r, g, b)

Set node graph grid color.

Parameters:
  • r (int) – red value.

  • g (int) – green value.

  • b (int) – blue value.

set_grid_mode(mode=None)

Set node graph background grid mode.

(default: NodeGraphQt.constants.ViewerEnum.GRID_DISPLAY_LINES).

See: NodeGraphQt.constants.ViewerEnum

1graph = NodeGraph()
2graph.set_grid_mode(ViewerEnum.GRID_DISPLAY_DOTS.value)
Parameters:

mode (int) – background style.

add_properties_bin(prop_bin)

Wire up a properties bin widget to the node graph.

Parameters:

prop_bin (NodeGraphQt.PropertiesBinWidget) – properties widget.

undo_stack()

Returns the undo stack used in the node graph.

Returns:

undo stack.

Return type:

QtWidgets.QUndoStack

clear_undo_stack()

Clears the undo stack.

Note

Convenience function to NodeGraph.undo_stack().clear()

begin_undo(name)

Start of an undo block followed by a NodeGraph.end_undo().

Parameters:

name (str) – name for the undo block.

end_undo()

End of an undo block started by NodeGraph.begin_undo().

context_menu()

Returns the context menu for the node graph.

Note

This is a convenience function to NodeGraph.get_context_menu() with the arg menu="graph"

Returns:

context menu object.

Return type:

NodeGraphQt.NodeGraphMenu

context_nodes_menu()

Returns the context menu for the nodes.

Note

This is a convenience function to NodeGraph.get_context_menu() with the arg menu="nodes"

Returns:

context menu object.

Return type:

NodeGraphQt.NodesMenu

get_context_menu(menu)

Returns the context menu specified by the name.

menu types:

  • "graph" context menu from the node graph.

  • "nodes" context menu for the nodes.

Parameters:

menu (str) – menu name.

Returns:

context menu object.

Return type:

NodeGraphQt.NodeGraphMenu or NodeGraphQt.NodesMenu

set_context_menu(menu_name, data, anchor_path=None)

Populate a context menu from serialized data.

example of serialized menu data:

[
    {
        'type': 'menu',
        'label': 'node sub menu',
        'items': [
            {
                'type': 'command',
                'label': 'test command',
                'file': '../path/to/my/test_module.py',
                'function': 'run_test',
                'node_type': 'nodeGraphQt.nodes.MyNodeClass'
            },

        ]
    },
]

the run_test example function:

def run_test(graph):
    print(graph.selected_nodes())
Parameters:
  • menu_name (str) – name of the parent context menu to populate under.

  • data (dict) – serialized menu data.

  • anchor_path (str or None) – directory to interpret file paths relative to (optional)

set_context_menu_from_file(file_path, menu='graph')

Populate a context menu from a serialized json file.

menu types:

  • "graph" context menu from the node graph.

  • "nodes" context menu for the nodes.

Parameters:
  • menu (str) – name of the parent context menu to populate under.

  • file_path (str) – serialized menu commands json file.

disable_context_menu(disabled=True, name='all')

Disable/Enable context menus from the node graph.

menu types:

  • "all" all context menus from the node graph.

  • "graph" context menu from the node graph.

  • "nodes" context menu for the nodes.

Parameters:
  • disabled (bool) – true to enable context menu.

  • name (str) – menu name. (default: "all")

acyclic()

Returns true if the current node graph is acyclic.

Returns:

true if acyclic (default: True).

Return type:

bool

set_acyclic(mode=True)

Enable the node graph to be a acyclic graph. (default: True)

Parameters:

mode (bool) – true to enable acyclic.

pipe_collision()

Returns if pipe collision is enabled.

See also

To enable/disable pipe collision NodeGraph.set_pipe_collision()

Returns:

True if pipe collision is enabled.

Return type:

bool

set_pipe_collision(mode=True)

Enable/Disable pipe collision.

When enabled dragging a node over a pipe will allow the node to be inserted as a new connection between the pipe.

Parameters:

mode (bool) – False to disable pipe collision.

pipe_slicing()

Returns if pipe slicing is enabled.

See also

To enable/disable pipe slicer NodeGraph.set_pipe_slicing()

Returns:

True if pipe slicing is enabled.

Return type:

bool

set_pipe_slicing(mode=True)

Enable/Disable pipe slicer.

When set to true holding down Alt + Shift + LMB Drag will allow node pipe connections to be sliced.

../_images/slicer.png
Parameters:

mode (bool) – False to disable the slicer pipe.

pipe_style()

Returns the current pipe layout style.

Returns:

pipe style value. NodeGraphQt.constants.PipeLayoutEnum

Return type:

int

set_pipe_style(style=1)

Set node graph pipes to be drawn as curved (default), straight or angled.

1graph = NodeGraph()
2graph.set_pipe_style(PipeLayoutEnum.CURVED.value)

See: NodeGraphQt.constants.PipeLayoutEnum

../_images/pipe_layout_types.gif
Parameters:

style (int) – pipe layout style.

layout_direction()

Return the current node graph layout direction.

Implemented in v0.3.0

Returns:

layout direction.

Return type:

int

set_layout_direction(direction)

Sets the node graph layout direction to horizontal or vertical. This function will also override the layout direction on all nodes in the current node graph.

Implemented in v0.3.0

Layout Types:

../_images/layout_direction_switch.gif

Warning

This function does not register to the undo stack.

Parameters:

direction (int) – layout direction.

fit_to_selection()

Sets the zoom level to fit selected nodes. If no nodes are selected then all nodes in the graph will be framed.

reset_zoom()

Reset the zoom level

set_zoom(zoom=0)

Set the zoom factor of the Node Graph the default is 0.0

Parameters:

zoom (float) – zoom factor (max zoom out -0.9 / max zoom in 2.0)

get_zoom()

Get the current zoom level of the node graph.

Returns:

the current zoom level.

Return type:

float

center_on(nodes=None)

Center the node graph on the given nodes or all nodes by default.

Parameters:

nodes (list[NodeGraphQt.BaseNode]) – a list of nodes.

center_selection()

Centers on the current selected nodes.

registered_nodes()

Return a list of all node types that have been registered.

See also

To register a node NodeGraph.register_node()

Returns:

list of node type identifiers.

Return type:

list[str]

register_node(node, alias=None)

Register the node to the NodeGraph.node_factory()

Parameters:
  • node (NodeGraphQt.NodeObject) – node object.

  • alias (str) – custom alias name for the node type.

register_nodes(nodes)

Register the nodes to the NodeGraph.node_factory()

Parameters:

nodes (list) – list of nodes.

create_node(node_type, name=None, selected=True, color=None, text_color=None, pos=None, push_undo=True)

Create a new node in the node graph.

See also

To list all node types NodeGraph.registered_nodes()

Parameters:
  • node_type (str) – node instance type.

  • name (str) – set name of the node.

  • selected (bool) – set created node to be selected.

  • color (tuple or str) – node color (255, 255, 255) or "#FFFFFF".

  • text_color (tuple or str) – text color (255, 255, 255) or "#FFFFFF".

  • pos (list[int, int]) – initial x, y position for the node (default: (0, 0)).

  • push_undo (bool) – register the command to the undo stack. (default: True)

Returns:

the created instance of the node.

Return type:

BaseNode

add_node(node, pos=None, selected=True, push_undo=True)

Add a node into the node graph. unlike the NodeGraph.create_node() function this will not trigger the NodeGraph.node_created signal.

Parameters:
  • node (NodeGraphQt.BaseNode) – node object.

  • pos (list[float]) – node x,y position. (optional)

  • selected (bool) – node selected state. (optional)

  • push_undo (bool) – register the command to the undo stack. (default: True)

delete_node(node, push_undo=True)

Remove the node from the node graph.

Parameters:
  • node (NodeGraphQt.BaseNode) – node object.

  • push_undo (bool) – register the command to the undo stack. (default: True)

remove_node(node, push_undo=True)

Remove the node from the node graph.

unlike the NodeGraph.delete_node() function this will not trigger the NodeGraph.nodes_deleted signal.

Parameters:
  • node (NodeGraphQt.BaseNode) – node object.

  • push_undo (bool) – register the command to the undo stack. (default: True)

delete_nodes(nodes, push_undo=True)

Remove a list of specified nodes from the node graph.

Parameters:
  • nodes (list[NodeGraphQt.BaseNode]) – list of node instances.

  • push_undo (bool) – register the command to the undo stack. (default: True)

extract_nodes(nodes, push_undo=True, prompt_warning=True)

Extract select nodes from its connections.

Parameters:
  • nodes (list[NodeGraphQt.BaseNode]) – list of node instances.

  • push_undo (bool) – register the command to the undo stack. (default: True)

  • prompt_warning (bool) – prompt warning dialog box.

all_nodes()

Return all nodes in the node graph.

Returns:

list of nodes.

Return type:

list[NodeGraphQt.BaseNode]

selected_nodes()

Return all selected nodes that are in the node graph.

Returns:

list of nodes.

Return type:

list[NodeGraphQt.BaseNode]

select_all()

Select all nodes in the node graph.

clear_selection()

Clears the selection in the node graph.

invert_selection()

Inverts the current node selection.

get_node_by_id(node_id=None)

Returns the node from the node id string.

Parameters:

node_id (str) – node id (NodeObject.id)

Returns:

node object.

Return type:

NodeGraphQt.NodeObject

get_node_by_name(name)

Returns node that matches the name.

Parameters:

name (str) – name of the node.

Returns:

node object.

Return type:

NodeGraphQt.NodeObject

get_nodes_by_type(node_type)

Return all nodes by their node type identifier. (see: NodeGraphQt.NodeObject.type_)

Parameters:

node_type (str) – node type identifier.

Returns:

list of nodes.

Return type:

list[NodeGraphQt.NodeObject]

get_unique_name(name)

Creates a unique node name to avoid having nodes with the same name.

Parameters:

name (str) – node name.

Returns:

unique node name.

Return type:

str

current_session()

Returns the file path to the currently loaded session.

Returns:

path to the currently loaded session

Return type:

str

clear_session()

Clears the current node graph session.

serialize_session()

Serializes the current node graph layout to a dictionary.

Returns:

serialized session of the current node layout.

Return type:

dict

deserialize_session(layout_data, clear_session=True, clear_undo_stack=True)

Load node graph session from a dictionary object.

Parameters:
  • layout_data (dict) – dictionary object containing a node session.

  • clear_session (bool) – clear current session.

  • clear_undo_stack (bool) – clear the undo stack.

save_session(file_path)

Saves the current node graph session layout to a JSON formatted file.

Parameters:

file_path (str) – path to the saved node layout.

load_session(file_path)

Load node graph session layout file.

Parameters:

file_path (str) – path to the serialized layout file.

import_session(file_path, clear_undo_stack=True)

Import node graph into the current session.

Parameters:
  • file_path (str) – path to the serialized layout file.

  • clear_undo_stack (bool) – clear the undo stack after import.

copy_nodes(nodes=None)

Copy nodes to the clipboard as a JSON formatted str.

Parameters:

nodes (list[NodeGraphQt.BaseNode]) – list of nodes (default: selected nodes).

cut_nodes(nodes=None)

Cut nodes to the clipboard as a JSON formatted str.

Note

This function doesn’t trigger the NodeGraph.nodes_deleted signal.

Parameters:

nodes (list[NodeGraphQt.BaseNode]) – list of nodes (default: selected nodes).

paste_nodes()

Pastes nodes copied from the clipboard.

Returns:

list of pasted node instances.

Return type:

list[NodeGraphQt.BaseNode]

duplicate_nodes(nodes)

Create duplicate copy from the list of nodes.

Parameters:

nodes (list[NodeGraphQt.BaseNode]) – list of nodes.

Returns:

list of duplicated node instances.

Return type:

list[NodeGraphQt.BaseNode]

disable_nodes(nodes, mode=None)

Toggle nodes to be either disabled or enabled state.

Parameters:
  • nodes (list[NodeGraphQt.BaseNode]) – list of nodes.

  • mode (bool) – (optional) override state of the nodes.

use_OpenGL()

Set the viewport to use QOpenGLWidget widget to draw the graph.

auto_layout_nodes(nodes=None, down_stream=True, start_nodes=None)

Auto layout the nodes in the node graph.

Note

If the node graph is acyclic then the start_nodes will need to be specified.

Parameters:
  • nodes (list[NodeGraphQt.BaseNode]) – list of nodes to auto layout if nodes is None then all nodes is layed out.

  • down_stream (bool) – false to layout up stream.

  • start_nodes (list[NodeGraphQt.BaseNode]) – list of nodes to start the auto layout from (Optional).

question_dialog(text, title='Node Graph', dialog_icon=None, custom_icon=None, parent=None)

Prompts a question open dialog with "Yes" and "No" buttons in the node graph.

Note

Convenience function to NodeGraph.viewer().question_dialog()

Parameters:
  • text (str) – question text.

  • title (str) – dialog window title.

  • dialog_icon (str) – display icon. (“information”, “warning”, “critical”)

  • custom_icon (str) – custom icon to display.

  • parent (QtWidgets.QObject) – override dialog parent. (optional)

Returns:

true if user clicked yes.

Return type:

bool

message_dialog(text, title='Node Graph', dialog_icon=None, custom_icon=None, parent=None)

Prompts a file open dialog in the node graph.

Note

Convenience function to NodeGraph.viewer().message_dialog()

Parameters:
  • text (str) – message text.

  • title (str) – dialog window title.

  • dialog_icon (str) – display icon. (“information”, “warning”, “critical”)

  • custom_icon (str) – custom icon to display.

  • parent (QtWidgets.QObject) – override dialog parent. (optional)

load_dialog(current_dir=None, ext=None, parent=None)

Prompts a file open dialog in the node graph.

Note

Convenience function to NodeGraph.viewer().load_dialog()

Parameters:
  • current_dir (str) – path to a directory.

  • ext (str) – custom file type extension (default: "json")

  • parent (QtWidgets.QObject) – override dialog parent. (optional)

Returns:

selected file path.

Return type:

str

save_dialog(current_dir=None, ext=None, parent=None)

Prompts a file save dialog in the node graph.

Note

Convenience function to NodeGraph.viewer().save_dialog()

Parameters:
  • current_dir (str) – path to a directory.

  • ext (str) – custom file type extension (default: "json")

  • parent (QtWidgets.QObject) – override dialog parent. (optional)

Returns:

selected file path.

Return type:

str

property is_root

Returns if the node graph controller is the root graph.

Returns:

true is the node graph is root.

Return type:

bool

property sub_graphs

Returns expanded group node sub graphs.

Returns:

{<node_id>: <sub_graph>}

Return type:

dict

expand_group_node(node)

Expands a group node session in a new tab.

Parameters:

node (NodeGraphQt.GroupNode) – group node.

Returns:

sub node graph used to manage the group node session.

Return type:

SubGraph

collapse_group_node(node)

Collapse a group node session tab and it’s expanded child sub graphs.

Parameters:

node (NodeGraphQt.GroupNode) – group node.