More human readable formating in enums and others.
authorGuillermo S. Romero <gsr.b3d@infernal-iceberg.com>
Fri, 23 Oct 2009 23:19:23 +0000 (23:19 +0000)
committerGuillermo S. Romero <gsr.b3d@infernal-iceberg.com>
Fri, 23 Oct 2009 23:19:23 +0000 (23:19 +0000)
This makes some code inspection tools give cleaner results.

source/blender/makesrna/intern/makesrna.c

index 7e473fcb096fe25d7903f938014c75350b6da5eb..b16a0f00fd27b18dd643163bb1153dff10b23cd4 100644 (file)
@@ -1659,21 +1659,21 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
                                int i, defaultfound= 0;
 
                                if(eprop->item) {
                                int i, defaultfound= 0;
 
                                if(eprop->item) {
-                                       fprintf(f, "static EnumPropertyItem rna_%s%s_%s_items[%d] = {", srna->identifier, strnest, prop->identifier, eprop->totitem+1);
+                                       fprintf(f, "static EnumPropertyItem rna_%s%s_%s_items[%d] = {\n\t", srna->identifier, strnest, prop->identifier, eprop->totitem+1);
 
                                        for(i=0; i<eprop->totitem; i++) {
                                                fprintf(f, "{%d, ", eprop->item[i].value);
                                                rna_print_c_string(f, eprop->item[i].identifier); fprintf(f, ", ");
                                                fprintf(f, "%d, ", eprop->item[i].icon);
                                                rna_print_c_string(f, eprop->item[i].name); fprintf(f, ", ");
 
                                        for(i=0; i<eprop->totitem; i++) {
                                                fprintf(f, "{%d, ", eprop->item[i].value);
                                                rna_print_c_string(f, eprop->item[i].identifier); fprintf(f, ", ");
                                                fprintf(f, "%d, ", eprop->item[i].icon);
                                                rna_print_c_string(f, eprop->item[i].name); fprintf(f, ", ");
-                                               rna_print_c_string(f, eprop->item[i].description); fprintf(f, "}, ");
+                                               rna_print_c_string(f, eprop->item[i].description); fprintf(f, "},\n\t");
 
                                                if(eprop->item[i].identifier[0])
                                                        if(eprop->defaultvalue == eprop->item[i].value)
                                                                defaultfound= 1;
                                        }
 
 
                                                if(eprop->item[i].identifier[0])
                                                        if(eprop->defaultvalue == eprop->item[i].value)
                                                                defaultfound= 1;
                                        }
 
-                                       fprintf(f, "{0, NULL, 0, NULL, NULL}};\n\n");
+                                       fprintf(f, "{0, NULL, 0, NULL, NULL}\n};\n\n");
 
                                        if(!defaultfound) {
                                                fprintf(stderr, "rna_generate_structs: %s%s.%s, enum default is not in items.\n", srna->identifier, errnest, prop->identifier);
 
                                        if(!defaultfound) {
                                                fprintf(stderr, "rna_generate_structs: %s%s.%s, enum default is not in items.\n", srna->identifier, errnest, prop->identifier);
@@ -1691,7 +1691,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
                                unsigned int i;
 
                                if(prop->arraydimension && prop->totarraylength) {
                                unsigned int i;
 
                                if(prop->arraydimension && prop->totarraylength) {
-                                       fprintf(f, "static int rna_%s%s_%s_default[%d] = {", srna->identifier, strnest, prop->identifier, prop->totarraylength);
+                                       fprintf(f, "static int rna_%s%s_%s_default[%d] = {\n\t", srna->identifier, strnest, prop->identifier, prop->totarraylength);
 
                                        for(i=0; i<prop->totarraylength; i++) {
                                                if(bprop->defaultarray)
 
                                        for(i=0; i<prop->totarraylength; i++) {
                                                if(bprop->defaultarray)
@@ -1699,10 +1699,10 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
                                                else
                                                        fprintf(f, "%d", bprop->defaultvalue);
                                                if(i != prop->totarraylength-1)
                                                else
                                                        fprintf(f, "%d", bprop->defaultvalue);
                                                if(i != prop->totarraylength-1)
-                                                       fprintf(f, ", ");
+                                                       fprintf(f, ",\n\t");
                                        }
 
                                        }
 
-                                       fprintf(f, "};\n\n");
+                                       fprintf(f, "\n};\n\n");
                                }
                                break;
                        }
                                }
                                break;
                        }
@@ -1711,7 +1711,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
                                unsigned int i;
 
                                if(prop->arraydimension && prop->totarraylength) {
                                unsigned int i;
 
                                if(prop->arraydimension && prop->totarraylength) {
-                                       fprintf(f, "static int rna_%s%s_%s_default[%d] = {", srna->identifier, strnest, prop->identifier, prop->totarraylength);
+                                       fprintf(f, "static int rna_%s%s_%s_default[%d] = {\n\t", srna->identifier, strnest, prop->identifier, prop->totarraylength);
 
                                        for(i=0; i<prop->totarraylength; i++) {
                                                if(iprop->defaultarray)
 
                                        for(i=0; i<prop->totarraylength; i++) {
                                                if(iprop->defaultarray)
@@ -1719,10 +1719,10 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
                                                else
                                                        fprintf(f, "%d", iprop->defaultvalue);
                                                if(i != prop->totarraylength-1)
                                                else
                                                        fprintf(f, "%d", iprop->defaultvalue);
                                                if(i != prop->totarraylength-1)
-                                                       fprintf(f, ", ");
+                                                       fprintf(f, ",\n\t");
                                        }
 
                                        }
 
-                                       fprintf(f, "};\n\n");
+                                       fprintf(f, "\n};\n\n");
                                }
                                break;
                        }
                                }
                                break;
                        }
