[Bf-python] Registry.SetKey issues
Willian Padovani Germano
wgermano at superig.com.br
Fri Apr 13 03:38:49 CEST 2007
Joe Eagar wrote:
> Hi. I noticed that Registry.SetKey uses an external script to save
> data. This seems like a kindof odd thing to do, because it makes
> blender dependant on an external script (instead of the other way around).
Hi, was just a test to see if it would work fine to mix things this way,
using Python for things it does well. Works fine and the script is
bundled with Blender, so only "broken" installs wouldn't have it. But of
course it can be rewritten in C if needed.
> Also, could someone explain why there are all kinds of weird limitations
> on the data you can save?
This system was intended for simple script config data, not for general
data. Since this stays in the Registry dict and depends on script
writers being sensible to how much to store there, a system with clear
goals and limitations seemed better to me.
> Perhaps its to make the config editor script
> easier; however I think if a script wants to save more complex data, it
> should be able to.
It is able to, you have the full power and simplicity of Python on your
hands, just create a file (there's the scripts/bpydata/ dir as
recommended place to save this file) and write whatever data you want to
there. You can also put any data on the Registry if you need it in
memory for a while.
> There should be no real limit to the size of a dict,
> lists or strings, as its trivial to wrap long lines to prevent saving
> one giant line in the config file.
The limitations were meant as a way to keep the system simple and to the
point: saving config data (for gui button states, paths, etc.), nothing
fancier, no "pickle for blender". For anything more complex, just create
your own file.
Anyway, Joe, if you think this should be upgraded to support general
data, feel free to discuss more here (with examples of what you want to
do) and add it as a topic for a future meeting.
--
Willian
More information about the Bf-python
mailing list