[Bf-committers] Defaults for RNA array parameters

Tom Edwards contact at steamreview.org
Fri Jul 22 15:45:51 CEST 2011


I can't work out how to provide a default value for an RNA array 
parameter. Ominously, the unit tests don't cover this at all.

The code is:

const int default_layout_size = sizeof(float) * 12;
const float default_layout_stack[] = { 0,0, 0,1, 0,2, 1,0, 1,1, 1,2 };

float* default_layout_heap = (float*)malloc(default_layout_size);
memcpy(default_layout_heap,default_layout_stack,default_layout_size);

...

parm = RNA_def_float_array(func, "layout", 12, default_layout_heap, 
0.0f, 0.0f, "File layout", "Snip", 0.0f, 0.0f);

There is no problem if a value is provided, but the default appears to 
be uninitialised memory.


More information about the Bf-committers mailing list