376
static PropertyRNA *typemap[IDP_NUMTYPES] =
377
{(PropertyRNA*)&rna_PropertyGroupItem_string,
378
(PropertyRNA*)&rna_PropertyGroupItem_int,
379
(PropertyRNA*)&rna_PropertyGroupItem_float,
381
(PropertyRNA*)&rna_PropertyGroupItem_group, NULL,
382
(PropertyRNA*)&rna_PropertyGroupItem_double,
383
(PropertyRNA*)&rna_PropertyGroupItem_idp_array};
378
static PropertyRNA *typemap[IDP_NUMTYPES] = {
379
(PropertyRNA *)&rna_PropertyGroupItem_string,
380
(PropertyRNA *)&rna_PropertyGroupItem_int,
381
(PropertyRNA *)&rna_PropertyGroupItem_float,
383
(PropertyRNA *)&rna_PropertyGroupItem_group, NULL,
384
(PropertyRNA *)&rna_PropertyGroupItem_double,
385
(PropertyRNA *)&rna_PropertyGroupItem_idp_array
385
static PropertyRNA *arraytypemap[IDP_NUMTYPES] =
386
{NULL, (PropertyRNA*)&rna_PropertyGroupItem_int_array,
387
(PropertyRNA*)&rna_PropertyGroupItem_float_array,
389
(PropertyRNA*)&rna_PropertyGroupItem_collection, NULL,
390
(PropertyRNA*)&rna_PropertyGroupItem_double_array};
388
static PropertyRNA *arraytypemap[IDP_NUMTYPES] = {
389
NULL, (PropertyRNA *)&rna_PropertyGroupItem_int_array,
390
(PropertyRNA *)&rna_PropertyGroupItem_float_array,
392
(PropertyRNA *)&rna_PropertyGroupItem_collection, NULL,
393
(PropertyRNA *)&rna_PropertyGroupItem_double_array
392
396
IDProperty *rna_idproperty_check(PropertyRNA **prop, PointerRNA *ptr)
3645
3788
* collection, otherwise return the property rna so that the
3646
3789
* caller can read the value of the property itself */
3647
3790
switch (type) {
3649
nextptr = RNA_property_pointer_get(&curptr, prop);
3653
prop = NULL; /* now we have a PointerRNA, the prop is our parent so forget it */
3654
if (index) *index = -1;
3660
case PROP_COLLECTION:
3663
/* resolve the lookup with [] brackets */
3664
token = rna_path_token(&path, fixedbuf, sizeof(fixedbuf), 1);
3669
/* check for "" to see if it is a string */
3670
if (rna_token_strip_quotes(token)) {
3671
RNA_property_collection_lookup_string(&curptr, prop, token+1, &nextptr);
3674
/* otherwise do int lookup */
3675
intkey = atoi(token);
3676
if (intkey == 0 && (token[0] != '0' || token[1] != '\0')) {
3677
return 0; /* we can be sure the fixedbuf was used in this case */
3679
RNA_property_collection_lookup_int(&curptr, prop, intkey, &nextptr);
3682
if (token != fixedbuf) {
3689
/* ensure we quit on invalid values */
3690
nextptr.data = NULL;
3692
if (RNA_property_collection_type_get(&curptr, prop, &c_ptr)) {
3792
nextptr = RNA_property_pointer_get(&curptr, prop);
3697
3794
if (nextptr.data) {
3698
3795
curptr = nextptr;
3699
prop = NULL; /* now we have a PointerRNA, the prop is our parent so forget it */
3796
prop = NULL; /* now we have a PointerRNA, the prop is our parent so forget it */
3700
3797
if (index) *index = -1;
3714
int index_arr[RNA_MAX_ARRAY_DIMENSION] = {0};
3715
int len[RNA_MAX_ARRAY_DIMENSION];
3716
const int dim = RNA_property_array_dimension(&curptr, prop, len);
3719
for (i = 0; i<dim; i++) {
3722
/* multi index resolve */
3803
case PROP_COLLECTION:
3806
/* resolve the lookup with [] brackets */
3724
3807
token = rna_path_token(&path, fixedbuf, sizeof(fixedbuf), 1);
3726
if (token == NULL) {
3727
/* invalid syntax blah[] */
3730
3812
/* check for "" to see if it is a string */
3731
else if (rna_token_strip_quotes(token)) {
3732
temp_index = RNA_property_array_item_index(prop, *(token+1));
3813
if (rna_token_strip_quotes(token)) {
3814
if (RNA_property_collection_lookup_string(&curptr, prop, token + 1, &nextptr)) {
3818
nextptr.data = NULL;
3735
3822
/* otherwise do int lookup */
3736
temp_index = atoi(token);
3738
if (temp_index == 0 && (token[0] != '0' || token[1] != '\0')) {
3739
if (token != fixedbuf) {
3747
else if (dim == 1) {
3748
/* location.x || scale.X, single dimension arrays only */
3749
token = rna_path_token(&path, fixedbuf, sizeof(fixedbuf), 0);
3750
if (token == NULL) {
3751
/* invalid syntax blah.. */
3754
temp_index = RNA_property_array_item_index(prop, *token);
3823
intkey = atoi(token);
3824
if (intkey == 0 && (token[0] != '0' || token[1] != '\0')) {
3825
return 0; /* we can be sure the fixedbuf was used in this case */
3827
if (RNA_property_collection_lookup_int(&curptr, prop, intkey, &nextptr)) {
3831
nextptr.data = NULL;
3835
if (token != fixedbuf) {
3757
if (token != fixedbuf) {
3842
if (RNA_property_collection_type_get(&curptr, prop, &c_ptr)) {
3846
/* ensure we quit on invalid values */
3847
nextptr.data = NULL;
3762
if (temp_index < 0 || temp_index >= len[i])
3853
prop = NULL; /* now we have a PointerRNA, the prop is our parent so forget it */
3854
if (index) *index = -1;
3765
index_arr[i] = temp_index;
3766
/* end multi index resolve */
3769
/* arrays always contain numbers so further values are not valid */
3777
for (i = dim-1; i >= 0; i--) {
3778
flat_index += index_arr[i] * totdim;
3782
*index = flat_index;
3868
int index_arr[RNA_MAX_ARRAY_DIMENSION] = {0};
3869
int len[RNA_MAX_ARRAY_DIMENSION];
3870
const int dim = RNA_property_array_dimension(&curptr, prop, len);
3873
for (i = 0; i < dim; i++) {
3876
/* multi index resolve */
3878
token = rna_path_token(&path, fixedbuf, sizeof(fixedbuf), 1);
3880
if (token == NULL) {
3881
/* invalid syntax blah[] */
3884
/* check for "" to see if it is a string */
3885
else if (rna_token_strip_quotes(token)) {
3886
temp_index = RNA_property_array_item_index(prop, *(token + 1));
3889
/* otherwise do int lookup */
3890
temp_index = atoi(token);
3892
if (temp_index == 0 && (token[0] != '0' || token[1] != '\0')) {
3893
if (token != fixedbuf) {
3901
else if (dim == 1) {
3902
/* location.x || scale.X, single dimension arrays only */
3903
token = rna_path_token(&path, fixedbuf, sizeof(fixedbuf), 0);
3904
if (token == NULL) {
3905
/* invalid syntax blah.. */
3908
temp_index = RNA_property_array_item_index(prop, *token);
3911
if (token != fixedbuf) {
3916
if (temp_index < 0 || temp_index >= len[i])
3919
index_arr[i] = temp_index;
3920
/* end multi index resolve */
3923
/* arrays always contain numbers so further values are not valid */
3931
for (i = dim - 1; i >= 0; i--) {
3932
flat_index += index_arr[i] * totdim;
3936
*index = flat_index;
4083
4242
propname = RNA_property_identifier(prop);
4086
path = BLI_sprintfN(is_rna ? "%s.%s":"%s[\"%s\"]", ptrpath, propname);
4245
path = BLI_sprintfN(is_rna ? "%s.%s" : "%s[\"%s\"]", ptrpath, propname);
4087
4246
MEM_freeN(ptrpath);
4248
else if (RNA_struct_is_ID(ptr->type)) {
4091
4250
path = BLI_strdup(propname);
4093
4252
path = BLI_sprintfN("[\"%s\"]", propname);
4262
* Get the ID as a python representation, eg:
4263
* bpy.data.foo["bar"]
4265
char *RNA_path_full_ID_py(ID *id)
4267
char id_esc[(sizeof(id->name) - 2) * 2];
4269
BLI_strescape(id_esc, id->name + 2, sizeof(id_esc));
4271
return BLI_sprintfN("bpy.data.%s[\"%s\"]", BKE_idcode_to_name_plural(GS(id->name)), id_esc);
4275
* Get the ID.struct as a python representation, eg:
4276
* bpy.data.foo["bar"].some_struct
4278
char *RNA_path_full_struct_py(struct PointerRNA *ptr)
4285
if (!ptr->id.data) {
4290
id_path = RNA_path_full_ID_py(ptr->id.data);
4292
data_path = RNA_path_from_ID_to_struct(ptr);
4294
ret = BLI_sprintfN("%s.%s",
4295
id_path, data_path);
4297
MEM_freeN(data_path);
4303
* Get the ID.struct.property as a python representation, eg:
4304
* bpy.data.foo["bar"].some_struct.some_prop[10]
4306
char *RNA_path_full_property_py(PointerRNA *ptr, PropertyRNA *prop, int index)
4313
if (!ptr->id.data) {
4318
id_path = RNA_path_full_ID_py(ptr->id.data);
4320
data_path = RNA_path_from_ID_to_property(ptr, prop);
4322
if ((index == -1) || (RNA_property_array_check(prop) == FALSE)) {
4323
ret = BLI_sprintfN("%s.%s",
4324
id_path, data_path);
4327
ret = BLI_sprintfN("%s.%s[%d]",
4328
id_path, data_path, index);
4332
MEM_freeN(data_path);
4339
* Get the struct.property as a python representation, eg:
4340
* some_struct.some_prop[10]
4342
char *RNA_path_struct_property_py(PointerRNA *ptr, PropertyRNA *prop, int index)
4348
if (!ptr->id.data) {
4352
data_path = RNA_path_from_ID_to_property(ptr, prop);
4354
if ((index == -1) || (RNA_property_array_check(prop) == FALSE)) {
4355
ret = BLI_sprintfN("%s",
4359
ret = BLI_sprintfN("%s[%d]",
4364
MEM_freeN(data_path);
4371
* Get the struct.property as a python representation, eg:
4374
char *RNA_path_property_py(PointerRNA *UNUSED(ptr), PropertyRNA *prop, int index)
4378
if ((index == -1) || (RNA_property_array_check(prop) == FALSE)) {
4379
ret = BLI_sprintfN("%s",
4380
RNA_property_identifier(prop));
4383
ret = BLI_sprintfN("%s[%d]",
4384
RNA_property_identifier(prop), index);
4099
4390
/* Quick name based property access */
4101
4392
int RNA_boolean_get(PointerRNA *ptr, const char *name)
4647
5004
/* see if we can coorce into a python type - PropertyType */
4648
5005
switch (type) {
4651
BLI_dynstr_append(dynstr, RNA_property_boolean_get(ptr, prop) ? "True" : "False");
4654
BLI_dynstr_append(dynstr, "(");
4655
for (i = 0; i<len; i++) {
4656
BLI_dynstr_appendf(dynstr, i ? ", %s" : "%s",
4657
RNA_property_boolean_get_index(ptr, prop, i) ? "True" : "False");
4660
BLI_dynstr_append(dynstr, ","); /* otherwise python wont see it as a tuple */
4661
BLI_dynstr_append(dynstr, ")");
4666
BLI_dynstr_appendf(dynstr, "%d", RNA_property_int_get(ptr, prop));
4669
BLI_dynstr_append(dynstr, "(");
4670
for (i = 0; i<len; i++) {
4671
BLI_dynstr_appendf(dynstr, i?", %d":"%d", RNA_property_int_get_index(ptr, prop, i));
4674
BLI_dynstr_append(dynstr, ","); /* otherwise python wont see it as a tuple */
4675
BLI_dynstr_append(dynstr, ")");
4680
BLI_dynstr_appendf(dynstr, "%g", RNA_property_float_get(ptr, prop));
4683
BLI_dynstr_append(dynstr, "(");
4684
for (i = 0; i<len; i++) {
4685
BLI_dynstr_appendf(dynstr, i?", %g":"%g", RNA_property_float_get_index(ptr, prop, i));
4688
BLI_dynstr_append(dynstr, ","); /* otherwise python wont see it as a tuple */
4689
BLI_dynstr_append(dynstr, ")");
4698
length = RNA_property_string_length(ptr, prop);
4699
buf = MEM_mallocN(sizeof(char)*(length+1), "RNA_property_as_string");
4700
buf_esc = MEM_mallocN(sizeof(char)*(length*2+1), "RNA_property_as_string esc");
4701
RNA_property_string_get(ptr, prop, buf);
4702
BLI_strescape(buf_esc, buf, length*2+1);
4704
BLI_dynstr_appendf(dynstr, "\"%s\"", buf_esc);
4710
/* string arrays don't exist */
4711
const char *identifier;
4712
int val = RNA_property_enum_get(ptr, prop);
4714
if (RNA_property_flag(prop) & PROP_ENUM_FLAG) {
4715
/* represent as a python set */
4717
EnumPropertyItem *item = NULL;
4720
BLI_dynstr_append(dynstr, "{");
4722
RNA_property_enum_items(C, ptr, prop, &item, NULL, &free);
4724
short is_first = TRUE;
4725
for (; item->identifier; item++) {
4726
if (item->identifier[0] && item->value & val) {
4727
BLI_dynstr_appendf(dynstr, is_first ? "'%s'" : ", '%s'", item->identifier);
4737
BLI_dynstr_append(dynstr, "}");
4740
/* annoying exception, don't confuse with dictionary syntax above: {} */
4741
BLI_dynstr_append(dynstr, "set()");
4744
else if (RNA_property_enum_identifier(C, ptr, prop, val, &identifier)) {
4745
BLI_dynstr_appendf(dynstr, "'%s'", identifier);
4748
BLI_dynstr_append(dynstr, "'<UNKNOWN ENUM>'");
4754
PointerRNA tptr = RNA_property_pointer_get(ptr, prop);
4755
cstring = RNA_pointer_as_string(C, &tptr);
4756
BLI_dynstr_append(dynstr, cstring);
4760
case PROP_COLLECTION:
4763
CollectionPropertyIterator collect_iter;
4764
BLI_dynstr_append(dynstr, "[");
4766
for (RNA_property_collection_begin(ptr, prop, &collect_iter); collect_iter.valid;
4767
RNA_property_collection_next(&collect_iter)) {
4768
PointerRNA itemptr = collect_iter.ptr;
4770
if (first_time == 0)
4771
BLI_dynstr_append(dynstr, ", ");
4774
/* now get every prop of the collection */
4775
cstring = RNA_pointer_as_string(C, &itemptr);
5008
BLI_dynstr_append(dynstr, bool_as_py_string(RNA_property_boolean_get(ptr, prop)));
5012
BLI_dynstr_append(dynstr, bool_as_py_string(RNA_property_boolean_get_index(ptr, prop, index)));
5015
BLI_dynstr_append(dynstr, "(");
5016
for (i = 0; i < len; i++) {
5017
BLI_dynstr_appendf(dynstr, i ? ", %s" : "%s",
5018
bool_as_py_string(RNA_property_boolean_get_index(ptr, prop, i)));
5021
BLI_dynstr_append(dynstr, ","); /* otherwise python wont see it as a tuple */
5022
BLI_dynstr_append(dynstr, ")");
5028
BLI_dynstr_appendf(dynstr, "%d", RNA_property_int_get(ptr, prop));
5032
BLI_dynstr_appendf(dynstr, "%d", RNA_property_int_get_index(ptr, prop, index));
5035
BLI_dynstr_append(dynstr, "(");
5036
for (i = 0; i < len; i++) {
5037
BLI_dynstr_appendf(dynstr, i ? ", %d" : "%d", RNA_property_int_get_index(ptr, prop, i));
5040
BLI_dynstr_append(dynstr, ","); /* otherwise python wont see it as a tuple */
5041
BLI_dynstr_append(dynstr, ")");
5047
BLI_dynstr_appendf(dynstr, "%g", RNA_property_float_get(ptr, prop));
5051
BLI_dynstr_appendf(dynstr, "%g", RNA_property_float_get_index(ptr, prop, index));
5054
BLI_dynstr_append(dynstr, "(");
5055
for (i = 0; i < len; i++) {
5056
BLI_dynstr_appendf(dynstr, i ? ", %g" : "%g", RNA_property_float_get_index(ptr, prop, i));
5059
BLI_dynstr_append(dynstr, ","); /* otherwise python wont see it as a tuple */
5060
BLI_dynstr_append(dynstr, ")");
5070
length = RNA_property_string_length(ptr, prop);
5071
buf = MEM_mallocN(sizeof(char) * (length + 1), "RNA_property_as_string");
5072
buf_esc = MEM_mallocN(sizeof(char) * (length * 2 + 1), "RNA_property_as_string esc");
5073
RNA_property_string_get(ptr, prop, buf);
5074
BLI_strescape(buf_esc, buf, length * 2 + 1);
5076
BLI_dynstr_appendf(dynstr, "\"%s\"", buf_esc);
5082
/* string arrays don't exist */
5083
const char *identifier;
5084
int val = RNA_property_enum_get(ptr, prop);
5086
if (RNA_property_flag(prop) & PROP_ENUM_FLAG) {
5087
/* represent as a python set */
5089
EnumPropertyItem *item = NULL;
5092
BLI_dynstr_append(dynstr, "{");
5094
RNA_property_enum_items(C, ptr, prop, &item, NULL, &free);
5096
short is_first = TRUE;
5097
for (; item->identifier; item++) {
5098
if (item->identifier[0] && item->value & val) {
5099
BLI_dynstr_appendf(dynstr, is_first ? "'%s'" : ", '%s'", item->identifier);
5109
BLI_dynstr_append(dynstr, "}");
5112
/* annoying exception, don't confuse with dictionary syntax above: {} */
5113
BLI_dynstr_append(dynstr, "set()");
5116
else if (RNA_property_enum_identifier(C, ptr, prop, val, &identifier)) {
5117
BLI_dynstr_appendf(dynstr, "'%s'", identifier);
5120
BLI_dynstr_append(dynstr, "'<UNKNOWN ENUM>'");
5126
PointerRNA tptr = RNA_property_pointer_get(ptr, prop);
5127
cstring = RNA_pointer_as_string(C, ptr, prop, &tptr);
4776
5128
BLI_dynstr_append(dynstr, cstring);
4777
5129
MEM_freeN(cstring);
5132
case PROP_COLLECTION:
5135
CollectionPropertyIterator collect_iter;
5136
BLI_dynstr_append(dynstr, "[");
5138
for (RNA_property_collection_begin(ptr, prop, &collect_iter); collect_iter.valid;
5139
RNA_property_collection_next(&collect_iter))
5141
PointerRNA itemptr = collect_iter.ptr;
5143
if (first_time == 0)
5144
BLI_dynstr_append(dynstr, ", ");
5147
/* now get every prop of the collection */
5148
cstring = RNA_pointer_as_string(C, ptr, prop, &itemptr);
5149
BLI_dynstr_append(dynstr, cstring);
4780
RNA_property_collection_end(&collect_iter);
4781
BLI_dynstr_append(dynstr, "]");
4785
BLI_dynstr_append(dynstr, "'<UNKNOWN TYPE>'"); /* TODO */
5153
RNA_property_collection_end(&collect_iter);
5154
BLI_dynstr_append(dynstr, "]");
5158
BLI_dynstr_append(dynstr, "'<UNKNOWN TYPE>'"); /* TODO */
4789
5162
cstring = BLI_dynstr_get_cstring(dynstr);
5173
5547
/* ptr is always a function pointer, prop always a parameter */
5175
5549
switch (type) {
5179
5553
fprintf(stderr, "%s.%s: wrong type for parameter %s, a boolean was expected\n", tid, fid, pid);
5184
*((int*)dest) = *((int*)src);
5558
*((int *)dest) = *((int *)src);
5186
memcpy(dest, src, len*sizeof(int));
5560
memcpy(dest, src, len * sizeof(int));
5193
5567
fprintf(stderr, "%s.%s: wrong type for parameter %s, an integer was expected\n", tid, fid, pid);
5198
*((int*)dest) = *((int*)src);
5572
*((int *)dest) = *((int *)src);
5200
memcpy(dest, src, len*sizeof(int));
5574
memcpy(dest, src, len * sizeof(int));
5207
5581
fprintf(stderr, "%s.%s: wrong type for parameter %s, a float was expected\n", tid, fid, pid);
5212
*((float*)dest) = *((float*)src);
5586
*((float *)dest) = *((float *)src);
5214
memcpy(dest, src, len*sizeof(float));
5588
memcpy(dest, src, len * sizeof(float));
5221
5595
fprintf(stderr, "%s.%s: wrong type for parameter %s, a string was expected\n", tid, fid, pid);
5225
*((char**)dest) = *((char**)src);
5599
*((char **)dest) = *((char **)src);
5232
5606
fprintf(stderr, "%s.%s: wrong type for parameter %s, an enum was expected\n", tid, fid, pid);
5236
*((int*)dest) = *((int*)src);
5610
*((int *)dest) = *((int *)src);
5242
5616
StructRNA *ptype;
5245
5619
fprintf(stderr, "%s.%s: wrong type for parameter %s, an object was expected\n", tid, fid, pid);
5374
5748
switch (type) {
5379
5753
int arg = va_arg(args, int);
5380
5754
err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg,
5381
5755
NULL, tid, fid, pid);
5386
5760
double arg = va_arg(args, double);
5387
5761
err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg,
5388
5762
NULL, tid, fid, pid);
5393
char *arg = va_arg(args, char*);
5767
char *arg = va_arg(args, char *);
5394
5768
err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg,
5395
5769
NULL, tid, fid, pid);
5400
StructRNA *srna = va_arg(args, StructRNA*);
5401
void *arg = va_arg(args, void*);
5402
err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg,
5403
srna, tid, fid, pid);
5406
case PROP_COLLECTION:
5408
StructRNA *srna = va_arg(args, StructRNA*);
5409
ListBase *arg = va_arg(args, ListBase*);
5410
err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg,
5411
srna, tid, fid, pid);
5774
StructRNA *srna = va_arg(args, StructRNA *);
5775
void *arg = va_arg(args, void *);
5776
err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg,
5777
srna, tid, fid, pid);
5780
case PROP_COLLECTION:
5782
StructRNA *srna = va_arg(args, StructRNA *);
5783
ListBase *arg = va_arg(args, ListBase *);
5784
err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg,
5785
srna, tid, fid, pid);
5416
5790
/* handle errors */
5417
5791
err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, NULL,
5446
5820
switch (type) {
5451
int *arg = va_arg(args, int*);
5452
err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata,
5453
NULL, tid, fid, pid);
5458
float *arg = va_arg(args, float*);
5459
err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata,
5460
NULL, tid, fid, pid);
5465
char **arg = va_arg(args, char**);
5466
err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata,
5467
NULL, tid, fid, pid);
5472
StructRNA *srna = va_arg(args, StructRNA*);
5473
void **arg = va_arg(args, void**);
5474
err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata,
5475
srna, tid, fid, pid);
5478
case PROP_COLLECTION:
5480
StructRNA *srna = va_arg(args, StructRNA*);
5481
ListBase **arg = va_arg(args, ListBase**);
5482
err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata,
5483
srna, tid, fid, pid);
5825
int *arg = va_arg(args, int *);
5826
err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata,
5827
NULL, tid, fid, pid);
5832
float *arg = va_arg(args, float *);
5833
err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata,
5834
NULL, tid, fid, pid);
5839
char **arg = va_arg(args, char **);
5840
err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata,
5841
NULL, tid, fid, pid);
5846
StructRNA *srna = va_arg(args, StructRNA *);
5847
void **arg = va_arg(args, void **);
5848
err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata,
5849
srna, tid, fid, pid);
5852
case PROP_COLLECTION:
5854
StructRNA *srna = va_arg(args, StructRNA *);
5855
ListBase **arg = va_arg(args, ListBase * *);
5856
err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata,
5857
srna, tid, fid, pid);
5488
5862
/* handle errors */
5489
5863
err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, NULL, NULL,
6108
int RNA_property_equals(PointerRNA *a, PointerRNA *b, PropertyRNA *prop)
6110
/* get the length of the array to work with */
6111
int len = RNA_property_array_length(a, prop);
6112
int fromlen = RNA_property_array_length(b, prop);
6117
/* get and set the default values as appropriate for the various types */
6118
switch (RNA_property_type(prop)) {
6122
int fixed_a[16], fixed_b[16];
6123
int *array_a, *array_b;
6126
array_a = (len > 16)? MEM_callocN(sizeof(int) * len, "RNA equals"): fixed_a;
6127
array_b = (len > 16)? MEM_callocN(sizeof(int) * len, "RNA equals"): fixed_b;
6129
RNA_property_boolean_get_array(a, prop, array_a);
6130
RNA_property_boolean_get_array(b, prop, array_b);
6132
equals = memcmp(array_a, array_b, sizeof(int) * len) == 0;
6134
if (array_a != fixed_a) MEM_freeN(array_a);
6135
if (array_b != fixed_b) MEM_freeN(array_b);
6140
int value = RNA_property_boolean_get(a, prop);
6141
return value == RNA_property_boolean_get(b, prop);
6148
int fixed_a[16], fixed_b[16];
6149
int *array_a, *array_b;
6152
array_a = (len > 16)? MEM_callocN(sizeof(int) * len, "RNA equals"): fixed_a;
6153
array_b = (len > 16)? MEM_callocN(sizeof(int) * len, "RNA equals"): fixed_b;
6155
RNA_property_int_get_array(a, prop, array_a);
6156
RNA_property_int_get_array(b, prop, array_b);
6158
equals = memcmp(array_a, array_b, sizeof(int) * len) == 0;
6160
if (array_a != fixed_a) MEM_freeN(array_a);
6161
if (array_b != fixed_b) MEM_freeN(array_b);
6166
int value = RNA_property_int_get(a, prop);
6167
return value == RNA_property_int_get(b, prop);
6174
float fixed_a[16], fixed_b[16];
6175
float *array_a, *array_b;
6178
array_a = (len > 16)? MEM_callocN(sizeof(float) * len, "RNA equals"): fixed_a;
6179
array_b = (len > 16)? MEM_callocN(sizeof(float) * len, "RNA equals"): fixed_b;
6181
RNA_property_float_get_array(a, prop, array_a);
6182
RNA_property_float_get_array(b, prop, array_b);
6184
equals = memcmp(array_a, array_b, sizeof(float) * len) == 0;
6186
if (array_a != fixed_a) MEM_freeN(array_a);
6187
if (array_b != fixed_b) MEM_freeN(array_b);
6192
float value = RNA_property_float_get(a, prop);
6193
return value == RNA_property_float_get(b, prop);
6199
int value = RNA_property_enum_get(a, prop);
6200
return value == RNA_property_enum_get(b, prop);
6205
char fixed_a[128], fixed_b[128];
6207
char *value_a = RNA_property_string_get_alloc(a, prop, fixed_a, sizeof(fixed_a), &len_a);
6208
char *value_b = RNA_property_string_get_alloc(b, prop, fixed_b, sizeof(fixed_b), &len_b);
6209
int equals = strcmp(value_a, value_b) == 0;
6211
if (value_a != fixed_a) MEM_freeN(value_a);
6212
if (value_b != fixed_b) MEM_freeN(value_b);
6224
int RNA_struct_equals(PointerRNA *a, PointerRNA *b)
6226
CollectionPropertyIterator iter;
6227
// CollectionPropertyRNA *citerprop; /* UNUSED */
6228
PropertyRNA *iterprop;
6231
if (a == NULL && b == NULL)
6233
else if (a == NULL || b == NULL)
6235
else if (a->type != b->type)
6238
iterprop = RNA_struct_iterator_property(a->type);
6239
// citerprop = (CollectionPropertyRNA *)rna_ensure_property(iterprop); /* UNUSED */
6241
RNA_property_collection_begin(a, iterprop, &iter);
6242
for (; iter.valid; RNA_property_collection_next(&iter)) {
6243
PropertyRNA *prop = iter.ptr.data;
6245
if (!RNA_property_equals(a, b, prop)) {
6250
RNA_property_collection_end(&iter);