26
$\begingroup$

I really love the look of Blender's built-in GUI, and would potentially like to use these tools in some of my other Python applications. As I understand it, Blender created all of these tools from scratch, instead of inheriting them from one of the other standard GUI packages (wxPython, Tkinter, qt, etc).

Do these tools exist as a stand-alone package that I could use, either in addition to or instead of other packages (preferably something as simple as import blender_gui)?

For example, how could I use Blender's Node Editor setup in another Python application?

$\endgroup$
18
$\begingroup$

Short answer: no

...at least nobody has split off Blender's user interface from the application so that it can be used separately, and doing this isn't trivial.


Even if such a task were undertaken, keeping the code-bases in sync would be a challenge, so I think there is not much interest to do this. Besides, there are many UI toolkits out there.

There is GHOST (General Handy Operating System Toolkit), which can be used outside of Blender, but it's very low level, only providing window access, mouse, keyboard, ndof and tablet events from X11/MS-Windows/OS X. It doesn't actually draw anything; buttons or text, for example, are handled by Blender's own code. So likely GHOST isn't what you want.

Rather then using GHOST you're better off using a general purpose library such as SDL, Allegro, GLFW, or SFML. Some of these libraries have Python wrappers; for example, PyGame is a popular SDL wrapper.

And, as for UI toolkits, there are too many to mention here; there are enough resources online. See: Q What are the best cross platform widget toolkits?


On the other hand, nothing is stopping your from making a fork of Blenders UI for your own purposes, its just likely you'll end up having to spend time refactoring code out for your own use where you might better spend time working on the application its self.

$\endgroup$
  • 1
    $\begingroup$ Thanks for the answer! I'm a pretty heavy user of wxPython for application GUI, I was just wondering if I could port over some of Blender's features easily (especially the node editor). It appears the answer is sadly no. $\endgroup$ – Gwen Jun 22 '13 at 23:26
7
$\begingroup$

No. You cannot use Blender's GUI package in other programs outside of Blender.

Blender Graphical User Interface package is solely designed to be used with Blender on various platforms. Blender also has a custom window manager. And the UI widgets in Blender are tightly coupled with Blender's Data API (RNA/ID properties)

Most other user interface toolkits have their own runtime and are created for generic use, hence contain lots of functionality that either conflicts with Blender Design Goals, or adds unnecessary size to Blender package (hence increasing download size)

Some of the design goals of Blender user interface as stated in the Wiki

The Blender user interface is based on 3 main principles:

Non Overlapping: The UI permits you to view all relevant options and tools at a glance without pushing or dragging windows around.

Non Blocking: Tools and interface options do not block the user from any other parts of Blender. Blender doesn't pop up requesters that require the user to fill in data before things execute.

Non Modal: User input should remain as consistent and predictable as possible without changing commonly used methods (mouse, keyboard) on the fly.

However, Blender 2.5 permits multiple windows for multi-screen setup. It is an exception to the Non overlapping rule.

$\endgroup$
  • $\begingroup$ Added some more details :) $\endgroup$ – satishgoda Jun 22 '13 at 5:00
  • $\begingroup$ Okay thank you for updating your answer :) $\endgroup$ – A Wild RolandiXor Jun 23 '13 at 1:21
2
$\begingroup$

As satishgoda says, No. Blender uses its own windowing wrapper to provide OpenGL window access - called GHOST. I won't get into too much detail as satishgoda's answer pretty much sums it up.

However, while it might not be exactly what you have in mind, you can definitely use this toolkit to draw your own shapes/interfaces as Blender's entire interface is drawn in OpenGL. (src)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.