diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-03-23 18:04:06 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-03-23 18:04:06 +0300 |
commit | 5bc2d5350776e1fd063a62a40255589083ea6217 (patch) | |
tree | 244554e6379dfefcc9e47960b15e0564671b7eb3 /source/blender/makesrna/intern/rna_access.c | |
parent | 33e0ea0e5940dba240dc68fe44b5295c31dcb974 (diff) |
fix for parsing python args to rna functions, was using allocated size as argument count.
(commit 27670 by Campbell from render25 branch)
Diffstat (limited to 'source/blender/makesrna/intern/rna_access.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 09b4371fa20..1b5ab861556 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -3758,15 +3758,24 @@ ParameterList *RNA_parameter_list_create(ParameterList *parms, PointerRNA *ptr, { PropertyRNA *parm; void *data; - int tot= 0, size; + int alloc_size= 0, size; + parms->arg_count= 0; + parms->ret_count= 0; + /* allocate data */ - for(parm= func->cont.properties.first; parm; parm= parm->next) - tot+= rna_parameter_size_alloc(parm); + for(parm= func->cont.properties.first; parm; parm= parm->next) { + alloc_size += rna_parameter_size_alloc(parm); + + if(parm->flag & PROP_OUTPUT) + parms->ret_count++; + else + parms->arg_count++; + } - parms->data= MEM_callocN(tot, "RNA_parameter_list_create"); + parms->data= MEM_callocN(alloc_size, "RNA_parameter_list_create"); parms->func= func; - parms->tot= tot; + parms->alloc_size= alloc_size; /* set default values */ data= parms->data; @@ -3840,7 +3849,17 @@ void RNA_parameter_list_free(ParameterList *parms) int RNA_parameter_list_size(ParameterList *parms) { - return parms->tot; + return parms->alloc_size; +} + +int RNA_parameter_list_arg_count(ParameterList *parms) +{ + return parms->arg_count; +} + +int RNA_parameter_list_ret_count(ParameterList *parms) +{ + return parms->ret_count; } void RNA_parameter_list_begin(ParameterList *parms, ParameterIterator *iter) |