RNA:
* Added support for using pointers + collections as operator properties,
but with the restriction that they must point to other type derived from
ID property groups. The "add" function for these properties will allocate
a new ID property group and point to that.
* Added support for arrays with type IDP_GROUP in ID properties.
* Fix bug getting/setting float array values.
Example code for collections, note the "OperatorMousePath" type is defined
in rna_wm.c and has a float[2] property named "loc".
Defining the operator property:
prop= RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
Adding values:
PointerRNA itemptr;
float loc[2] = {1, 1},
RNA_collection_add(op->ptr, "path", &itemptr);
RNA_float_set_array(&itemptr, "loc", loc);
Iterating:
RNA_BEGIN(op->ptr, itemptr, "path") {
float loc[2];
RNA_float_get_array(&itemptr, "loc", loc);
printf("Location: %f %f\n", loc[0], loc[1]);
}
RNA_END;
This commit is contained in:
@@ -390,6 +390,14 @@ static void IDP_WriteArray(IDProperty *prop, void *wd)
|
||||
/*REMEMBER to set totalen to len in the linking code!!*/
|
||||
if (prop->data.pointer) {
|
||||
writedata(wd, DATA, MEM_allocN_len(prop->data.pointer), prop->data.pointer);
|
||||
|
||||
if(prop->type == IDP_GROUP) {
|
||||
IDProperty **array= prop->data.pointer;
|
||||
int a;
|
||||
|
||||
for(a=0; a<prop->len; a++)
|
||||
IDP_WriteProperty(array[a], wd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user