Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArystanbek Dyussenov <arystan.d@gmail.com>2009-09-06 19:13:57 +0400
committerArystanbek Dyussenov <arystan.d@gmail.com>2009-09-06 19:13:57 +0400
commit62138aaa5a7f931fa2ddb4815f755413111cceb0 (patch)
treed675dc3decf8f86ec0dd60a659976723784dd5f4 /source/blender/makesrna/intern/rna_main.c
parent3d64d65ad9c43f82bd4b9241b4a7fdde0fd12000 (diff)
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
Diffstat (limited to 'source/blender/makesrna/intern/rna_main.c')
-rw-r--r--source/blender/makesrna/intern/rna_main.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c
index 82e460ea57d..344135acaff 100644
--- a/source/blender/makesrna/intern/rna_main.c
+++ b/source/blender/makesrna/intern/rna_main.c
@@ -219,6 +219,18 @@ static void rna_Main_wm_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
rna_iterator_listbase_begin(iter, &bmain->wm, NULL);
}
+#ifdef UNIT_TEST
+
+static PointerRNA rna_Test_test_get(PointerRNA *ptr)
+{
+ PointerRNA ret= *ptr;
+ ret.type= &RNA_Test;
+
+ return ret;
+}
+
+#endif
+
#else
void RNA_def_main(BlenderRNA *brna)
@@ -276,6 +288,18 @@ void RNA_def_main(BlenderRNA *brna)
}
RNA_api_main(srna);
+
+#ifdef UNIT_TEST
+
+ RNA_define_verify_sdna(0);
+
+ prop= RNA_def_property(srna, "test", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Test");
+ RNA_def_property_pointer_funcs(prop, "rna_Test_test_get", NULL, NULL);
+
+ RNA_define_verify_sdna(1);
+
+#endif
}
#endif