how to change view to script mode?

nodeQ's Avatar


17 Dec, 2012 06:56 PM

I tested both nodebox2 and 3, but I am not sure how to change my view from node to script in nodebox3.
Please let me know how to solve this!
Thank you :)

  1. Support Staff 1 Posted by Frederik De Ble... on 20 Dec, 2012 03:20 PM

    Frederik De Bleser's Avatar

    We did have a code editor in the previous edition of NodeBox, but because the internal workings have changed quite a bit since we started developing NodeBox 3 we decided to leave it out for the time being. We do agree that an integrated code editing tool is a valuable thing to have though, so it will definitely return one day.

    That said, it's totally possible to integrate your own code into
    NodeBox, even without having a dedicated editor. The procedure as it stands right now is as follows:

    • Create a folder to store your python file.

    • In NodeBox, create a new document and store it inside this folder. This step is important because NodeBox won't allow you to import outside code when the document has not yet been stored. Also, because code dependencies are stored inside the .ndbx file in a relative way it's wise to have the ndbx file and python code files close to each other (e.g. in the same folder).

    • Write some code and put it inside a python file ( NodeBox relates every node to a specific function and it calls its parameters one on one. The names of the parameters are not important but their order is. For example adding 3 numbers:

      def add(a, b, c): return a + b + c

    • Import the code inside NodeBox:

      • Go to File > Code Libraries (a new dialog will show up).
      • Press the + button and choose Python.
      • In the file dialog select
      • Close the dialog.
    • You can now create a node based on this code:

      • Inside NodeBox, open the node selection dialog and add a new "root" node (the first one to show up in the dialog).
      • When added, this node is named _root1, but feel free to rename it.
      • With this node selected, press the Metadata button on top of the ports panel. A new editor window will show up.
      • In the left panel, click on "settings". This will bring up the node metadata.
      • In the field "Function" write down "mycode/add".
        • "mycode" is the name of the python file we created (here, we'll also call it the function's namespace).
        • "add" is the name of the function we wrote.
      • We have a new node but we still have to map the function's parameters to node ports (parameters):
      • Press the + button in the bottom left part of the metadata panel.
      • An "Add new port" dialog shows up. Give your port a name "a" and a type "float".
      • Optionally, more parameter tweaking can be done at this point.
      • Repeat this process for the "b" and "c" parameters.
      • Press "Ok" to apply your changes.
      • That's it, the node is ready to use!

    You can make changes to the code in an external editor, then press Command-R to reload the code instantly in NodeBox.

    Hope this helps. We'll put this information on our website in the near future as well. If you have more questions please do feel free to ask!

  2. Frederik De Bleser closed this discussion on 20 Dec, 2012 03:20 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

23 Feb, 2024 07:39 PM
23 Feb, 2024 10:02 AM
22 Feb, 2024 05:51 AM
21 Feb, 2024 05:27 PM
21 Feb, 2024 04:49 PM


16 Feb, 2024 05:24 PM
06 Feb, 2024 04:45 AM
19 Jan, 2024 09:50 AM
13 Jan, 2024 03:47 AM
05 Jan, 2024 05:10 PM
05 Jan, 2024 04:54 PM