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-07-11 20:11:26 +0400
committerArystanbek Dyussenov <arystan.d@gmail.com>2009-07-11 20:11:26 +0400
commit870a9d61042d8badb02673678dd1ed32a6ee994d (patch)
tree1417a09c3ccf0091c972772bcde8f87140a95102 /source/blender/makesrna/intern/rna_action_api.c
parentf221d9128ddf593f7977251ed4214cfe682d7c40 (diff)
RNA functions can now return dynamic arrays (float, int/boolean). RNA handles freeing memory.
Example code: http://pastebin.mozilla.org/662154.
Diffstat (limited to 'source/blender/makesrna/intern/rna_action_api.c')
-rw-r--r--source/blender/makesrna/intern/rna_action_api.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_action_api.c b/source/blender/makesrna/intern/rna_action_api.c
index a758a2c56d0..b989d2d66a9 100644
--- a/source/blender/makesrna/intern/rna_action_api.c
+++ b/source/blender/makesrna/intern/rna_action_api.c
@@ -36,6 +36,16 @@
#ifdef RNA_RUNTIME
+int *rna_Action_get_frames(bAction *act, int *ret_length)
+{
+ *ret_length= 3;
+ int *ret= MEM_callocN(*ret_length * sizeof(int), "action frames");
+ ret[0] = 1;
+ ret[1] = 2;
+ ret[2] = 3;
+ return ret;
+}
+
#else
void RNA_api_action(StructRNA *srna)
@@ -43,6 +53,11 @@ void RNA_api_action(StructRNA *srna)
FunctionRNA *func;
PropertyRNA *parm;
+ func= RNA_def_function(srna, "get_frames", "rna_Action_get_frames");
+ RNA_def_function_ui_description(func, "Get action frames."); /* XXX describe better */
+ parm= RNA_def_int_array(func, "frames", 1, NULL, 0, 0, "", "", 0, 0);
+ RNA_def_property_flag(parm, PROP_DYNAMIC_ARRAY);
+ RNA_def_function_return(func, parm);
}
#endif