Blender Git Commit Log

Git Commits -> Revision 82cf2ae

Revision 82cf2ae by Brecht Van Lommel (master)
December 26, 2008, 20:38 (GMT)
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 %fn", loc[0], loc[1]);
}
RNA_END;

Commit Details:

Full Hash: 82cf2aebba1c340c1c4fffde1e89fc80a4591fea
SVN Revision: 18086
Parent Commit: 254fc41
Lines Changed: +379, -55

12 Modified Paths:

/source/blender/blenkernel/intern/idprop.c (+58, -10) (Diff)
/source/blender/blenloader/intern/readfile.c (+18, -10) (Diff)
/source/blender/blenloader/intern/writefile.c (+8, -0) (Diff)
/source/blender/makesrna/intern/makesrna.c (+13, -11) (Diff)
/source/blender/makesrna/intern/rna_access.c (+202, -22) (Diff)
/source/blender/makesrna/intern/rna_define.c (+27, -0) (Diff)
/source/blender/makesrna/intern/rna_ID.c (+4, -1) (Diff)
/source/blender/makesrna/intern/rna_internal.h (+1, -0) (Diff)
/source/blender/makesrna/intern/rna_wm.c (+21, -0) (Diff)
/source/blender/makesrna/RNA_access.h (+25, -1) (Diff)
/source/blender/makesrna/RNA_define.h (+1, -0) (Diff)
/source/blender/makesrna/RNA_types.h (+1, -0) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021