From db23a2700b2a7989887f3dd1a5f2eff81c4b8639 Mon Sep 17 00:00:00 2001 From: Leandro Inocencio Date: Thu, 13 Feb 2020 15:46:45 -0500 Subject: [PATCH 1/7] Only load .py with nodes --- example_nodes/__init__.py | 51 +++++++++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 10 deletions(-) diff --git a/example_nodes/__init__.py b/example_nodes/__init__.py index eaa19e32..f3eb74a4 100644 --- a/example_nodes/__init__.py +++ b/example_nodes/__init__.py @@ -1,27 +1,58 @@ #!/usr/bin/python import os import sys -import inspect -import importlib +import ast + + +VALID_NODE_TYPE = ['BaseNode', 'AutoNode'] + + +def detectNodesFromText(filepath): + """returns Node names from a python script""" + froms = [] + + with open(filepath, "r") as source: + tree = ast.parse(source.read()) + + for node in tree.body: + if isinstance(node, ast.ClassDef): + for base in node.bases: + if base.id in VALID_NODE_TYPE: + for indef in node.body: + if isinstance(indef, ast.Assign): + for target in indef.targets: + if target.id == '__identifier__': + froms.append(node.name) + return froms def getNodesRecursively(path=__file__): + """ Returns imported nodes. """ Nodes = [] basedir, filename = os.path.split(path) + rootModule = os.path.basename(basedir) + for root, dirs, files in os.walk(basedir, topdown=False): if root not in sys.path: sys.path.append(root) for name in files: if name.endswith('.py') and not name.startswith('_'): - module_name = name[:-3] - module = importlib.import_module(module_name) - for name, obj in inspect.getmembers(module): - if inspect.isclass(obj) and not obj.__name__ == 'BaseNode': - for clsObj in inspect.getmro(obj): - if clsObj.__name__ == 'BaseNode': - Nodes.append(obj) - break + module_name = root.split(rootModule)[1].replace('\\', '.') + name[:-3] + modulePath = os.path.join(root, name) + froms = detectNodesFromText(modulePath) + if not froms: + continue + + try: + mod = __import__(module_name, globals(), locals(), froms, 0) + for node in froms: + Nodes.append(getattr(mod, node)) + + except ImportError as e: + print ('Error in importing class: %s' % (e)) + continue + return Nodes From 105a2ac8b7e5f9078ef3ba67f4441f28a30e4493 Mon Sep 17 00:00:00 2001 From: Leandro Inocencio Date: Thu, 13 Feb 2020 15:47:04 -0500 Subject: [PATCH 2/7] remove prints --- example_nodes/wrappers/math.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/example_nodes/wrappers/math.py b/example_nodes/wrappers/math.py index d2dd475a..b0a357fe 100644 --- a/example_nodes/wrappers/math.py +++ b/example_nodes/wrappers/math.py @@ -10,27 +10,22 @@ def pi(): - print('pi', _pi) return _pi def e(): - print('e', _e) return _e def tau(): - print('tau', _tau) return _tau def inf(): - print('inf', _inf) return _inf def nan(): - print('nan', _nan) return _nan From 8e98f3294352855da5769bf77b0963f37fac7c85 Mon Sep 17 00:00:00 2001 From: Leandro Inocencio Date: Thu, 13 Feb 2020 15:47:39 -0500 Subject: [PATCH 3/7] add SelfNode and clean ups --- example_nodes/util_nodes.py | 43 ++++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/example_nodes/util_nodes.py b/example_nodes/util_nodes.py index 9ff490b5..d4c13aeb 100644 --- a/example_nodes/util_nodes.py +++ b/example_nodes/util_nodes.py @@ -23,17 +23,17 @@ def __init__(self): def buildNode(self): obj = self.get_property('self') if obj: - self.set_name(obj.__class__.__name__.capitalize()) + self.set_name('Object Wrapper (%s)' % obj.__class__.__name__.capitalize()) else: self.set_name('Object Wrapper (None)') - # switch math function type if 'methods' not in self.view.widgets: self.add_combo_menu('methods', 'Methods', items=dir(obj), tab='widgets') + self.funcName = self.view.widgets['methods'].widget.currentText() self.view.widgets['methods'].value_changed.connect( self.addFunction) self.view.widgets['methods'].value_changed.connect( @@ -52,8 +52,9 @@ def addFunction(self, prop, func): self.funcName = func obj = self.get_property('self') func = getattr(obj, self.funcName) - dataFunc = inspect.signature(func) - + + if callable(func): + dataFunc = inspect.getfullargspec(func) for arg in dataFunc.args: if not self.has_property(arg): inPort = self.add_input(arg) @@ -65,6 +66,10 @@ def addFunction(self, prop, func): inPort.set_visible(True) else: inPort.set_visible(False) + else: + for inPort in self._inputs: + if inPort.name() != 'self': + inPort.set_visible(False) def getSelf(self): for from_port in self.selfPort.connected_ports(): @@ -100,10 +105,10 @@ def run(self): try: # Execute math function with arguments. - data = self.func(*[ - self.get_property(inport.name()) for inport in self._inputs - if inport.visible() and inport.name() != 'self' - ]) + if callable(self.func): + data = self.func(*[self.get_property(inport.name()) for inport in self._inputs if inport.visible() and inport.name() != 'self']) + else: + data = self.func self.set_property('output', data) except KeyError as error: @@ -128,3 +133,25 @@ def on_input_disconnected(self, to_port, from_port): comboBox = self.view.widgets['methods'].widget comboBox.clear() self.update_streams() + + +class SelfNode(BaseNode): + """ + A node class with 3 inputs and 3 outputs. + The last input and last output can take in multiple pipes. + """ + + # unique node identifier. + __identifier__ = 'Util' + + # initial default node name. + NODE_NAME = 'MetaNode' + + def __init__(self): + super(SelfNode, self).__init__() + self.add_output('self') + self.create_property('self', None) + + def run(self): + self.set_property('self', self) + \ No newline at end of file From 46f502089f59fafa98086d548925dd8674b667c7 Mon Sep 17 00:00:00 2001 From: Leandro Inocencio Date: Thu, 13 Feb 2020 15:49:17 -0500 Subject: [PATCH 4/7] fix and better print message --- example_nodes/input_nodes.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/example_nodes/input_nodes.py b/example_nodes/input_nodes.py index 1bc7cf53..2fc286bb 100644 --- a/example_nodes/input_nodes.py +++ b/example_nodes/input_nodes.py @@ -1,3 +1,4 @@ +import os from NodeGraphQt import BaseNode, QtCore @@ -64,7 +65,7 @@ def run(self): data = fread.read() self.set_property('output', data) else: - print('No existe %s' % path) + print("%s doesn't exist!" % path) self.set_property('output', '') From de33333c1ebb51e712d497c6c6a405845e2cd32f Mon Sep 17 00:00:00 2001 From: Leandro Inocencio Date: Thu, 13 Feb 2020 15:55:50 -0500 Subject: [PATCH 5/7] Add import session option and drag and drop to graph for JSON nodes --- NodeGraphQt/base/graph.py | 43 +++++++++++++++++++++++++++++++++++---- NodeGraphQt/base/utils.py | 15 ++++++++++++++ 2 files changed, 54 insertions(+), 4 deletions(-) diff --git a/NodeGraphQt/base/graph.py b/NodeGraphQt/base/graph.py index 182378f1..c448fc76 100644 --- a/NodeGraphQt/base/graph.py +++ b/NodeGraphQt/base/graph.py @@ -23,6 +23,29 @@ from NodeGraphQt.widgets.viewer import NodeViewer +class QWidgetDrops(QtWidgets.QWidget): + def dragEnterEvent(self, event): + if event.mimeData().hasUrls: + event.accept() + else: + event.ignore() + + def dragMoveEvent(self, event): + if event.mimeData().hasUrls: + event.accept() + else: + event.ignore() + + def dropEvent(self, event): + if event.mimeData().hasUrls: + event.setDropAction(QtCore.Qt.CopyAction) + event.accept() + for url in event.mimeData().urls(): + self.import_session(url.toLocalFile()) + else: + e.ignore() + + class NodeGraph(QtCore.QObject): """ The ``NodeGraph`` class is the main controller for managing all nodes. @@ -110,6 +133,7 @@ def __init__(self, parent=None): self._viewer.need_show_tab_search.connect(self._toggle_tab_search) self._wire_signals() + self.widget.setAcceptDrops(True) def __repr__(self): return '<{} object at {}>'.format(self.__class__.__name__, hex(id(self))) @@ -325,8 +349,10 @@ def widget(self): PySide2.QtWidgets.QWidget: node graph widget. """ if self._widget is None: - self._widget = QtWidgets.QWidget() - layout = QtWidgets.QVBoxLayout(self._widget) + self._widget = QWidgetDrops() + self._widget.import_session = self.import_session + + layout = QtWidgets.QVBoxLayout(self._widget) layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(self._viewer) return self._widget @@ -1046,16 +1072,25 @@ def save_session(self, file_path): def load_session(self, file_path): """ Load node graph session layout file. + + Args: + file_path (str): path to the serialized layout file. + """ + self.clear_session() + self.import_session(file_path) + def import_session(self, file_path): + """ + Import node graph session layout file. + Args: file_path (str): path to the serialized layout file. """ + file_path = file_path.strip() if not os.path.isfile(file_path): raise IOError('file does not exist.') - self.clear_session() - try: with open(file_path) as data_file: layout_data = json.load(data_file) diff --git a/NodeGraphQt/base/utils.py b/NodeGraphQt/base/utils.py index 14bae47c..612361c9 100644 --- a/NodeGraphQt/base/utils.py +++ b/NodeGraphQt/base/utils.py @@ -33,6 +33,7 @@ def setup_context_menu(graph): # create "File" menu. file_menu.add_command('Open...', _open_session, QtGui.QKeySequence.Open) + file_menu.add_command('Import...', _import_session, QtGui.QKeySequence.Open) file_menu.add_command('Save...', _save_session, QtGui.QKeySequence.Save) file_menu.add_command('Save As...', _save_session_as, 'Ctrl+Shift+s') file_menu.add_command('New Session', _new_session) @@ -119,6 +120,20 @@ def _open_session(graph): graph.load_session(file_path) +def _import_session(graph): + """ + Prompts a file open dialog to load a session. + + Args: + graph (NodeGraphQt.NodeGraph): node graph. + """ + current = graph.current_session() + viewer = graph.viewer() + file_path = viewer.load_dialog(current) + if file_path: + graph.import_session(file_path) + + def _save_session(graph): """ Prompts a file save dialog to serialize a session if required. From 1be63dc4a1d20e60b34be55283ddd08563fec225 Mon Sep 17 00:00:00 2001 From: Leandro Inocencio Date: Thu, 13 Feb 2020 16:55:21 -0500 Subject: [PATCH 6/7] add new examples and move to networks dir --- example_math_nodes.py | 2 +- example_nodes/networks/example.nodes | 175 ++++++ example_nodes/networks/logic_example.nodes | 488 ++++++++++++++++ example_nodes/networks/math_example.nodes | 360 ++++++++++++ example_nodes/networks/metanode_example.nodes | 534 ++++++++++++++++++ 5 files changed, 1558 insertions(+), 1 deletion(-) create mode 100644 example_nodes/networks/example.nodes create mode 100644 example_nodes/networks/logic_example.nodes create mode 100644 example_nodes/networks/math_example.nodes create mode 100644 example_nodes/networks/metanode_example.nodes diff --git a/example_math_nodes.py b/example_math_nodes.py index c6206380..f1c2287e 100644 --- a/example_math_nodes.py +++ b/example_math_nodes.py @@ -41,6 +41,6 @@ def show_nodes_list(node): # registered nodes. [graph.register_node(n) for n in Nodes] - graph.load_session('example.nodes') + graph.load_session(r'example_nodes\networks\example.nodes') app.exec_() diff --git a/example_nodes/networks/example.nodes b/example_nodes/networks/example.nodes new file mode 100644 index 00000000..9b0216fe --- /dev/null +++ b/example_nodes/networks/example.nodes @@ -0,0 +1,175 @@ +{ + "nodes":{ + "0x150eccc8":{ + "type_":"Viewers.DataViewerNode", + "icon":null, + "name":"Output", + "color":[ + 13, + 18, + 23, + 255 + ], + "border_color":[ + 74, + 84, + 85, + 255 + ], + "text_color":[ + 255, + 255, + 255, + 180 + ], + "disabled":false, + "selected":true, + "width":170, + "height":91.0, + "pos":[ + 602.4100268187593, + 341.7567828173967 + ], + "custom":{ + "data":"" + } + }, + "0x150f5588":{ + "type_":"Inputs.BoolInputNode", + "icon":null, + "name":"Bool", + "color":[ + 13, + 18, + 23, + 255 + ], + "border_color":[ + 74, + 84, + 85, + 255 + ], + "text_color":[ + 255, + 255, + 255, + 180 + ], + "disabled":false, + "selected":true, + "width":170, + "height":103.0, + "pos":[ + 40.41002681875926, + 275.7567828173967 + ], + "custom":{ + "out":true, + "combo":"True" + } + }, + "0x150f5d88":{ + "type_":"Logics.BooleanNode", + "icon":null, + "name":"Boolean", + "color":[ + 13, + 18, + 23, + 255 + ], + "border_color":[ + 74, + 84, + 85, + 255 + ], + "text_color":[ + 255, + 255, + 255, + 180 + ], + "disabled":false, + "selected":true, + "width":170, + "height":103.0, + "pos":[ + 310.41002681875943, + 338.7567828173967 + ], + "custom":{ + "out":null, + "funcs":"and" + } + }, + "0x1510e948":{ + "type_":"Inputs.BoolInputNode", + "icon":null, + "name":"Bool 1", + "color":[ + 13, + 18, + 23, + 255 + ], + "border_color":[ + 74, + 84, + 85, + 255 + ], + "text_color":[ + 255, + 255, + 255, + 180 + ], + "disabled":false, + "selected":true, + "width":170, + "height":103.0, + "pos":[ + 42.16002681875926, + 426.2567828173967 + ], + "custom":{ + "out":true, + "combo":"True" + } + } + }, + "connections":[ + { + "in":[ + "0x150eccc8", + "data" + ], + "out":[ + "0x150f5d88", + "out" + ] + }, + { + "out":[ + "0x150f5588", + "out" + ], + "in":[ + "0x150f5d88", + "a" + ] + }, + { + "in":[ + "0x150f5d88", + "b" + ], + "out":[ + "0x1510e948", + "out" + ] + } + ] +} \ No newline at end of file diff --git a/example_nodes/networks/logic_example.nodes b/example_nodes/networks/logic_example.nodes new file mode 100644 index 00000000..f3d106fd --- /dev/null +++ b/example_nodes/networks/logic_example.nodes @@ -0,0 +1,488 @@ +{ + "nodes":{ + "0x24655d68080":{ + "type_":"Viewers.DataViewerNode", + "icon":null, + "name":"Output", + "color":[ + 13, + 18, + 23, + 255 + ], + "border_color":[ + 74, + 84, + 85, + 255 + ], + "text_color":[ + 255, + 255, + 255, + 180 + ], + "disabled":false, + "selected":true, + "width":170, + "height":91.0, + "pos":[ + 1054.8408846082234, + 277.69046477635413 + ], + "custom":{ + "data":"True" + } + }, + "0x24655d68198":{ + "type_":"Inputs.BoolInputNode", + "icon":null, + "name":"Bool", + "color":[ + 13, + 18, + 23, + 255 + ], + "border_color":[ + 74, + 84, + 85, + 255 + ], + "text_color":[ + 255, + 255, + 255, + 180 + ], + "disabled":false, + "selected":true, + "width":170, + "height":103.0, + "pos":[ + 40.41002681875926, + 76.51843692273559 + ], + "custom":{ + "out":true, + "combo":"True" + } + }, + "0x24655d682b0":{ + "type_":"Logics.BooleanNode", + "icon":null, + "name":"Boolean", + "color":[ + 13, + 18, + 23, + 255 + ], + "border_color":[ + 74, + 84, + 85, + 255 + ], + "text_color":[ + 255, + 255, + 255, + 180 + ], + "disabled":false, + "selected":true, + "width":170, + "height":103.0, + "pos":[ + 310.41002681875943, + 139.5184369227356 + ], + "custom":{ + "out":true, + "funcs":"and" + } + }, + "0x24655d684e0":{ + "type_":"Inputs.BoolInputNode", + "icon":null, + "name":"Bool 1", + "color":[ + 13, + 18, + 23, + 255 + ], + "border_color":[ + 74, + 84, + 85, + 255 + ], + "text_color":[ + 255, + 255, + 255, + 180 + ], + "disabled":false, + "selected":true, + "width":170, + "height":103.0, + "pos":[ + 42.16002681875926, + 227.0184369227356 + ], + "custom":{ + "out":true, + "combo":"True" + } + }, + "0x24655d68d30":{ + "type_":"Logics.BooleanNode", + "icon":null, + "name":"Boolean 1", + "color":[ + 13, + 18, + 23, + 255 + ], + "border_color":[ + 74, + 84, + 85, + 255 + ], + "text_color":[ + 255, + 255, + 255, + 180 + ], + "disabled":false, + "selected":true, + "width":170, + "height":103.0, + "pos":[ + 311.66120646514884, + 435.352119008848 + ], + "custom":{ + "out":true, + "funcs":"or" + } + }, + "0x24655d68e48":{ + "type_":"Inputs.BoolInputNode", + "icon":null, + "name":"Bool 2", + "color":[ + 13, + 18, + 23, + 255 + ], + "border_color":[ + 74, + 84, + 85, + 255 + ], + "text_color":[ + 255, + 255, + 255, + 180 + ], + "disabled":false, + "selected":true, + "width":170, + "height":103.0, + "pos":[ + 40.52672596688427, + 372.352119008848 + ], + "custom":{ + "out":true, + "combo":"True" + } + }, + "0x24655d68f98":{ + "type_":"Inputs.BoolInputNode", + "icon":null, + "name":"Bool 3", + "color":[ + 13, + 18, + 23, + 255 + ], + "border_color":[ + 74, + 84, + 85, + 255 + ], + "text_color":[ + 255, + 255, + 255, + 180 + ], + "disabled":false, + "selected":true, + "width":170, + "height":103.0, + "pos":[ + 42.27672596688427, + 522.8521190088479 + ], + "custom":{ + "out":true, + "combo":"True" + } + }, + "0x24655d68588":{ + "type_":"Logics.BooleanNode", + "icon":null, + "name":"Boolean 2", + "color":[ + 13, + 18, + 23, + 255 + ], + "border_color":[ + 74, + 84, + 85, + 255 + ], + "text_color":[ + 255, + 255, + 255, + 180 + ], + "disabled":false, + "selected":true, + "width":170, + "height":103.0, + "pos":[ + 595.6882989586192, + 276.3648639984016 + ], + "custom":{ + "out":false, + "funcs":"xor" + } + }, + "0x24658ab5128":{ + "type_":"Logics.BooleanNode", + "icon":null, + "name":"Boolean 3", + "color":[ + 13, + 18, + 23, + 255 + ], + "border_color":[ + 74, + 84, + 85, + 255 + ], + "text_color":[ + 255, + 255, + 255, + 180 + ], + "disabled":false, + "selected":true, + "width":170, + "height":103.0, + "pos":[ + 817.5980018652086, + 276.1485560153941 + ], + "custom":{ + "out":true, + "funcs":"not" + } + }, + "0x24658ab56d8":{ + "type_":"Viewers.DataViewerNode", + "icon":null, + "name":"Output 1", + "color":[ + 13, + 18, + 23, + 255 + ], + "border_color":[ + 74, + 84, + 85, + 255 + ], + "text_color":[ + 255, + 255, + 255, + 180 + ], + "disabled":false, + "selected":true, + "width":170, + "height":91.0, + "pos":[ + 588.4911307833673, + 39.918487207336575 + ], + "custom":{ + "data":"True" + } + }, + "0x24658ab5898":{ + "type_":"Viewers.DataViewerNode", + "icon":null, + "name":"Output 2", + "color":[ + 13, + 18, + 23, + 255 + ], + "border_color":[ + 74, + 84, + 85, + 255 + ], + "text_color":[ + 255, + 255, + 255, + 180 + ], + "disabled":false, + "selected":true, + "width":170, + "height":91.0, + "pos":[ + 586.2432758568585, + 556.9251203043739 + ], + "custom":{ + "data":"True" + } + } + }, + "connections":[ + { + "in":[ + "0x24655d68080", + "data" + ], + "out":[ + "0x24658ab5128", + "out" + ] + }, + { + "out":[ + "0x24655d68198", + "out" + ], + "in":[ + "0x24655d682b0", + "a" + ] + }, + { + "in":[ + "0x24655d682b0", + "b" + ], + "out":[ + "0x24655d684e0", + "out" + ] + }, + { + "out":[ + "0x24655d682b0", + "out" + ], + "in":[ + "0x24655d68588", + "a" + ] + }, + { + "out":[ + "0x24655d682b0", + "out" + ], + "in":[ + "0x24658ab56d8", + "data" + ] + }, + { + "in":[ + "0x24655d68d30", + "a" + ], + "out":[ + "0x24655d68e48", + "out" + ] + }, + { + "in":[ + "0x24655d68d30", + "b" + ], + "out":[ + "0x24655d68f98", + "out" + ] + }, + { + "out":[ + "0x24655d68d30", + "out" + ], + "in":[ + "0x24655d68588", + "b" + ] + }, + { + "out":[ + "0x24655d68d30", + "out" + ], + "in":[ + "0x24658ab5898", + "data" + ] + }, + { + "out":[ + "0x24655d68588", + "out" + ], + "in":[ + "0x24658ab5128", + "a" + ] + } + ] +} \ No newline at end of file diff --git a/example_nodes/networks/math_example.nodes b/example_nodes/networks/math_example.nodes new file mode 100644 index 00000000..78edf13a --- /dev/null +++ b/example_nodes/networks/math_example.nodes @@ -0,0 +1,360 @@ +{ + "nodes":{ + "0x23186a70d68":{ + "type_":"Math.MathFunctionsNode", + "icon":null, + "name":"Math Functions", + "color":[ + 25, + 58, + 51, + 255 + ], + "border_color":[ + 74, + 84, + 85, + 255 + ], + "text_color":[ + 255, + 255, + 255, + 180 + ], + "disabled":false, + "selected":true, + "width":171.66666666666669, + "height":103.0, + "pos":[ + -86.57120242495097, + -255.88446202264552 + ], + "custom":{ + "funcs":"pi", + "output":3.141592653589793, + "x":null, + "y":null + } + }, + "0x23186a969e8":{ + "type_":"Math.MathFunctionsNode", + "icon":null, + "name":"Math Functions 1", + "color":[ + 25, + 58, + 51, + 255 + ], + "border_color":[ + 74, + 84, + 85, + 255 + ], + "text_color":[ + 255, + 255, + 255, + 180 + ], + "disabled":false, + "selected":true, + "width":185.0, + "height":103.0, + "pos":[ + 422.4155841142551, + -8.721545094082103 + ], + "custom":{ + "funcs":"mul", + "output":125.66370614359172, + "x":31.41592653589793, + "y":4.0 + } + }, + "0x23186a96780":{ + "type_":"Inputs.DataInputNode", + "icon":null, + "name":"Base Pow", + "color":[ + 13, + 18, + 23, + 255 + ], + "border_color":[ + 74, + 84, + 85, + 255 + ], + "text_color":[ + 255, + 255, + 255, + 180 + ], + "disabled":false, + "selected":true, + "width":173.0, + "height":91.0, + "pos":[ + -82.09158914872236, + 227.90422058505337 + ], + "custom":{ + "out":"2" + } + }, + "0x23186a70fd0":{ + "type_":"Viewers.DataViewerNode", + "icon":null, + "name":"Result View", + "color":[ + 13, + 18, + 23, + 255 + ], + "border_color":[ + 74, + 84, + 85, + 255 + ], + "text_color":[ + 255, + 255, + 255, + 180 + ], + "disabled":false, + "selected":true, + "width":170, + "height":91.0, + "pos":[ + 690.8492283748191, + 67.9743999567168 + ], + "custom":{ + "data":"125.66370614359172" + } + }, + "0x23186a96fd0":{ + "type_":"Math.MathFunctionsNode", + "icon":null, + "name":"Math Functions 2", + "color":[ + 25, + 58, + 51, + 255 + ], + "border_color":[ + 74, + 84, + 85, + 255 + ], + "text_color":[ + 255, + 255, + 255, + 180 + ], + "disabled":false, + "selected":true, + "width":185.0, + "height":103.0, + "pos":[ + 167.5921001970744, + 139.05653411762376 + ], + "custom":{ + "funcs":"pow", + "output":4.0, + "x":2.0, + "y":2.0 + } + }, + "0x2318756a748":{ + "type_":"Inputs.DataInputNode", + "icon":null, + "name":"Radius", + "color":[ + 13, + 18, + 23, + 255 + ], + "border_color":[ + 74, + 84, + 85, + 255 + ], + "text_color":[ + 255, + 255, + 255, + 180 + ], + "disabled":false, + "selected":true, + "width":173.0, + "height":91.0, + "pos":[ + -95.19868712071765, + 49.10350478105088 + ], + "custom":{ + "out":"2" + } + }, + "0x2318756aba8":{ + "type_":"Math.MathFunctionsNode", + "icon":null, + "name":"Math Functions 3", + "color":[ + 25, + 58, + 51, + 255 + ], + "border_color":[ + 74, + 84, + 85, + 255 + ], + "text_color":[ + 255, + 255, + 255, + 180 + ], + "disabled":false, + "selected":true, + "width":185.0, + "height":103.0, + "pos":[ + 165.77172748246284, + -129.58215016911666 + ], + "custom":{ + "funcs":"mul", + "output":31.41592653589793, + "x":3.141592653589793, + "y":10.0 + } + }, + "0x2318756add8":{ + "type_":"Inputs.DataInputNode", + "icon":null, + "name":"Height", + "color":[ + 13, + 18, + 23, + 255 + ], + "border_color":[ + 74, + 84, + 85, + 255 + ], + "text_color":[ + 255, + 255, + 255, + 180 + ], + "disabled":false, + "selected":true, + "width":173.0, + "height":91.0, + "pos":[ + -95.75000000000001, + -98.55581998670749 + ], + "custom":{ + "out":"10" + } + } + }, + "connections":[ + { + "out":[ + "0x23186a70d68", + "output" + ], + "in":[ + "0x2318756aba8", + "x" + ] + }, + { + "in":[ + "0x23186a969e8", + "x" + ], + "out":[ + "0x2318756aba8", + "output" + ] + }, + { + "in":[ + "0x23186a969e8", + "y" + ], + "out":[ + "0x23186a96fd0", + "output" + ] + }, + { + "out":[ + "0x23186a969e8", + "output" + ], + "in":[ + "0x23186a70fd0", + "data" + ] + }, + { + "out":[ + "0x23186a96780", + "out" + ], + "in":[ + "0x23186a96fd0", + "y" + ] + }, + { + "in":[ + "0x23186a96fd0", + "x" + ], + "out":[ + "0x2318756a748", + "out" + ] + }, + { + "in":[ + "0x2318756aba8", + "y" + ], + "out":[ + "0x2318756add8", + "out" + ] + } + ] +} \ No newline at end of file diff --git a/example_nodes/networks/metanode_example.nodes b/example_nodes/networks/metanode_example.nodes new file mode 100644 index 00000000..b7e84ea1 --- /dev/null +++ b/example_nodes/networks/metanode_example.nodes @@ -0,0 +1,534 @@ +{ + "nodes":{ + "0x23186a44ac8":{ + "type_":"Util.SelfNode", + "icon":null, + "name":"MetaNode", + "color":[ + 13, + 18, + 23, + 255 + ], + "border_color":[ + 74, + 84, + 85, + 255 + ], + "text_color":[ + 255, + 255, + 255, + 180 + ], + "disabled":false, + "selected":true, + "width":170, + "height":80, + "pos":[ + -83.41043390249492, + 145.80686130703504 + ], + "custom":{} + }, + "0x23186a44a90":{ + "type_":"Util.ObjectWrapperNode", + "icon":null, + "name":"Object Wrapper (Selfnode)", + "color":[ + 13, + 18, + 23, + 255 + ], + "border_color":[ + 74, + 84, + 85, + 255 + ], + "text_color":[ + 255, + 255, + 255, + 180 + ], + "disabled":false, + "selected":true, + "width":263.33333333333337, + "height":103.0, + "pos":[ + 190.18205744490388, + 141.88185237953135 + ], + "custom":{ + "methods":"NODE_NAME", + "output":"MetaNode" + } + }, + "0x23186a359b0":{ + "type_":"Viewers.DataViewerNode", + "icon":null, + "name":"Result View", + "color":[ + 13, + 18, + 23, + 255 + ], + "border_color":[ + 74, + 84, + 85, + 255 + ], + "text_color":[ + 255, + 255, + 255, + 180 + ], + "disabled":false, + "selected":true, + "width":170, + "height":91.0, + "pos":[ + 507.8932924780331, + 141.5753958467545 + ], + "custom":{ + "data":"MetaNode" + } + }, + "0x23186a35b00":{ + "type_":"Util.ObjectWrapperNode", + "icon":null, + "name":"Object Wrapper (Selfnode) 1", + "color":[ + 13, + 18, + 23, + 255 + ], + "border_color":[ + 74, + 84, + 85, + 255 + ], + "text_color":[ + 255, + 255, + 255, + 180 + ], + "disabled":false, + "selected":true, + "width":269.33333333333337, + "height":103.0, + "pos":[ + 190.18205744490376, + 252.56982232100978 + ], + "custom":{ + "methods":"set_disabled", + "output":null, + "mode":false + } + }, + "0x23186a70390":{ + "type_":"Util.ObjectWrapperNode", + "icon":null, + "name":"Object Wrapper (Selfnode) 5", + "color":[ + 13, + 18, + 23, + 255 + ], + "border_color":[ + 74, + 84, + 85, + 255 + ], + "text_color":[ + 255, + 255, + 255, + 180 + ], + "disabled":false, + "selected":true, + "width":263.33333333333337, + "height":103.0, + "pos":[ + 184.86985649857195, + 369.5454887834702 + ], + "custom":{ + "methods":"color", + "output":[ + 13, + 18, + 23 + ] + } + }, + "0x23186a70518":{ + "type_":"Util.ObjectWrapperNode", + "icon":null, + "name":"Object Wrapper (Selfnode) 2", + "color":[ + 13, + 18, + 23, + 255 + ], + "border_color":[ + 74, + 84, + 85, + 255 + ], + "text_color":[ + 255, + 255, + 255, + 180 + ], + "disabled":false, + "selected":true, + "width":263.33333333333337, + "height":103.0, + "pos":[ + 192.919890676134, + 483.2522215415342 + ], + "custom":{ + "methods":"x_pos", + "output":-34.21264525463879, + "value":null + } + }, + "0x23186a70588":{ + "type_":"Util.ObjectWrapperNode", + "icon":null, + "name":"Object Wrapper (Selfnode) 4", + "color":[ + 13, + 18, + 23, + 255 + ], + "border_color":[ + 74, + 84, + 85, + 255 + ], + "text_color":[ + 255, + 255, + 255, + 180 + ], + "disabled":false, + "selected":true, + "width":263.33333333333337, + "height":103.0, + "pos":[ + 194.9323992205243, + 609.0340055659415 + ], + "custom":{ + "methods":"y_pos", + "output":109.68171566928311 + } + }, + "0x23186a706d8":{ + "type_":"Inputs.BoolInputNode", + "icon":null, + "name":"Bool", + "color":[ + 13, + 18, + 23, + 255 + ], + "border_color":[ + 74, + 84, + 85, + 255 + ], + "text_color":[ + 255, + 255, + 255, + 180 + ], + "disabled":false, + "selected":true, + "width":170, + "height":103.0, + "pos":[ + -82.51285032001113, + 265.65112785954807 + ], + "custom":{ + "out":false, + "combo":"False" + } + }, + "0x23186a70860":{ + "type_":"Viewers.DataViewerNode", + "icon":null, + "name":"Result View 1", + "color":[ + 13, + 18, + 23, + 255 + ], + "border_color":[ + 74, + 84, + 85, + 255 + ], + "text_color":[ + 255, + 255, + 255, + 180 + ], + "disabled":false, + "selected":true, + "width":170, + "height":91.0, + "pos":[ + 511.7900833407451, + 250.04440887234296 + ], + "custom":{ + "data":"None" + } + }, + "0x23186a70ef0":{ + "type_":"Viewers.DataViewerNode", + "icon":null, + "name":"Result View 2", + "color":[ + 13, + 18, + 23, + 255 + ], + "border_color":[ + 74, + 84, + 85, + 255 + ], + "text_color":[ + 255, + 255, + 255, + 180 + ], + "disabled":false, + "selected":true, + "width":170, + "height":91.0, + "pos":[ + 512.0025031233081, + 364.9235168295961 + ], + "custom":{ + "data":"(13, 18, 23)" + } + }, + "0x23186a96080":{ + "type_":"Viewers.DataViewerNode", + "icon":null, + "name":"Result View 3", + "color":[ + 13, + 18, + 23, + 255 + ], + "border_color":[ + 74, + 84, + 85, + 255 + ], + "text_color":[ + 255, + 255, + 255, + 180 + ], + "disabled":false, + "selected":true, + "width":170, + "height":91.0, + "pos":[ + 513.0453785992057, + 486.5713536859874 + ], + "custom":{ + "data":"-34.21264525463879" + } + }, + "0x23186a96160":{ + "type_":"Viewers.DataViewerNode", + "icon":null, + "name":"Result View 4", + "color":[ + 13, + 18, + 23, + 255 + ], + "border_color":[ + 74, + 84, + 85, + 255 + ], + "text_color":[ + 255, + 255, + 255, + 180 + ], + "disabled":false, + "selected":true, + "width":170, + "height":91.0, + "pos":[ + 516.4488200939988, + 611.3642084950676 + ], + "custom":{ + "data":"109.68171566928311" + } + } + }, + "connections":[ + { + "out":[ + "0x23186a44ac8", + "self" + ], + "in":[ + "0x23186a44a90", + "self" + ] + }, + { + "out":[ + "0x23186a44ac8", + "self" + ], + "in":[ + "0x23186a35b00", + "self" + ] + }, + { + "out":[ + "0x23186a44ac8", + "self" + ], + "in":[ + "0x23186a70390", + "self" + ] + }, + { + "out":[ + "0x23186a44ac8", + "self" + ], + "in":[ + "0x23186a70518", + "self" + ] + }, + { + "out":[ + "0x23186a44ac8", + "self" + ], + "in":[ + "0x23186a70588", + "self" + ] + }, + { + "out":[ + "0x23186a44a90", + "output" + ], + "in":[ + "0x23186a359b0", + "data" + ] + }, + { + "in":[ + "0x23186a35b00", + "mode" + ], + "out":[ + "0x23186a706d8", + "out" + ] + }, + { + "out":[ + "0x23186a35b00", + "output" + ], + "in":[ + "0x23186a70860", + "data" + ] + }, + { + "out":[ + "0x23186a70390", + "output" + ], + "in":[ + "0x23186a70ef0", + "data" + ] + }, + { + "out":[ + "0x23186a70518", + "output" + ], + "in":[ + "0x23186a96080", + "data" + ] + }, + { + "out":[ + "0x23186a70588", + "output" + ], + "in":[ + "0x23186a96160", + "data" + ] + } + ] +} \ No newline at end of file From 7c7d3732fb9cde3210bbf3369887b0b6a0764a13 Mon Sep 17 00:00:00 2001 From: Leandro Inocencio Date: Thu, 13 Feb 2020 16:58:07 -0500 Subject: [PATCH 7/7] remove example --- example.nodes | 175 -------------------------------------------------- 1 file changed, 175 deletions(-) delete mode 100644 example.nodes diff --git a/example.nodes b/example.nodes deleted file mode 100644 index 104ba0b8..00000000 --- a/example.nodes +++ /dev/null @@ -1,175 +0,0 @@ -{ - "nodes":{ - "0x15095e08":{ - "type_":"Viewers.DataViewerNode", - "icon":null, - "name":"Output", - "color":[ - 13, - 18, - 23, - 255 - ], - "border_color":[ - 74, - 84, - 85, - 255 - ], - "text_color":[ - 255, - 255, - 255, - 180 - ], - "disabled":false, - "selected":true, - "width":170, - "height":91.0, - "pos":[ - 149.0, - -146.0 - ], - "custom":{ - "data":"" - } - }, - "0x15126848":{ - "type_":"Inputs.BoolInputNode", - "icon":null, - "name":"Bool", - "color":[ - 13, - 18, - 23, - 255 - ], - "border_color":[ - 74, - 84, - 85, - 255 - ], - "text_color":[ - 255, - 255, - 255, - 180 - ], - "disabled":false, - "selected":true, - "width":170, - "height":103.0, - "pos":[ - -413.0, - -212.0 - ], - "custom":{ - "out":true, - "combo":"True" - } - }, - "0x15140308":{ - "type_":"Logics.BooleanNode", - "icon":null, - "name":"Boolean", - "color":[ - 13, - 18, - 23, - 255 - ], - "border_color":[ - 74, - 84, - 85, - 255 - ], - "text_color":[ - 255, - 255, - 255, - 180 - ], - "disabled":false, - "selected":true, - "width":170, - "height":103.0, - "pos":[ - -143.0, - -149.0 - ], - "custom":{ - "out":null, - "funcs":"and" - } - }, - "0x1514a4c8":{ - "type_":"Inputs.BoolInputNode", - "icon":null, - "name":"Bool 1", - "color":[ - 13, - 18, - 23, - 255 - ], - "border_color":[ - 74, - 84, - 85, - 255 - ], - "text_color":[ - 255, - 255, - 255, - 180 - ], - "disabled":false, - "selected":true, - "width":170, - "height":103.0, - "pos":[ - -411.25, - -61.5 - ], - "custom":{ - "out":true, - "combo":"True" - } - } - }, - "connections":[ - { - "in":[ - "0x15095e08", - "data" - ], - "out":[ - "0x15140308", - "out" - ] - }, - { - "out":[ - "0x15126848", - "out" - ], - "in":[ - "0x15140308", - "a" - ] - }, - { - "in":[ - "0x15140308", - "b" - ], - "out":[ - "0x1514a4c8", - "out" - ] - } - ] -} \ No newline at end of file