25# define DYNAMIC_ARRAY_SIZE 64
26# define MARRAY_DIM [3][4][5]
27# define MARRAY_TOTDIM 3
28# define MARRAY_DIMSIZE 4, 5
29# define MARRAY_SIZE(type) (sizeof(type MARRAY_DIM) / sizeof(type))
30# define DYNAMIC_MARRAY_DIM [3][4][5]
31# define DYNAMIC_MARRAY_SIZE(type) (sizeof(type DYNAMIC_MARRAY_DIM) / sizeof(type))
35# define DEF_VARS(type, prefix) \
36 static type prefix##arr[ARRAY_SIZE]; \
37 static type prefix##darr[DYNAMIC_ARRAY_SIZE]; \
38 static int prefix##darr_len = ARRAY_SIZE; \
39 static type prefix##marr MARRAY_DIM; \
40 static type prefix##dmarr DYNAMIC_MARRAY_DIM; \
41 static int prefix##dmarr_len = sizeof(prefix##dmarr); \
44# define DEF_GET_SET(type, arr) \
45 void rna_Test_##arr##_get(PointerRNA *ptr, type *values) \
47 memcpy(values, arr, sizeof(arr)); \
50 void rna_Test_##arr##_set(PointerRNA *ptr, const type *values) \
52 memcpy(arr, values, sizeof(arr)); \
56# define DEF_GET_SET_LEN(arr, max) \
57 static int rna_Test_##arr##_get_length(PointerRNA *ptr) \
62 static int rna_Test_##arr##_set_length(PointerRNA *ptr, int length) \
77DEF_GET_SET(
float, farr);
78DEF_GET_SET(
int, iarr);
79DEF_GET_SET(
int, barr);
81DEF_GET_SET(
float, fmarr);
82DEF_GET_SET(
int, imarr);
83DEF_GET_SET(
int, bmarr);
85DEF_GET_SET(
float, fdarr);
86DEF_GET_SET_LEN(fdarr, DYNAMIC_ARRAY_SIZE);
87DEF_GET_SET(
int, idarr);
88DEF_GET_SET_LEN(idarr, DYNAMIC_ARRAY_SIZE);
89DEF_GET_SET(
int, bdarr);
90DEF_GET_SET_LEN(bdarr, DYNAMIC_ARRAY_SIZE);
92DEF_GET_SET(
float, fdmarr);
93DEF_GET_SET_LEN(fdmarr, DYNAMIC_MARRAY_SIZE(
float));
94DEF_GET_SET(
int, idmarr);
95DEF_GET_SET_LEN(idmarr, DYNAMIC_MARRAY_SIZE(
int));
96DEF_GET_SET(
int, bdmarr);
97DEF_GET_SET_LEN(bdmarr, DYNAMIC_MARRAY_SIZE(
int));
108 ushort dimsize[] = {MARRAY_DIMSIZE};
114 srna,
"farr",
ARRAY_SIZE,
nullptr, 0.0f, 0.0f,
"farr",
"float array", 0.0f, 0.0f);
132 "dynamic float array",
137 prop,
"rna_Test_fdarr_get_length",
"rna_Test_fdarr_set_length");
141 srna,
"idarr", DYNAMIC_ARRAY_SIZE,
nullptr, 0, 0,
"idarr",
"int array", 0, 0);
144 prop,
"rna_Test_idarr_get_length",
"rna_Test_idarr_set_length");
148 srna,
"bdarr", DYNAMIC_ARRAY_SIZE,
nullptr,
"bdarr",
"boolean array");
151 prop,
"rna_Test_bdarr_get_length",
"rna_Test_bdarr_set_length");
157 RNA_def_property_multidimensional_array(prop, MARRAY_SIZE(
float), MARRAY_TOTDIM, dimsize);
161 RNA_def_property_multidimensional_array(prop, MARRAY_SIZE(
int), MARRAY_TOTDIM, dimsize);
165 RNA_def_property_multidimensional_array(prop, MARRAY_SIZE(
int), MARRAY_TOTDIM, dimsize);
171 RNA_def_property_multidimensional_array(
172 prop, DYNAMIC_MARRAY_SIZE(
float), MARRAY_TOTDIM, dimsize);
175 prop,
"rna_Test_fdmarr_get_length",
"rna_Test_fdmarr_set_length");
179 RNA_def_property_multidimensional_array(prop, DYNAMIC_MARRAY_SIZE(
int), MARRAY_TOTDIM, dimsize);
182 prop,
"rna_Test_idmarr_get_length",
"rna_Test_idmarr_set_length");
186 RNA_def_property_multidimensional_array(prop, DYNAMIC_MARRAY_SIZE(
int), MARRAY_TOTDIM, dimsize);
189 prop,
"rna_Test_bdmarr_get_length",
"rna_Test_bdmarr_set_length");
local_group_size(16, 16) .push_constant(Type b
PropertyRNA * RNA_def_int_array(StructOrFunctionRNA *cont_, const char *identifier, const int len, const int *default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
PropertyRNA * RNA_def_boolean_array(StructOrFunctionRNA *cont_, const char *identifier, const int len, const bool *default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
void RNA_def_property_dynamic_array_funcs(PropertyRNA *prop, const char *getlength)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
PropertyRNA * RNA_def_float_array(StructOrFunctionRNA *cont_, const char *identifier, const int len, const float *default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_test(BlenderRNA *brna)