![stability-wip](https://camo.githubusercontent.com/9bb6d538d3e4702e30d53a08d413bd46933e12bded37337a02fb2172c78076f1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73746162696c6974792d576f726b5f496e5f50726f67726573732d6c69676874677265792e737667)
NodeGraphQt is a node graph framework for PySide2 that can be implemented and re-purposed into
applications.
![NodeGraphQt](https://github.com/docs/_images/screenshot.png)
NodeGraphQt API documentation
action |
controls |
Zoom in/out |
Alt + MMB Drag or Mouse Scroll Up/Down |
Pan |
Alt + LMB Drag or MMB Drag |
Node search |
Tab |
![Pipe Slicer](https://github.com/docs/_images/slicer.png)
action |
controls |
Slice Connections |
Shift + Alt + LMB Drag |
![Vertical Layout](https://github.com/docs/_images/vertical_layout.png)
![Pipe Layout](https://github.com/docs/_images/pipe_layout_types.gif)
![Properties Bin](https://github.com/docs/_images/prop_bin.png)
![Nodes Paletten](https://github.com/docs/_images/nodes_palette.png)
![Nodes Tree](https://github.com/docs/_images/nodes_tree.png)
import sys
from NodeGraphQt import QtWidgets
from NodeGraphQt import NodeGraph, BaseNode, BackdropNode, setup_context_menu
# create a example node object with a input/output port.
class MyNode(BaseNode):
"""example test node."""
# unique node identifier domain. ("com.chantasticvfx.MyNode")
__identifier__ = 'com.chantasticvfx'
# initial default node name.
NODE_NAME = 'My Node'
def __init__(self):
super(MyNode, self).__init__()
self.add_input('foo', color=(180, 80, 0))
self.add_output('bar')
if __name__ == '__main__':
app = QtWidgets.QApplication(sys.argv)
# create the node graph controller.
graph = NodeGraph()
# set up default menu and commands.
setup_context_menu(graph)
# register backdrop node. (included in the NodeGraphQt module)
graph.register_node(BackdropNode)
# register example node into the node graph.
graph.register_node(MyNode)
# create nodes.
node_a = graph.create_node('com.chantasticvfx.MyNode', name='Node A')
node_b = graph.create_node('com.chantasticvfx.MyNode', name='Node B', color='#5b162f')
backdrop = graph.create_node('nodeGraphQt.nodes.Backdrop', name='Backdrop')
# wrap "backdrop" node around "node_a" and "node_b"
backdrop.wrap_nodes([node_a, node_b])
# connect "node_a" input to "node_b" output.
node_a.set_input(0, node_b.output(0))
# auto layout nodes.
graph.auto_layout_nodes()
# show the node graph widget.
graph_widget = graph.widget
graph_widget.show()
app.exec_()