Python part of multidim. array support for RNA complete.
authorArystanbek Dyussenov <arystan.d@gmail.com>
Sun, 6 Sep 2009 15:13:57 +0000 (15:13 +0000)
committerArystanbek Dyussenov <arystan.d@gmail.com>
Sun, 6 Sep 2009 15:13:57 +0000 (15:13 +0000)
commit62138aaa5a7f931fa2ddb4815f755413111cceb0
treed675dc3decf8f86ec0dd60a659976723784dd5f4
parent3d64d65ad9c43f82bd4b9241b4a7fdde0fd12000
Python part of multidim. array support for RNA complete.

Multidim. arrays can now be modified at any level, for example:

struc.arrayprop = x
struc.arrayprop[i] = x
struc.arrayprop[i][j] = x
struc.arrayprop[i][j][k] = x
etc...

Approriate rvalue type/length checking is done.

To ensure all works correctly, I wrote automated tests in release/test/rna_array.py.

These tests cover: array/item access, assignment on different levels, tests that proper exceptions are thrown on invalid item access/assignment.

The tests use properties of the RNA Test struct defined in rna_test.c. This struct is only compiled when building with BF_UNIT_TEST=1 scons arg.

Currently unit tests are run manually by loading the script in the Text Editor.
Here's the output I have: http://www.pasteall.org/7644

Things to improve here:
- better exception messages when multidim. array assignment fails. Those we have currently are not very useful for multidim.
- add tests for slice assignment
17 files changed:
release/test/rna_array.py [new file with mode: 0644]
source/blender/blenloader/intern/readblenentry.c
source/blender/makesrna/RNA_access.h
source/blender/makesrna/SConscript
source/blender/makesrna/intern/SConscript
source/blender/makesrna/intern/makesrna.c
source/blender/makesrna/intern/rna_access.c
source/blender/makesrna/intern/rna_define.c
source/blender/makesrna/intern/rna_internal.h
source/blender/makesrna/intern/rna_internal_types.h
source/blender/makesrna/intern/rna_main.c
source/blender/makesrna/intern/rna_mesh.c
source/blender/makesrna/intern/rna_test.c [new file with mode: 0644]
source/blender/python/intern/bpy_array.c
source/blender/python/intern/bpy_rna.c
source/blender/python/intern/bpy_rna.h
tools/btools.py