@@ -1731,7 +1731,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
                                unsigned int i;
 
                                if(prop->arraydimension && prop->totarraylength) {
                                unsigned int i;
 
                                if(prop->arraydimension && prop->totarraylength) {
-                                       fprintf(f, "static float rna_%s%s_%s_default[%d] = {", srna->identifier, strnest, prop->identifier, prop->totarraylength);
+                                       fprintf(f, "static float rna_%s%s_%s_default[%d] = {\n\t", srna->identifier, strnest, prop->identifier, prop->totarraylength);
 
                                        for(i=0; i<prop->totarraylength; i++) {
                                                if(fprop->defaultarray)
 
                                        for(i=0; i<prop->totarraylength; i++) {
                                                if(fprop->defaultarray)
@@ -1739,10 +1739,10 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
                                                else
                                                        rna_float_print(f, fprop->defaultvalue);
                                                if(i != prop->totarraylength-1)
                                                else
                                                        rna_float_print(f, fprop->defaultvalue);
                                                if(i != prop->totarraylength-1)
-                                                       fprintf(f, ", ");
+                                                       fprintf(f, ",\n\t");
                                        }
 
                                        }
 
-                                       fprintf(f, "};\n\n");
+                                       fprintf(f, "\n};\n\n");
                                }
                                break;
                        }
                                }
                                break;
                        }
@@ -1922,7 +1922,7 @@ static void rna_generate_struct(BlenderRNA *brna, StructRNA *srna, FILE *f)
        rna_print_c_string(f, srna->name);
        fprintf(f, ", ");
        rna_print_c_string(f, srna->description);
        rna_print_c_string(f, srna->name);
        fprintf(f, ", ");
        rna_print_c_string(f, srna->description);
-       fprintf(f, ",\n %d,\n", srna->icon);
+       fprintf(f, ",\n\t%d,\n", srna->icon);
 
        prop= srna->nameproperty;
        if(prop) {
 
        prop= srna->nameproperty;
        if(prop) {