-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathmain.py
More file actions
71 lines (51 loc) · 1.86 KB
/
main.py
File metadata and controls
71 lines (51 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env python
# import os
import sys
# import networkx
from thirdparty.Qt import QtWidgets
from nodegraph.scene import Scene
from nodegraph.view import View
class NodeGraphDialog(QtWidgets.QMainWindow):
"""
Handles top level dialog of Node grap
"""
def __init__(self, parent=None):
QtWidgets.QMainWindow.__init__(self, parent)
self.parent = parent or self
self.nodegraph = NodeGraphWidget("main", parent=self.parent)
self.setCentralWidget(self.nodegraph)
self.resize(800, 600)
self.setWindowTitle("Node graph -")
# center = self.nodegraph.graph_view.sceneRect().center()
cam = self.nodegraph.graph_scene.create_node("camera")
cam.setPos(-200, -150)
model = self.nodegraph.graph_scene.create_node(
"combine",
inputs=["mesh1", "mesh2", "camera"])
model.setPos(150, 0)
edge = self.nodegraph.graph_scene.create_edge(
cam._output,
model._inputs[0])
test = self.nodegraph.graph_scene.create_node("test")
test.setPos(-400, 150)
egde = self.nodegraph.graph_scene.create_edge(
test._output,
model._inputs[1])
class NodeGraphWidget(QtWidgets.QWidget):
"""
Handles node graph view
"""
def __init__(self, name, parent=None):
QtWidgets.QWidget.__init__(self, parent)
self.name = name
self.parent = parent
self.graph_scene = Scene(parent=self.parent,
nodegraph_widget=self)
self.graph_view = View(self.graph_scene, parent=self.parent)
self.horizontal_layout = QtWidgets.QHBoxLayout(self)
self.horizontal_layout.addWidget(self.graph_view)
if __name__ == "__main__":
app = QtWidgets.QApplication([])
dialog = NodeGraphDialog()
dialog.show()
sys.exit(app.exec_())