Hi Tom, It's not clear to me when you saw uninitialized memory, am I right thinking that the malloc made it work, but didn't look like a good solution? In other places the array is defined "static" to keep it in memory, without a malloc.
Brecht. On Fri, Jul 22, 2011 at 3:45 PM, Tom Edwards <[email protected]> wrote: > 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. > _______________________________________________ > Bf-committers mailing list > [email protected] > http://lists.blender.org/mailman/listinfo/bf-committers > _______________________________________________ Bf-committers mailing list [email protected] http://lists.blender.org/mailman/listinfo/bf-committers
