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):<br>
<br>/*<br>simple access api for id properties.<br><br>it works on id property groups (groups store other properties in a key:value manner). <br>since not all IDs necessarily have a<br>top-level group property (it's created as needed) a utility function<br>
IDP_getIDP is provided, which will ensure a given ID struct has<br>a top-level group property.<br><br>e.g. IDP_SetString(IDP_GetIDP(some_mesh), "author", "someone");<br>or IDP_SetInt(some_group, "int", 1);<br>
<br>*/<br>//shortcut to IDP_GetProperties(id, 1)<br>void IDP_GetIDP(ID *id);<br>void IDP_SetInt(IDProperty *group, char *name, int val);<br>void IDP_SetFloat(IDProperty *group, char *name, float val); <br>void IDP_SetString(IDProperty *group, char *name, char *string)<br>
//copies the array<br>void IDP_SetIntArray(IDProperty *group, char *name, int *array, int len);<br>//copies the array<br>void IDP_SetFloatArray(IDProperty *group, char *name, float *array, int len);<br><br>Another possibility are functions that'd use the embedded python interpreter to create or fetch properties, kindof like:<br>
<br>IDP_MakePyProp("{string: \"str\", int: 1, intarray: [0, 2, 3, 4], subgroup: {float: 1.0}}");<br>IDP_PyGetInt(IDP_GetIDP(someID), "metadata["xml"].record["author"]");<br>
<br>Joe<br>