Blender Git Commit Log

Git Commits -> Revision 288f772

Revision 288f772 by Elia Sarti (master)
April 11, 2009, 12:44 (GMT)
2.5 / RNA
Committing quick RNA function calling RNA_function_call_direct* functions set à la fprintf.

It works like this (with ptr being an RNA pointer to some ID):

RNA_function_call_direct_lookup(ptr, "rename", "s", "MyCamera");

the format specifier would not be strictly needed but I prefer to keep this as it gives nice error handling in case some RNA function changes.
Format strings are very easy and similar to python ones:
"b" for booleans
"i" for integers
"f" for floats
"s" for strings
"e" for enums (using int values)
"O" for pointers (using O as in py, we can change to P)
"N" special NULL parameter, valid to skip optional parameters
For bools, ints and floats you can use a special format specifier with [n] where n is the size of an array of that type. For instance "f[4]" to set a location/vector (it expects a pointer to float* holding the array).

Return values still have to be implemented.
Also I know the name is a bit long maybe we can cut it up at RNA_call_direct or simply RNA_call.

Commit Details:

Full Hash: 288f772350fae9d12cb712fc26108c24f6f59bd8
SVN Revision: 19657
Parent Commit: 963e217
Lines Changed: +180, -12

2 Modified Paths:

/source/blender/makesrna/intern/rna_access.c (+179, -10) (Diff)
/source/blender/makesrna/RNA_access.h (+1, -2) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021