[Bf-committers] ListBase vs. slots

Tom Edwards contact at steamreview.org
Tue Mar 6 00:10:14 CET 2012


OK, solved it in the RNA get function:

static PointerRNA rna_actlib_get(CollectionPropertyIterator *iter)
{
     return rna_pointer_inherit_refine(&iter->parent, &RNA_Action, 
((LinkData*)rna_iterator_listbase_get(iter))->data);
}

That's what needs to be offered by the API.

On 05/03/2012 10:48, Tom Edwards wrote:
> 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.
> <http://projects.blender.org/tracker/index.php?func=detail&aid=28453&group_id=9&atid=127>
>
> 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. :)
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
>


More information about the Bf-committers mailing list