diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2013-08-26 20:08:03 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2013-08-26 20:08:03 +0400 |
commit | c93750d893e25a9f2ffd98222aa63cc3852f8a37 (patch) | |
tree | 437951b267c83acd04f6aa7e82de64cc00615b99 /source/blender/makesrna/intern/makesrna.c | |
parent | f157753120b0a0cce61f0f4a4f8a24c2cdd7642a (diff) |
RNA fixes regarding dynamic array properties in functions parameters (reviewed by Brecht, thanks!):
* It was not clear that RNA_parameter_length_get() & co only affected dynamic properties, renamed them to RNA_parameter_dynamic_length_get() and such.
* Fixed RNA_function_find_parameter(), we can't use BLI_findstring() here, need to call RNA_property_identifier()!
* Fixed RNA_parameter_get() and RNA_parameter_set(), which were completely wrong for dynamic properties.
* Fixed RNA_parameter_dynamic_length_get/set_data(), they did not check the property was actually a dynamic one and were using again ugly blackmagic casting intead of ParameterDynAlloc structure!
* makesrna was still using an ugly hackish (and perhaps not always working) code when handling dynamic parameters, now synchronized with RNA_parameter_dynamic_length_get_data and RNA_parameter_get code.
Diffstat (limited to 'source/blender/makesrna/intern/makesrna.c')
-rw-r--r-- | source/blender/makesrna/intern/makesrna.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index c158facca7c..4703e70b369 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -2273,11 +2273,12 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA valstr = "*"; } - /* this must be kept in sync with RNA_parameter_length_get_data, + /* this must be kept in sync with RNA_parameter_dynamic_length_get_data and RNA_parameter_get, * we could just call the function directly, but this is faster */ if (flag & PROP_DYNAMIC) { - fprintf(f, "\t%s_len = %s((int *)_data);\n", dparm->prop->identifier, pout ? "" : "*"); - data_str = "(&(((char *)_data)[sizeof(void *)]))"; + fprintf(f, "\t%s_len = %s((ParameterDynAlloc *)_data)->array_tot;\n", dparm->prop->identifier, + pout ? "(int *)&" : "(int)"); + data_str = "(&(((ParameterDynAlloc *)_data)->array))"; } else { data_str = "_data"; |