23 # define DYNAMIC_ARRAY_SIZE 64
24 # define MARRAY_DIM [3][4][5]
25 # define MARRAY_TOTDIM 3
26 # define MARRAY_DIMSIZE 4, 5
27 # define MARRAY_SIZE(type) (sizeof(type MARRAY_DIM) / sizeof(type))
28 # define DYNAMIC_MARRAY_DIM [3][4][5]
29 # define DYNAMIC_MARRAY_SIZE(type) (sizeof(type DYNAMIC_MARRAY_DIM) / sizeof(type))
33 # define DEF_VARS(type, prefix) \
34 static type prefix##arr[ARRAY_SIZE]; \
35 static type prefix##darr[DYNAMIC_ARRAY_SIZE]; \
36 static int prefix##darr_len = ARRAY_SIZE; \
37 static type prefix##marr MARRAY_DIM; \
38 static type prefix##dmarr DYNAMIC_MARRAY_DIM; \
39 static int prefix##dmarr_len = sizeof(prefix##dmarr); \
42 # define DEF_GET_SET(type, arr) \
43 void rna_Test_##arr##_get(PointerRNA *ptr, type *values) \
45 memcpy(values, arr, sizeof(arr)); \
48 void rna_Test_##arr##_set(PointerRNA *ptr, const type *values) \
50 memcpy(arr, values, sizeof(arr)); \
54 # define DEF_GET_SET_LEN(arr, max) \
55 static int rna_Test_##arr##_get_length(PointerRNA *ptr) \
60 static int rna_Test_##arr##_set_length(PointerRNA *ptr, int length) \
75 DEF_GET_SET(
float, farr);
76 DEF_GET_SET(
int, iarr);
77 DEF_GET_SET(
int, barr);
79 DEF_GET_SET(
float, fmarr);
80 DEF_GET_SET(
int, imarr);
81 DEF_GET_SET(
int, bmarr);
83 DEF_GET_SET(
float, fdarr);
84 DEF_GET_SET_LEN(fdarr, DYNAMIC_ARRAY_SIZE);
85 DEF_GET_SET(
int, idarr);
86 DEF_GET_SET_LEN(idarr, DYNAMIC_ARRAY_SIZE);
87 DEF_GET_SET(
int, bdarr);
88 DEF_GET_SET_LEN(bdarr, DYNAMIC_ARRAY_SIZE);
90 DEF_GET_SET(
float, fdmarr);
91 DEF_GET_SET_LEN(fdmarr, DYNAMIC_MARRAY_SIZE(
float));
92 DEF_GET_SET(
int, idmarr);
93 DEF_GET_SET_LEN(idmarr, DYNAMIC_MARRAY_SIZE(
int));
94 DEF_GET_SET(
int, bdmarr);
95 DEF_GET_SET_LEN(bdmarr, DYNAMIC_MARRAY_SIZE(
int));
106 unsigned short dimsize[] = {MARRAY_DIMSIZE};
112 srna,
"farr",
ARRAY_SIZE,
NULL, 0.0f, 0.0f,
"farr",
"float array", 0.0f, 0.0f);
130 "dynamic float array",
135 prop,
"rna_Test_fdarr_get_length",
"rna_Test_fdarr_set_length");
139 srna,
"idarr", DYNAMIC_ARRAY_SIZE,
NULL, 0, 0,
"idarr",
"int array", 0, 0);
142 prop,
"rna_Test_idarr_get_length",
"rna_Test_idarr_set_length");
148 prop,
"rna_Test_bdarr_get_length",
"rna_Test_bdarr_set_length");
154 RNA_def_property_multidimensional_array(prop, MARRAY_SIZE(
float), MARRAY_TOTDIM, dimsize);
158 RNA_def_property_multidimensional_array(prop, MARRAY_SIZE(
int), MARRAY_TOTDIM, dimsize);
162 RNA_def_property_multidimensional_array(prop, MARRAY_SIZE(
int), MARRAY_TOTDIM, dimsize);
168 RNA_def_property_multidimensional_array(
169 prop, DYNAMIC_MARRAY_SIZE(
float), MARRAY_TOTDIM, dimsize);
172 prop,
"rna_Test_fdmarr_get_length",
"rna_Test_fdmarr_set_length");
176 RNA_def_property_multidimensional_array(prop, DYNAMIC_MARRAY_SIZE(
int), MARRAY_TOTDIM, dimsize);
179 prop,
"rna_Test_idmarr_get_length",
"rna_Test_idmarr_set_length");
183 RNA_def_property_multidimensional_array(prop, DYNAMIC_MARRAY_SIZE(
int), MARRAY_TOTDIM, dimsize);
186 prop,
"rna_Test_bdmarr_get_length",
"rna_Test_bdmarr_set_length");
SyclQueue void void size_t num_bytes void
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
PropertyRNA * RNA_def_int_array(StructOrFunctionRNA *cont_, const char *identifier, int len, const int *default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
PropertyRNA * RNA_def_float_array(StructOrFunctionRNA *cont_, const char *identifier, int len, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
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)
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)
PropertyRNA * RNA_def_boolean_array(StructOrFunctionRNA *cont_, const char *identifier, int len, bool *default_value, const char *ui_name, const char *ui_description)
void RNA_def_test(BlenderRNA *brna)