From 706a4c22b54ede250fbdb2c2bd772c63cdbf7d09 Mon Sep 17 00:00:00 2001 From: Arystanbek Dyussenov Date: Tue, 25 Aug 2009 17:06:36 +0000 Subject: Implemented dynamic and multidimensional array support in RNA. Example code: http://www.pasteall.org/7332/c. New API functions: http://www.pasteall.org/7330/c. Maximum number of dimensions is currently limited to 3, but can be increased arbitrarily if needed. What this means for ID property access: * MeshFace.verts - dynamic array, size 3 or 4 depending on MFace.v4 * MeshTextureFace.uv - dynamic, 2-dimensional array, size depends on MFace.v4 * Object.matrix - 2-dimensional array What this means for functions: * more intuitive API possibility, for example: Mesh.add_vertices([(x, y, z), (x, y, z), ...]) Mesh.add_faces([(1, 2, 3), (4, 5, 6), ...]) Python part is not complete yet, e.g. it is possible to: MeshFace.verts = (1, 2, 3) # even if Mesh.verts is (1, 2, 3, 4) and vice-versa MeshTextureFace.uv = [(0.0, 0.0)] * 4 # only if a corresponding MFace is a quad but the following won't work: MeshTextureFace.uv[3] = (0.0, 0.0) # setting uv[3] modifies MTFace.uv[1][0] instead of MTFace.uv[3] --- source/blender/editors/animation/drivers.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source/blender/editors/animation/drivers.c') diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c index 849e2d2eede..e7b7d785d7b 100644 --- a/source/blender/editors/animation/drivers.c +++ b/source/blender/editors/animation/drivers.c @@ -157,7 +157,7 @@ short ANIM_add_driver (ID *id, const char rna_path[], int array_index, short fla /* fill in current value for python */ if(type == DRIVER_TYPE_PYTHON) { PropertyType proptype= RNA_property_type(prop); - int array= RNA_property_array_length(prop); + int array= RNA_property_array_length(&ptr, prop); char *expression= fcu->driver->expression; int val, maxlen= sizeof(fcu->driver->expression); float fval; @@ -241,7 +241,7 @@ static int add_driver_button_exec (bContext *C, wmOperator *op) if (path) { if (all) { - length= RNA_property_array_length(prop); + length= RNA_property_array_length(&ptr, prop); if (length) index= 0; else length= 1; @@ -303,7 +303,7 @@ static int remove_driver_button_exec (bContext *C, wmOperator *op) if (path) { if (all) { - length= RNA_property_array_length(prop); + length= RNA_property_array_length(&ptr, prop); if(length) index= 0; else length= 1; -- cgit v1.2.3