[Bf-committers] ListBase vs. slots

Tom Edwards contact at steamreview.org
Mon Mar 5 23:48:55 CET 2012

I'm trying to refactor some code from the "array of pointers" solution 
used by material/texture slots to ListBase, as a result of code review. 
But I'm beginning to think that Blender doesn't support that.

The code in question is my Action Library patch from last October. It 
allows AnimData to store a list of associated Actions in addition to the 
single "active action" it currently stores. 

ListBase usually takes IDs directly, but since I'm not creating a global 
list of IDs I am having to use LinkData instead. For reference:

typedef struct LinkData
     struct LinkData *next, *prev;
     void *data;
} LinkData;

This works fine in C, but accessing items with Python crashes. Python 
can walk the list just fine (*next and *prev are as it expects) but 
doesn't seem to understand the *data indirection of LinkData.

Is there a RNA setting I've overlooked here? If not, I vote for 
supporting ListBase->LinkData collections. They are immediately 
applicable to material slots, texture slots, and I suspect particle 
system settings too. :)

More information about the Bf-committers mailing list