Search code examples
pythonreusabilityvisual-programming

Is there a Python reusable component that is like the Blender node editor?


Blender has a powerful, fun-to-use, flexible node editor:

Blender 2.6 node editor

Is there a Python library that will allow me to easily create a visual developing environment like this? In Blender, the node editor works with shaders, images, colors and the like, and I'd like to define the types of nodes, sockets and preview widgets myself, as in building a "visual DSL".

Edit: I don't want to create custom nodes within Blender, but use a component LIKE the node editor in my own projects. I removed the Blender tag to avoid confusion.


Solution

  • You can find how to do that in the documentation:

    http://wiki.blender.org/index.php/User:Phonybone/Python_Nodes

    If you want to use the nodes to build objects and meshes procedurally with it then I recommend you to use and/or fork and and improve this project:

    http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Nodes/Sverchok

    (These guys are also using the API linked above)

    If you have blender specific questions, like this, I also recommend you to ask it on this blender dedicated stack exchange site:

    https://blender.stackexchange.com/


    EDIT:

    As far as I know, there isn't any pre-made node-editor widget or anything similar like that in any UI libraries. However it is quite easy to implement the basic rectangles , input and output ports and the bezier lines to connect them. After the first steps it is only a matter of preference how many hours you put into design and smaller details.

    I implemented my own in Python with the builtin tkinter library:

    enter image description here

    And then later in Pyglet and after that to improve speed I implemented it in pure C with OpenGL wrapped with Cython for Python usage:

    enter image description here