[Bf-committers] SDL2-based GUI toolkit for Blender (just a suggestion)

Felipe Ferreira da Silva felipefsdev at gmail.com
Sun Dec 1 10:12:13 CET 2013

Since it's the first time I'm posting here, my name is Felipe. I'm a
Blender user for years, and as a software developer I see a lot of posts
asking about which one is the GUI toolkit used by Blender. The answer is
that it is a embed library (very integrated with the rest of the program),
and it is hard to use as a stand-alone.

Well, I'm working on a personal project, and a need to create a custom
toolkit has emerged (I was using Gtk+, but it was useless at such point,
since integrate Gtk+ with OpenGL is very wearing), and maybe this toolkit
could be used in the future of Blender. I'm creating a GUI toolkit in C
with a simple system of class hierarchy for the widgets. It is very easy to
create new classes of widgets. For now, I have only 4 widget classes, but
my plan is to create equivalent classes to those of Gtk+.

I'm using SDL2 for inputs and drawing. The widgets are drawn using the
SDL_Texture, and I will put support to OpenGL widgets (just converting the
SDL_Texture of an widget to a OpenGL rendering and then back to
SDL_Texture). I'm not even using the hardware accelerated option of SDL2,
and the drawing is surprisingly fast.



In this second screen, the window has two "client widgets", that are
top-level widgets. The top widget will be drawn above the others and a
shadow/hatch effect will be drawn behind to indicate that we are dealing
with a widget that acts has a modal window.

And here is the code that takes to create this window and widgets:

It is very simple. To create new classes of widget, you just need to create
an allocation function and register it in the class manager. To create new
properties just need to use a function Widget_AddInt(), Widget_AddBool(),
Widget_AddPointer()... and so on. The same is to set or get a value.

Well, it is just it for now, I think that a stand-alone gui toolkit could
give to the developers more flexibility over the interface, but I know that
it would be something very arduous to change, so I'm just exposing a
suggestion. I will keep working on this toolkit because I need it, but if
anyone show interest, I plan to put it on git as GPL or LGPL when it
becomes more usable.

- Felipe Ferreira da Silva

More information about the Bf-committers mailing list