[Bf-committers] id property changes

joe joeedh at gmail.com
Wed Nov 12 21:34:38 CET 2008


It seems the current C API of id properties is rather lacking.  As such,
it'd be great if everyone could send a list of their ideas/needs in this
area, especially relating to the 2.5 project.  Because of the 2.5 project I
figure I should get on top of this.  I've come up with the following ideas
for new functions to start out with (I've not implemented any of them):

/*
simple access api for id properties.

it works on id property groups (groups store other properties in a key:value
manner).
since not all IDs necessarily have a
top-level group property (it's created as needed) a utility function
IDP_getIDP is provided, which will ensure a given ID struct has
a top-level group property.

e.g. IDP_SetString(IDP_GetIDP(some_mesh), "author", "someone");
or IDP_SetInt(some_group, "int", 1);

*/
//shortcut to IDP_GetProperties(id, 1)
void IDP_GetIDP(ID *id);
void IDP_SetInt(IDProperty *group, char *name, int val);
void IDP_SetFloat(IDProperty *group, char *name, float val);
void IDP_SetString(IDProperty *group, char *name, char *string)
//copies the array
void IDP_SetIntArray(IDProperty *group, char *name, int *array, int len);
//copies the array
void IDP_SetFloatArray(IDProperty *group, char *name, float *array, int
len);

Another possibility are functions that'd use the embedded python interpreter
to create or fetch properties, kindof like:

IDP_MakePyProp("{string: \"str\", int: 1, intarray: [0, 2, 3, 4], subgroup:
{float: 1.0}}");
IDP_PyGetInt(IDP_GetIDP(someID), "metadata["xml"].record["author"]");

Joe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.blender.org/pipermail/bf-committers/attachments/20081112/97023d90/attachment.htm 


More information about the Bf-committers mailing list