diff options
author | Arystanbek Dyussenov <arystan.d@gmail.com> | 2009-08-25 21:06:36 +0400 |
---|---|---|
committer | Arystanbek Dyussenov <arystan.d@gmail.com> | 2009-08-25 21:06:36 +0400 |
commit | 706a4c22b54ede250fbdb2c2bd772c63cdbf7d09 (patch) | |
tree | e9398918b950b98e3fa17741d67fe7b94915f89f /source/blender/editors/interface/interface_utils.c | |
parent | 7288bacad9bbe5e670de3454c9a64dee0c3d920c (diff) |
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]
Diffstat (limited to 'source/blender/editors/interface/interface_utils.c')
-rw-r--r-- | source/blender/editors/interface/interface_utils.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c index 997ac8b78c6..5b44f6544d1 100644 --- a/source/blender/editors/interface/interface_utils.c +++ b/source/blender/editors/interface/interface_utils.c @@ -72,7 +72,7 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind { uiBut *but=NULL; const char *propname= RNA_property_identifier(prop); - int arraylen= RNA_property_array_length(prop); + int arraylen= RNA_property_array_length(ptr, prop); switch(RNA_property_type(prop)) { case PROP_BOOLEAN: { @@ -81,7 +81,7 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind if(arraylen && index == -1) return NULL; - length= RNA_property_array_length(prop); + length= RNA_property_array_length(ptr, prop); if(length) value= RNA_property_boolean_get_index(ptr, prop, index); |