Can you suggest a better method of developing a script in such a
fashion that several people can work on components of it? The primary
issue with this script is that the GUI code is so large (almost 600
lines for the draw function, for just the shader editor alone) that it
becomes cumbersome to work on with just one draw() function, and I do
expect it the other modules of the script to have needs as demanding.
My initial thought was that I could register a "master" draw function
to handle routing to various modules based on the value of a 'state'
variable, and while that does seem to work, it also introduces these
memory issues. The modules I'm developing here are less a means of
"reusing" code than it is to provide some ease of modifying components
of the script as a whole.<br>
<br>
<br>
Also, I'm not following your above indicated method, rather I'm doing
import from math.* since the Register() function doesn't appear to be
happy with callbacks stored in a module (as in ShaderEditorGUI.draw()),
since that loads the functions/variables I need into the current
namespaces( at least I think/hope that's what's happening, and results
seem to bear me out).<br>
<br>
I'm going to try a few things (like accessing the blender.draw() using
the <module>.<attribute> style) and see if that changes
thing memory wise.<br>
<br>
Many thanks<br>
<br>
Bobby Parker<br><br><div><span class="gmail_quote">On 1/18/06, <b class="gmail_sendername">Willian Padovani Germano</b> <<a href="mailto:wgermano@superig.com.br">wgermano@superig.com.br</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br><br>One thing has nothing to do with the other:<br><br>Global dicts:<br><br>Each script in Blender has its own global dictionary, that gets deleted<br>when the script finishes executing (GUI scripts and also those who call
<br>the file selector leave callbacks, so we postpone removing their global<br>dicts until they are really finished). This keeps things clean, with one<br>script not affected by another's namespace.<br><br>Note: among other changes, after 
2.41 I plan to keep the global dicts of<br>script links (including space handlers) around, to make writing these<br>scripts easier and running them faster. Each will still have its own<br>global dict (that gets cleaned (deleted) when an error occurs), so no
<br>namespace issues still.<br><br>Modules:<br><br>Python modules are not reloaded unless you specifically tell the<br>interpreter to do so.<br><br>To solve the problem of vars created in modules being persistent, simply<br>
*do not use modules to store new data* -- do not do this:<br><br>import math<br>math.myvar = <something><br>math.myfunction = f<br>#etc<br><br>Use the Registry dict, use a Blender text, save data as a file (the<br>Registry can do this for you). Storing vars in default modules like
<br>math, etc. is like adding new vars or functions to a system library.<br><br>Besides not being a clean way to code, it also pollutes the modules that<br>other scripts will use. Imagine if many authors start doing this, soon
<br>one script will change the data created by another and cause trouble.<br><br>Saving GUI buttons in modules would be even more troublesome, these<br>don't stay around for that long, Blender recreates buttons on every<br>
redraw. That's why they should be created in the draw callback that you<br>register with Draw.Register.<br><br>--<br>Willian<br>_______________________________________________<br>Bf-python mailing list<br><a href="mailto:Bf-python@projects.blender.org">
Bf-python@projects.blender.org</a><br><a href="http://projects.blender.org/mailman/listinfo/bf-python">http://projects.blender.org/mailman/listinfo/bf-python</a><br></blockquote></div><br>