diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-22 02:16:18 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-22 12:48:16 +0300 |
commit | 775c8ce3327975ea98c18e29012bc03268753385 (patch) | |
tree | e0fbc3d64b2ebe21326caa416aed998aebdcae17 /source/blender/makesrna | |
parent | a25a7714c592dff1fc1b3b4b0888bf984fa9e6fd (diff) |
Cleanup: style, use braces for makesdna, makesrna
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/makesrna.c | 910 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 861 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_animation.c | 18 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_armature.c | 30 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_define.c | 531 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_main.c | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_material.c | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_mesh.c | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree.c | 6 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_rna.c | 39 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 216 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_sequencer.c | 3 |
12 files changed, 1748 insertions, 876 deletions
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 2e7277606da..94fa06452be 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -73,10 +73,12 @@ static int file_older(const char *file1, const char *file2) printf("compare: %s %s\n", file1, file2); } - if (stat(file1, &st1)) + if (stat(file1, &st1)) { return 0; - if (stat(file2, &st2)) + } + if (stat(file2, &st2)) { return 0; + } return (st1.st_mtime < st2.st_mtime); } @@ -243,12 +245,15 @@ static int replace_if_different(const char *tmpfile, const char *dep_files[]) static const char *rna_safe_id(const char *id) { - if (STREQ(id, "default")) + if (STREQ(id, "default")) { return "default_value"; - else if (STREQ(id, "operator")) + } + else if (STREQ(id, "operator")) { return "operator_value"; - else if (STREQ(id, "new")) + } + else if (STREQ(id, "new")) { return "create"; + } else if (STREQ(id, "co_return")) { /* MSVC2015, C++ uses for coroutines */ return "coord_return"; @@ -272,15 +277,19 @@ static int cmp_property(const void *a, const void *b) const PropertyRNA *propa = *(const PropertyRNA **)a; const PropertyRNA *propb = *(const PropertyRNA **)b; - if (STREQ(propa->identifier, "rna_type")) + if (STREQ(propa->identifier, "rna_type")) { return -1; - else if (STREQ(propb->identifier, "rna_type")) + } + else if (STREQ(propb->identifier, "rna_type")) { return 1; + } - if (STREQ(propa->identifier, "name")) + if (STREQ(propa->identifier, "name")) { return -1; - else if (STREQ(propb->identifier, "name")) + } + else if (STREQ(propb->identifier, "name")) { return 1; + } return strcmp(propa->name, propb->name); } @@ -307,15 +316,18 @@ static void rna_sortlist(ListBase *listbase, int (*cmp)(const void *, const void void **array; int a, size; - if (listbase->first == listbase->last) + if (listbase->first == listbase->last) { return; + } - for (size = 0, link = listbase->first; link; link = link->next) + for (size = 0, link = listbase->first; link; link = link->next) { size++; + } array = MEM_mallocN(sizeof(void *) * size, "rna_sortlist"); - for (a = 0, link = listbase->first; link; link = link->next, a++) + for (a = 0, link = listbase->first; link; link = link->next, a++) { array[a] = link; + } qsort(array, size, sizeof(void *), cmp); @@ -344,29 +356,35 @@ static void rna_print_c_string(FILE *f, const char *str) fprintf(f, "\""); for (i = 0; str[i]; i++) { - for (j = 0; escape[j]; j++) - if (str[i] == escape[j][0]) + for (j = 0; escape[j]; j++) { + if (str[i] == escape[j][0]) { break; + } + } - if (escape[j]) + if (escape[j]) { fprintf(f, "\\%c", escape[j][1]); - else + } + else { fprintf(f, "%c", str[i]); + } } fprintf(f, "\""); } static void rna_print_data_get(FILE *f, PropertyDefRNA *dp) { - if (dp->dnastructfromname && dp->dnastructfromprop) + if (dp->dnastructfromname && dp->dnastructfromprop) { fprintf(f, " %s *data = (%s *)(((%s *)ptr->data)->%s);\n", dp->dnastructname, dp->dnastructname, dp->dnastructfromname, dp->dnastructfromprop); - else + } + else { fprintf(f, " %s *data = (%s *)(ptr->data);\n", dp->dnastructname, dp->dnastructname); + } } static void rna_print_id_get(FILE *f, PropertyDefRNA *UNUSED(dp)) @@ -383,10 +401,12 @@ static void rna_construct_function_name( static void rna_construct_wrapper_function_name( char *buffer, int size, const char *structname, const char *propname, const char *type) { - if (type == NULL || type[0] == '\0') + if (type == NULL || type[0] == '\0') { snprintf(buffer, size, "%s_%s", structname, propname); - else + } + else { snprintf(buffer, size, "%s_%s_%s", structname, propname, type); + } } static char *rna_alloc_function_name(const char *structname, @@ -412,9 +432,11 @@ static StructRNA *rna_find_struct(const char *identifier) { StructDefRNA *ds; - for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) - if (STREQ(ds->srna->identifier, identifier)) + for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) { + if (STREQ(ds->srna->identifier, identifier)) { return ds->srna; + } + } return NULL; } @@ -423,9 +445,11 @@ static const char *rna_find_type(const char *type) { StructDefRNA *ds; - for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) - if (ds->dnaname && STREQ(ds->dnaname, type)) + for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) { + if (ds->dnaname && STREQ(ds->dnaname, type)) { return ds->srna->identifier; + } + } return NULL; } @@ -434,9 +458,11 @@ static const char *rna_find_dna_type(const char *type) { StructDefRNA *ds; - for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) - if (STREQ(ds->srna->identifier, type)) + for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) { + if (STREQ(ds->srna->identifier, type)) { return ds->dnaname; + } + } return NULL; } @@ -469,8 +495,9 @@ static const char *rna_type_type(PropertyRNA *prop) type = rna_type_type_name(prop); - if (type) + if (type) { return type; + } return "PointerRNA"; } @@ -481,8 +508,9 @@ static const char *rna_type_struct(PropertyRNA *prop) type = rna_type_type_name(prop); - if (type) + if (type) { return ""; + } return "struct "; } @@ -493,17 +521,20 @@ static const char *rna_parameter_type_name(PropertyRNA *parm) type = rna_type_type_name(parm); - if (type) + if (type) { return type; + } switch (parm->type) { case PROP_POINTER: { PointerPropertyRNA *pparm = (PointerPropertyRNA *)parm; - if (parm->flag_parameter & PARM_RNAPTR) + if (parm->flag_parameter & PARM_RNAPTR) { return "PointerRNA"; - else + } + else { return rna_find_dna_type((const char *)pparm->type); + } } case PROP_COLLECTION: { return "CollectionListBase"; @@ -519,9 +550,11 @@ static int rna_enum_bitmask(PropertyRNA *prop) int a, mask = 0; if (eprop->item) { - for (a = 0; a < eprop->totitem; a++) - if (eprop->item[a].identifier[0]) + for (a = 0; a < eprop->totitem; a++) { + if (eprop->item[a].identifier[0]) { mask |= eprop->item[a].value; + } + } } return mask; @@ -541,24 +574,31 @@ static const char *rna_function_string(void *func) static void rna_float_print(FILE *f, float num) { - if (num == -FLT_MAX) + if (num == -FLT_MAX) { fprintf(f, "-FLT_MAX"); - else if (num == FLT_MAX) + } + else if (num == FLT_MAX) { fprintf(f, "FLT_MAX"); - else if ((ABS(num) < INT64_MAX) && ((int64_t)num == num)) + } + else if ((ABS(num) < INT64_MAX) && ((int64_t)num == num)) { fprintf(f, "%.1ff", num); - else + } + else { fprintf(f, "%.10ff", num); + } } static void rna_int_print(FILE *f, int num) { - if (num == INT_MIN) + if (num == INT_MIN) { fprintf(f, "INT_MIN"); - else if (num == INT_MAX) + } + else if (num == INT_MAX) { fprintf(f, "INT_MAX"); - else + } + else { fprintf(f, "%d", num); + } } static char *rna_def_property_get_func( @@ -566,8 +606,9 @@ static char *rna_def_property_get_func( { char *func; - if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL) + if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL) { return NULL; + } if (!manualfunc) { if (!dp->dnastructname || !dp->dnaname) { @@ -635,18 +676,20 @@ static char *rna_def_property_get_func( fprintf(f, " }\n"); } - if (sprop->maxlength) + if (sprop->maxlength) { fprintf(f, " %s(value, data->%s, %d);\n", string_copy_func, dp->dnaname, sprop->maxlength); - else + } + else { fprintf(f, " %s(value, data->%s, sizeof(data->%s));\n", string_copy_func, dp->dnaname, dp->dnaname); + } } fprintf(f, "}\n\n"); break; @@ -660,16 +703,18 @@ static char *rna_def_property_get_func( else { PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop; rna_print_data_get(f, dp); - if (dp->dnapointerlevel == 0) + if (dp->dnapointerlevel == 0) { fprintf(f, " return rna_pointer_inherit_refine(ptr, &RNA_%s, &data->%s);\n", (const char *)pprop->type, dp->dnaname); - else + } + else { fprintf(f, " return rna_pointer_inherit_refine(ptr, &RNA_%s, data->%s);\n", (const char *)pprop->type, dp->dnaname); + } } fprintf(f, "}\n\n"); break; @@ -697,14 +742,16 @@ static char *rna_def_property_get_func( } default: if (prop->arraydimension) { - if (prop->flag & PROP_DYNAMIC) + if (prop->flag & PROP_DYNAMIC) { fprintf(f, "void %s(PointerRNA *ptr, %s values[])\n", func, rna_type_type(prop)); - else + } + else { fprintf(f, "void %s(PointerRNA *ptr, %s values[%u])\n", func, rna_type_type(prop), prop->totarraylength); + } fprintf(f, "{\n"); if (manualfunc) { @@ -798,12 +845,13 @@ static char *rna_def_property_get_func( rna_int_print(f, rna_enum_bitmask(prop)); fprintf(f, ");\n"); } - else + else { fprintf(f, " return (%s)%s(data->%s);\n", rna_type_type(prop), (dp->booleannegative) ? "!" : "", dp->dnaname); + } } fprintf(f, "}\n\n"); @@ -870,10 +918,12 @@ static void rna_clamp_value(FILE *f, PropertyRNA *prop, int array) IntPropertyRNA *iprop = (IntPropertyRNA *)prop; if (iprop->hardmin != INT_MIN || iprop->hardmax != INT_MAX || iprop->range) { - if (array) + if (array) { fprintf(f, "CLAMPIS(values[i], "); - else + } + else { fprintf(f, "CLAMPIS(value, "); + } if (iprop->range) { fprintf(f, "prop_clamp_min, prop_clamp_max);"); } @@ -890,10 +940,12 @@ static void rna_clamp_value(FILE *f, PropertyRNA *prop, int array) FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop; if (fprop->hardmin != -FLT_MAX || fprop->hardmax != FLT_MAX || fprop->range) { - if (array) + if (array) { fprintf(f, "CLAMPIS(values[i], "); - else + } + else { fprintf(f, "CLAMPIS(value, "); + } if (fprop->range) { fprintf(f, "prop_clamp_min, prop_clamp_max);"); } @@ -907,10 +959,12 @@ static void rna_clamp_value(FILE *f, PropertyRNA *prop, int array) } } - if (array) + if (array) { fprintf(f, "values[i];\n"); - else + } + else { fprintf(f, "value;\n"); + } } static char *rna_def_property_set_func( @@ -918,10 +972,12 @@ static char *rna_def_property_set_func( { char *func; - if (!(prop->flag & PROP_EDITABLE)) + if (!(prop->flag & PROP_EDITABLE)) { return NULL; - if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL) + } + if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL) { return NULL; + } if (!manualfunc) { if (!dp->dnastructname || !dp->dnaname) { @@ -958,18 +1014,20 @@ static char *rna_def_property_set_func( fprintf(f, " }\n"); } - if (sprop->maxlength) + if (sprop->maxlength) { fprintf(f, " %s(data->%s, value, %d);\n", string_copy_func, dp->dnaname, sprop->maxlength); - else + } + else { fprintf(f, " %s(data->%s, value, sizeof(data->%s));\n", string_copy_func, dp->dnaname, dp->dnaname); + } } fprintf(f, "}\n\n"); break; @@ -1010,14 +1068,16 @@ static char *rna_def_property_set_func( } default: if (prop->arraydimension) { - if (prop->flag & PROP_DYNAMIC) + if (prop->flag & PROP_DYNAMIC) { fprintf(f, "void %s(PointerRNA *ptr, const %s values[])\n", func, rna_type_type(prop)); - else + } + else { fprintf(f, "void %s(PointerRNA *ptr, const %s values[%u])\n", func, rna_type_type(prop), prop->totarraylength); + } fprintf(f, "{\n"); if (manualfunc) { @@ -1073,17 +1133,19 @@ static char *rna_def_property_set_func( f, " data->%s[i] = unit_float_to_uchar_clamp(values[i]);\n", dp->dnaname); } else { - if (dp->dnatype) + if (dp->dnatype) { fprintf(f, " ((%s *)data->%s)[i] = %s", dp->dnatype, dp->dnaname, (dp->booleannegative) ? "!" : ""); - else + } + else { fprintf(f, " (data->%s)[i] = %s", dp->dnaname, (dp->booleannegative) ? "!" : ""); + } rna_clamp_value(f, prop, 1); } } @@ -1153,8 +1215,9 @@ static char *rna_def_property_length_func( { char *func = NULL; - if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL) + if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL) { return NULL; + } if (prop->type == PROP_STRING) { if (!manualfunc) { @@ -1199,18 +1262,23 @@ static char *rna_def_property_length_func( fprintf(f, " return %s(ptr);\n", manualfunc); } else { - if (dp->dnaarraylength <= 1 || dp->dnalengthname) + if (dp->dnaarraylength <= 1 || dp->dnalengthname) { rna_print_data_get(f, dp); + } - if (dp->dnaarraylength > 1) + if (dp->dnaarraylength > 1) { fprintf(f, " return "); - else + } + else { fprintf(f, " return (data->%s == NULL) ? 0 : ", dp->dnaname); + } - if (dp->dnalengthname) + if (dp->dnalengthname) { fprintf(f, "data->%s;\n", dp->dnalengthname); - else + } + else { fprintf(f, "%d;\n", dp->dnalengthfixed); + } } fprintf(f, "}\n\n"); } @@ -1223,8 +1291,9 @@ static char *rna_def_property_begin_func( { char *func, *getfunc; - if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL) + if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL) { return NULL; + } if (!manualfunc) { if (!dp->dnastructname || !dp->dnaname) { @@ -1239,8 +1308,9 @@ static char *rna_def_property_begin_func( fprintf(f, "void %s(CollectionPropertyIterator *iter, PointerRNA *ptr)\n", func); fprintf(f, "{\n"); - if (!manualfunc) + if (!manualfunc) { rna_print_data_get(f, dp); + } fprintf(f, "\n memset(iter, 0, sizeof(*iter));\n"); fprintf(f, " iter->parent = *ptr;\n"); @@ -1251,29 +1321,34 @@ static char *rna_def_property_begin_func( fprintf(f, "\n %s(iter, ptr);\n", manualfunc); } else { - if (dp->dnalengthname) + if (dp->dnalengthname) { fprintf(f, "\n rna_iterator_array_begin(iter, data->%s, sizeof(data->%s[0]), data->%s, 0, " "NULL);\n", dp->dnaname, dp->dnaname, dp->dnalengthname); - else + } + else { fprintf( f, "\n rna_iterator_array_begin(iter, data->%s, sizeof(data->%s[0]), %d, 0, NULL);\n", dp->dnaname, dp->dnaname, dp->dnalengthfixed); + } } } else { - if (manualfunc) + if (manualfunc) { fprintf(f, "\n %s(iter, ptr);\n", manualfunc); - else if (dp->dnapointerlevel == 0) + } + else if (dp->dnapointerlevel == 0) { fprintf(f, "\n rna_iterator_listbase_begin(iter, &data->%s, NULL);\n", dp->dnaname); - else + } + else { fprintf(f, "\n rna_iterator_listbase_begin(iter, data->%s, NULL);\n", dp->dnaname); + } } getfunc = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "get"); @@ -1297,20 +1372,23 @@ static char *rna_def_property_lookup_int_func(FILE *f, * so the index can only be checked against the length when there is no 'skip' function. */ char *func; - if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL) + if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL) { return NULL; + } if (!manualfunc) { - if (!dp->dnastructname || !dp->dnaname) + if (!dp->dnastructname || !dp->dnaname) { return NULL; + } /* only supported in case of standard next functions */ if (STREQ(nextfunc, "rna_iterator_array_next")) { } else if (STREQ(nextfunc, "rna_iterator_listbase_next")) { } - else + else { return NULL; + } } func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "lookup_int"); @@ -1429,23 +1507,27 @@ static char *rna_def_property_lookup_string_func(FILE *f, PropertyRNA *item_name_prop; const int namebuflen = 1024; - if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL) + if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL) { return NULL; + } if (!manualfunc) { - if (!dp->dnastructname || !dp->dnaname) + if (!dp->dnastructname || !dp->dnaname) { return NULL; + } /* only supported for collection items with name properties */ item_srna = rna_find_struct(item_type); if (item_srna && item_srna->nameproperty) { item_name_prop = item_srna->nameproperty; item_name_base = item_srna; - while (item_name_base->base && item_name_base->base->nameproperty == item_name_prop) + while (item_name_base->base && item_name_base->base->nameproperty == item_name_prop) { item_name_base = item_name_base->base; + } } - else + else { return NULL; + } } func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "lookup_string"); @@ -1530,11 +1612,13 @@ static char *rna_def_property_next_func(FILE *f, { char *func, *getfunc; - if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL) + if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL) { return NULL; + } - if (!manualfunc) + if (!manualfunc) { return NULL; + } func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "next"); @@ -1560,15 +1644,17 @@ static char *rna_def_property_end_func(FILE *f, { char *func; - if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL) + if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL) { return NULL; + } func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "end"); fprintf(f, "void %s(CollectionPropertyIterator *iter)\n", func); fprintf(f, "{\n"); - if (manualfunc) + if (manualfunc) { fprintf(f, " %s(iter);\n", manualfunc); + } fprintf(f, "}\n\n"); return func; @@ -1576,10 +1662,12 @@ static char *rna_def_property_end_func(FILE *f, static void rna_set_raw_property(PropertyDefRNA *dp, PropertyRNA *prop) { - if (dp->dnapointerlevel != 0) + if (dp->dnapointerlevel != 0) { return; - if (!dp->dnatype || !dp->dnaname || !dp->dnastructname) + } + if (!dp->dnatype || !dp->dnaname || !dp->dnastructname) { return; + } if (STREQ(dp->dnatype, "char")) { prop->rawtype = PROP_RAW_CHAR; @@ -1621,8 +1709,9 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp) BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop; if (!prop->arraydimension) { - if (!bprop->get && !bprop->set && !dp->booleanbit) + if (!bprop->get && !bprop->set && !dp->booleanbit) { rna_set_raw_property(dp, prop); + } bprop->get = (void *)rna_def_property_get_func( f, srna, prop, dp, (const char *)bprop->get); @@ -1641,8 +1730,9 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp) IntPropertyRNA *iprop = (IntPropertyRNA *)prop; if (!prop->arraydimension) { - if (!iprop->get && !iprop->set) + if (!iprop->get && !iprop->set) { rna_set_raw_property(dp, prop); + } iprop->get = (void *)rna_def_property_get_func( f, srna, prop, dp, (const char *)iprop->get); @@ -1650,8 +1740,9 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp) f, srna, prop, dp, (const char *)iprop->set); } else { - if (!iprop->getarray && !iprop->setarray) + if (!iprop->getarray && !iprop->setarray) { rna_set_raw_property(dp, prop); + } iprop->getarray = (void *)rna_def_property_get_func( f, srna, prop, dp, (const char *)iprop->getarray); @@ -1664,8 +1755,9 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp) FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop; if (!prop->arraydimension) { - if (!fprop->get && !fprop->set) + if (!fprop->get && !fprop->set) { rna_set_raw_property(dp, prop); + } fprop->get = (void *)rna_def_property_get_func( f, srna, prop, dp, (const char *)fprop->get); @@ -1673,8 +1765,9 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp) f, srna, prop, dp, (const char *)fprop->set); } else { - if (!fprop->getarray && !fprop->setarray) + if (!fprop->getarray && !fprop->setarray) { rna_set_raw_property(dp, prop); + } fprop->getarray = (void *)rna_def_property_get_func( f, srna, prop, dp, (const char *)fprop->getarray); @@ -1731,11 +1824,12 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp) /* test if we can allow raw array access, if it is using our standard * array get/next function, we can be sure it is an actual array */ - if (cprop->next && cprop->get) + if (cprop->next && cprop->get) { if (STREQ((const char *)cprop->next, "rna_iterator_array_next") && STREQ((const char *)cprop->get, "rna_iterator_array_get")) { prop->flag_internal |= PROP_INTERN_RAW_ARRAY; } + } cprop->get = (void *)rna_def_property_get_func(f, srna, prop, dp, (const char *)cprop->get); cprop->begin = (void *)rna_def_property_begin_func( @@ -1856,14 +1950,16 @@ static void rna_def_property_funcs_header(FILE *f, StructRNA *srna, PropertyDefR if (eprop->item && eprop->totitem) { fprintf(f, "enum {\n"); - for (i = 0; i < eprop->totitem; i++) - if (eprop->item[i].identifier[0]) + for (i = 0; i < eprop->totitem; i++) { + if (eprop->item[i].identifier[0]) { fprintf(f, "\t%s_%s_%s = %d,\n", srna->identifier, prop->identifier, eprop->item[i].identifier, eprop->item[i].value); + } + } fprintf(f, "};\n\n"); } @@ -1897,14 +1993,17 @@ static void rna_def_property_funcs_header(FILE *f, StructRNA *srna, PropertyDefR fprintf(f, "void %sbegin(CollectionPropertyIterator *iter, PointerRNA *ptr);\n", func); fprintf(f, "void %snext(CollectionPropertyIterator *iter);\n", func); fprintf(f, "void %send(CollectionPropertyIterator *iter);\n", func); - if (cprop->length) + if (cprop->length) { fprintf(f, "int %slength(PointerRNA *ptr);\n", func); - if (cprop->lookupint) + } + if (cprop->lookupint) { fprintf(f, "int %slookup_int(PointerRNA *ptr, int key, PointerRNA *r_ptr);\n", func); - if (cprop->lookupstring) + } + if (cprop->lookupstring) { fprintf(f, "int %slookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ptr);\n", func); + } break; } } @@ -2020,13 +2119,15 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property if (eprop->item) { fprintf(f, "\tenum %s_enum {\n", rna_safe_id(prop->identifier)); - for (i = 0; i < eprop->totitem; i++) - if (eprop->item[i].identifier[0]) + for (i = 0; i < eprop->totitem; i++) { + if (eprop->item[i].identifier[0]) { fprintf(f, "\t\t%s_%s = %d,\n", rna_safe_id(prop->identifier), eprop->item[i].identifier, eprop->item[i].value); + } + } fprintf(f, "\t};\n"); } @@ -2049,11 +2150,13 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property case PROP_POINTER: { PointerPropertyRNA *pprop = (PointerPropertyRNA *)dp->prop; - if (pprop->type) + if (pprop->type) { fprintf( f, "\tinline %s %s(void);", (const char *)pprop->type, rna_safe_id(prop->identifier)); - else + } + else { fprintf(f, "\tinline %s %s(void);", "UnknownType", rna_safe_id(prop->identifier)); + } break; } case PROP_COLLECTION: { @@ -2065,7 +2168,7 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property collection_funcs = (char *)cprop->property.srna; } - if (cprop->item_type) + if (cprop->item_type) { fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s, %s, %s, %s, %s)", collection_funcs, @@ -2075,7 +2178,8 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property (cprop->length ? "true" : "false"), (cprop->lookupint ? "true" : "false"), (cprop->lookupstring ? "true" : "false")); - else + } + else { fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s, %s, %s, %s, %s)", collection_funcs, @@ -2085,6 +2189,7 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property (cprop->length ? "true" : "false"), (cprop->lookupint ? "true" : "false"), (cprop->lookupstring ? "true" : "false")); + } break; } } @@ -2122,10 +2227,12 @@ static void rna_def_struct_function_prototype_cpp(FILE *f, retval_type = rna_parameter_type_cpp_name(dp->prop); } - if (namespace && namespace[0]) + if (namespace && namespace[0]) { fprintf(f, "\tinline %s %s::%s(", retval_type, namespace, rna_safe_id(func->identifier)); - else + } + else { fprintf(f, "\tinline %s %s(", retval_type, rna_safe_id(func->identifier)); + } if (func->flag & FUNC_USE_MAIN) WRITE_PARAM("void *main"); @@ -2137,37 +2244,45 @@ static void rna_def_struct_function_prototype_cpp(FILE *f, int type, flag, flag_parameter, pout; const char *ptrstr; - if (dp->prop == func->c_ret) + if (dp->prop == func->c_ret) { continue; + } type = dp->prop->type; flag = dp->prop->flag; flag_parameter = dp->prop->flag_parameter; pout = (flag_parameter & PARM_OUTPUT); - if (flag & PROP_DYNAMIC) + if (flag & PROP_DYNAMIC) { ptrstr = pout ? "**" : "*"; - else if (type == PROP_POINTER) + } + else if (type == PROP_POINTER) { ptrstr = pout ? "*" : ""; - else if (dp->prop->arraydimension) + } + else if (dp->prop->arraydimension) { ptrstr = "*"; - else if (type == PROP_STRING && (flag & PROP_THICK_WRAP)) + } + else if (type == PROP_STRING && (flag & PROP_THICK_WRAP)) { ptrstr = ""; - else + } + else { ptrstr = pout ? "*" : ""; + } WRITE_COMMA; - if (flag & PROP_DYNAMIC) + if (flag & PROP_DYNAMIC) { fprintf( f, "int %s%s_len, ", (flag_parameter & PARM_OUTPUT) ? "*" : "", dp->prop->identifier); + } - if (!(flag & PROP_DYNAMIC) && dp->prop->arraydimension) + if (!(flag & PROP_DYNAMIC) && dp->prop->arraydimension) { fprintf(f, "%s %s[%u]", rna_parameter_type_cpp_name(dp->prop), rna_safe_id(dp->prop->identifier), dp->prop->totarraylength); + } else { fprintf(f, "%s%s%s%s", @@ -2179,8 +2294,9 @@ static void rna_def_struct_function_prototype_cpp(FILE *f, } fprintf(f, ")"); - if (close_prototype) + if (close_prototype) { fprintf(f, ";\n"); + } } static void rna_def_struct_function_header_cpp(FILE *f, StructRNA *srna, FunctionDefRNA *dfunc) @@ -2208,51 +2324,60 @@ static void rna_def_property_funcs_impl_cpp(FILE *f, StructRNA *srna, PropertyDe switch (prop->type) { case PROP_BOOLEAN: { - if (!prop->arraydimension) + if (!prop->arraydimension) { fprintf(f, "\tBOOLEAN_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier)); - else if (prop->totarraylength) + } + else if (prop->totarraylength) { fprintf(f, "\tBOOLEAN_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength, rna_safe_id(prop->identifier)); - else if (prop->getlength) + } + else if (prop->getlength) { fprintf(f, "\tBOOLEAN_DYNAMIC_ARRAY_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier)); + } break; } case PROP_INT: { - if (!prop->arraydimension) + if (!prop->arraydimension) { fprintf(f, "\tINT_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier)); - else if (prop->totarraylength) + } + else if (prop->totarraylength) { fprintf(f, "\tINT_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength, rna_safe_id(prop->identifier)); - else if (prop->getlength) + } + else if (prop->getlength) { fprintf(f, "\tINT_DYNAMIC_ARRAY_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier)); + } break; } case PROP_FLOAT: { - if (!prop->arraydimension) + if (!prop->arraydimension) { fprintf(f, "\tFLOAT_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier)); - else if (prop->totarraylength) + } + else if (prop->totarraylength) { fprintf(f, "\tFLOAT_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength, rna_safe_id(prop->identifier)); - else if (prop->getlength) + } + else if (prop->getlength) { fprintf(f, "\tFLOAT_DYNAMIC_ARRAY_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier)); + } break; } case PROP_ENUM: { @@ -2271,18 +2396,20 @@ static void rna_def_property_funcs_impl_cpp(FILE *f, StructRNA *srna, PropertyDe case PROP_POINTER: { PointerPropertyRNA *pprop = (PointerPropertyRNA *)dp->prop; - if (pprop->type) + if (pprop->type) { fprintf(f, "\tPOINTER_PROPERTY(%s, %s, %s)", (const char *)pprop->type, srna->identifier, rna_safe_id(prop->identifier)); - else + } + else { fprintf(f, "\tPOINTER_PROPERTY(%s, %s, %s)", "UnknownType", srna->identifier, rna_safe_id(prop->identifier)); + } break; } case PROP_COLLECTION: { @@ -2336,12 +2463,15 @@ static void rna_def_struct_function_call_impl_cpp(FILE *f, StructRNA *srna, Func if ((func->flag & FUNC_NO_SELF) == 0) { WRITE_COMMA; - if (dsrna->dnafromprop) + if (dsrna->dnafromprop) { fprintf(f, "(::%s *) this->ptr.data", dsrna->dnafromname); - else if (dsrna->dnaname) + } + else if (dsrna->dnaname) { fprintf(f, "(::%s *) this->ptr.data", dsrna->dnaname); - else + } + else { fprintf(f, "(::%s *) this->ptr.data", srna->identifier); + } } else if (func->flag & FUNC_USE_SELF_TYPE) { WRITE_COMMA; @@ -2359,20 +2489,23 @@ static void rna_def_struct_function_call_impl_cpp(FILE *f, StructRNA *srna, Func dp = dfunc->cont.properties.first; for (; dp; dp = dp->next) { - if (dp->prop == func->c_ret) + if (dp->prop == func->c_ret) { continue; + } WRITE_COMMA; - if (dp->prop->flag & PROP_DYNAMIC) + if (dp->prop->flag & PROP_DYNAMIC) { fprintf(f, "%s_len, ", dp->prop->identifier); + } - if (dp->prop->type == PROP_POINTER) - if ((dp->prop->flag_parameter & PARM_RNAPTR) && !(dp->prop->flag & PROP_THICK_WRAP)) + if (dp->prop->type == PROP_POINTER) { + if ((dp->prop->flag_parameter & PARM_RNAPTR) && !(dp->prop->flag & PROP_THICK_WRAP)) { fprintf(f, "(::%s *) &%s.ptr", rna_parameter_type_name(dp->prop), rna_safe_id(dp->prop->identifier)); + } else if (dp->prop->flag_parameter & PARM_OUTPUT) { if (dp->prop->flag_parameter & PARM_RNAPTR) { fprintf(f, "&%s->ptr", rna_safe_id(dp->prop->identifier)); @@ -2384,13 +2517,16 @@ static void rna_def_struct_function_call_impl_cpp(FILE *f, StructRNA *srna, Func rna_safe_id(dp->prop->identifier)); } } - else + else { fprintf(f, "(::%s *) %s.ptr.data", rna_parameter_type_name(dp->prop), rna_safe_id(dp->prop->identifier)); - else + } + } + else { fprintf(f, "%s", rna_safe_id(dp->prop->identifier)); + } } fprintf(f, ");\n"); @@ -2403,8 +2539,9 @@ static void rna_def_struct_function_impl_cpp(FILE *f, StructRNA *srna, FunctionD FunctionRNA *func = dfunc->func; - if (!dfunc->call) + if (!dfunc->call) { return; + } rna_def_struct_function_prototype_cpp(f, srna, dfunc, srna->identifier, 0); @@ -2422,12 +2559,14 @@ static void rna_def_struct_function_impl_cpp(FILE *f, StructRNA *srna, FunctionD StructRNA *ret_srna = rna_find_struct((const char *)pprop->type); fprintf(f, "\t\t::%s *retdata = ", rna_parameter_type_name(dp->prop)); rna_def_struct_function_call_impl_cpp(f, srna, dfunc); - if (ret_srna->flag & STRUCT_ID) + if (ret_srna->flag & STRUCT_ID) { fprintf(f, "\t\tRNA_id_pointer_create((::ID *) retdata, &result);\n"); - else + } + else { fprintf(f, "\t\tRNA_pointer_create((::ID *) ptr.id.data, &RNA_%s, retdata, &result);\n", (const char *)pprop->type); + } } else { fprintf(f, "\t\tresult = "); @@ -2471,8 +2610,9 @@ static void rna_def_function_wrapper_funcs(FILE *f, StructDefRNA *dsrna, Functio int first; char funcname[2048]; - if (!dfunc->call) + if (!dfunc->call) { return; + } rna_construct_wrapper_function_name( funcname, sizeof(funcname), srna->identifier, func->identifier, NULL); @@ -2481,10 +2621,12 @@ static void rna_def_function_wrapper_funcs(FILE *f, StructDefRNA *dsrna, Functio fprintf(f, "\n{\n"); - if (func->c_ret) + if (func->c_ret) { fprintf(f, "\treturn %s(", dfunc->call); - else + } + else { fprintf(f, "\t%s(", dfunc->call); + } first = 1; @@ -2509,15 +2651,18 @@ static void rna_def_function_wrapper_funcs(FILE *f, StructDefRNA *dsrna, Functio dparm = dfunc->cont.properties.first; for (; dparm; dparm = dparm->next) { - if (dparm->prop == func->c_ret) + if (dparm->prop == func->c_ret) { continue; + } WRITE_COMMA; - if (dparm->prop->flag & PROP_DYNAMIC) + if (dparm->prop->flag & PROP_DYNAMIC) { fprintf(f, "%s_len, %s", dparm->prop->identifier, dparm->prop->identifier); - else + } + else { fprintf(f, "%s", rna_safe_id(dparm->prop->identifier)); + } } fprintf(f, ");\n"); @@ -2538,8 +2683,9 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA srna = dsrna->srna; func = dfunc->func; - if (!dfunc->call) + if (!dfunc->call) { return; + } funcname = rna_alloc_function_name(srna->identifier, func->identifier, "call"); @@ -2556,12 +2702,15 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA } if ((func->flag & FUNC_NO_SELF) == 0) { - if (dsrna->dnafromprop) + if (dsrna->dnafromprop) { fprintf(f, "\tstruct %s *_self;\n", dsrna->dnafromname); - else if (dsrna->dnaname) + } + else if (dsrna->dnaname) { fprintf(f, "\tstruct %s *_self;\n", dsrna->dnaname); - else + } + else { fprintf(f, "\tstruct %s *_self;\n", srna->identifier); + } } else if (func->flag & FUNC_USE_SELF_TYPE) { fprintf(f, "\tstruct StructRNA *_type;\n"); @@ -2575,27 +2724,35 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA pout = (flag_parameter & PARM_OUTPUT); cptr = ((type == PROP_POINTER) && !(flag_parameter & PARM_RNAPTR)); - if (dparm->prop == func->c_ret) + if (dparm->prop == func->c_ret) { ptrstr = cptr || dparm->prop->arraydimension ? "*" : ""; - /* XXX only arrays and strings are allowed to be dynamic, is this checked anywhere? */ - else if (cptr || (flag & PROP_DYNAMIC)) + /* XXX only arrays and strings are allowed to be dynamic, is this checked anywhere? */ + } + else if (cptr || (flag & PROP_DYNAMIC)) { ptrstr = pout ? "**" : "*"; - /* Fixed size arrays and RNA pointers are pre-allocated on the ParameterList stack, + /* Fixed size arrays and RNA pointers are pre-allocated on the ParameterList stack, * pass a pointer to it. */ - else if (type == PROP_POINTER || dparm->prop->arraydimension) + } + else if (type == PROP_POINTER || dparm->prop->arraydimension) { ptrstr = "*"; - else if ((type == PROP_POINTER) && (flag_parameter & PARM_RNAPTR) && !(flag & PROP_THICK_WRAP)) + } + else if ((type == PROP_POINTER) && (flag_parameter & PARM_RNAPTR) && + !(flag & PROP_THICK_WRAP)) { ptrstr = "*"; - /* PROP_THICK_WRAP strings are pre-allocated on the ParameterList stack, + /* PROP_THICK_WRAP strings are pre-allocated on the ParameterList stack, * but type name for string props is already (char *), so leave empty */ - else if (type == PROP_STRING && (flag & PROP_THICK_WRAP)) + } + else if (type == PROP_STRING && (flag & PROP_THICK_WRAP)) { ptrstr = ""; - else + } + else { ptrstr = pout ? "*" : ""; + } /* for dynamic parameters we pass an additional int for the length of the parameter */ - if (flag & PROP_DYNAMIC) + if (flag & PROP_DYNAMIC) { fprintf(f, "\tint %s%s_len;\n", pout ? "*" : "", dparm->prop->identifier); + } fprintf(f, "\t%s%s %s%s;\n", @@ -2607,8 +2764,9 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA if (has_data) { fprintf(f, "\tchar *_data"); - if (func->c_ret) + if (func->c_ret) { fprintf(f, ", *_retdata"); + } fprintf(f, ";\n"); fprintf(f, "\t\n"); } @@ -2619,12 +2777,15 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA } if ((func->flag & FUNC_NO_SELF) == 0) { - if (dsrna->dnafromprop) + if (dsrna->dnafromprop) { fprintf(f, "\t_self = (struct %s *)_ptr->data;\n", dsrna->dnafromname); - else if (dsrna->dnaname) + } + else if (dsrna->dnaname) { fprintf(f, "\t_self = (struct %s *)_ptr->data;\n", dsrna->dnaname); - else + } + else { fprintf(f, "\t_self = (struct %s *)_ptr->data;\n", srna->identifier); + } } else if (func->flag & FUNC_USE_SELF_TYPE) { fprintf(f, "\t_type = _ptr->type;\n"); @@ -2642,8 +2803,9 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA pout = (flag_parameter & PARM_OUTPUT); cptr = ((type == PROP_POINTER) && !(flag_parameter & PARM_RNAPTR)); - if (dparm->prop == func->c_ret) + if (dparm->prop == func->c_ret) { fprintf(f, "\t_retdata = _data;\n"); + } else { const char *data_str; if (cptr || (flag & PROP_DYNAMIC)) { @@ -2681,8 +2843,9 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA } fprintf(f, "\t%s = ", dparm->prop->identifier); - if (!pout) + if (!pout) { fprintf(f, "%s", valstr); + } fprintf(f, "((%s%s %s)%s);\n", @@ -2692,15 +2855,17 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA data_str); } - if (dparm->next) + if (dparm->next) { fprintf(f, "\t_data += %d;\n", rna_parameter_size(dparm->prop)); + } } if (dfunc->call) { fprintf(f, "\t\n"); fprintf(f, "\t"); - if (func->c_ret) + if (func->c_ret) { fprintf(f, "%s = ", func->c_ret->identifier); + } fprintf(f, "%s(", dfunc->call); first = 1; @@ -2711,52 +2876,61 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA } if ((func->flag & FUNC_NO_SELF) == 0) { - if (!first) + if (!first) { fprintf(f, ", "); + } fprintf(f, "_self"); first = 0; } else if (func->flag & FUNC_USE_SELF_TYPE) { - if (!first) + if (!first) { fprintf(f, ", "); + } fprintf(f, "_type"); first = 0; } if (func->flag & FUNC_USE_MAIN) { - if (!first) + if (!first) { fprintf(f, ", "); + } first = 0; fprintf(f, "CTX_data_main(C)"); /* may have direct access later */ } if (func->flag & FUNC_USE_CONTEXT) { - if (!first) + if (!first) { fprintf(f, ", "); + } first = 0; fprintf(f, "C"); } if (func->flag & FUNC_USE_REPORTS) { - if (!first) + if (!first) { fprintf(f, ", "); + } first = 0; fprintf(f, "reports"); } dparm = dfunc->cont.properties.first; for (; dparm; dparm = dparm->next) { - if (dparm->prop == func->c_ret) + if (dparm->prop == func->c_ret) { continue; + } - if (!first) + if (!first) { fprintf(f, ", "); + } first = 0; - if (dparm->prop->flag & PROP_DYNAMIC) + if (dparm->prop->flag & PROP_DYNAMIC) { fprintf(f, "%s_len, %s", dparm->prop->identifier, dparm->prop->identifier); - else + } + else { fprintf(f, "%s", dparm->prop->identifier); + } } fprintf(f, ");\n"); @@ -2790,22 +2964,28 @@ static void rna_auto_types(void) for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) { /* DNA name for Screen is patched in 2.5, we do the reverse here .. */ if (ds->dnaname) { - if (STREQ(ds->dnaname, "Screen")) + if (STREQ(ds->dnaname, "Screen")) { ds->dnaname = "bScreen"; - if (STREQ(ds->dnaname, "Group")) + } + if (STREQ(ds->dnaname, "Group")) { ds->dnaname = "Collection"; - if (STREQ(ds->dnaname, "GroupObject")) + } + if (STREQ(ds->dnaname, "GroupObject")) { ds->dnaname = "CollectionObject"; + } } for (dp = ds->cont.properties.first; dp; dp = dp->next) { if (dp->dnastructname) { - if (STREQ(dp->dnastructname, "Screen")) + if (STREQ(dp->dnastructname, "Screen")) { dp->dnastructname = "bScreen"; - if (STREQ(dp->dnastructname, "Group")) + } + if (STREQ(dp->dnastructname, "Group")) { dp->dnastructname = "Collection"; - if (STREQ(dp->dnastructname, "GroupObject")) + } + if (STREQ(dp->dnastructname, "GroupObject")) { dp->dnastructname = "CollectionObject"; + } } if (dp->dnatype) { @@ -2813,20 +2993,23 @@ static void rna_auto_types(void) PointerPropertyRNA *pprop = (PointerPropertyRNA *)dp->prop; StructRNA *type; - if (!pprop->type && !pprop->get) + if (!pprop->type && !pprop->get) { pprop->type = (StructRNA *)rna_find_type(dp->dnatype); + } if (pprop->type) { type = rna_find_struct((const char *)pprop->type); - if (type && (type->flag & STRUCT_ID_REFCOUNT)) + if (type && (type->flag & STRUCT_ID_REFCOUNT)) { pprop->property.flag |= PROP_ID_REFCOUNT; + } } } else if (dp->prop->type == PROP_COLLECTION) { CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)dp->prop; - if (!cprop->item_type && !cprop->get && STREQ(dp->dnatype, "ListBase")) + if (!cprop->item_type && !cprop->get && STREQ(dp->dnatype, "ListBase")) { cprop->item_type = (StructRNA *)rna_find_type(dp->dnatype); + } } } } @@ -2841,11 +3024,13 @@ static void rna_sort(BlenderRNA *brna) rna_sortlist(&brna->structs, cmp_struct); rna_sortlist(&DefRNA.structs, cmp_def_struct); - for (srna = brna->structs.first; srna; srna = srna->cont.next) + for (srna = brna->structs.first; srna; srna = srna->cont.next) { rna_sortlist(&srna->cont.properties, cmp_property); + } - for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) + for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) { rna_sortlist(&ds->cont.properties, cmp_def_property); + } } static const char *rna_property_structname(PropertyType type) @@ -2977,8 +3162,9 @@ static void rna_generate_prototypes(BlenderRNA *brna, FILE *f) { StructRNA *srna; - for (srna = brna->structs.first; srna; srna = srna->cont.next) + for (srna = brna->structs.first; srna; srna = srna->cont.next) { fprintf(f, "extern StructRNA RNA_%s;\n", srna->identifier); + } fprintf(f, "\n"); } @@ -2990,16 +3176,20 @@ static void rna_generate_blender(BlenderRNA *brna, FILE *f) "BlenderRNA BLENDER_RNA = {\n" "\t.structs = {"); srna = brna->structs.first; - if (srna) + if (srna) { fprintf(f, "&RNA_%s, ", srna->identifier); - else + } + else { fprintf(f, "NULL, "); + } srna = brna->structs.last; - if (srna) + if (srna) { fprintf(f, "&RNA_%s},\n", srna->identifier); - else + } + else { fprintf(f, "NULL},\n"); + } fprintf(f, "\t.structs_map = NULL,\n" @@ -3015,25 +3205,28 @@ static void rna_generate_property_prototypes(BlenderRNA *UNUSED(brna), StructRNA base = srna->base; while (base) { fprintf(f, "\n"); - for (prop = base->cont.properties.first; prop; prop = prop->next) + for (prop = base->cont.properties.first; prop; prop = prop->next) { fprintf(f, "%s%s rna_%s_%s;\n", "extern ", rna_property_structname(prop->type), base->identifier, prop->identifier); + } base = base->base; } - if (srna->cont.properties.first) + if (srna->cont.properties.first) { fprintf(f, "\n"); + } - for (prop = srna->cont.properties.first; prop; prop = prop->next) + for (prop = srna->cont.properties.first; prop; prop = prop->next) { fprintf(f, "%s rna_%s_%s;\n", rna_property_structname(prop->type), srna->identifier, prop->identifier); + } fprintf(f, "\n"); } @@ -3044,7 +3237,7 @@ static void rna_generate_parameter_prototypes(BlenderRNA *UNUSED(brna), { PropertyRNA *parm; - for (parm = func->cont.properties.first; parm; parm = parm->next) + for (parm = func->cont.properties.first; parm; parm = parm->next) { fprintf(f, "%s%s rna_%s_%s_%s;\n", "extern ", @@ -3052,9 +3245,11 @@ static void rna_generate_parameter_prototypes(BlenderRNA *UNUSED(brna), srna->identifier, func->identifier, parm->identifier); + } - if (func->cont.properties.first) + if (func->cont.properties.first) { fprintf(f, "\n"); + } } static void rna_generate_function_prototypes(BlenderRNA *brna, StructRNA *srna, FILE *f) @@ -3074,8 +3269,9 @@ static void rna_generate_function_prototypes(BlenderRNA *brna, StructRNA *srna, rna_generate_parameter_prototypes(brna, base, func, f); } - if (base->functions.first) + if (base->functions.first) { fprintf(f, "\n"); + } base = base->base; } @@ -3086,8 +3282,9 @@ static void rna_generate_function_prototypes(BlenderRNA *brna, StructRNA *srna, rna_generate_parameter_prototypes(brna, srna, func, f); } - if (srna->functions.first) + if (srna->functions.first) { fprintf(f, "\n"); + } } static void rna_generate_static_parameter_prototypes(FILE *f, @@ -3109,26 +3306,32 @@ static void rna_generate_static_parameter_prototypes(FILE *f, /* return type */ for (dparm = dfunc->cont.properties.first; dparm; dparm = dparm->next) { if (dparm->prop == func->c_ret) { - if (dparm->prop->arraydimension) + if (dparm->prop->arraydimension) { fprintf(f, "XXX no array return types yet"); /* XXX not supported */ - else if (dparm->prop->type == PROP_POINTER && !(dparm->prop->flag_parameter & PARM_RNAPTR)) + } + else if (dparm->prop->type == PROP_POINTER && !(dparm->prop->flag_parameter & PARM_RNAPTR)) { fprintf(f, "%s%s *", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop)); - else + } + else { fprintf(f, "%s%s ", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop)); + } break; } } /* void if nothing to return */ - if (!dparm) + if (!dparm) { fprintf(f, "void "); + } /* function name */ - if (name_override == NULL || name_override[0] == '\0') + if (name_override == NULL || name_override[0] == '\0') { fprintf(f, "%s(", dfunc->call); - else + } + else { fprintf(f, "%s(", name_override); + } first = 1; @@ -3139,40 +3342,48 @@ static void rna_generate_static_parameter_prototypes(FILE *f, } if ((func->flag & FUNC_NO_SELF) == 0) { - if (!first) + if (!first) { fprintf(f, ", "); - if (dsrna->dnafromprop) + } + if (dsrna->dnafromprop) { fprintf(f, "struct %s *_self", dsrna->dnafromname); - else if (dsrna->dnaname) + } + else if (dsrna->dnaname) { fprintf(f, "struct %s *_self", dsrna->dnaname); - else + } + else { fprintf(f, "struct %s *_self", srna->identifier); + } first = 0; } else if (func->flag & FUNC_USE_SELF_TYPE) { - if (!first) + if (!first) { fprintf(f, ", "); + } fprintf(f, "struct StructRNA *_type"); first = 0; } if (func->flag & FUNC_USE_MAIN) { - if (!first) + if (!first) { fprintf(f, ", "); + } first = 0; fprintf(f, "Main *bmain"); } if (func->flag & FUNC_USE_CONTEXT) { - if (!first) + if (!first) { fprintf(f, ", "); + } first = 0; fprintf(f, "bContext *C"); } if (func->flag & FUNC_USE_REPORTS) { - if (!first) + if (!first) { fprintf(f, ", "); + } first = 0; fprintf(f, "ReportList *reports"); } @@ -3185,49 +3396,60 @@ static void rna_generate_static_parameter_prototypes(FILE *f, pout = (flag_parameter & PARM_OUTPUT); cptr = ((type == PROP_POINTER) && !(flag_parameter & PARM_RNAPTR)); - if (dparm->prop == func->c_ret) + if (dparm->prop == func->c_ret) { continue; + } - if (cptr || (flag & PROP_DYNAMIC)) + if (cptr || (flag & PROP_DYNAMIC)) { ptrstr = pout ? "**" : "*"; - else if (type == PROP_POINTER || dparm->prop->arraydimension) + } + else if (type == PROP_POINTER || dparm->prop->arraydimension) { ptrstr = "*"; - else if (type == PROP_STRING && (flag & PROP_THICK_WRAP)) + } + else if (type == PROP_STRING && (flag & PROP_THICK_WRAP)) { ptrstr = ""; - else + } + else { ptrstr = pout ? "*" : ""; + } - if (!first) + if (!first) { fprintf(f, ", "); + } first = 0; - if (flag & PROP_DYNAMIC) + if (flag & PROP_DYNAMIC) { fprintf(f, "int %s%s_len, ", pout ? "*" : "", dparm->prop->identifier); + } - if (!(flag & PROP_DYNAMIC) && dparm->prop->arraydimension) + if (!(flag & PROP_DYNAMIC) && dparm->prop->arraydimension) { fprintf(f, "%s%s %s[%u]", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), rna_safe_id(dparm->prop->identifier), dparm->prop->totarraylength); - else + } + else { fprintf(f, "%s%s %s%s", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), ptrstr, rna_safe_id(dparm->prop->identifier)); + } } /* ensure func(void) if there are no args */ - if (first) + if (first) { fprintf(f, "void"); + } fprintf(f, ")"); - if (close_prototype) + if (close_prototype) { fprintf(f, ";\n"); + } } static void rna_generate_static_function_prototypes(BlenderRNA *UNUSED(brna), @@ -3402,12 +3624,15 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr prop->totarraylength); for (i = 0; i < prop->totarraylength; i++) { - if (bprop->defaultarray) + if (bprop->defaultarray) { fprintf(f, "%d", bprop->defaultarray[i]); - else + } + else { fprintf(f, "%d", bprop->defaultvalue); - if (i != prop->totarraylength - 1) + } + if (i != prop->totarraylength - 1) { fprintf(f, ",\n\t"); + } } fprintf(f, "\n};\n\n"); @@ -3427,12 +3652,15 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr prop->totarraylength); for (i = 0; i < prop->totarraylength; i++) { - if (iprop->defaultarray) + if (iprop->defaultarray) { fprintf(f, "%d", iprop->defaultarray[i]); - else + } + else { fprintf(f, "%d", iprop->defaultvalue); - if (i != prop->totarraylength - 1) + } + if (i != prop->totarraylength - 1) { fprintf(f, ",\n\t"); + } } fprintf(f, "\n};\n\n"); @@ -3452,12 +3680,15 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr prop->totarraylength); for (i = 0; i < prop->totarraylength; i++) { - if (fprop->defaultarray) + if (fprop->defaultarray) { rna_float_print(f, fprop->defaultarray[i]); - else + } + else { rna_float_print(f, fprop->defaultvalue); - if (i != prop->totarraylength - 1) + } + if (i != prop->totarraylength - 1) { fprintf(f, ",\n\t"); + } } fprintf(f, "\n};\n\n"); @@ -3497,16 +3728,20 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr strnest, prop->identifier); - if (prop->next) + if (prop->next) { fprintf( f, "\t{(PropertyRNA *)&rna_%s%s_%s, ", srna->identifier, strnest, prop->next->identifier); - else + } + else { fprintf(f, "\t{NULL, "); - if (prop->prev) + } + if (prop->prev) { fprintf( f, "(PropertyRNA *)&rna_%s%s_%s,\n", srna->identifier, strnest, prop->prev->identifier); - else + } + else { fprintf(f, "NULL,\n"); + } fprintf(f, "\t%d, ", prop->magic); rna_print_c_string(f, prop->identifier); fprintf(f, @@ -3545,16 +3780,20 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr rna_function_string(prop->override_store), rna_function_string(prop->override_apply)); - if (prop->flag_internal & PROP_INTERN_RAW_ACCESS) + if (prop->flag_internal & PROP_INTERN_RAW_ACCESS) { rna_set_raw_offset(f, srna, prop); - else + } + else { fprintf(f, "\t0, -1"); + } /* our own type - collections/arrays only */ - if (prop->srna) + if (prop->srna) { fprintf(f, ", &RNA_%s", (const char *)prop->srna); - else + } + else { fprintf(f, ", NULL"); + } fprintf(f, "},\n"); @@ -3572,10 +3811,12 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr rna_function_string(bprop->getarray_ex), rna_function_string(bprop->setarray_ex), bprop->defaultvalue); - if (prop->arraydimension && prop->totarraylength) + if (prop->arraydimension && prop->totarraylength) { fprintf(f, "rna_%s%s_%s_default\n", srna->identifier, strnest, prop->identifier); - else + } + else { fprintf(f, "NULL\n"); + } break; } case PROP_INT: { @@ -3604,10 +3845,12 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr fprintf(f, ", "); rna_int_print(f, iprop->defaultvalue); fprintf(f, ", "); - if (prop->arraydimension && prop->totarraylength) + if (prop->arraydimension && prop->totarraylength) { fprintf(f, "rna_%s%s_%s_default\n", srna->identifier, strnest, prop->identifier); - else + } + else { fprintf(f, "NULL\n"); + } break; } case PROP_FLOAT: { @@ -3638,10 +3881,12 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr fprintf(f, ", "); rna_float_print(f, fprop->defaultvalue); fprintf(f, ", "); - if (prop->arraydimension && prop->totarraylength) + if (prop->arraydimension && prop->totarraylength) { fprintf(f, "rna_%s%s_%s_default\n", srna->identifier, strnest, prop->identifier); - else + } + else { fprintf(f, "NULL\n"); + } break; } case PROP_STRING: { @@ -3668,10 +3913,12 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr rna_function_string(eprop->itemf), rna_function_string(eprop->get_ex), rna_function_string(eprop->set_ex)); - if (eprop->item) + if (eprop->item) { fprintf(f, "rna_%s%s_%s_items, ", srna->identifier, strnest, prop->identifier); - else + } + else { fprintf(f, "NULL, "); + } fprintf(f, "%d, %d\n", eprop->totitem, eprop->defaultvalue); break; } @@ -3683,10 +3930,12 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr rna_function_string(pprop->set), rna_function_string(pprop->typef), rna_function_string(pprop->poll)); - if (pprop->type) + if (pprop->type) { fprintf(f, "&RNA_%s\n", (const char *)pprop->type); - else + } + else { fprintf(f, "NULL\n"); + } break; } case PROP_COLLECTION: { @@ -3701,10 +3950,12 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr rna_function_string(cprop->lookupint), rna_function_string(cprop->lookupstring), rna_function_string(cprop->assignint)); - if (cprop->item_type) + if (cprop->item_type) { fprintf(f, "&RNA_%s\n", (const char *)cprop->item_type); - else + } + else { fprintf(f, "NULL\n"); + } break; } } @@ -3726,51 +3977,61 @@ static void rna_generate_struct(BlenderRNA *UNUSED(brna), StructRNA *srna, FILE fprintf(f, "/* %s */\n", srna->name); - for (prop = srna->cont.properties.first; prop; prop = prop->next) + for (prop = srna->cont.properties.first; prop; prop = prop->next) { rna_generate_property(f, srna, NULL, prop); + } for (func = srna->functions.first; func; func = func->cont.next) { - for (parm = func->cont.properties.first; parm; parm = parm->next) + for (parm = func->cont.properties.first; parm; parm = parm->next) { rna_generate_property(f, srna, func->identifier, parm); + } fprintf(f, "%s%s rna_%s_%s_func = {\n", "", "FunctionRNA", srna->identifier, func->identifier); - if (func->cont.next) + if (func->cont.next) { fprintf(f, "\t{(FunctionRNA *)&rna_%s_%s_func, ", srna->identifier, ((FunctionRNA *)func->cont.next)->identifier); - else + } + else { fprintf(f, "\t{NULL, "); - if (func->cont.prev) + } + if (func->cont.prev) { fprintf(f, "(FunctionRNA *)&rna_%s_%s_func,\n", srna->identifier, ((FunctionRNA *)func->cont.prev)->identifier); - else + } + else { fprintf(f, "NULL,\n"); + } fprintf(f, "\tNULL,\n"); parm = func->cont.properties.first; - if (parm) + if (parm) { fprintf(f, "\t{(PropertyRNA *)&rna_%s_%s_%s, ", srna->identifier, func->identifier, parm->identifier); - else + } + else { fprintf(f, "\t{NULL, "); + } parm = func->cont.properties.last; - if (parm) + if (parm) { fprintf(f, "(PropertyRNA *)&rna_%s_%s_%s}},\n", srna->identifier, func->identifier, parm->identifier); - else + } + else { fprintf(f, "NULL}},\n"); + } fprintf(f, "\t"); rna_print_c_string(f, func->identifier); @@ -3779,19 +4040,23 @@ static void rna_generate_struct(BlenderRNA *UNUSED(brna), StructRNA *srna, FILE fprintf(f, ",\n"); dfunc = rna_find_function_def(func); - if (dfunc->gencall) + if (dfunc->gencall) { fprintf(f, "\t%s,\n", dfunc->gencall); - else + } + else { fprintf(f, "\tNULL,\n"); + } - if (func->c_ret) + if (func->c_ret) { fprintf(f, "\t(PropertyRNA *)&rna_%s_%s_%s\n", srna->identifier, func->identifier, func->c_ret->identifier); - else + } + else { fprintf(f, "\tNULL\n"); + } fprintf(f, "};\n"); fprintf(f, "\n"); @@ -3799,28 +4064,36 @@ static void rna_generate_struct(BlenderRNA *UNUSED(brna), StructRNA *srna, FILE fprintf(f, "StructRNA RNA_%s = {\n", srna->identifier); - if (srna->cont.next) + if (srna->cont.next) { fprintf(f, "\t{(ContainerRNA *)&RNA_%s, ", ((StructRNA *)srna->cont.next)->identifier); - else + } + else { fprintf(f, "\t{NULL, "); - if (srna->cont.prev) + } + if (srna->cont.prev) { fprintf(f, "(ContainerRNA *)&RNA_%s,\n", ((StructRNA *)srna->cont.prev)->identifier); - else + } + else { fprintf(f, "NULL,\n"); + } fprintf(f, "\tNULL,\n"); prop = srna->cont.properties.first; - if (prop) + if (prop) { fprintf(f, "\t{(PropertyRNA *)&rna_%s_%s, ", srna->identifier, prop->identifier); - else + } + else { fprintf(f, "\t{NULL, "); + } prop = srna->cont.properties.last; - if (prop) + if (prop) { fprintf(f, "(PropertyRNA *)&rna_%s_%s}},\n", srna->identifier, prop->identifier); - else + } + else { fprintf(f, "NULL}},\n"); + } fprintf(f, "\t"); rna_print_c_string(f, srna->identifier); fprintf(f, ", NULL, NULL"); /* PyType - Cant initialize here */ @@ -3835,8 +4108,9 @@ static void rna_generate_struct(BlenderRNA *UNUSED(brna), StructRNA *srna, FILE prop = srna->nameproperty; if (prop) { base = srna; - while (base->base && base->base->nameproperty == prop) + while (base->base && base->base->nameproperty == prop) { base = base->base; + } fprintf(f, "\t(PropertyRNA *)&rna_%s_%s, ", base->identifier, prop->identifier); } @@ -3846,19 +4120,24 @@ static void rna_generate_struct(BlenderRNA *UNUSED(brna), StructRNA *srna, FILE prop = srna->iteratorproperty; base = srna; - while (base->base && base->base->iteratorproperty == prop) + while (base->base && base->base->iteratorproperty == prop) { base = base->base; + } fprintf(f, "(PropertyRNA *)&rna_%s_rna_properties,\n", base->identifier); - if (srna->base) + if (srna->base) { fprintf(f, "\t&RNA_%s,\n", srna->base->identifier); - else + } + else { fprintf(f, "\tNULL,\n"); + } - if (srna->nested) + if (srna->nested) { fprintf(f, "\t&RNA_%s,\n", srna->nested->identifier); - else + } + else { fprintf(f, "\tNULL,\n"); + } fprintf(f, "\t%s,\n", rna_function_string(srna->refine)); fprintf(f, "\t%s,\n", rna_function_string(srna->path)); @@ -3874,16 +4153,20 @@ static void rna_generate_struct(BlenderRNA *UNUSED(brna), StructRNA *srna, FILE } func = srna->functions.first; - if (func) + if (func) { fprintf(f, "\t{(FunctionRNA *)&rna_%s_%s_func, ", srna->identifier, func->identifier); - else + } + else { fprintf(f, "\t{NULL, "); + } func = srna->functions.last; - if (func) + if (func) { fprintf(f, "(FunctionRNA *)&rna_%s_%s_func}\n", srna->identifier, func->identifier); - else + } + else { fprintf(f, "NULL}\n"); + } fprintf(f, "};\n"); @@ -4006,8 +4289,9 @@ static void rna_generate(BlenderRNA *brna, FILE *f, const char *filename, const fprintf(f, "#include \"rna_prototypes_gen.h\"\n\n"); fprintf(f, "#include \"%s\"\n", filename); - if (api_filename) + if (api_filename) { fprintf(f, "#include \"%s\"\n", api_filename); + } fprintf(f, "\n"); /* we want the included C files to have warnings enabled but for the generated code @@ -4025,15 +4309,19 @@ static void rna_generate(BlenderRNA *brna, FILE *f, const char *filename, const } } - for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) - if (!filename || ds->filename == filename) - for (dp = ds->cont.properties.first; dp; dp = dp->next) + for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) { + if (!filename || ds->filename == filename) { + for (dp = ds->cont.properties.first; dp; dp = dp->next) { rna_def_property_funcs(f, ds->srna, dp); + } + } + } for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) { if (!filename || ds->filename == filename) { - for (dp = ds->cont.properties.first; dp; dp = dp->next) + for (dp = ds->cont.properties.first; dp; dp = dp->next) { rna_def_property_wrapper_funcs(f, ds, dp); + } for (dfunc = ds->functions.first; dfunc; dfunc = dfunc->cont.next) { rna_def_function_wrapper_funcs(f, ds, dfunc); @@ -4044,9 +4332,11 @@ static void rna_generate(BlenderRNA *brna, FILE *f, const char *filename, const } } - for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) - if (!filename || ds->filename == filename) + for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) { + if (!filename || ds->filename == filename) { rna_generate_struct(brna, ds->srna, f); + } + } if (STREQ(filename, "rna_ID.c")) { /* this is ugly, but we cannot have c files compiled for both @@ -4099,11 +4389,13 @@ static void rna_generate_header(BlenderRNA *UNUSED(brna), FILE *f) } fprintf(f, "\n"); - for (dp = ds->cont.properties.first; dp; dp = dp->next) + for (dp = ds->cont.properties.first; dp; dp = dp->next) { rna_def_property_funcs_header(f, ds->srna, dp); + } - for (dfunc = ds->functions.first; dfunc; dfunc = dfunc->cont.next) + for (dfunc = ds->functions.first; dfunc; dfunc = dfunc->cont.next) { rna_def_function_funcs_header(f, ds->srna, dfunc); + } } fprintf(f, "#ifdef __cplusplus\n}\n#endif\n\n"); @@ -4462,17 +4754,21 @@ static void rna_generate_header_class_cpp(StructDefRNA *ds, FILE *f) "\t%s(const PointerRNA &ptr_arg) :\n\t\t%s(ptr_arg)", srna->identifier, (srna->base) ? srna->base->identifier : "Pointer"); - for (dp = ds->cont.properties.first; dp; dp = dp->next) - if (rna_is_collection_prop(dp->prop)) + for (dp = ds->cont.properties.first; dp; dp = dp->next) { + if (rna_is_collection_prop(dp->prop)) { fprintf(f, ",\n\t\t%s(ptr_arg)", dp->prop->identifier); + } + } fprintf(f, "\n\t\t{}\n\n"); - for (dp = ds->cont.properties.first; dp; dp = dp->next) + for (dp = ds->cont.properties.first; dp; dp = dp->next) { rna_def_property_funcs_header_cpp(f, ds->srna, dp); + } fprintf(f, "\n"); - for (dfunc = ds->functions.first; dfunc; dfunc = dfunc->cont.next) + for (dfunc = ds->functions.first; dfunc; dfunc = dfunc->cont.next) { rna_def_struct_function_header_cpp(f, srna, dfunc); + } fprintf(f, "};\n\n"); } @@ -4518,8 +4814,9 @@ static void rna_generate_header_cpp(BlenderRNA *UNUSED(brna), FILE *f) if (prop->srna) { /* store name of structure which first uses custom functions for collections */ - if (first_collection_func_struct == NULL) + if (first_collection_func_struct == NULL) { first_collection_func_struct = ds->srna->identifier; + } if (!rna_is_collection_functions_struct(collection_func_structs, (char *)prop->srna)) { if (all_collection_func_structs >= max_collection_func_structs) { @@ -4556,8 +4853,9 @@ static void rna_generate_header_cpp(BlenderRNA *UNUSED(brna), FILE *f) } } - if (!rna_is_collection_functions_struct(collection_func_structs, srna->identifier)) + if (!rna_is_collection_functions_struct(collection_func_structs, srna->identifier)) { rna_generate_header_class_cpp(ds, f); + } } fprintf(f, "} /* namespace BL */\n"); @@ -4576,13 +4874,15 @@ static void rna_generate_header_cpp(BlenderRNA *UNUSED(brna), FILE *f) for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) { srna = ds->srna; - for (dp = ds->cont.properties.first; dp; dp = dp->next) + for (dp = ds->cont.properties.first; dp; dp = dp->next) { rna_def_property_funcs_impl_cpp(f, ds->srna, dp); + } fprintf(f, "\n"); - for (dfunc = ds->functions.first; dfunc; dfunc = dfunc->cont.next) + for (dfunc = ds->functions.first; dfunc; dfunc = dfunc->cont.next) { rna_def_struct_function_impl_cpp(f, srna, dfunc); + } fprintf(f, "\n"); } @@ -4622,9 +4922,11 @@ static int rna_preprocess(const char *outfile) fprintf(stderr, "Error: DefRNA.animate left disabled in %s\n", PROCESS_ITEMS[i].filename); } - for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) - if (!ds->filename) + for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) { + if (!ds->filename) { ds->filename = PROCESS_ITEMS[i].filename; + } + } } } diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 99a6247da79..c893fb86851 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -133,10 +133,12 @@ void RNA_id_pointer_create(ID *id, PointerRNA *r_ptr) while (idtype->refine) { type = idtype->refine(&tmp); - if (type == idtype) + if (type == idtype) { break; - else + } + else { idtype = type; + } } } @@ -165,10 +167,12 @@ void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr) while (r_ptr->type && r_ptr->type->refine) { StructRNA *rtype = r_ptr->type->refine(r_ptr); - if (rtype == r_ptr->type) + if (rtype == r_ptr->type) { break; - else + } + else { r_ptr->type = rtype; + } } } } @@ -206,10 +210,12 @@ PointerRNA rna_pointer_inherit_refine(PointerRNA *ptr, StructRNA *type, void *da while (result.type->refine) { type = result.type->refine(&result); - if (type == result.type) + if (type == result.type) { break; - else + } + else { result.type = type; + } } return result; } @@ -254,14 +260,16 @@ static IDProperty *rna_idproperty_ui_container(PropertyRNA *prop) IDProperty *idprop; for (idprop = ((IDProperty *)prop)->prev; idprop; idprop = idprop->prev) { - if (STREQ(RNA_IDP_UI, idprop->name)) + if (STREQ(RNA_IDP_UI, idprop->name)) { break; + } } if (idprop == NULL) { for (idprop = ((IDProperty *)prop)->next; idprop; idprop = idprop->next) { - if (STREQ(RNA_IDP_UI, idprop->name)) + if (STREQ(RNA_IDP_UI, idprop->name)) { break; + } } } @@ -429,10 +437,12 @@ static int rna_ensure_property_array_length(PointerRNA *ptr, PropertyRNA *prop) else { IDProperty *idprop = (IDProperty *)prop; - if (idprop->type == IDP_ARRAY) + if (idprop->type == IDP_ARRAY) { return idprop->len; - else + } + else { return 0; + } } } @@ -453,18 +463,22 @@ static void rna_ensure_property_multi_array_length(PointerRNA *ptr, int length[]) { if (prop->magic == RNA_MAGIC) { - if (prop->getlength) + if (prop->getlength) { prop->getlength(ptr, length); - else + } + else { memcpy(length, prop->arraylength, prop->arraydimension * sizeof(int)); + } } else { IDProperty *idprop = (IDProperty *)prop; - if (idprop->type == IDP_ARRAY) + if (idprop->type == IDP_ARRAY) { length[0] = idprop->len; - else + } + else { length[0] = 0; + } } } @@ -477,36 +491,44 @@ static bool rna_idproperty_verify_valid(PointerRNA *ptr, PropertyRNA *prop, IDPr switch (idprop->type) { case IDP_IDPARRAY: - if (prop->type != PROP_COLLECTION) + if (prop->type != PROP_COLLECTION) { return false; + } break; case IDP_ARRAY: - if (rna_ensure_property_array_length(ptr, prop) != idprop->len) + if (rna_ensure_property_array_length(ptr, prop) != idprop->len) { return false; + } - if (idprop->subtype == IDP_FLOAT && prop->type != PROP_FLOAT) + if (idprop->subtype == IDP_FLOAT && prop->type != PROP_FLOAT) { return false; - if (idprop->subtype == IDP_INT && !ELEM(prop->type, PROP_BOOLEAN, PROP_INT, PROP_ENUM)) + } + if (idprop->subtype == IDP_INT && !ELEM(prop->type, PROP_BOOLEAN, PROP_INT, PROP_ENUM)) { return false; + } break; case IDP_INT: - if (!ELEM(prop->type, PROP_BOOLEAN, PROP_INT, PROP_ENUM)) + if (!ELEM(prop->type, PROP_BOOLEAN, PROP_INT, PROP_ENUM)) { return false; + } break; case IDP_FLOAT: case IDP_DOUBLE: - if (prop->type != PROP_FLOAT) + if (prop->type != PROP_FLOAT) { return false; + } break; case IDP_STRING: - if (prop->type != PROP_STRING) + if (prop->type != PROP_STRING) { return false; + } break; case IDP_GROUP: case IDP_ID: - if (prop->type != PROP_POINTER) + if (prop->type != PROP_POINTER) { return false; + } break; default: return false; @@ -572,10 +594,12 @@ static void *rna_idproperty_check_ex(PropertyRNA **prop, { IDProperty *idprop = (IDProperty *)(*prop); - if (idprop->type == IDP_ARRAY) + if (idprop->type == IDP_ARRAY) { *prop = arraytypemap[(int)(idprop->subtype)]; - else + } + else { *prop = typemap[(int)(idprop->type)]; + } return idprop; } @@ -599,45 +623,53 @@ static PropertyRNA *rna_ensure_property(PropertyRNA *prop) { /* the quick version if we don't need the idproperty */ - if (prop->magic == RNA_MAGIC) + if (prop->magic == RNA_MAGIC) { return prop; + } { IDProperty *idprop = (IDProperty *)prop; - if (idprop->type == IDP_ARRAY) + if (idprop->type == IDP_ARRAY) { return arraytypemap[(int)(idprop->subtype)]; - else + } + else { return typemap[(int)(idprop->type)]; + } } } static const char *rna_ensure_property_identifier(const PropertyRNA *prop) { - if (prop->magic == RNA_MAGIC) + if (prop->magic == RNA_MAGIC) { return prop->identifier; - else + } + else { return ((const IDProperty *)prop)->name; + } } static const char *rna_ensure_property_description(PropertyRNA *prop) { const char *description = NULL; - if (prop->magic == RNA_MAGIC) + if (prop->magic == RNA_MAGIC) { description = prop->description; + } else { /* attempt to get the local ID values */ IDProperty *idp_ui = rna_idproperty_ui(prop); if (idp_ui) { IDProperty *item = IDP_GetPropertyTypeFromGroup(idp_ui, "description", IDP_STRING); - if (item) + if (item) { description = IDP_String(item); + } } - if (description == NULL) + if (description == NULL) { description = ((IDProperty *)prop)->name; /* XXX - not correct */ + } } return description; @@ -647,10 +679,12 @@ static const char *rna_ensure_property_name(const PropertyRNA *prop) { const char *name; - if (prop->magic == RNA_MAGIC) + if (prop->magic == RNA_MAGIC) { name = prop->name; - else + } + else { name = ((const IDProperty *)prop)->name; + } return name; } @@ -679,10 +713,12 @@ const char *RNA_struct_ui_name_raw(const StructRNA *type) int RNA_struct_ui_icon(const StructRNA *type) { - if (type) + if (type) { return type->icon; - else + } + else { return ICON_DOT; + } } const char *RNA_struct_ui_description(const StructRNA *type) @@ -787,16 +823,20 @@ bool RNA_struct_is_a(const StructRNA *type, const StructRNA *srna) { const StructRNA *base; - if (srna == &RNA_AnyType) + if (srna == &RNA_AnyType) { return true; + } - if (!type) + if (!type) { return false; + } /* ptr->type is always maximally refined */ - for (base = type; base; base = base->base) - if (base == srna) + for (base = type; base; base = base->base) { + if (base == srna) { return true; + } + } return false; } @@ -818,8 +858,9 @@ PropertyRNA *RNA_struct_find_property(PointerRNA *ptr, const char *identifier) PropertyRNA *iterprop = RNA_struct_iterator_property(ptr->type); PointerRNA propptr; - if (RNA_property_collection_lookup_string(ptr, iterprop, identifier, &propptr)) + if (RNA_property_collection_lookup_string(ptr, iterprop, identifier, &propptr)) { return propptr.data; + } } return NULL; @@ -942,8 +983,9 @@ StructRegisterFunc RNA_struct_register(StructRNA *type) StructUnregisterFunc RNA_struct_unregister(StructRNA *type) { do { - if (type->unreg) + if (type->unreg) { return type->unreg; + } } while ((type = type->base)); return NULL; @@ -954,8 +996,9 @@ void **RNA_struct_instance(PointerRNA *ptr) StructRNA *type = ptr->type; do { - if (type->instance) + if (type->instance) { return type->instance(ptr); + } } while ((type = type->base)); return NULL; @@ -985,8 +1028,9 @@ char *RNA_struct_name_get_alloc(PointerRNA *ptr, char *fixedbuf, int fixedlen, i { PropertyRNA *nameprop; - if (ptr->data && (nameprop = RNA_struct_name_property(ptr->type))) + if (ptr->data && (nameprop = RNA_struct_name_property(ptr->type))) { return RNA_property_string_get_alloc(ptr, nameprop, fixedbuf, fixedlen, r_len); + } return NULL; } @@ -1146,8 +1190,9 @@ int RNA_property_array_dimension(PointerRNA *ptr, PropertyRNA *prop, int length[ { PropertyRNA *rprop = rna_ensure_property(prop); - if (length) + if (length) { rna_ensure_property_multi_array_length(ptr, prop, length); + } return rprop->arraydimension; } @@ -1489,16 +1534,19 @@ StructRNA *RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop) if (prop->type == PROP_POINTER) { PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop; - if (pprop->typef) + if (pprop->typef) { return pprop->typef(ptr); - else if (pprop->type) + } + else if (pprop->type) { return pprop->type; + } } else if (prop->type == PROP_COLLECTION) { CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop; - if (cprop->item_type) + if (cprop->item_type) { return cprop->item_type; + } } /* ignore other types, RNA_struct_find_nested calls with unchecked props */ @@ -1543,10 +1591,12 @@ void RNA_property_enum_items_ex(bContext *C, if (!use_static && eprop->itemf && (C != NULL || (prop->flag & PROP_ENUM_NO_CONTEXT))) { const EnumPropertyItem *item; - if (prop->flag & PROP_ENUM_NO_CONTEXT) + if (prop->flag & PROP_ENUM_NO_CONTEXT) { item = eprop->itemf(NULL, ptr, prop, r_free); - else + } + else { item = eprop->itemf(C, ptr, prop, r_free); + } /* any callbacks returning NULL should be fixed */ BLI_assert(item != NULL); @@ -1563,8 +1613,9 @@ void RNA_property_enum_items_ex(bContext *C, } else { *r_item = eprop->item; - if (r_totitem) + if (r_totitem) { *r_totitem = eprop->totitem; + } } } @@ -1592,8 +1643,9 @@ static void property_enum_translate(PropertyRNA *prop, bool do_tooltip = BLT_translate_tooltips(); EnumPropertyItem *nitem; - if (!(do_iface || do_tooltip)) + if (!(do_iface || do_tooltip)) { return; + } if (*r_free) { nitem = *r_item; @@ -1671,10 +1723,12 @@ void RNA_property_enum_items_gettexted_all(bContext *C, int i; bool free = false; - if (prop->flag & PROP_ENUM_NO_CONTEXT) + if (prop->flag & PROP_ENUM_NO_CONTEXT) { item = eprop->itemf(NULL, ptr, prop, &free); - else + } + else { item = eprop->itemf(C, ptr, prop, &free); + } /* any callbacks returning NULL should be fixed */ BLI_assert(item != NULL); @@ -1948,8 +2002,9 @@ int RNA_property_enum_bitflag_identifiers( if (item) { int result; result = RNA_enum_bitflag_identifiers(item, value, identifier); - if (free) + if (free) { MEM_freeN((void *)item); + } return result; } @@ -2070,8 +2125,9 @@ bool RNA_property_editable_index(PointerRNA *ptr, PropertyRNA *prop, int index) flag &= prop->editable(ptr, &dummy_info); } - if (prop->itemeditable) + if (prop->itemeditable) { flag &= prop->itemeditable(ptr, index); + } id = ptr->id.data; @@ -2081,13 +2137,15 @@ bool RNA_property_editable_index(PointerRNA *ptr, PropertyRNA *prop, int index) bool RNA_property_animateable(PointerRNA *ptr, PropertyRNA *prop) { /* check that base ID-block can support animation data */ - if (!id_can_have_animdata(ptr->id.data)) + if (!id_can_have_animdata(ptr->id.data)) { return false; + } prop = rna_ensure_property(prop); - if (!(prop->flag & PROP_ANIMATABLE)) + if (!(prop->flag & PROP_ANIMATABLE)) { return false; + } return (prop->flag & PROP_EDITABLE) != 0; } @@ -2097,15 +2155,18 @@ bool RNA_property_animated(PointerRNA *ptr, PropertyRNA *prop) int len = 1, index; bool driven, special; - if (!prop) + if (!prop) { return false; + } - if (RNA_property_array_check(prop)) + if (RNA_property_array_check(prop)) { len = RNA_property_array_length(ptr, prop); + } for (index = 0; index < len; index++) { - if (rna_get_fcurve(ptr, prop, index, NULL, NULL, &driven, &special)) + if (rna_get_fcurve(ptr, prop, index, NULL, NULL, &driven, &special)) { return true; + } } return false; @@ -2223,8 +2284,9 @@ static void rna_property_update( } } } - else + else { prop->update(bmain, scene, ptr); + } } #if 1 @@ -2319,14 +2381,16 @@ void RNA_property_update_cache_add(PointerRNA *ptr, PropertyRNA *prop) LinkData *ld; /* sanity check */ - if (NULL == ptr) + if (NULL == ptr) { return; + } prop = rna_ensure_property(prop); /* we can only handle update calls with no context args for now (makes animsys updates easier) */ - if ((is_rna == false) || (prop->update == NULL) || (prop->flag & PROP_CONTEXT_UPDATE)) + if ((is_rna == false) || (prop->update == NULL) || (prop->flag & PROP_CONTEXT_UPDATE)) { return; + } fn = prop->update; /* find cache element for which key matches... */ @@ -2335,8 +2399,9 @@ void RNA_property_update_cache_add(PointerRNA *ptr, PropertyRNA *prop) * since most update calls that we'll encounter only really care about this. */ /* TODO: later, the cache might need to have some nesting on L1 to cope better * with these problems + some tagging to indicate we need this */ - if (uce->ptr.id.data == ptr->id.data) + if (uce->ptr.id.data == ptr->id.data) { break; + } } if (uce == NULL) { /* create new instance */ @@ -2350,8 +2415,9 @@ void RNA_property_update_cache_add(PointerRNA *ptr, PropertyRNA *prop) /* check on the update func */ for (ld = uce->L2Funcs.first; ld; ld = ld->next) { /* stop on match - function already cached */ - if (fn == ld->data) + if (fn == ld->data) { return; + } } /* else... if still here, we need to add it */ BLI_addtail(&uce->L2Funcs, BLI_genericNodeN(fn)); @@ -2402,14 +2468,18 @@ bool RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop) BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); BLI_assert(RNA_property_array_check(prop) == false); - if ((idprop = rna_idproperty_check(&prop, ptr))) + if ((idprop = rna_idproperty_check(&prop, ptr))) { value = IDP_Int(idprop) != 0; - else if (bprop->get) + } + else if (bprop->get) { value = bprop->get(ptr); - else if (bprop->get_ex) + } + else if (bprop->get_ex) { value = bprop->get_ex(ptr, prop); - else + } + else { value = bprop->defaultvalue; + } BLI_assert(ELEM(value, false, true)); @@ -2445,8 +2515,9 @@ void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, bool value) val.i = value; group = RNA_struct_idprops(ptr, 1); - if (group) + if (group) { IDP_AddToGroup(group, IDP_New(IDP_INT, &val, prop->identifier)); + } } } @@ -2483,14 +2554,18 @@ void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, bool *va } } } - else if (prop->arraydimension == 0) + else if (prop->arraydimension == 0) { values[0] = RNA_property_boolean_get(ptr, prop); - else if (bprop->getarray) + } + else if (bprop->getarray) { bprop->getarray(ptr, values); - else if (bprop->getarray_ex) + } + else if (bprop->getarray_ex) { bprop->getarray_ex(ptr, prop, values); - else + } + else { rna_property_boolean_get_default_array_values(bprop, values); + } } bool RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int index) @@ -2542,12 +2617,15 @@ void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const bo } rna_idproperty_touch(idprop); } - else if (prop->arraydimension == 0) + else if (prop->arraydimension == 0) { RNA_property_boolean_set(ptr, prop, values[0]); - else if (bprop->setarray) + } + else if (bprop->setarray) { bprop->setarray(ptr, values); - else if (bprop->setarray_ex) + } + else if (bprop->setarray_ex) { bprop->setarray_ex(ptr, prop, values); + } else if (prop->flag & PROP_EDITABLE) { IDPropertyTemplate val = {0}; IDProperty *group; @@ -2614,10 +2692,12 @@ void RNA_property_boolean_get_default_array(PointerRNA *UNUSED(ptr), BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); BLI_assert(RNA_property_array_check(prop) != false); - if (prop->arraydimension == 0) + if (prop->arraydimension == 0) { values[0] = bprop->defaultvalue; - else + } + else { rna_property_boolean_get_default_array_values(bprop, values); + } } bool RNA_property_boolean_get_default_index(PointerRNA *ptr, PropertyRNA *prop, int index) @@ -2654,14 +2734,18 @@ int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop) BLI_assert(RNA_property_type(prop) == PROP_INT); BLI_assert(RNA_property_array_check(prop) == false); - if ((idprop = rna_idproperty_check(&prop, ptr))) + if ((idprop = rna_idproperty_check(&prop, ptr))) { return IDP_Int(idprop); - else if (iprop->get) + } + else if (iprop->get) { return iprop->get(ptr); - else if (iprop->get_ex) + } + else if (iprop->get_ex) { return iprop->get_ex(ptr, prop); - else + } + else { return iprop->defaultvalue; + } } void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value) @@ -2679,10 +2763,12 @@ void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value) IDP_Int(idprop) = value; rna_idproperty_touch(idprop); } - else if (iprop->set) + else if (iprop->set) { iprop->set(ptr, value); - else if (iprop->set_ex) + } + else if (iprop->set_ex) { iprop->set_ex(ptr, prop, value); + } else if (prop->flag & PROP_EDITABLE) { IDPropertyTemplate val = {0}; IDProperty *group; @@ -2692,8 +2778,9 @@ void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value) val.i = value; group = RNA_struct_idprops(ptr, 1); - if (group) + if (group) { IDP_AddToGroup(group, IDP_New(IDP_INT, &val, prop->identifier)); + } } } @@ -2722,19 +2809,25 @@ void RNA_property_int_get_array(PointerRNA *ptr, PropertyRNA *prop, int *values) if ((idprop = rna_idproperty_check(&prop, ptr))) { BLI_assert(idprop->len == RNA_property_array_length(ptr, prop) || (prop->flag & PROP_IDPROPERTY)); - if (prop->arraydimension == 0) + if (prop->arraydimension == 0) { values[0] = RNA_property_int_get(ptr, prop); - else + } + else { memcpy(values, IDP_Array(idprop), sizeof(int) * idprop->len); + } } - else if (prop->arraydimension == 0) + else if (prop->arraydimension == 0) { values[0] = RNA_property_int_get(ptr, prop); - else if (iprop->getarray) + } + else if (iprop->getarray) { iprop->getarray(ptr, values); - else if (iprop->getarray_ex) + } + else if (iprop->getarray_ex) { iprop->getarray_ex(ptr, prop, values); - else + } + else { rna_property_int_get_default_array_values(iprop, values); + } } void RNA_property_int_get_array_range(PointerRNA *ptr, PropertyRNA *prop, int values[2]) @@ -2811,19 +2904,24 @@ void RNA_property_int_set_array(PointerRNA *ptr, PropertyRNA *prop, const int *v if ((idprop = rna_idproperty_check(&prop, ptr))) { BLI_assert(idprop->len == RNA_property_array_length(ptr, prop) || (prop->flag & PROP_IDPROPERTY)); - if (prop->arraydimension == 0) + if (prop->arraydimension == 0) { IDP_Int(idprop) = values[0]; - else + } + else { memcpy(IDP_Array(idprop), values, sizeof(int) * idprop->len); + } rna_idproperty_touch(idprop); } - else if (prop->arraydimension == 0) + else if (prop->arraydimension == 0) { RNA_property_int_set(ptr, prop, values[0]); - else if (iprop->setarray) + } + else if (iprop->setarray) { iprop->setarray(ptr, values); - else if (iprop->setarray_ex) + } + else if (iprop->setarray_ex) { iprop->setarray_ex(ptr, prop, values); + } else if (prop->flag & PROP_EDITABLE) { IDPropertyTemplate val = {0}; IDProperty *group; @@ -2907,10 +3005,12 @@ void RNA_property_int_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA *pr BLI_assert(RNA_property_type(prop) == PROP_INT); BLI_assert(RNA_property_array_check(prop) != false); - if (prop->arraydimension == 0) + if (prop->arraydimension == 0) { values[0] = iprop->defaultvalue; - else + } + else { rna_property_int_get_default_array_values(iprop, values); + } } int RNA_property_int_get_default_index(PointerRNA *ptr, PropertyRNA *prop, int index) @@ -2948,17 +3048,22 @@ float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop) BLI_assert(RNA_property_array_check(prop) == false); if ((idprop = rna_idproperty_check(&prop, ptr))) { - if (idprop->type == IDP_FLOAT) + if (idprop->type == IDP_FLOAT) { return IDP_Float(idprop); - else + } + else { return (float)IDP_Double(idprop); + } } - else if (fprop->get) + else if (fprop->get) { return fprop->get(ptr); - else if (fprop->get_ex) + } + else if (fprop->get_ex) { return fprop->get_ex(ptr, prop); - else + } + else { return fprop->defaultvalue; + } } void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value) @@ -2973,10 +3078,12 @@ void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value) if ((idprop = rna_idproperty_check(&prop, ptr))) { RNA_property_float_clamp(ptr, prop, &value); - if (idprop->type == IDP_FLOAT) + if (idprop->type == IDP_FLOAT) { IDP_Float(idprop) = value; - else + } + else { IDP_Double(idprop) = value; + } rna_idproperty_touch(idprop); } @@ -2995,8 +3102,9 @@ void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value) val.f = value; group = RNA_struct_idprops(ptr, 1); - if (group) + if (group) { IDP_AddToGroup(group, IDP_New(IDP_FLOAT, &val, prop->identifier)); + } } } @@ -3026,24 +3134,30 @@ void RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, float *val if ((idprop = rna_idproperty_check(&prop, ptr))) { BLI_assert(idprop->len == RNA_property_array_length(ptr, prop) || (prop->flag & PROP_IDPROPERTY)); - if (prop->arraydimension == 0) + if (prop->arraydimension == 0) { values[0] = RNA_property_float_get(ptr, prop); + } else if (idprop->subtype == IDP_FLOAT) { memcpy(values, IDP_Array(idprop), sizeof(float) * idprop->len); } else { - for (i = 0; i < idprop->len; i++) + for (i = 0; i < idprop->len; i++) { values[i] = (float)(((double *)IDP_Array(idprop))[i]); + } } } - else if (prop->arraydimension == 0) + else if (prop->arraydimension == 0) { values[0] = RNA_property_float_get(ptr, prop); - else if (fprop->getarray) + } + else if (fprop->getarray) { fprop->getarray(ptr, values); - else if (fprop->getarray_ex) + } + else if (fprop->getarray_ex) { fprop->getarray_ex(ptr, prop, values); - else + } + else { rna_property_float_get_default_array_values(fprop, values); + } } void RNA_property_float_get_array_range(PointerRNA *ptr, PropertyRNA *prop, float values[2]) @@ -3122,23 +3236,27 @@ void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, const floa BLI_assert(idprop->len == RNA_property_array_length(ptr, prop) || (prop->flag & PROP_IDPROPERTY)); if (prop->arraydimension == 0) { - if (idprop->type == IDP_FLOAT) + if (idprop->type == IDP_FLOAT) { IDP_Float(idprop) = values[0]; - else + } + else { IDP_Double(idprop) = values[0]; + } } else if (idprop->subtype == IDP_FLOAT) { memcpy(IDP_Array(idprop), values, sizeof(float) * idprop->len); } else { - for (i = 0; i < idprop->len; i++) + for (i = 0; i < idprop->len; i++) { ((double *)IDP_Array(idprop))[i] = values[i]; + } } rna_idproperty_touch(idprop); } - else if (prop->arraydimension == 0) + else if (prop->arraydimension == 0) { RNA_property_float_set(ptr, prop, values[0]); + } else if (fprop->setarray) { fprop->setarray(ptr, values); } @@ -3233,10 +3351,12 @@ void RNA_property_float_get_default_array(PointerRNA *UNUSED(ptr), BLI_assert(RNA_property_type(prop) == PROP_FLOAT); BLI_assert(RNA_property_array_check(prop) != false); - if (prop->arraydimension == 0) + if (prop->arraydimension == 0) { values[0] = fprop->defaultvalue; - else + } + else { rna_property_float_get_default_array_values(fprop, values); + } } float RNA_property_float_get_default_index(PointerRNA *ptr, PropertyRNA *prop, int index) @@ -3304,10 +3424,12 @@ char *RNA_property_string_get_alloc( length = RNA_property_string_length(ptr, prop); - if (length + 1 < fixedlen) + if (length + 1 < fixedlen) { buf = fixedbuf; - else + } + else { buf = MEM_mallocN(sizeof(char) * (length + 1), "RNA_string_get_alloc"); + } #ifndef NDEBUG /* safety check to ensure the string is actually set */ @@ -3347,12 +3469,15 @@ int RNA_property_string_length(PointerRNA *ptr, PropertyRNA *prop) return idprop->len - 1; } } - else if (sprop->length) + else if (sprop->length) { return sprop->length(ptr); - else if (sprop->length_ex) + } + else if (sprop->length_ex) { return sprop->length_ex(ptr, prop); - else + } + else { return strlen(sprop->defaultvalue); + } } void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *value) @@ -3367,17 +3492,20 @@ void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *val IDP_AssignString(idprop, value, RNA_property_string_maxlength(prop) - 1); rna_idproperty_touch(idprop); } - else if (sprop->set) + else if (sprop->set) { sprop->set(ptr, value); /* set function needs to clamp its self */ - else if (sprop->set_ex) + } + else if (sprop->set_ex) { sprop->set_ex(ptr, prop, value); /* set function needs to clamp its self */ + } else if (prop->flag & PROP_EDITABLE) { IDProperty *group; group = RNA_struct_idprops(ptr, 1); - if (group) + if (group) { IDP_AddToGroup(group, IDP_NewString(value, prop->identifier, RNA_property_string_maxlength(prop))); + } } } @@ -3438,10 +3566,12 @@ char *RNA_property_string_get_default_alloc(PointerRNA *ptr, length = RNA_property_string_default_length(ptr, prop); - if (length + 1 < fixedlen) + if (length + 1 < fixedlen) { buf = fixedbuf; - else + } + else { buf = MEM_callocN(sizeof(char) * (length + 1), "RNA_string_get_alloc"); + } RNA_property_string_get_default(ptr, prop, buf); @@ -3465,14 +3595,18 @@ int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop) BLI_assert(RNA_property_type(prop) == PROP_ENUM); - if ((idprop = rna_idproperty_check(&prop, ptr))) + if ((idprop = rna_idproperty_check(&prop, ptr))) { return IDP_Int(idprop); - else if (eprop->get) + } + else if (eprop->get) { return eprop->get(ptr); - else if (eprop->get_ex) + } + else if (eprop->get_ex) { return eprop->get_ex(ptr, prop); - else + } + else { return eprop->defaultvalue; + } } void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value) @@ -3499,8 +3633,9 @@ void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value) val.i = value; group = RNA_struct_idprops(ptr, 1); - if (group) + if (group) { IDP_AddToGroup(group, IDP_New(IDP_INT, &val, prop->identifier)); + } } } @@ -3577,10 +3712,12 @@ PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop) } /* for groups, data is idprop itself */ - if (pprop->typef) + if (pprop->typef) { return rna_pointer_inherit_refine(ptr, pprop->typef(ptr), idprop); - else + } + else { return rna_pointer_inherit_refine(ptr, pprop->type, idprop); + } } else if (pprop->get) { return pprop->get(ptr); @@ -3654,14 +3791,16 @@ void RNA_property_pointer_add(PointerRNA *ptr, PropertyRNA *prop) val.i = 0; group = RNA_struct_idprops(ptr, 1); - if (group) + if (group) { IDP_AddToGroup(group, IDP_New(IDP_GROUP, &val, prop->identifier)); + } } - else + else { printf("%s %s.%s: only supported for id properties.\n", __func__, ptr->type->identifier, prop->identifier); + } } void RNA_property_pointer_remove(PointerRNA *ptr, PropertyRNA *prop) @@ -3677,11 +3816,12 @@ void RNA_property_pointer_remove(PointerRNA *ptr, PropertyRNA *prop) IDP_FreeFromGroup(group, idprop); } } - else + else { printf("%s %s.%s: only supported for id properties.\n", __func__, ptr->type->identifier, prop->identifier); + } } static void rna_property_collection_get_idp(CollectionPropertyIterator *iter) @@ -3707,14 +3847,17 @@ void RNA_property_collection_begin(PointerRNA *ptr, iter->parent = *ptr; iter->prop = prop; - if (idprop) + if (idprop) { rna_iterator_array_begin( iter, IDP_IDPArray(idprop), sizeof(IDProperty), idprop->len, 0, NULL); - else + } + else { rna_iterator_array_begin(iter, NULL, sizeof(IDProperty), 0, 0, NULL); + } - if (iter->valid) + if (iter->valid) { rna_property_collection_get_idp(iter); + } iter->idprop = 1; } @@ -3731,11 +3874,13 @@ void RNA_property_collection_next(CollectionPropertyIterator *iter) if (iter->idprop) { rna_iterator_array_next(iter); - if (iter->valid) + if (iter->valid) { rna_property_collection_get_idp(iter); + } } - else + else { cprop->next(iter); + } } void RNA_property_collection_skip(CollectionPropertyIterator *iter, int num) @@ -3750,25 +3895,29 @@ void RNA_property_collection_skip(CollectionPropertyIterator *iter, int num) if (!internal->skip) { internal->ptr += internal->itemsize * (num - 1); iter->valid = (internal->ptr < internal->endptr); - if (iter->valid) + if (iter->valid) { RNA_property_collection_next(iter); + } return; } } /* slow iteration otherwise */ - for (i = 0; i < num && iter->valid; i++) + for (i = 0; i < num && iter->valid; i++) { RNA_property_collection_next(iter); + } } void RNA_property_collection_end(CollectionPropertyIterator *iter) { CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)rna_ensure_property(iter->prop); - if (iter->idprop) + if (iter->idprop) { rna_iterator_array_end(iter); - else + } + else { cprop->end(iter); + } } int RNA_property_collection_length(PointerRNA *ptr, PropertyRNA *prop) @@ -3789,8 +3938,9 @@ int RNA_property_collection_length(PointerRNA *ptr, PropertyRNA *prop) int length = 0; RNA_property_collection_begin(ptr, prop, &iter); - for (; iter.valid; RNA_property_collection_next(&iter)) + for (; iter.valid; RNA_property_collection_next(&iter)) { length++; + } RNA_property_collection_end(&iter); return length; @@ -3860,8 +4010,9 @@ void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA r_ptr->type = cprop->item_type; rna_pointer_inherit_id(NULL, ptr, r_ptr); } - else + else { memset(r_ptr, 0, sizeof(*r_ptr)); + } } } @@ -3935,10 +4086,12 @@ bool RNA_property_collection_move(PointerRNA *ptr, PropertyRNA *prop, int key, i if (key >= 0 && key < len && pos >= 0 && pos < len && key != pos) { memcpy(&tmp, &array[key], sizeof(IDProperty)); - if (pos < key) + if (pos < key) { memmove(array + pos + 1, array + pos, sizeof(IDProperty) * (key - pos)); - else + } + else { memmove(array + key, array + key + 1, sizeof(IDProperty) * (pos - key)); + } memcpy(&array[pos], &tmp, sizeof(IDProperty)); } @@ -3972,16 +4125,19 @@ int RNA_property_collection_lookup_index(PointerRNA *ptr, PropertyRNA *prop, Poi RNA_property_collection_begin(ptr, prop, &iter); for (index = 0; iter.valid; RNA_property_collection_next(&iter), index++) { - if (iter.ptr.data == t_ptr->data) + if (iter.ptr.data == t_ptr->data) { break; + } } RNA_property_collection_end(&iter); /* did we find it? */ - if (iter.valid) + if (iter.valid) { return index; - else + } + else { return -1; + } } int RNA_property_collection_lookup_int(PointerRNA *ptr, @@ -4011,8 +4167,9 @@ int RNA_property_collection_lookup_int(PointerRNA *ptr, } RNA_property_collection_end(&iter); - if (!iter.valid) + if (!iter.valid) { memset(r_ptr, 0, sizeof(*r_ptr)); + } return iter.valid; } @@ -4052,17 +4209,20 @@ int RNA_property_collection_lookup_string(PointerRNA *ptr, found = 1; } - if ((char *)&name != nameptr) + if ((char *)&name != nameptr) { MEM_freeN(nameptr); + } - if (found) + if (found) { break; + } } } RNA_property_collection_end(&iter); - if (!iter.valid) + if (!iter.valid) { memset(r_ptr, 0, sizeof(*r_ptr)); + } return iter.valid; } @@ -4106,8 +4266,9 @@ int RNA_property_collection_raw_array(PointerRNA *ptr, BLI_assert(RNA_property_type(prop) == PROP_COLLECTION); if (!(prop->flag_internal & PROP_INTERN_RAW_ARRAY) || - !(itemprop->flag_internal & PROP_INTERN_RAW_ACCESS)) + !(itemprop->flag_internal & PROP_INTERN_RAW_ACCESS)) { return 0; + } RNA_property_collection_begin(ptr, prop, &iter); @@ -4127,8 +4288,9 @@ int RNA_property_collection_raw_array(PointerRNA *ptr, array->len = ((char *)internal->endptr - arrayp) / internal->itemsize; array->type = itemprop->rawtype; } - else + else { memset(array, 0, sizeof(RawArray)); + } RNA_property_collection_end(&iter); @@ -4215,11 +4377,13 @@ static int rna_property_array_length_all_dimensions(PointerRNA *ptr, PropertyRNA const int dim = RNA_property_array_dimension(ptr, prop, len); int size; - if (dim == 0) + if (dim == 0) { return 0; + } - for (size = 1, i = 0; i < dim; i++) + for (size = 1, i = 0; i < dim; i++) { size *= len[i]; + } return size; } @@ -4292,10 +4456,12 @@ static int rna_raw_access(ReportList *reports, size = RNA_raw_type_sizeof(out.type) * arraylen; for (a = 0; a < out.len; a++) { - if (set) + if (set) { memcpy(outp, inp, size); - else + } + else { memcpy(inp, outp, size); + } inp = (char *)inp + size; outp = (char *)outp + out.stride; @@ -4518,8 +4684,9 @@ static int rna_raw_access(ReportList *reports, } RNA_PROP_END; - if (tmparray) + if (tmparray) { MEM_freeN(tmparray); + } return !err; } @@ -4581,8 +4748,9 @@ void rna_iterator_listbase_begin(CollectionPropertyIterator *iter, iter->valid = (internal->link != NULL); - if (skip && iter->valid && skip(iter, internal->link)) + if (skip && iter->valid && skip(iter, internal->link)) { rna_iterator_listbase_next(iter); + } } void rna_iterator_listbase_next(CollectionPropertyIterator *iter) @@ -4630,8 +4798,9 @@ void rna_iterator_array_begin(CollectionPropertyIterator *iter, { ArrayIterator *internal; - if (ptr == NULL) + if (ptr == NULL) { length = 0; + } else if (length == 0) { ptr = NULL; itemsize = 0; @@ -4647,8 +4816,9 @@ void rna_iterator_array_begin(CollectionPropertyIterator *iter, iter->valid = (internal->ptr != internal->endptr); - if (skip && iter->valid && skip(iter, internal->ptr)) + if (skip && iter->valid && skip(iter, internal->ptr)) { rna_iterator_array_next(iter); + } } void rna_iterator_array_next(CollectionPropertyIterator *iter) @@ -4695,8 +4865,9 @@ void rna_iterator_array_end(CollectionPropertyIterator *iter) PointerRNA rna_array_lookup_int( PointerRNA *ptr, StructRNA *type, void *data, int itemsize, int length, int index) { - if (index < 0 || index >= length) + if (index < 0 || index >= length) { return PointerRNA_NULL; + } return rna_pointer_inherit_refine(ptr, type, ((char *)data) + index * itemsize); } @@ -4714,18 +4885,21 @@ static char *rna_path_token(const char **path, char *fixedbuf, int fixedlen, int if (bracket) { /* get data between [], check escaping ] with \] */ - if (**path == '[') + if (**path == '[') { (*path)++; - else + } + else { return NULL; + } p = *path; /* 2 kinds of lookups now, quoted or unquoted */ quote = *p; - if (quote != '"') /* " - this comment is hack for Aligorith's text editor's sanity */ + if (quote != '"') { /* " - this comment is hack for Aligorith's text editor's sanity */ quote = 0; + } if (quote == 0) { while (*p && (*p != ']')) { @@ -4749,8 +4923,9 @@ static char *rna_path_token(const char **path, char *fixedbuf, int fixedlen, int p++; } - if (*p != ']') + if (*p != ']') { return NULL; + } } else { /* get data until . or [ */ @@ -4763,22 +4938,26 @@ static char *rna_path_token(const char **path, char *fixedbuf, int fixedlen, int } /* empty, return */ - if (len == 0) + if (len == 0) { return NULL; + } /* try to use fixed buffer if possible */ - if (len + 1 < fixedlen) + if (len + 1 < fixedlen) { buf = fixedbuf; - else + } + else { buf = MEM_mallocN(sizeof(char) * (len + 1), "rna_path_token"); + } /* copy string, taking into account escaped ] */ if (bracket) { for (p = *path, i = 0, j = 0; i < len; i++, p++) { if (*p == '\\' && *(p + 1) == quote) { } - else + else { buf[j++] = *p; + } } buf[j] = 0; @@ -4789,10 +4968,12 @@ static char *rna_path_token(const char **path, char *fixedbuf, int fixedlen, int } /* set path to start of next token */ - if (*p == ']') + if (*p == ']') { p++; - if (*p == '.') + } + if (*p == '.') { p++; + } *path = p; return buf; @@ -4822,8 +5003,9 @@ static bool rna_path_parse_collection_key(const char **path, *r_nextptr = *ptr; /* end of path, ok */ - if (!(**path)) + if (!(**path)) { return true; + } if (**path == '[') { char *token; @@ -4831,8 +5013,9 @@ static bool rna_path_parse_collection_key(const char **path, /* resolve the lookup with [] brackets */ token = rna_path_token(path, fixedbuf, sizeof(fixedbuf), 1); - if (!token) + if (!token) { return false; + } /* check for "" to see if it is a string */ if (rna_token_strip_quotes(token)) { @@ -4888,8 +5071,9 @@ static bool rna_path_parse_array_index(const char **path, *r_index = -1; /* end of path, ok */ - if (!(**path)) + if (!(**path)) { return true; + } for (i = 0; i < dim; i++) { int temp_index = -1; @@ -4939,16 +5123,18 @@ static bool rna_path_parse_array_index(const char **path, } /* out of range */ - if (temp_index < 0 || temp_index >= len[i]) + if (temp_index < 0 || temp_index >= len[i]) { return false; + } index_arr[i] = temp_index; /* end multi index resolve */ } /* arrays always contain numbers so further values are not valid */ - if (**path) + if (**path) { return false; + } /* flatten index over all dimensions */ { @@ -5011,8 +5197,9 @@ static bool rna_path_parse(PointerRNA *ptr, prop = NULL; curptr = *ptr; - if (path == NULL || *path == '\0') + if (path == NULL || *path == '\0') { return false; + } while (*path) { if (do_item_ptr) { @@ -5039,8 +5226,9 @@ static bool rna_path_parse(PointerRNA *ptr, prop = NULL; if (use_id_prop) { /* look up property name in current struct */ IDProperty *group = RNA_struct_idprops(&curptr, 0); - if (group && rna_token_strip_quotes(token)) + if (group && rna_token_strip_quotes(token)) { prop = (PropertyRNA *)IDP_GetPropertyFromGroup(group, token + 1); + } } else { prop = RNA_struct_find_property(&curptr, token); @@ -5149,8 +5337,9 @@ static bool rna_path_parse(PointerRNA *ptr, */ bool RNA_path_resolve(PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop) { - if (!rna_path_parse(ptr, path, r_ptr, r_prop, NULL, NULL, NULL, true)) + if (!rna_path_parse(ptr, path, r_ptr, r_prop, NULL, NULL, NULL, true)) { return false; + } return r_ptr->data != NULL; } @@ -5165,8 +5354,9 @@ bool RNA_path_resolve(PointerRNA *ptr, const char *path, PointerRNA *r_ptr, Prop bool RNA_path_resolve_full( PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop, int *r_index) { - if (!rna_path_parse(ptr, path, r_ptr, r_prop, r_index, NULL, NULL, true)) + if (!rna_path_parse(ptr, path, r_ptr, r_prop, r_index, NULL, NULL, true)) { return false; + } return r_ptr->data != NULL; } @@ -5202,8 +5392,9 @@ bool RNA_path_resolve_property(PointerRNA *ptr, bool RNA_path_resolve_property_full( PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop, int *r_index) { - if (!rna_path_parse(ptr, path, r_ptr, r_prop, r_index, NULL, NULL, false)) + if (!rna_path_parse(ptr, path, r_ptr, r_prop, r_index, NULL, NULL, false)) { return false; + } return r_ptr->data != NULL && *r_prop != NULL; } @@ -5253,8 +5444,9 @@ bool RNA_path_resolve_property_and_item_pointer_full(PointerRNA *ptr, int *r_index, PointerRNA *r_item_ptr) { - if (!rna_path_parse(ptr, path, r_ptr, r_prop, r_index, r_item_ptr, NULL, false)) + if (!rna_path_parse(ptr, path, r_ptr, r_prop, r_index, r_item_ptr, NULL, false)) { return false; + } return r_ptr->data != NULL && *r_prop != NULL; } @@ -5284,8 +5476,9 @@ char *RNA_path_append( /* add .identifier */ if (path) { BLI_dynstr_append(dynstr, path); - if (*path) + if (*path) { BLI_dynstr_append(dynstr, "."); + } } BLI_dynstr_append(dynstr, RNA_property_identifier(prop)); @@ -5331,8 +5524,9 @@ char *RNA_path_back(const char *path) char *result; int i; - if (!path) + if (!path) { return NULL; + } previous = NULL; current = path; @@ -5344,31 +5538,37 @@ char *RNA_path_back(const char *path) token = rna_path_token(¤t, fixedbuf, sizeof(fixedbuf), 0); - if (!token) + if (!token) { return NULL; - if (token != fixedbuf) + } + if (token != fixedbuf) { MEM_freeN(token); + } /* in case of collection we also need to strip off [] */ token = rna_path_token(¤t, fixedbuf, sizeof(fixedbuf), 1); - if (token && token != fixedbuf) + if (token && token != fixedbuf) { MEM_freeN(token); + } - if (!*current) + if (!*current) { break; + } previous = current; } - if (!previous) + if (!previous) { return NULL; + } /* copy and strip off last token */ i = previous - path; result = BLI_strdup(path); - if (i > 0 && result[i - 1] == '.') + if (i > 0 && result[i - 1] == '.') { i--; + } result[i] = 0; return result; @@ -5488,8 +5688,9 @@ static char *rna_idp_path(PointerRNA *ptr, } } } - if (path) + if (path) { break; + } } } } @@ -5528,8 +5729,9 @@ char *RNA_path_from_ID_to_struct(PointerRNA *ptr) { char *ptrpath = NULL; - if (!ptr->id.data || !ptr->data) + if (!ptr->id.data || !ptr->data) { return NULL; + } if (!RNA_struct_is_ID(ptr->type)) { if (ptr->type->path) { @@ -5546,17 +5748,20 @@ char *RNA_path_from_ID_to_struct(PointerRNA *ptr) RNA_id_pointer_create(ptr->id.data, &parentptr); userprop = RNA_struct_find_nested(&parentptr, ptr->type); - if (userprop) + if (userprop) { ptrpath = BLI_strdup(RNA_property_identifier(userprop)); - else + } + else { return NULL; /* can't do anything about this case yet... */ + } } else if (RNA_struct_is_a(ptr->type, &RNA_PropertyGroup)) { /* special case, easier to deal with here then in ptr->type->path() */ return rna_path_from_ID_to_idpgroup(ptr); } - else + else { return NULL; + } } return ptrpath; @@ -5616,8 +5821,9 @@ char *RNA_path_from_ID_to_property_index(PointerRNA *ptr, const char *propname; char *ptrpath, *path; - if (!ptr->id.data || !ptr->data) + if (!ptr->id.data || !ptr->data) { return NULL; + } /* path from ID to the struct holding this property */ ptrpath = RNA_path_from_ID_to_struct(ptr); @@ -5891,30 +6097,36 @@ void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value) { PropertyRNA *prop = RNA_struct_find_property(ptr, name); - if (prop) + if (prop) { RNA_property_boolean_set(ptr, prop, value); - else + } + else { printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); + } } void RNA_boolean_get_array(PointerRNA *ptr, const char *name, bool *values) { PropertyRNA *prop = RNA_struct_find_property(ptr, name); - if (prop) + if (prop) { RNA_property_boolean_get_array(ptr, prop, values); - else + } + else { printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); + } } void RNA_boolean_set_array(PointerRNA *ptr, const char *name, const bool *values) { PropertyRNA *prop = RNA_struct_find_property(ptr, name); - if (prop) + if (prop) { RNA_property_boolean_set_array(ptr, prop, values); - else + } + else { printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); + } } int RNA_int_get(PointerRNA *ptr, const char *name) @@ -5934,30 +6146,36 @@ void RNA_int_set(PointerRNA *ptr, const char *name, int value) { PropertyRNA *prop = RNA_struct_find_property(ptr, name); - if (prop) + if (prop) { RNA_property_int_set(ptr, prop, value); - else + } + else { printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); + } } void RNA_int_get_array(PointerRNA *ptr, const char *name, int *values) { PropertyRNA *prop = RNA_struct_find_property(ptr, name); - if (prop) + if (prop) { RNA_property_int_get_array(ptr, prop, values); - else + } + else { printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); + } } void RNA_int_set_array(PointerRNA *ptr, const char *name, const int *values) { PropertyRNA *prop = RNA_struct_find_property(ptr, name); - if (prop) + if (prop) { RNA_property_int_set_array(ptr, prop, values); - else + } + else { printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); + } } float RNA_float_get(PointerRNA *ptr, const char *name) @@ -5977,30 +6195,36 @@ void RNA_float_set(PointerRNA *ptr, const char *name, float value) { PropertyRNA *prop = RNA_struct_find_property(ptr, name); - if (prop) + if (prop) { RNA_property_float_set(ptr, prop, value); - else + } + else { printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); + } } void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values) { PropertyRNA *prop = RNA_struct_find_property(ptr, name); - if (prop) + if (prop) { RNA_property_float_get_array(ptr, prop, values); - else + } + else { printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); + } } void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values) { PropertyRNA *prop = RNA_struct_find_property(ptr, name); - if (prop) + if (prop) { RNA_property_float_set_array(ptr, prop, values); - else + } + else { printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); + } } int RNA_enum_get(PointerRNA *ptr, const char *name) @@ -6020,10 +6244,12 @@ void RNA_enum_set(PointerRNA *ptr, const char *name, int value) { PropertyRNA *prop = RNA_struct_find_property(ptr, name); - if (prop) + if (prop) { RNA_property_enum_set(ptr, prop, value); - else + } + else { printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); + } } void RNA_enum_set_identifier(bContext *C, PointerRNA *ptr, const char *name, const char *id) @@ -6032,10 +6258,12 @@ void RNA_enum_set_identifier(bContext *C, PointerRNA *ptr, const char *name, con if (prop) { int value; - if (RNA_property_enum_value(C, ptr, prop, id, &value)) + if (RNA_property_enum_value(C, ptr, prop, id, &value)) { RNA_property_enum_set(ptr, prop, value); - else + } + else { printf("%s: %s.%s has no enum id '%s'.\n", __func__, ptr->type->identifier, name, id); + } } else { printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); @@ -6167,10 +6395,12 @@ void RNA_string_set(PointerRNA *ptr, const char *name, const char *value) { PropertyRNA *prop = RNA_struct_find_property(ptr, name); - if (prop) + if (prop) { RNA_property_string_set(ptr, prop, value); - else + } + else { printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); + } } PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name) @@ -6203,40 +6433,48 @@ void RNA_pointer_add(PointerRNA *ptr, const char *name) { PropertyRNA *prop = RNA_struct_find_property(ptr, name); - if (prop) + if (prop) { RNA_property_pointer_add(ptr, prop); - else + } + else { printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); + } } void RNA_collection_begin(PointerRNA *ptr, const char *name, CollectionPropertyIterator *iter) { PropertyRNA *prop = RNA_struct_find_property(ptr, name); - if (prop) + if (prop) { RNA_property_collection_begin(ptr, prop, iter); - else + } + else { printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); + } } void RNA_collection_add(PointerRNA *ptr, const char *name, PointerRNA *r_value) { PropertyRNA *prop = RNA_struct_find_property(ptr, name); - if (prop) + if (prop) { RNA_property_collection_add(ptr, prop, r_value); - else + } + else { printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); + } } void RNA_collection_clear(PointerRNA *ptr, const char *name) { PropertyRNA *prop = RNA_struct_find_property(ptr, name); - if (prop) + if (prop) { RNA_property_collection_clear(ptr, prop); - else + } + else { printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); + } } int RNA_collection_length(PointerRNA *ptr, const char *name) @@ -6354,11 +6592,13 @@ char *RNA_pointer_as_string_id(bContext *C, PointerRNA *ptr) RNA_STRUCT_BEGIN (ptr, prop) { propname = RNA_property_identifier(prop); - if (STREQ(propname, "rna_type")) + if (STREQ(propname, "rna_type")) { continue; + } - if (first_time == 0) + if (first_time == 0) { BLI_dynstr_append(dynstr, ", "); + } first_time = 0; cstring = RNA_property_as_string(C, ptr, prop, -1, INT_MAX); @@ -6742,8 +6982,9 @@ char *RNA_property_as_string( RNA_property_collection_next(&collect_iter), i++) { PointerRNA itemptr = collect_iter.ptr; - if (i != 0) + if (i != 0) { BLI_dynstr_append(dynstr, ", "); + } /* now get every prop of the collection */ cstring = RNA_pointer_as_string(C, ptr, prop, &itemptr); @@ -6804,9 +7045,11 @@ PropertyRNA *RNA_function_find_parameter(PointerRNA *UNUSED(ptr), PropertyRNA *parm; parm = func->cont.properties.first; - for (; parm; parm = parm->next) - if (STREQ(RNA_property_identifier(parm), identifier)) + for (; parm; parm = parm->next) { + if (STREQ(RNA_property_identifier(parm), identifier)) { break; + } + } return parm; } @@ -6838,10 +7081,12 @@ ParameterList *RNA_parameter_list_create(ParameterList *parms, for (parm = func->cont.properties.first; parm; parm = parm->next) { alloc_size += rna_parameter_size(parm); - if (parm->flag_parameter & PARM_OUTPUT) + if (parm->flag_parameter & PARM_OUTPUT) { parms->ret_count++; - else + } + else { parms->arg_count++; + } } parms->data = MEM_callocN(alloc_size, "RNA_parameter_list_create"); @@ -6864,22 +7109,28 @@ ParameterList *RNA_parameter_list_create(ParameterList *parms, if (!(parm->flag_parameter & PARM_REQUIRED) && !(parm->flag & PROP_DYNAMIC)) { switch (parm->type) { case PROP_BOOLEAN: - if (parm->arraydimension) + if (parm->arraydimension) { rna_property_boolean_get_default_array_values((BoolPropertyRNA *)parm, data); - else + } + else { memcpy(data, &((BoolPropertyRNA *)parm)->defaultvalue, size); + } break; case PROP_INT: - if (parm->arraydimension) + if (parm->arraydimension) { rna_property_int_get_default_array_values((IntPropertyRNA *)parm, data); - else + } + else { memcpy(data, &((IntPropertyRNA *)parm)->defaultvalue, size); + } break; case PROP_FLOAT: - if (parm->arraydimension) + if (parm->arraydimension) { rna_property_float_get_default_array_values((FloatPropertyRNA *)parm, data); - else + } + else { memcpy(data, &((FloatPropertyRNA *)parm)->defaultvalue, size); + } break; case PROP_ENUM: memcpy(data, &((EnumPropertyRNA *)parm)->defaultvalue, size); @@ -6916,13 +7167,15 @@ void RNA_parameter_list_free(ParameterList *parms) parm = parms->func->cont.properties.first; for (tot = 0; parm; parm = parm->next) { - if (parm->type == PROP_COLLECTION) + if (parm->type == PROP_COLLECTION) { BLI_freelistN((ListBase *)((char *)parms->data + tot)); + } else if (parm->flag & PROP_DYNAMIC) { /* for dynamic arrays and strings, data is a pointer to an array */ ParameterDynAlloc *data_alloc = (void *)(((char *)parms->data) + tot); - if (data_alloc->array) + if (data_alloc->array) { MEM_freeN(data_alloc->array); + } } tot += rna_parameter_size(parm); @@ -6988,9 +7241,11 @@ void RNA_parameter_get(ParameterList *parms, PropertyRNA *parm, void **value) RNA_parameter_list_begin(parms, &iter); - for (; iter.valid; RNA_parameter_list_next(&iter)) - if (iter.parm == parm) + for (; iter.valid; RNA_parameter_list_next(&iter)) { + if (iter.parm == parm) { break; + } + } if (iter.valid) { if (parm->flag & PROP_DYNAMIC) { @@ -7014,12 +7269,15 @@ void RNA_parameter_get_lookup(ParameterList *parms, const char *identifier, void PropertyRNA *parm; parm = parms->func->cont.properties.first; - for (; parm; parm = parm->next) - if (STREQ(RNA_property_identifier(parm), identifier)) + for (; parm; parm = parm->next) { + if (STREQ(RNA_property_identifier(parm), identifier)) { break; + } + } - if (parm) + if (parm) { RNA_parameter_get(parms, parm, value); + } } void RNA_parameter_set(ParameterList *parms, PropertyRNA *parm, const void *value) @@ -7028,9 +7286,11 @@ void RNA_parameter_set(ParameterList *parms, PropertyRNA *parm, const void *valu RNA_parameter_list_begin(parms, &iter); - for (; iter.valid; RNA_parameter_list_next(&iter)) - if (iter.parm == parm) + for (; iter.valid; RNA_parameter_list_next(&iter)) { + if (iter.parm == parm) { break; + } + } if (iter.valid) { if (parm->flag & PROP_DYNAMIC) { @@ -7052,8 +7312,9 @@ void RNA_parameter_set(ParameterList *parms, PropertyRNA *parm, const void *valu break; } size *= data_alloc->array_tot; - if (data_alloc->array) + if (data_alloc->array) { MEM_freeN(data_alloc->array); + } data_alloc->array = MEM_mallocN(size, __func__); memcpy(data_alloc->array, value, size); } @@ -7070,12 +7331,15 @@ void RNA_parameter_set_lookup(ParameterList *parms, const char *identifier, cons PropertyRNA *parm; parm = parms->func->cont.properties.first; - for (; parm; parm = parm->next) - if (STREQ(RNA_property_identifier(parm), identifier)) + for (; parm; parm = parm->next) { + if (STREQ(RNA_property_identifier(parm), identifier)) { break; + } + } - if (parm) + if (parm) { RNA_parameter_set(parms, parm, value); + } } int RNA_parameter_dynamic_length_get(ParameterList *parms, PropertyRNA *parm) @@ -7085,12 +7349,15 @@ int RNA_parameter_dynamic_length_get(ParameterList *parms, PropertyRNA *parm) RNA_parameter_list_begin(parms, &iter); - for (; iter.valid; RNA_parameter_list_next(&iter)) - if (iter.parm == parm) + for (; iter.valid; RNA_parameter_list_next(&iter)) { + if (iter.parm == parm) { break; + } + } - if (iter.valid) + if (iter.valid) { len = RNA_parameter_dynamic_length_get_data(parms, parm, iter.data); + } RNA_parameter_list_end(&iter); @@ -7103,12 +7370,15 @@ void RNA_parameter_dynamic_length_set(ParameterList *parms, PropertyRNA *parm, i RNA_parameter_list_begin(parms, &iter); - for (; iter.valid; RNA_parameter_list_next(&iter)) - if (iter.parm == parm) + for (; iter.valid; RNA_parameter_list_next(&iter)) { + if (iter.parm == parm) { break; + } + } - if (iter.valid) + if (iter.valid) { RNA_parameter_dynamic_length_set_data(parms, parm, iter.data, length); + } RNA_parameter_list_end(&iter); } @@ -7155,8 +7425,9 @@ int RNA_function_call_lookup(bContext *C, func = RNA_struct_find_function(ptr->type, identifier); - if (func) + if (func) { return RNA_function_call(C, reports, ptr, func, parms); + } return -1; } @@ -7208,9 +7479,11 @@ static int rna_function_format_array_length(const char *format, int ofs, int fle char lenbuf[16]; int idx = 0; - if (format[ofs++] == '[') - for (; ofs < flen && format[ofs] != ']' && idx < sizeof(lenbuf) - 1; idx++, ofs++) + if (format[ofs++] == '[') { + for (; ofs < flen && format[ofs] != ']' && idx < sizeof(lenbuf) - 1; idx++, ofs++) { lenbuf[idx] = format[ofs]; + } + } if (ofs < flen && format[ofs + 1] == ']') { /* XXX put better error reporting for (ofs >= flen) or idx over lenbuf capacity */ @@ -7243,10 +7516,12 @@ static int rna_function_parameter_parse(PointerRNA *ptr, return -1; } - if (len == 0) + if (len == 0) { *((bool *)dest) = *((bool *)src); - else + } + else { memcpy(dest, src, len * sizeof(bool)); + } break; } @@ -7260,10 +7535,12 @@ static int rna_function_parameter_parse(PointerRNA *ptr, return -1; } - if (len == 0) + if (len == 0) { *((int *)dest) = *((int *)src); - else + } + else { memcpy(dest, src, len * sizeof(int)); + } break; } @@ -7274,10 +7551,12 @@ static int rna_function_parameter_parse(PointerRNA *ptr, return -1; } - if (len == 0) + if (len == 0) { *((float *)dest) = *((float *)src); - else + } + else { memcpy(dest, src, len * sizeof(float)); + } break; } @@ -7376,10 +7655,12 @@ static int rna_function_parameter_parse(PointerRNA *ptr, break; } default: { - if (len == 0) + if (len == 0) { fprintf(stderr, "%s.%s: unknown type for parameter %s\n", tid, fid, pid); - else + } + else { fprintf(stderr, "%s.%s: unknown array type for parameter %s\n", tid, fid, pid); + } return -1; } @@ -7501,12 +7782,14 @@ int RNA_function_call_direct_va(bContext *C, } } - if (err != 0) + if (err != 0) { break; + } } - if (err == 0) + if (err == 0) { err = RNA_function_call(C, reports, ptr, func, &parms); + } /* XXX throw error when more parameters than those needed are passed or leave silent? */ if (err == 0 && pret && ofs < flen && format[ofs++] == 'R') { @@ -7591,8 +7874,9 @@ int RNA_function_call_direct_va_lookup(bContext *C, func = RNA_struct_find_function(ptr->type, identifier); - if (func) + if (func) { return RNA_function_call_direct_va(C, reports, ptr, func, format, args); + } return 0; } @@ -7823,12 +8107,15 @@ bool RNA_struct_equals(Main *bmain, PointerRNA *ptr_a, PointerRNA *ptr_b, eRNACo PropertyRNA *iterprop; bool equals = true; - if (ptr_a == NULL && ptr_b == NULL) + if (ptr_a == NULL && ptr_b == NULL) { return true; - else if (ptr_a == NULL || ptr_b == NULL) + } + else if (ptr_a == NULL || ptr_b == NULL) { return false; - else if (ptr_a->type != ptr_b->type) + } + else if (ptr_a->type != ptr_b->type) { return false; + } iterprop = RNA_struct_iterator_property(ptr_a->type); diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index 45df6f8d0b2..27a9333cd9e 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -693,8 +693,9 @@ static void rna_def_common_keying_flags(StructRNA *srna, short reg) "Override Insert Keyframes Default- Only Needed", "Override default setting to only insert keyframes where they're " "needed in the relevant F-Curves"); - if (reg) + if (reg) { RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); + } prop = RNA_def_property(srna, "use_insertkey_override_visual", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "keyingoverride", INSERTKEY_MATRIX); @@ -702,8 +703,9 @@ static void rna_def_common_keying_flags(StructRNA *srna, short reg) prop, "Override Insert Keyframes Default - Visual", "Override default setting to insert keyframes based on 'visual transforms'"); - if (reg) + if (reg) { RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); + } prop = RNA_def_property(srna, "use_insertkey_override_xyz_to_rgb", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "keyingoverride", INSERTKEY_XYZ2RGB); @@ -712,8 +714,9 @@ static void rna_def_common_keying_flags(StructRNA *srna, short reg) "Override F-Curve Colors - XYZ to RGB", "Override default setting to set color for newly added transformation F-Curves " "(Location, Rotation, Scale) to be based on the transform axis"); - if (reg) + if (reg) { RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); + } /* value to override defaults with */ prop = RNA_def_property(srna, "use_insertkey_needed", PROP_BOOLEAN, PROP_NONE); @@ -721,15 +724,17 @@ static void rna_def_common_keying_flags(StructRNA *srna, short reg) RNA_def_property_ui_text(prop, "Insert Keyframes - Only Needed", "Only insert keyframes where they're needed in the relevant F-Curves"); - if (reg) + if (reg) { RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); + } prop = RNA_def_property(srna, "use_insertkey_visual", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "keyingflag", INSERTKEY_MATRIX); RNA_def_property_ui_text( prop, "Insert Keyframes - Visual", "Insert keyframes based on 'visual transforms'"); - if (reg) + if (reg) { RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); + } prop = RNA_def_property(srna, "use_insertkey_xyz_to_rgb", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "keyingflag", INSERTKEY_XYZ2RGB); @@ -737,8 +742,9 @@ static void rna_def_common_keying_flags(StructRNA *srna, short reg) "F-Curve Colors - XYZ to RGB", "Color for newly added transformation F-Curves (Location, Rotation, " "Scale) is based on the transform axis"); - if (reg) + if (reg) { RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); + } } /* --- */ diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index 5c1d639ac57..d32e814f7f8 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -727,29 +727,35 @@ static void rna_def_bone_common(StructRNA *srna, int editbone) RNA_def_property_string_sdna(prop, NULL, "name"); RNA_def_property_ui_text(prop, "Name", ""); RNA_def_struct_name_property(srna, prop); - if (editbone) + if (editbone) { RNA_def_property_string_funcs(prop, NULL, NULL, "rna_EditBone_name_set"); - else + } + else { RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Bone_name_set"); + } RNA_def_property_update(prop, 0, "rna_Bone_update_renamed"); /* flags */ prop = RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER); RNA_def_property_boolean_sdna(prop, NULL, "layer", 1); RNA_def_property_array(prop, 32); - if (editbone) + if (editbone) { RNA_def_property_boolean_funcs(prop, NULL, "rna_EditBone_layer_set"); - else + } + else { RNA_def_property_boolean_funcs(prop, NULL, "rna_Bone_layer_set"); + } RNA_def_property_ui_text(prop, "Layers", "Layers bone exists in"); RNA_def_property_update(prop, 0, "rna_Armature_redraw_data"); prop = RNA_def_property(srna, "use_connect", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_CONNECTED); - if (editbone) + if (editbone) { RNA_def_property_boolean_funcs(prop, NULL, "rna_EditBone_connected_set"); - else + } + else { RNA_def_property_clear_flag(prop, PROP_EDITABLE); + } RNA_def_property_ui_text( prop, "Connected", "When bone has a parent, bone's head is stuck to the parent's tail"); RNA_def_property_update(prop, 0, "rna_Armature_update_data"); @@ -829,10 +835,12 @@ static void rna_def_bone_common(StructRNA *srna, int editbone) RNA_def_property_update(prop, 0, "rna_Armature_update_data"); prop = RNA_def_property(srna, "head_radius", PROP_FLOAT, PROP_DISTANCE); - if (editbone) + if (editbone) { RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update"); - else + } + else { RNA_def_property_update(prop, 0, "rna_Armature_update_data"); + } RNA_def_property_float_sdna(prop, NULL, "rad_head"); /* XXX range is 0 to lim, where lim = 10000.0f * MAX2(1.0, view3d->grid); */ /*RNA_def_property_range(prop, 0, 1000); */ @@ -841,10 +849,12 @@ static void rna_def_bone_common(StructRNA *srna, int editbone) prop, "Envelope Head Radius", "Radius of head of bone (for Envelope deform only)"); prop = RNA_def_property(srna, "tail_radius", PROP_FLOAT, PROP_DISTANCE); - if (editbone) + if (editbone) { RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update"); - else + } + else { RNA_def_property_update(prop, 0, "rna_Armature_update_data"); + } RNA_def_property_float_sdna(prop, NULL, "rad_tail"); /* XXX range is 0 to lim, where lim = 10000.0f * MAX2(1.0, view3d->grid); */ /*RNA_def_property_range(prop, 0, 1000); */ diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 3e56307ed1d..20fbbed572c 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -96,10 +96,12 @@ void rna_addtail(ListBase *listbase, void *vlink) link->next = NULL; link->prev = listbase->last; - if (listbase->last) + if (listbase->last) { ((Link *)listbase->last)->next = link; - if (listbase->first == NULL) + } + if (listbase->first == NULL) { listbase->first = link; + } listbase->last = link; } @@ -107,15 +109,19 @@ static void rna_remlink(ListBase *listbase, void *vlink) { Link *link = vlink; - if (link->next) + if (link->next) { link->next->prev = link->prev; - if (link->prev) + } + if (link->prev) { link->prev->next = link->next; + } - if (listbase->last == link) + if (listbase->last == link) { listbase->last = link->prev; - if (listbase->first == link) + } + if (listbase->first == link) { listbase->first = link->next; + } } PropertyDefRNA *rna_findlink(ListBase *listbase, const char *identifier) @@ -204,9 +210,11 @@ StructDefRNA *rna_find_struct_def(StructRNA *srna) } dsrna = DefRNA.structs.last; - for (; dsrna; dsrna = dsrna->cont.prev) - if (dsrna->srna == srna) + for (; dsrna; dsrna = dsrna->cont.prev) { + if (dsrna->srna == srna) { return dsrna; + } + } return NULL; } @@ -224,16 +232,20 @@ PropertyDefRNA *rna_find_struct_property_def(StructRNA *srna, PropertyRNA *prop) dsrna = rna_find_struct_def(srna); dprop = dsrna->cont.properties.last; - for (; dprop; dprop = dprop->prev) - if (dprop->prop == prop) + for (; dprop; dprop = dprop->prev) { + if (dprop->prop == prop) { return dprop; + } + } dsrna = DefRNA.structs.last; for (; dsrna; dsrna = dsrna->cont.prev) { dprop = dsrna->cont.properties.last; - for (; dprop; dprop = dprop->prev) - if (dprop->prop == prop) + for (; dprop; dprop = dprop->prev) { + if (dprop->prop == prop) { return dprop; + } + } } return NULL; @@ -275,16 +287,20 @@ FunctionDefRNA *rna_find_function_def(FunctionRNA *func) dsrna = rna_find_struct_def(DefRNA.laststruct); dfunc = dsrna->functions.last; - for (; dfunc; dfunc = dfunc->cont.prev) - if (dfunc->func == func) + for (; dfunc; dfunc = dfunc->cont.prev) { + if (dfunc->func == func) { return dfunc; + } + } dsrna = DefRNA.structs.last; for (; dsrna; dsrna = dsrna->cont.prev) { dfunc = dsrna->functions.last; - for (; dfunc; dfunc = dfunc->cont.prev) - if (dfunc->func == func) + for (; dfunc; dfunc = dfunc->cont.prev) { + if (dfunc->func == func) { return dfunc; + } + } } return NULL; @@ -306,9 +322,11 @@ PropertyDefRNA *rna_find_parameter_def(PropertyRNA *parm) dfunc = dsrna->functions.last; for (; dfunc; dfunc = dfunc->cont.prev) { dparm = dfunc->cont.properties.last; - for (; dparm; dparm = dparm->prev) - if (dparm->prop == parm) + for (; dparm; dparm = dparm->prev) { + if (dparm->prop == parm) { return dparm; + } + } } dsrna = DefRNA.structs.last; @@ -316,9 +334,11 @@ PropertyDefRNA *rna_find_parameter_def(PropertyRNA *parm) dfunc = dsrna->functions.last; for (; dfunc; dfunc = dfunc->cont.prev) { dparm = dfunc->cont.properties.last; - for (; dparm; dparm = dparm->prev) - if (dparm->prop == parm) + for (; dparm; dparm = dparm->prev) { + if (dparm->prop == parm) { return dparm; + } + } } } @@ -337,12 +357,14 @@ static ContainerDefRNA *rna_find_container_def(ContainerRNA *cont) } ds = rna_find_struct_def((StructRNA *)cont); - if (ds) + if (ds) { return &ds->cont; + } dfunc = rna_find_function_def((FunctionRNA *)cont); - if (dfunc) + if (dfunc) { return &dfunc->cont; + } return NULL; } @@ -361,26 +383,34 @@ static int rna_member_cmp(const char *name, const char *oname) int a = 0; /* compare without pointer or array part */ - while (name[0] == '*') + while (name[0] == '*') { name++; - while (oname[0] == '*') + } + while (oname[0] == '*') { oname++; + } while (1) { - if (name[a] == '[' && oname[a] == 0) + if (name[a] == '[' && oname[a] == 0) { return 1; - if (name[a] == '[' && oname[a] == '[') + } + if (name[a] == '[' && oname[a] == '[') { return 1; - if (name[a] == 0) + } + if (name[a] == 0) { break; - if (name[a] != oname[a]) + } + if (name[a] != oname[a]) { return 0; + } a++; } - if (name[a] == 0 && oname[a] == '.') + if (name[a] == 0 && oname[a] == '.') { return 2; - if (name[a] == 0 && oname[a] == '-' && oname[a + 1] == '>') + } + if (name[a] == 0 && oname[a] == '-' && oname[a + 1] == '>') { return 3; + } return (name[a] == oname[a]); } @@ -400,8 +430,9 @@ static int rna_find_sdna_member(SDNA *sdna, } structnr = DNA_struct_find_nr_wrapper(sdna, structname); - if (structnr == -1) + if (structnr == -1) { return 0; + } sp = sdna->structs[structnr]; totmember = sp[1]; @@ -415,14 +446,17 @@ static int rna_find_sdna_member(SDNA *sdna, smember->type = sdna->alias.types[sp[0]]; smember->name = dnaname; - if (strstr(membername, "[")) + if (strstr(membername, "[")) { smember->arraylength = 0; - else + } + else { smember->arraylength = DNA_elem_array_size(smember->name); + } smember->pointerlevel = 0; - for (b = 0; dnaname[b] == '*'; b++) + for (b = 0; dnaname[b] == '*'; b++) { smember->pointerlevel++; + } return 1; } @@ -639,13 +673,15 @@ void RNA_define_free(BlenderRNA *UNUSED(brna)) FunctionDefRNA *dfunc; AllocDefRNA *alloc; - for (alloc = DefRNA.allocs.first; alloc; alloc = alloc->next) + for (alloc = DefRNA.allocs.first; alloc; alloc = alloc->next) { MEM_freeN(alloc->mem); + } rna_freelistN(&DefRNA.allocs); for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) { - for (dfunc = ds->functions.first; dfunc; dfunc = dfunc->cont.next) + for (dfunc = ds->functions.first; dfunc; dfunc = dfunc->cont.next) { rna_freelistN(&dfunc->cont.properties); + } rna_freelistN(&ds->cont.properties); rna_freelistN(&ds->functions); @@ -746,8 +782,9 @@ void RNA_free(BlenderRNA *brna) RNA_define_free(brna); for (srna = brna->structs.first; srna; srna = srna->cont.next) { - for (func = srna->functions.first; func; func = func->cont.next) + for (func = srna->functions.first; func; func = func->cont.next) { rna_freelistN(&func->cont.properties); + } rna_freelistN(&srna->cont.properties); rna_freelistN(&srna->functions); @@ -796,9 +833,11 @@ static StructDefRNA *rna_find_def_struct(StructRNA *srna) { StructDefRNA *ds; - for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) - if (ds->srna == srna) + for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) { + if (ds->srna == srna) { return ds; + } + } return NULL; } @@ -852,8 +891,9 @@ StructRNA *RNA_def_struct_ptr(BlenderRNA *brna, const char *identifier, StructRN /* may be overwritten later RNA_def_struct_translation_context */ srna->translation_context = BLT_I18NCONTEXT_DEFAULT_BPYRNA; srna->flag |= STRUCT_UNDO; - if (!srnafrom) + if (!srnafrom) { srna->icon = ICON_DOT; + } if (DefRNA.preprocess) { srna->flag |= STRUCT_PUBLIC_NAMESPACE; @@ -866,15 +906,18 @@ StructRNA *RNA_def_struct_ptr(BlenderRNA *brna, const char *identifier, StructRN ds->srna = srna; rna_addtail(&DefRNA.structs, ds); - if (dsfrom) + if (dsfrom) { ds->dnafromname = dsfrom->dnaname; + } } /* in preprocess, try to find sdna */ - if (DefRNA.preprocess) + if (DefRNA.preprocess) { RNA_def_struct_sdna(srna, srna->identifier); - else + } + else { srna->flag |= STRUCT_RUNTIME; + } if (srnafrom) { srna->nameproperty = srnafrom->nameproperty; @@ -1009,8 +1052,9 @@ void RNA_def_struct_name_property(struct StructRNA *srna, struct PropertyRNA *pr CLOG_ERROR(&LOG, "\"%s.%s\", must be a string property.", srna->identifier, prop->identifier); DefRNA.error = 1; } - else + else { srna->nameproperty = prop; + } } void RNA_def_struct_nested(BlenderRNA *brna, StructRNA *srna, const char *structname) @@ -1049,8 +1093,9 @@ void RNA_def_struct_refine_func(StructRNA *srna, const char *refine) return; } - if (refine) + if (refine) { srna->refine = (StructRefineFunc)refine; + } } void RNA_def_struct_idprops_func(StructRNA *srna, const char *idproperties) @@ -1060,8 +1105,9 @@ void RNA_def_struct_idprops_func(StructRNA *srna, const char *idproperties) return; } - if (idproperties) + if (idproperties) { srna->idproperties = (IDPropertiesFunc)idproperties; + } } void RNA_def_struct_register_funcs(StructRNA *srna, @@ -1074,12 +1120,15 @@ void RNA_def_struct_register_funcs(StructRNA *srna, return; } - if (reg) + if (reg) { srna->reg = (StructRegisterFunc)reg; - if (unreg) + } + if (unreg) { srna->unreg = (StructUnregisterFunc)unreg; - if (instance) + } + if (instance) { srna->instance = (StructInstanceFunc)instance; + } } void RNA_def_struct_path_func(StructRNA *srna, const char *path) @@ -1089,8 +1138,9 @@ void RNA_def_struct_path_func(StructRNA *srna, const char *path) return; } - if (path) + if (path) { srna->path = (StructPathFunc)path; + } } void RNA_def_struct_identifier(BlenderRNA *brna, StructRNA *srna, const char *identifier) @@ -1518,11 +1568,13 @@ void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int le memcpy(prop->arraylength, length, sizeof(int) * dimension); prop->totarraylength = length[0]; - for (i = 1; i < dimension; i++) + for (i = 1; i < dimension; i++) { prop->totarraylength *= length[i]; + } } - else + else { memset(prop->arraylength, 0, sizeof(prop->arraylength)); + } /* TODO make sure arraylength values are sane */ } @@ -1538,10 +1590,12 @@ void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *d void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, int consecutive) { prop->icon = icon; - if (consecutive != 0) + if (consecutive != 0) { prop->flag |= PROP_ICONS_CONSECUTIVE; - if (consecutive < 0) + } + if (consecutive < 0) { prop->flag |= PROP_ICONS_REVERSE; + } } /** @@ -1678,8 +1732,9 @@ void RNA_def_property_struct_runtime(PropertyRNA *prop, StructRNA *type) PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop; pprop->type = type; - if (type && (type->flag & STRUCT_ID_REFCOUNT)) + if (type && (type->flag & STRUCT_ID_REFCOUNT)) { prop->flag |= PROP_ID_REFCOUNT; + } break; } @@ -1709,8 +1764,9 @@ void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item for (i = 0; item[i].identifier; i++) { eprop->totitem++; - if (item[i].identifier[0] && item[i].value == eprop->defaultvalue) + if (item[i].identifier[0] && item[i].value == eprop->defaultvalue) { defaultfound = 1; + } } if (!defaultfound) { @@ -1919,8 +1975,9 @@ void RNA_def_property_enum_default(PropertyRNA *prop, int value) } else { for (i = 0; i < eprop->totitem; i++) { - if (eprop->item[i].identifier[0] && eprop->item[i].value == eprop->defaultvalue) + if (eprop->item[i].identifier[0] && eprop->item[i].value == eprop->defaultvalue) { defaultfound = 1; + } } if (!defaultfound && eprop->totitem) { @@ -1955,15 +2012,18 @@ static PropertyDefRNA *rna_def_property_sdna(PropertyRNA *prop, PropertyDefRNA *dp; dp = rna_find_struct_property_def(DefRNA.laststruct, prop); - if (dp == NULL) + if (dp == NULL) { return NULL; + } ds = rna_find_struct_def((StructRNA *)dp->cont); - if (!structname) + if (!structname) { structname = ds->dnaname; - if (!propname) + } + if (!propname) { propname = prop->identifier; + } if (!rna_find_sdna_member(DefRNA.sdna, structname, propname, &smember)) { if (DefRNA.silent) { @@ -1973,10 +2033,12 @@ static PropertyDefRNA *rna_def_property_sdna(PropertyRNA *prop, /* some basic values to survive even with sdna info */ dp->dnastructname = structname; dp->dnaname = propname; - if (prop->type == PROP_BOOLEAN) + if (prop->type == PROP_BOOLEAN) { dp->dnaarraylength = 1; - if (prop->type == PROP_POINTER) + } + if (prop->type == PROP_POINTER) { dp->dnapointerlevel = 1; + } return dp; } else { @@ -2061,8 +2123,9 @@ void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, dp = rna_find_struct_property_def(DefRNA.laststruct, prop); - if (dp) + if (dp) { dp->booleannegative = 1; + } } void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname) @@ -2116,8 +2179,9 @@ void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const } if (prop->subtype == PROP_UNSIGNED || prop->subtype == PROP_PERCENTAGE || - prop->subtype == PROP_FACTOR) + prop->subtype == PROP_FACTOR) { iprop->hardmin = iprop->softmin = 0; + } } } @@ -2204,8 +2268,9 @@ void RNA_def_property_enum_bitflag_sdna(PropertyRNA *prop, dp = rna_find_struct_property_def(DefRNA.laststruct, prop); - if (dp) + if (dp) { dp->enumbitflags = 1; + } } void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname) @@ -2305,8 +2370,9 @@ void RNA_def_property_collection_sdna(PropertyRNA *prop, DNAStructMember smember; StructDefRNA *ds = rna_find_struct_def((StructRNA *)dp->cont); - if (!structname) + if (!structname) { structname = ds->dnaname; + } if (lengthpropname[0] == 0 || rna_find_sdna_member(DefRNA.sdna, structname, lengthpropname, &smember)) { @@ -2324,10 +2390,12 @@ void RNA_def_property_collection_sdna(PropertyRNA *prop, cprop->next = (PropCollectionNextFunc) "rna_iterator_array_next"; cprop->end = (PropCollectionEndFunc) "rna_iterator_array_end"; - if (dp->dnapointerlevel >= 2) + if (dp->dnapointerlevel >= 2) { cprop->get = (PropCollectionGetFunc) "rna_iterator_array_dereference_get"; - else + } + else { cprop->get = (PropCollectionGetFunc) "rna_iterator_array_get"; + } } else { if (!DefRNA.silent) { @@ -2352,8 +2420,9 @@ void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable) return; } - if (editable) + if (editable) { prop->editable = (EditableFunc)editable; + } } void RNA_def_property_editable_array_func(PropertyRNA *prop, const char *editable) @@ -2363,8 +2432,9 @@ void RNA_def_property_editable_array_func(PropertyRNA *prop, const char *editabl return; } - if (editable) + if (editable) { prop->itemeditable = (ItemEditableFunc)editable; + } } /** @@ -2432,8 +2502,9 @@ void RNA_def_property_dynamic_array_funcs(PropertyRNA *prop, const char *getleng return; } - if (getlength) + if (getlength) { prop->getlength = (PropArrayLengthGetFunc)getlength; + } } void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set) @@ -2450,16 +2521,20 @@ void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const ch BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop; if (prop->arraydimension) { - if (get) + if (get) { bprop->getarray = (PropBooleanArrayGetFunc)get; - if (set) + } + if (set) { bprop->setarray = (PropBooleanArraySetFunc)set; + } } else { - if (get) + if (get) { bprop->get = (PropBooleanGetFunc)get; - if (set) + } + if (set) { bprop->set = (PropBooleanSetFunc)set; + } } break; } @@ -2476,17 +2551,20 @@ void RNA_def_property_boolean_funcs_runtime(PropertyRNA *prop, { BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop; - if (getfunc) + if (getfunc) { bprop->get_ex = getfunc; - if (setfunc) + } + if (setfunc) { bprop->set_ex = setfunc; + } if (getfunc || setfunc) { /* don't save in id properties */ prop->flag &= ~PROP_IDPROPERTY; - if (!setfunc) + if (!setfunc) { prop->flag &= ~PROP_EDITABLE; + } } } @@ -2496,17 +2574,20 @@ void RNA_def_property_boolean_array_funcs_runtime(PropertyRNA *prop, { BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop; - if (getfunc) + if (getfunc) { bprop->getarray_ex = getfunc; - if (setfunc) + } + if (setfunc) { bprop->setarray_ex = setfunc; + } if (getfunc || setfunc) { /* don't save in id properties */ prop->flag &= ~PROP_IDPROPERTY; - if (!setfunc) + if (!setfunc) { prop->flag &= ~PROP_EDITABLE; + } } } @@ -2527,19 +2608,24 @@ void RNA_def_property_int_funcs(PropertyRNA *prop, IntPropertyRNA *iprop = (IntPropertyRNA *)prop; if (prop->arraydimension) { - if (get) + if (get) { iprop->getarray = (PropIntArrayGetFunc)get; - if (set) + } + if (set) { iprop->setarray = (PropIntArraySetFunc)set; + } } else { - if (get) + if (get) { iprop->get = (PropIntGetFunc)get; - if (set) + } + if (set) { iprop->set = (PropIntSetFunc)set; + } } - if (range) + if (range) { iprop->range = (PropIntRangeFunc)range; + } break; } default: @@ -2556,19 +2642,23 @@ void RNA_def_property_int_funcs_runtime(PropertyRNA *prop, { IntPropertyRNA *iprop = (IntPropertyRNA *)prop; - if (getfunc) + if (getfunc) { iprop->get_ex = getfunc; - if (setfunc) + } + if (setfunc) { iprop->set_ex = setfunc; - if (rangefunc) + } + if (rangefunc) { iprop->range_ex = rangefunc; + } if (getfunc || setfunc) { /* don't save in id properties */ prop->flag &= ~PROP_IDPROPERTY; - if (!setfunc) + if (!setfunc) { prop->flag &= ~PROP_EDITABLE; + } } } @@ -2579,19 +2669,23 @@ void RNA_def_property_int_array_funcs_runtime(PropertyRNA *prop, { IntPropertyRNA *iprop = (IntPropertyRNA *)prop; - if (getfunc) + if (getfunc) { iprop->getarray_ex = getfunc; - if (setfunc) + } + if (setfunc) { iprop->setarray_ex = setfunc; - if (rangefunc) + } + if (rangefunc) { iprop->range_ex = rangefunc; + } if (getfunc || setfunc) { /* don't save in id properties */ prop->flag &= ~PROP_IDPROPERTY; - if (!setfunc) + if (!setfunc) { prop->flag &= ~PROP_EDITABLE; + } } } @@ -2612,19 +2706,24 @@ void RNA_def_property_float_funcs(PropertyRNA *prop, FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop; if (prop->arraydimension) { - if (get) + if (get) { fprop->getarray = (PropFloatArrayGetFunc)get; - if (set) + } + if (set) { fprop->setarray = (PropFloatArraySetFunc)set; + } } else { - if (get) + if (get) { fprop->get = (PropFloatGetFunc)get; - if (set) + } + if (set) { fprop->set = (PropFloatSetFunc)set; + } } - if (range) + if (range) { fprop->range = (PropFloatRangeFunc)range; + } break; } default: @@ -2641,19 +2740,23 @@ void RNA_def_property_float_funcs_runtime(PropertyRNA *prop, { FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop; - if (getfunc) + if (getfunc) { fprop->get_ex = getfunc; - if (setfunc) + } + if (setfunc) { fprop->set_ex = setfunc; - if (rangefunc) + } + if (rangefunc) { fprop->range_ex = rangefunc; + } if (getfunc || setfunc) { /* don't save in id properties */ prop->flag &= ~PROP_IDPROPERTY; - if (!setfunc) + if (!setfunc) { prop->flag &= ~PROP_EDITABLE; + } } } @@ -2664,19 +2767,23 @@ void RNA_def_property_float_array_funcs_runtime(PropertyRNA *prop, { FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop; - if (getfunc) + if (getfunc) { fprop->getarray_ex = getfunc; - if (setfunc) + } + if (setfunc) { fprop->setarray_ex = setfunc; - if (rangefunc) + } + if (rangefunc) { fprop->range_ex = rangefunc; + } if (getfunc || setfunc) { /* don't save in id properties */ prop->flag &= ~PROP_IDPROPERTY; - if (!setfunc) + if (!setfunc) { prop->flag &= ~PROP_EDITABLE; + } } } @@ -2696,12 +2803,15 @@ void RNA_def_property_enum_funcs(PropertyRNA *prop, case PROP_ENUM: { EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop; - if (get) + if (get) { eprop->get = (PropEnumGetFunc)get; - if (set) + } + if (set) { eprop->set = (PropEnumSetFunc)set; - if (item) + } + if (item) { eprop->itemf = (PropEnumItemFunc)item; + } break; } default: @@ -2718,19 +2828,23 @@ void RNA_def_property_enum_funcs_runtime(PropertyRNA *prop, { EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop; - if (getfunc) + if (getfunc) { eprop->get_ex = getfunc; - if (setfunc) + } + if (setfunc) { eprop->set_ex = setfunc; - if (itemfunc) + } + if (itemfunc) { eprop->itemf = itemfunc; + } if (getfunc || setfunc) { /* don't save in id properties */ prop->flag &= ~PROP_IDPROPERTY; - if (!setfunc) + if (!setfunc) { prop->flag &= ~PROP_EDITABLE; + } } } @@ -2756,12 +2870,15 @@ void RNA_def_property_string_funcs(PropertyRNA *prop, case PROP_STRING: { StringPropertyRNA *sprop = (StringPropertyRNA *)prop; - if (get) + if (get) { sprop->get = (PropStringGetFunc)get; - if (length) + } + if (length) { sprop->length = (PropStringLengthFunc)length; - if (set) + } + if (set) { sprop->set = (PropStringSetFunc)set; + } break; } default: @@ -2778,19 +2895,23 @@ void RNA_def_property_string_funcs_runtime(PropertyRNA *prop, { StringPropertyRNA *sprop = (StringPropertyRNA *)prop; - if (getfunc) + if (getfunc) { sprop->get_ex = getfunc; - if (lengthfunc) + } + if (lengthfunc) { sprop->length_ex = lengthfunc; - if (setfunc) + } + if (setfunc) { sprop->set_ex = setfunc; + } if (getfunc || setfunc) { /* don't save in id properties */ prop->flag &= ~PROP_IDPROPERTY; - if (!setfunc) + if (!setfunc) { prop->flag &= ~PROP_EDITABLE; + } } } @@ -2808,14 +2929,18 @@ void RNA_def_property_pointer_funcs( case PROP_POINTER: { PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop; - if (get) + if (get) { pprop->get = (PropPointerGetFunc)get; - if (set) + } + if (set) { pprop->set = (PropPointerSetFunc)set; - if (typef) + } + if (typef) { pprop->typef = (PropPointerTypeFunc)typef; - if (poll) + } + if (poll) { pprop->poll = (PropPointerPollFunc)poll; + } break; } default: @@ -2846,22 +2971,30 @@ void RNA_def_property_collection_funcs(PropertyRNA *prop, case PROP_COLLECTION: { CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop; - if (begin) + if (begin) { cprop->begin = (PropCollectionBeginFunc)begin; - if (next) + } + if (next) { cprop->next = (PropCollectionNextFunc)next; - if (end) + } + if (end) { cprop->end = (PropCollectionEndFunc)end; - if (get) + } + if (get) { cprop->get = (PropCollectionGetFunc)get; - if (length) + } + if (length) { cprop->length = (PropCollectionLengthFunc)length; - if (lookupint) + } + if (lookupint) { cprop->lookupint = (PropCollectionLookupIntFunc)lookupint; - if (lookupstring) + } + if (lookupstring) { cprop->lookupstring = (PropCollectionLookupStringFunc)lookupstring; - if (assignint) + } + if (assignint) { cprop->assignint = (PropCollectionAssignIntFunc)assignint; + } break; } default: @@ -2910,10 +3043,12 @@ PropertyRNA *RNA_def_boolean_array(StructOrFunctionRNA *cont_, PropertyRNA *prop; prop = RNA_def_property(cont, identifier, PROP_BOOLEAN, PROP_NONE); - if (len != 0) + if (len != 0) { RNA_def_property_array(prop, len); - if (default_value) + } + if (default_value) { RNA_def_property_boolean_array_default(prop, default_value); + } RNA_def_property_ui_text(prop, ui_name, ui_description); return prop; @@ -2930,10 +3065,12 @@ PropertyRNA *RNA_def_boolean_layer(StructOrFunctionRNA *cont_, PropertyRNA *prop; prop = RNA_def_property(cont, identifier, PROP_BOOLEAN, PROP_LAYER); - if (len != 0) + if (len != 0) { RNA_def_property_array(prop, len); - if (default_value) + } + if (default_value) { RNA_def_property_boolean_array_default(prop, default_value); + } RNA_def_property_ui_text(prop, ui_name, ui_description); return prop; @@ -2950,10 +3087,12 @@ PropertyRNA *RNA_def_boolean_layer_member(StructOrFunctionRNA *cont_, PropertyRNA *prop; prop = RNA_def_property(cont, identifier, PROP_BOOLEAN, PROP_LAYER_MEMBER); - if (len != 0) + if (len != 0) { RNA_def_property_array(prop, len); - if (default_value) + } + if (default_value) { RNA_def_property_boolean_array_default(prop, default_value); + } RNA_def_property_ui_text(prop, ui_name, ui_description); return prop; @@ -2970,10 +3109,12 @@ PropertyRNA *RNA_def_boolean_vector(StructOrFunctionRNA *cont_, PropertyRNA *prop; prop = RNA_def_property(cont, identifier, PROP_BOOLEAN, PROP_XYZ); /* XXX */ - if (len != 0) + if (len != 0) { RNA_def_property_array(prop, len); - if (default_value) + } + if (default_value) { RNA_def_property_boolean_array_default(prop, default_value); + } RNA_def_property_ui_text(prop, ui_name, ui_description); return prop; @@ -2996,8 +3137,9 @@ PropertyRNA *RNA_def_int(StructOrFunctionRNA *cont_, prop = RNA_def_property(cont, identifier, PROP_INT, PROP_NONE); RNA_def_property_int_default(prop, default_value); - if (hardmin != hardmax) + if (hardmin != hardmax) { RNA_def_property_range(prop, hardmin, hardmax); + } RNA_def_property_ui_text(prop, ui_name, ui_description); RNA_def_property_ui_range(prop, softmin, softmax, 1, 3); @@ -3021,12 +3163,15 @@ PropertyRNA *RNA_def_int_vector(StructOrFunctionRNA *cont_, ASSERT_SOFT_HARD_LIMITS; prop = RNA_def_property(cont, identifier, PROP_INT, PROP_XYZ); /* XXX */ - if (len != 0) + if (len != 0) { RNA_def_property_array(prop, len); - if (default_value) + } + if (default_value) { RNA_def_property_int_array_default(prop, default_value); - if (hardmin != hardmax) + } + if (hardmin != hardmax) { RNA_def_property_range(prop, hardmin, hardmax); + } RNA_def_property_ui_text(prop, ui_name, ui_description); RNA_def_property_ui_range(prop, softmin, softmax, 1, 3); @@ -3050,12 +3195,15 @@ PropertyRNA *RNA_def_int_array(StructOrFunctionRNA *cont_, ASSERT_SOFT_HARD_LIMITS; prop = RNA_def_property(cont, identifier, PROP_INT, PROP_NONE); - if (len != 0) + if (len != 0) { RNA_def_property_array(prop, len); - if (default_value) + } + if (default_value) { RNA_def_property_int_array_default(prop, default_value); - if (hardmin != hardmax) + } + if (hardmin != hardmax) { RNA_def_property_range(prop, hardmin, hardmax); + } RNA_def_property_ui_text(prop, ui_name, ui_description); RNA_def_property_ui_range(prop, softmin, softmax, 1, 3); @@ -3075,10 +3223,12 @@ PropertyRNA *RNA_def_string(StructOrFunctionRNA *cont_, BLI_assert(default_value == NULL || default_value[0]); prop = RNA_def_property(cont, identifier, PROP_STRING, PROP_NONE); - if (maxlen != 0) + if (maxlen != 0) { RNA_def_property_string_maxlength(prop, maxlen); - if (default_value) + } + if (default_value) { RNA_def_property_string_default(prop, default_value); + } RNA_def_property_ui_text(prop, ui_name, ui_description); return prop; @@ -3097,10 +3247,12 @@ PropertyRNA *RNA_def_string_file_path(StructOrFunctionRNA *cont_, BLI_assert(default_value == NULL || default_value[0]); prop = RNA_def_property(cont, identifier, PROP_STRING, PROP_FILEPATH); - if (maxlen != 0) + if (maxlen != 0) { RNA_def_property_string_maxlength(prop, maxlen); - if (default_value) + } + if (default_value) { RNA_def_property_string_default(prop, default_value); + } RNA_def_property_ui_text(prop, ui_name, ui_description); return prop; @@ -3119,10 +3271,12 @@ PropertyRNA *RNA_def_string_dir_path(StructOrFunctionRNA *cont_, BLI_assert(default_value == NULL || default_value[0]); prop = RNA_def_property(cont, identifier, PROP_STRING, PROP_DIRPATH); - if (maxlen != 0) + if (maxlen != 0) { RNA_def_property_string_maxlength(prop, maxlen); - if (default_value) + } + if (default_value) { RNA_def_property_string_default(prop, default_value); + } RNA_def_property_ui_text(prop, ui_name, ui_description); return prop; @@ -3141,10 +3295,12 @@ PropertyRNA *RNA_def_string_file_name(StructOrFunctionRNA *cont_, BLI_assert(default_value == NULL || default_value[0]); prop = RNA_def_property(cont, identifier, PROP_STRING, PROP_FILENAME); - if (maxlen != 0) + if (maxlen != 0) { RNA_def_property_string_maxlength(prop, maxlen); - if (default_value) + } + if (default_value) { RNA_def_property_string_default(prop, default_value); + } RNA_def_property_ui_text(prop, ui_name, ui_description); return prop; @@ -3166,8 +3322,9 @@ PropertyRNA *RNA_def_enum(StructOrFunctionRNA *cont_, } prop = RNA_def_property(cont, identifier, PROP_ENUM, PROP_NONE); - if (items) + if (items) { RNA_def_property_enum_items(prop, items); + } RNA_def_property_enum_default(prop, default_value); RNA_def_property_ui_text(prop, ui_name, ui_description); @@ -3192,8 +3349,9 @@ PropertyRNA *RNA_def_enum_flag(StructOrFunctionRNA *cont_, prop = RNA_def_property(cont, identifier, PROP_ENUM, PROP_NONE); RNA_def_property_flag(prop, PROP_ENUM_FLAG); /* important to run before default set */ - if (items) + if (items) { RNA_def_property_enum_items(prop, items); + } RNA_def_property_enum_default(prop, default_value); RNA_def_property_ui_text(prop, ui_name, ui_description); @@ -3223,8 +3381,9 @@ PropertyRNA *RNA_def_float(StructOrFunctionRNA *cont_, prop = RNA_def_property(cont, identifier, PROP_FLOAT, PROP_NONE); RNA_def_property_float_default(prop, default_value); - if (hardmin != hardmax) + if (hardmin != hardmax) { RNA_def_property_range(prop, hardmin, hardmax); + } RNA_def_property_ui_text(prop, ui_name, ui_description); RNA_def_property_ui_range(prop, softmin, softmax, 1, 3); @@ -3248,12 +3407,15 @@ PropertyRNA *RNA_def_float_vector(StructOrFunctionRNA *cont_, ASSERT_SOFT_HARD_LIMITS; prop = RNA_def_property(cont, identifier, PROP_FLOAT, PROP_XYZ); - if (len != 0) + if (len != 0) { RNA_def_property_array(prop, len); - if (default_value) + } + if (default_value) { RNA_def_property_float_array_default(prop, default_value); - if (hardmin != hardmax) + } + if (hardmin != hardmax) { RNA_def_property_range(prop, hardmin, hardmax); + } RNA_def_property_ui_text(prop, ui_name, ui_description); RNA_def_property_ui_range(prop, softmin, softmax, 1, 3); @@ -3305,12 +3467,15 @@ PropertyRNA *RNA_def_float_color(StructOrFunctionRNA *cont_, ASSERT_SOFT_HARD_LIMITS; prop = RNA_def_property(cont, identifier, PROP_FLOAT, PROP_COLOR); - if (len != 0) + if (len != 0) { RNA_def_property_array(prop, len); - if (default_value) + } + if (default_value) { RNA_def_property_float_array_default(prop, default_value); - if (hardmin != hardmax) + } + if (hardmin != hardmax) { RNA_def_property_range(prop, hardmin, hardmax); + } RNA_def_property_ui_text(prop, ui_name, ui_description); RNA_def_property_ui_range(prop, softmin, softmax, 1, 3); @@ -3337,10 +3502,12 @@ PropertyRNA *RNA_def_float_matrix(StructOrFunctionRNA *cont_, prop = RNA_def_property(cont, identifier, PROP_FLOAT, PROP_MATRIX); RNA_def_property_multi_array(prop, 2, length); - if (default_value) + if (default_value) { RNA_def_property_float_array_default(prop, default_value); - if (hardmin != hardmax) + } + if (hardmin != hardmax) { RNA_def_property_range(prop, hardmin, hardmax); + } RNA_def_property_ui_text(prop, ui_name, ui_description); RNA_def_property_ui_range(prop, softmin, softmax, 1, 3); @@ -3366,15 +3533,17 @@ PropertyRNA *RNA_def_float_rotation(StructOrFunctionRNA *cont_, prop = RNA_def_property(cont, identifier, PROP_FLOAT, (len >= 3) ? PROP_EULER : PROP_ANGLE); if (len != 0) { RNA_def_property_array(prop, len); - if (default_value) + if (default_value) { RNA_def_property_float_array_default(prop, default_value); + } } else { /* RNA_def_property_float_default must be called outside */ BLI_assert(default_value == NULL); } - if (hardmin != hardmax) + if (hardmin != hardmax) { RNA_def_property_range(prop, hardmin, hardmax); + } RNA_def_property_ui_text(prop, ui_name, ui_description); RNA_def_property_ui_range(prop, softmin, softmax, 10, 3); @@ -3422,12 +3591,15 @@ PropertyRNA *RNA_def_float_array(StructOrFunctionRNA *cont_, ASSERT_SOFT_HARD_LIMITS; prop = RNA_def_property(cont, identifier, PROP_FLOAT, PROP_NONE); - if (len != 0) + if (len != 0) { RNA_def_property_array(prop, len); - if (default_value) + } + if (default_value) { RNA_def_property_float_array_default(prop, default_value); - if (hardmin != hardmax) + } + if (hardmin != hardmax) { RNA_def_property_range(prop, hardmin, hardmax); + } RNA_def_property_ui_text(prop, ui_name, ui_description); RNA_def_property_ui_range(prop, softmin, softmax, 1, 3); @@ -3451,8 +3623,9 @@ PropertyRNA *RNA_def_float_percentage(StructOrFunctionRNA *cont_, prop = RNA_def_property(cont, identifier, PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_float_default(prop, default_value); - if (hardmin != hardmax) + if (hardmin != hardmax) { RNA_def_property_range(prop, hardmin, hardmax); + } RNA_def_property_ui_text(prop, ui_name, ui_description); RNA_def_property_ui_range(prop, softmin, softmax, 1, 3); @@ -3476,8 +3649,9 @@ PropertyRNA *RNA_def_float_factor(StructOrFunctionRNA *cont_, prop = RNA_def_property(cont, identifier, PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_default(prop, default_value); - if (hardmin != hardmax) + if (hardmin != hardmax) { RNA_def_property_range(prop, hardmin, hardmax); + } RNA_def_property_ui_text(prop, ui_name, ui_description); RNA_def_property_ui_range(prop, softmin, softmax, 1, 3); @@ -3580,8 +3754,9 @@ static FunctionRNA *rna_def_function(StructRNA *srna, const char *identifier) rna_addtail(&dsrna->functions, dfunc); dfunc->func = func; } - else + else { func->flag |= FUNC_RUNTIME; + } return func; } @@ -3672,8 +3847,9 @@ int rna_parameter_size(PropertyRNA *parm) int len = parm->totarraylength; /* XXX in other parts is mentioned that strings can be dynamic as well */ - if (parm->flag & PROP_DYNAMIC) + if (parm->flag & PROP_DYNAMIC) { return sizeof(ParameterDynAlloc); + } if (len > 0) { switch (ptype) { @@ -3768,8 +3944,9 @@ void RNA_enum_item_add_separator(EnumPropertyItem **items, int *totitem) void RNA_enum_items_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item) { - for (; item->identifier; item++) + for (; item->identifier; item++) { RNA_enum_item_add(items, totitem, item); + } } void RNA_enum_items_add_value(EnumPropertyItem **items, diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c index 6d82ded02bd..63834c9280c 100644 --- a/source/blender/makesrna/intern/rna_main.c +++ b/source/blender/makesrna/intern/rna_main.c @@ -442,8 +442,9 @@ void RNA_def_main(BlenderRNA *brna) /* collection functions */ func = lists[i].func; - if (func) + if (func) { func(brna, prop); + } } RNA_api_main(srna); diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index d986f473791..d66b4e5be44 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -923,8 +923,9 @@ void rna_def_mtex_common(BlenderRNA *brna, prop = RNA_def_property(srna, "active_texture", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "Texture"); RNA_def_property_flag(prop, PROP_EDITABLE); - if (activeeditable) + if (activeeditable) { RNA_def_property_editable_func(prop, activeeditable); + } RNA_def_property_pointer_funcs(prop, activeget, activeset, NULL, NULL); RNA_def_property_ui_text(prop, "Active Texture", "Active texture slot being displayed"); RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING_LINKS, update); diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 3716a8d1404..0b4056121b3 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -2170,8 +2170,8 @@ static void rna_def_mproperties(BlenderRNA *brna) MESH_FLOAT_PROPERTY_LAYER("Polygon"); MESH_INT_PROPERTY_LAYER("Vertex"); MESH_INT_PROPERTY_LAYER("Polygon"); - MESH_STRING_PROPERTY_LAYER("Vertex"); - MESH_STRING_PROPERTY_LAYER("Polygon"); + MESH_STRING_PROPERTY_LAYER("Vertex") + MESH_STRING_PROPERTY_LAYER("Polygon") # undef MESH_PROPERTY_LAYER } diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 3f96c0c1d0e..1ce7b776126 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -9134,8 +9134,9 @@ static StructRNA *define_specific_node(BlenderRNA *brna, /* XXX hack, want to avoid "NodeInternal" prefix, * so use "Node" in NOD_static_types.h and replace here */ - if (STREQ(base_name, "Node")) + if (STREQ(base_name, "Node")) { base_name = "NodeInternal"; + } srna = RNA_def_struct(brna, struct_name, base_name); RNA_def_struct_ui_text(srna, ui_name, ui_desc); @@ -9172,8 +9173,9 @@ static StructRNA *define_specific_node(BlenderRNA *brna, RNA_def_parameter_flags(parm, 0, PARM_RNAPTR); RNA_def_function_return(func, parm); - if (def_func) + if (def_func) { def_func(srna); + } return srna; } diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index e6ee70a342a..032a1f86fc0 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -2825,47 +2825,58 @@ static void rna_def_number_property(StructRNA *srna, PropertyType type) RNA_def_property_boolean_funcs(prop, "rna_NumberProperty_is_array_get", NULL); RNA_def_property_ui_text(prop, "Is Array", ""); - if (type == PROP_BOOLEAN) + if (type == PROP_BOOLEAN) { return; + } prop = RNA_def_property(srna, "hard_min", type, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - if (type == PROP_INT) + if (type == PROP_INT) { RNA_def_property_int_funcs(prop, "rna_IntProperty_hard_min_get", NULL, NULL); - else + } + else { RNA_def_property_float_funcs(prop, "rna_FloatProperty_hard_min_get", NULL, NULL); + } RNA_def_property_ui_text(prop, "Hard Minimum", "Minimum value used by buttons"); prop = RNA_def_property(srna, "hard_max", type, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - if (type == PROP_INT) + if (type == PROP_INT) { RNA_def_property_int_funcs(prop, "rna_IntProperty_hard_max_get", NULL, NULL); - else + } + else { RNA_def_property_float_funcs(prop, "rna_FloatProperty_hard_max_get", NULL, NULL); + } RNA_def_property_ui_text(prop, "Hard Maximum", "Maximum value used by buttons"); prop = RNA_def_property(srna, "soft_min", type, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - if (type == PROP_INT) + if (type == PROP_INT) { RNA_def_property_int_funcs(prop, "rna_IntProperty_soft_min_get", NULL, NULL); - else + } + else { RNA_def_property_float_funcs(prop, "rna_FloatProperty_soft_min_get", NULL, NULL); + } RNA_def_property_ui_text(prop, "Soft Minimum", "Minimum value used by buttons"); prop = RNA_def_property(srna, "soft_max", type, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - if (type == PROP_INT) + if (type == PROP_INT) { RNA_def_property_int_funcs(prop, "rna_IntProperty_soft_max_get", NULL, NULL); - else + } + else { RNA_def_property_float_funcs(prop, "rna_FloatProperty_soft_max_get", NULL, NULL); + } RNA_def_property_ui_text(prop, "Soft Maximum", "Maximum value used by buttons"); prop = RNA_def_property(srna, "step", type, PROP_UNSIGNED); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - if (type == PROP_INT) + if (type == PROP_INT) { RNA_def_property_int_funcs(prop, "rna_IntProperty_step_get", NULL, NULL); - else + } + else { RNA_def_property_float_funcs(prop, "rna_FloatProperty_step_get", NULL, NULL); + } RNA_def_property_ui_text( prop, "Step", "Step size used by number buttons, for floats 1/100th of the step size"); @@ -2996,11 +3007,13 @@ static void rna_def_pointer_property(StructRNA *srna, PropertyType type) prop = RNA_def_property(srna, "fixed_type", PROP_POINTER, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_struct_type(prop, "Struct"); - if (type == PROP_POINTER) + if (type == PROP_POINTER) { RNA_def_property_pointer_funcs(prop, "rna_PointerProperty_fixed_type_get", NULL, NULL, NULL); - else + } + else { RNA_def_property_pointer_funcs( prop, "rna_CollectionProperty_fixed_type_get", NULL, NULL, NULL); + } RNA_def_property_ui_text(prop, "Pointer Type", "Fixed pointer type, empty if variable type"); } diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 7a0345795eb..53cfc0bc3c0 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -3612,16 +3612,20 @@ void rna_def_view_layer_common(StructRNA *srna, const bool scene) PropertyRNA *prop; prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); - if (scene) + if (scene) { RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ViewLayer_name_set"); - else + } + else { RNA_def_property_string_sdna(prop, NULL, "name"); + } RNA_def_property_ui_text(prop, "Name", "View layer name"); RNA_def_struct_name_property(srna, prop); - if (scene) + if (scene) { RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); - else + } + else { RNA_def_property_clear_flag(prop, PROP_EDITABLE); + } if (scene) { prop = RNA_def_property(srna, "material_override", PROP_POINTER, PROP_NONE); @@ -3653,10 +3657,12 @@ void rna_def_view_layer_common(StructRNA *srna, const bool scene) prop = RNA_def_property(srna, "use_zmask", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ZMASK); RNA_def_property_ui_text(prop, "Zmask", "Only render what's in front of the solid z values"); - if (scene) + if (scene) { RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update"); - else + } + else { RNA_def_property_clear_flag(prop, PROP_EDITABLE); + } prop = RNA_def_property(srna, "invert_zmask", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_NEG_ZMASK); @@ -3664,270 +3670,336 @@ void rna_def_view_layer_common(StructRNA *srna, const bool scene) prop, "Zmask Negate", "For Zmask, only render what is behind solid z values instead of in front"); - if (scene) + if (scene) { RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update"); - else + } + else { RNA_def_property_clear_flag(prop, PROP_EDITABLE); + } prop = RNA_def_property(srna, "use_all_z", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ALL_Z); RNA_def_property_ui_text( prop, "All Z", "Fill in Z values for solid faces in invisible layers, for masking"); - if (scene) + if (scene) { RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); - else + } + else { RNA_def_property_clear_flag(prop, PROP_EDITABLE); + } prop = RNA_def_property(srna, "use_solid", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_SOLID); RNA_def_property_ui_text(prop, "Solid", "Render Solid faces in this Layer"); - if (scene) + if (scene) { RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); - else + } + else { RNA_def_property_clear_flag(prop, PROP_EDITABLE); + } prop = RNA_def_property(srna, "use_halo", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_HALO); RNA_def_property_ui_text(prop, "Halo", "Render Halos in this Layer (on top of Solid)"); - if (scene) + if (scene) { RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); - else + } + else { RNA_def_property_clear_flag(prop, PROP_EDITABLE); + } prop = RNA_def_property(srna, "use_ztransp", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ZTRA); RNA_def_property_ui_text( prop, "ZTransp", "Render Z-Transparent faces in this Layer (on top of Solid and Halos)"); - if (scene) + if (scene) { RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); - else + } + else { RNA_def_property_clear_flag(prop, PROP_EDITABLE); + } prop = RNA_def_property(srna, "use_sky", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_SKY); RNA_def_property_ui_text(prop, "Sky", "Render Sky in this Layer"); - if (scene) + if (scene) { RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update"); - else + } + else { RNA_def_property_clear_flag(prop, PROP_EDITABLE); + } prop = RNA_def_property(srna, "use_ao", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_AO); RNA_def_property_ui_text(prop, "Ambient Occlusion", "Render Ambient Occlusion in this Layer"); - if (scene) + if (scene) { RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update"); - else + } + else { RNA_def_property_clear_flag(prop, PROP_EDITABLE); + } prop = RNA_def_property(srna, "use_edge_enhance", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_EDGE); RNA_def_property_ui_text( prop, "Edge", "Render Edge-enhance in this Layer (only works for Solid faces)"); - if (scene) + if (scene) { RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); - else + } + else { RNA_def_property_clear_flag(prop, PROP_EDITABLE); + } prop = RNA_def_property(srna, "use_strand", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_STRAND); RNA_def_property_ui_text(prop, "Strand", "Render Strands in this Layer"); - if (scene) + if (scene) { RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); - else + } + else { RNA_def_property_clear_flag(prop, PROP_EDITABLE); + } /* passes */ prop = RNA_def_property(srna, "use_pass_combined", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_COMBINED); RNA_def_property_ui_text(prop, "Combined", "Deliver full combined RGBA buffer"); - if (scene) + if (scene) { RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); - else + } + else { RNA_def_property_clear_flag(prop, PROP_EDITABLE); + } prop = RNA_def_property(srna, "use_pass_z", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_Z); RNA_def_property_ui_text(prop, "Z", "Deliver Z values pass"); - if (scene) + if (scene) { RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); - else + } + else { RNA_def_property_clear_flag(prop, PROP_EDITABLE); + } prop = RNA_def_property(srna, "use_pass_vector", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_VECTOR); RNA_def_property_ui_text(prop, "Vector", "Deliver speed vector pass"); - if (scene) + if (scene) { RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); - else + } + else { RNA_def_property_clear_flag(prop, PROP_EDITABLE); + } prop = RNA_def_property(srna, "use_pass_normal", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_NORMAL); RNA_def_property_ui_text(prop, "Normal", "Deliver normal pass"); - if (scene) + if (scene) { RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); - else + } + else { RNA_def_property_clear_flag(prop, PROP_EDITABLE); + } prop = RNA_def_property(srna, "use_pass_uv", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_UV); RNA_def_property_ui_text(prop, "UV", "Deliver texture UV pass"); - if (scene) + if (scene) { RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); - else + } + else { RNA_def_property_clear_flag(prop, PROP_EDITABLE); + } prop = RNA_def_property(srna, "use_pass_mist", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_MIST); RNA_def_property_ui_text(prop, "Mist", "Deliver mist factor pass (0.0-1.0)"); - if (scene) + if (scene) { RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); - else + } + else { RNA_def_property_clear_flag(prop, PROP_EDITABLE); + } prop = RNA_def_property(srna, "use_pass_object_index", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_INDEXOB); RNA_def_property_ui_text(prop, "Object Index", "Deliver object index pass"); - if (scene) + if (scene) { RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); - else + } + else { RNA_def_property_clear_flag(prop, PROP_EDITABLE); + } prop = RNA_def_property(srna, "use_pass_material_index", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_INDEXMA); RNA_def_property_ui_text(prop, "Material Index", "Deliver material index pass"); - if (scene) + if (scene) { RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); - else + } + else { RNA_def_property_clear_flag(prop, PROP_EDITABLE); + } prop = RNA_def_property(srna, "use_pass_shadow", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SHADOW); RNA_def_property_ui_text(prop, "Shadow", "Deliver shadow pass"); - if (scene) + if (scene) { RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); - else + } + else { RNA_def_property_clear_flag(prop, PROP_EDITABLE); + } prop = RNA_def_property(srna, "use_pass_ambient_occlusion", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_AO); RNA_def_property_ui_text(prop, "Ambient Occlusion", "Deliver Ambient Occlusion pass"); - if (scene) + if (scene) { RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); - else + } + else { RNA_def_property_clear_flag(prop, PROP_EDITABLE); + } prop = RNA_def_property(srna, "use_pass_emit", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_EMIT); RNA_def_property_ui_text(prop, "Emit", "Deliver emission pass"); - if (scene) + if (scene) { RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); - else + } + else { RNA_def_property_clear_flag(prop, PROP_EDITABLE); + } prop = RNA_def_property(srna, "use_pass_environment", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_ENVIRONMENT); RNA_def_property_ui_text(prop, "Environment", "Deliver environment lighting pass"); - if (scene) + if (scene) { RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); - else + } + else { RNA_def_property_clear_flag(prop, PROP_EDITABLE); + } prop = RNA_def_property(srna, "use_pass_diffuse_direct", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE_DIRECT); RNA_def_property_ui_text(prop, "Diffuse Direct", "Deliver diffuse direct pass"); - if (scene) + if (scene) { RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); - else + } + else { RNA_def_property_clear_flag(prop, PROP_EDITABLE); + } prop = RNA_def_property(srna, "use_pass_diffuse_indirect", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE_INDIRECT); RNA_def_property_ui_text(prop, "Diffuse Indirect", "Deliver diffuse indirect pass"); - if (scene) + if (scene) { RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); - else + } + else { RNA_def_property_clear_flag(prop, PROP_EDITABLE); + } prop = RNA_def_property(srna, "use_pass_diffuse_color", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE_COLOR); RNA_def_property_ui_text(prop, "Diffuse Color", "Deliver diffuse color pass"); - if (scene) + if (scene) { RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); - else + } + else { RNA_def_property_clear_flag(prop, PROP_EDITABLE); + } prop = RNA_def_property(srna, "use_pass_glossy_direct", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_GLOSSY_DIRECT); RNA_def_property_ui_text(prop, "Glossy Direct", "Deliver glossy direct pass"); - if (scene) + if (scene) { RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); - else + } + else { RNA_def_property_clear_flag(prop, PROP_EDITABLE); + } prop = RNA_def_property(srna, "use_pass_glossy_indirect", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_GLOSSY_INDIRECT); RNA_def_property_ui_text(prop, "Glossy Indirect", "Deliver glossy indirect pass"); - if (scene) + if (scene) { RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); - else + } + else { RNA_def_property_clear_flag(prop, PROP_EDITABLE); + } prop = RNA_def_property(srna, "use_pass_glossy_color", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_GLOSSY_COLOR); RNA_def_property_ui_text(prop, "Glossy Color", "Deliver glossy color pass"); - if (scene) + if (scene) { RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); - else + } + else { RNA_def_property_clear_flag(prop, PROP_EDITABLE); + } prop = RNA_def_property(srna, "use_pass_transmission_direct", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_TRANSM_DIRECT); RNA_def_property_ui_text(prop, "Transmission Direct", "Deliver transmission direct pass"); - if (scene) + if (scene) { RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); - else + } + else { RNA_def_property_clear_flag(prop, PROP_EDITABLE); + } prop = RNA_def_property(srna, "use_pass_transmission_indirect", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_TRANSM_INDIRECT); RNA_def_property_ui_text(prop, "Transmission Indirect", "Deliver transmission indirect pass"); - if (scene) + if (scene) { RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); - else + } + else { RNA_def_property_clear_flag(prop, PROP_EDITABLE); + } prop = RNA_def_property(srna, "use_pass_transmission_color", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_TRANSM_COLOR); RNA_def_property_ui_text(prop, "Transmission Color", "Deliver transmission color pass"); - if (scene) + if (scene) { RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); - else + } + else { RNA_def_property_clear_flag(prop, PROP_EDITABLE); + } prop = RNA_def_property(srna, "use_pass_subsurface_direct", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SUBSURFACE_DIRECT); RNA_def_property_ui_text(prop, "Subsurface Direct", "Deliver subsurface direct pass"); - if (scene) + if (scene) { RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); - else + } + else { RNA_def_property_clear_flag(prop, PROP_EDITABLE); + } prop = RNA_def_property(srna, "use_pass_subsurface_indirect", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SUBSURFACE_INDIRECT); RNA_def_property_ui_text(prop, "Subsurface Indirect", "Deliver subsurface indirect pass"); - if (scene) + if (scene) { RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); - else + } + else { RNA_def_property_clear_flag(prop, PROP_EDITABLE); + } prop = RNA_def_property(srna, "use_pass_subsurface_color", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SUBSURFACE_COLOR); RNA_def_property_ui_text(prop, "Subsurface Color", "Deliver subsurface color pass"); - if (scene) + if (scene) { RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update"); - else + } + else { RNA_def_property_clear_flag(prop, PROP_EDITABLE); + } } static void rna_def_freestyle_modules(BlenderRNA *brna, PropertyRNA *cprop) diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 504bfa79eb9..6f524be7473 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -2704,8 +2704,9 @@ static void rna_def_effects(BlenderRNA *brna) rna_def_effect_inputs(srna, effect->inputs); - if (effect->func) + if (effect->func) { effect->func(srna); + } } } |