[Bf-committers] Blender's Variable Registry..

Kiernan Holland bf-committers@blender.org
Fri, 6 Feb 2004 11:23:37 -0700


I think Like Meino Christian but abstract it to a localized database of
settings for all of blender. 

Think Windows Registry, but then imagine the registry in blender, and it
being 
accessible by users, python and programmers of blender. Then make it 
so that the registry has levels of access, settable on the programmer's
side. 
Variables registered by users are accessible to everyone, variables 
registered by python are accessible by everyone. 
Variables registered by programmers in the blender code are 
accessible by default only to the programmers. Then allow that 
to be changed so that python or users can see it and change it. 

Imagine in Meino Christian's case, that some of the variables define 
errors that are shown in the interface, then imagine being able to define
those 
errors in any language (dutch, german, russian, japanese, english etc.).  
This would allow anyone to have the level of error detail they need to 
solve problems, for the users it might be "Sorry can't do that" or some
requester 
message with some easy to understand buttons or for the programmers it 
might be "looks like this failed in mod.c contact ethan@co.com.uk" . 

Then it would also be possible with the code that checks registry values
and 
sets them, to  "grep"  the source for the setting of registry values.. It
is also 
possible if the registry is stored as a simple tree to define some macros
to 
easily access the registry keys, possibly even to verify the type of key, 
like 
	node = find_node(registry, "PROJECTION");
	if (this_key_is_matrix(node))  use_as_2D_projection(node);

The nodes of the registry could be structs, but for every struct there
could be 
some code to varify correctness of the struct.. Like "is_matrix()" and
"convert_to_registry_matrix()". 
This would also allow python and the users to set complex types like the
matrix transformations 
for the camera, or things of this sort.. On the fly.. Without requiring the
programmers to get 
too involved with the creation of interfaces (which can be a big time
waster if you just want to 
add one little thing to blender but make it accessible to users).

It would also be possible to create widgets for some complex registry
types, like 
if the parameter in the registry was a color, you could offer a button
widget to 
popup a color requester.  And if it was a matrix you could popup a matrix
requester. 
And so on..