[Bf-taskforce25] data api proposal

Martin Poirier theeth at yahoo.com
Sun Sep 28 21:22:06 CEST 2008


--- On Sun, 9/28/08, Brecht Van Lommel <brecht at blender.org> wrote:

> Martin Poirier wrote:
> > Getters will have to take a pointer as argument, the
> getter function
> > will copy data in there. The same problem/solution
> applies to matrix,
> > quat, color getters.
> 
> The reason I mentioned strings is that they can be variable
> length. 
> Though of course ID names for example have fixed length. I
> think a 
> function that gives a pointer + maxlength, and another
> function to 
> retrieve the length should work.

We could support both solutions. Maybe something like:

char *BDP_propStringValue(p, NULL); // Allocate and return pointer to string

char *BDP_propStringValue(p, ptr); // Copy string into ptr (assume there's enough allocated memory), return ptr.

First form is used when length has a high variance, second form when there's a known maximum length (ID names).

Martin


      


More information about the Bf-taskforce25 mailing list