[Bf-python] Initialization of data and python vars.

Willian Padovani Germano wgermano at ig.com.br
Wed Aug 11 05:40:11 CEST 2004


Campbell Barton wrote:

> Hi, While writing the class vars for the oops objects I discovered 
> that the oops data was not initialized until the oops window was viewed.

Hi Campbell,

Yes, it can be done the way you propose, even made general (a general 
Blender.Window.InitSpace or something that accepts a 
Blender.Window.Types parameter), since other spaces can potentially need 
this, too, like the 3d view.

Another and probably better way to do it depends on how the oops vars 
will be added.  You're adding them to objects, right?  If it's done like 
bones are added to Armature or radio and render are added to Scene, as a 
subtype, initialization can be done automatically:

oops = object.getOops() # or another name, this also inits the oops win 
if needed
print oops.var1 #, etc...

Compare with object.getData, scene.getRenderingContext, for example, 
that's the same idea: you force a single way to access the "oops" object 
and can control initialization, no need for script writers to do it.

-- 
Willian, wgermano at ig.com.br



More information about the Bf-python mailing list