[Bf-committers] Adding new panels/buttons and properties to the global variable.

Brecht Van Lommel brecht at blender.org
Fri Mar 13 11:52:46 CET 2009


Hi,

Jingyuan Huang wrote:
> I tried to add two new fields to RenderData. However, since all the
> buttons reference to the global variable G and G is initialized by
> reading .B.blend, I got segfault because the scene data is not loaded
> properly. I wonder if there is a work around to this. Can I add
> buttons without touching the main blender data structure and yet still
> make it work?

I'm not sure why there would be a problem here, adding more members to 
RenderData should work OK. The button drawing code may use G.scene->r 
but you shouldn't worry about that. When you add a new member variable 
to RenderData, Blender will initialize it to 0 on load. Also make sure 
you don't have any "makesdna" warnings or errors during the compile 
process, there's some restrictions on alignment.

Some more information in the form of a diff of the DNA header file 
changes and a crash backtrace would be helpful. Or drop by in 
#blendercoders on irc.freenode.net, it's quicker to resolve this kind 
of issue there.

Brecht.


More information about the Bf-committers mailing list