[Bf-committers] Declarative UI Experiment

Mathias Panzenböck grosser.meister.morti at gmx.net
Tue Aug 10 02:31:05 CEST 2010

I'm not a blender developer (only submitted a few tiny patches and once wrote
a python based small GUI toolkit for blender 2.4x scripts to make GUI
development easier), but here is what I think:

On 08/10/2010 12:27 AM, Jason Wilkins wrote:
> I have to argue with the assumption that you can't somehow have a GUI editor
> unless you have a declarative specification.  Most GUI editors that I have
> used generate procedural/oop code, not a special language.
> There is very little difference between a declarative language and a
> procedural one.  There may be practically no difference between saying
> 'There is an X' and 'Make an X' in some contexts.

The problem is to find out that 'Make an X' was said. Especially in dynamic
languages like python you need to execute the code to find out what was said
in the general case. Usually GUI editors do save a declarative version (in XML
or whatever) and use this to generate the procedural code. That said, XML is
really not meant to be read by humans and should not be used as basis for any
kind of language that is meant to.

> That aside, XML is meant to be parsed with libraries.  You would
> not re-implement XML anymore than you'd re-implement a C compiler.  Also,
> using a text editor to edit XML is like using a hex editor to edit python
> code.  I'm not saying use XML because you have tools that make it easier but
> I do find arguments that its complicated to implement from scratch and
> difficult to edit with the wrong tools to be rather odd.
> I 100% agree that Blender needs a way to fully access the UI as data and I'm
> surprised it apparently does not have one already.

I think the GUI building should not happen in a "draw" function (on every draw
python code is run!) but should be built once (e.g. in a constructor), like in
any other GUI toolkit. This of course complicates things and updates to GUI
elements have to trigger redraw events etc. The result is pretty much a full
blown toolkit. Don't know if this is needed for blender.


More information about the Bf-committers mailing list