添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

Stack Exchange Network

Stack Exchange network consists of 182 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. Visit Stack Exchange

Blender Stack Exchange is a question and answer site for people who use Blender to create 3D graphics, animations, or games. It only takes a minute to sign up.

Sign up to join this community

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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?

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.

$\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, 2013 at 23:26 $\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.

$\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 )