[Bf-committers] initializing new DNA vars in Blender

Ton Roosendaal bf-committers@blender.org
Thu, 6 Nov 2003 15:19:53 +0100


When you add new variables to structs that are written in a file as  
well, you can safely use the 'do_versions' in  
blenloader/intern/readfile.c to initialize them. By default Blender  
makes new variables zero (NULL) though.

However! There's one exception, and that's the User struct... this one  
is only read from the $HOME/.B.blend file, or from memory compiled in  
when it doesnt exist. Here it is important always to initialize the  
variable *always*, independent which version it comes from. Best of  
course is to do that in the code itself. For example in drawview.c  
init_gl_lighting() it checks the lamp colors. Or in resources.c it  
initializes theme colors.

Alternative is to put it in blenkernel/intern/blender.c  
(setup_app_data()). The code in src/usiblender.c (BIF_read_homefile())  
is plain wrong and will be removed.


Ton Roosendaal  Blender Foundation ton@blender.org