-
Notifications
You must be signed in to change notification settings - Fork 164
Description
It would be great to have an option to save (custom) nodes that you often need and then be able to access them using the Menu. This would be a lot more convenient than having to create a new script node (or whatever other base node you are using) and then copy the code you want or write new code each time you need it.
Adding a node to the saved nodes could be done using a GUI like in the sketch below:

It could be accessed using a new entry in the right click menu when right clicked on a node and/or using a new entry (e.g. "Edit available nodes") in either the "Edit" or the "Add" menu.
Implementing the dynamic addition/removal of menu items should not be difficult; it can be done using QMenu.addAction, QMenu.removeAction and QMenu.insertAction (of course, the nodes and the order would have to be saved in the program data and the menus would have to be adjusted accordingly on each program startup).
Saving the additional nodes in the program data should also not be a problem, as the nodes should actually be fully defined by their Python code snippet.
One node that would be useful to have accessible would be the following node (that evaluates an arbitrary mathematical expression in Python code):
import fab
import math
varTuple = ('a', 'b')
title('formula')
for v in varTuple:
input(v, float)
input('formula', str)
out = eval(formula)
output('out', out)