Saturday, January 23, 2016

OUI-Blendish - An interesting widget toolkit based on Blender's UI

I was just looking through one of my newsfeeds just now, and stumbled across a rather interesting little ui/widget toolkit that seems to have slipped under the radar till now. For everyone who's been whining about wanting about a Blender-styled widget toolkit they can use in their own projects, this may be what they've been waiting for!

Presenting:   Leonard Ritter's (Duangle)  "OUI-Blendish"





As I've just found this, I haven't had the chance to try and build the example code to test it out for myself. From what I can tell, it looks like it's a single-file C library built on top of "nanovg" - a neat little "antialiased vector graphics rendering library using an OpenGL backend" (which is also another very interesting little project in its own right!).

But, back to the focus of today's post.

Leonard's work here is very interesting (and also a nice development as anyone who's come to like Blender's widget system and would like to use it in other software would attest)! I've had a little poke around, and it looks like he's ported/extracted the widget drawing code used by Blender (i.e. the "Blendish" library), and attached it to a little widget-interaction library of his own creation (i.e. the "Oui" library).

* I'm pleased to report that all of these projects (Oui-Blendish, and nanovg) are all C code. The OUI-Blendish code files may have *.cpp filename extensions, but from what I've seen, they only really use C-style code by and large (with the ability to use these via C++ code via the extern "C"  stuff). 

* Although the Oui library so far looks to be much simpler than the much more heavyweight uiBut system used in Blender, from the descriptions in the readme and in the code, it sounds like it too shares many of the positive characteristics that Blender's widget code possesses. Namely, like in Blender, the widgets are only "transient", and only hang around until the screen is updated/redrawn in response to some event.

Having worked with quite a lot of different toolkits over the years, I've found that *this* turns out to be the best way to define UI's. In all other toolkits, people get their knickers in a twist over needing to "update the view state", resulting in a lot of very hairy and repetitive code, resulting in more code needing to be written, followed by flamewars over which implementation is "more *the* correct MVC" implementation... and all because it was totally unconscionable for them that "there is no actual widget state that is persisted and needs to be manually updated because all the widgets get created and destroyed constantly".

* I'm not sure yet whether the widgets actually function like the real Blender ones until I've given them a test drive.

* Apparently this is "MIT" licensed (i.e. an Open Source license). However, people familiar with licensing stuff may want to double check that everything here is in order here (i.e. that the library doesn't need to be GPL licensed instead)...


In conclusion, this looks like a very interesting UI toolkit that would be worth some further investigation. If it works well, then this could well be a useful addition to your next new project!

(For other similar single-file libs, see https://github.com/nothings/stb/blob/master/docs/other_libs.md)

No comments:

Post a Comment