Merging r50470 through r50477 from trunk into soc-2011-tomato
[blender.git] / source / blender / makesrna / intern / makesrna.c
index 62a09e6..ef3c7f4 100644 (file)
@@ -51,7 +51,7 @@
 #  define __func__ __FUNCTION__
 #endif
 
-/* copied from BKE_utildefines.h ugh */
+/* copied from BLI_utildefines.h ugh */
 #ifdef __GNUC__
 #  define UNUSED(x) UNUSED_ ## x __attribute__((__unused__))
 #else
@@ -532,7 +532,8 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
        func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "get");
 
        switch (prop->type) {
-               case PROP_STRING: {
+               case PROP_STRING:
+               {
                        StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
                        fprintf(f, "void %s(PointerRNA *ptr, char *value)\n", func);
                        fprintf(f, "{\n");
@@ -565,7 +566,8 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
                        fprintf(f, "}\n\n");
                        break;
                }
-               case PROP_POINTER: {
+               case PROP_POINTER:
+               {
                        fprintf(f, "PointerRNA %s(PointerRNA *ptr)\n", func);
                        fprintf(f, "{\n");
                        if (manualfunc) {
@@ -584,7 +586,8 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
                        fprintf(f, "}\n\n");
                        break;
                }
-               case PROP_COLLECTION: {
+               case PROP_COLLECTION:
+               {
                        CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop;
 
                        fprintf(f, "static PointerRNA %s(CollectionPropertyIterator *iter)\n", func);
@@ -785,7 +788,8 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
        func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "set");
 
        switch (prop->type) {
-               case PROP_STRING: {
+               case PROP_STRING:
+               {
                        StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
                        fprintf(f, "void %s(PointerRNA *ptr, const char *value)\n", func);
                        fprintf(f, "{\n");
@@ -817,7 +821,8 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
                        fprintf(f, "}\n\n");
                        break;
                }
-               case PROP_POINTER: {
+               case PROP_POINTER:
+               {
                        fprintf(f, "void %s(PointerRNA *ptr, PointerRNA value)\n", func);
                        fprintf(f, "{\n");
                        if (manualfunc) {
@@ -1275,7 +1280,8 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp)
        prop = dp->prop;
 
        switch (prop->type) {
-               case PROP_BOOLEAN: {
+               case PROP_BOOLEAN:
+               {
                        BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop;
 
                        if (!prop->arraydimension) {
@@ -1291,7 +1297,8 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp)
                        }
                        break;
                }
-               case PROP_INT: {
+               case PROP_INT:
+               {
                        IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
 
                        if (!prop->arraydimension) {
@@ -1310,7 +1317,8 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp)
                        }
                        break;
                }
-               case PROP_FLOAT: {
+               case PROP_FLOAT:
+               {
                        FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
 
                        if (!prop->arraydimension) {
@@ -1329,14 +1337,16 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp)
                        }
                        break;
                }
-               case PROP_ENUM: {
+               case PROP_ENUM:
+               {
                        EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
 
                        eprop->get = (void *)rna_def_property_get_func(f, srna, prop, dp, (const char *)eprop->get);
                        eprop->set = (void *)rna_def_property_set_func(f, srna, prop, dp, (const char *)eprop->set);
                        break;
                }
-               case PROP_STRING: {
+               case PROP_STRING:
+               {
                        StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
 
                        sprop->get = (void *)rna_def_property_get_func(f, srna, prop, dp, (const char *)sprop->get);
@@ -1344,7 +1354,8 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp)
                        sprop->set = (void *)rna_def_property_set_func(f, srna, prop, dp, (const char *)sprop->set);
                        break;
                }
-               case PROP_POINTER: {
+               case PROP_POINTER:
+               {
                        PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop;
 
                        pprop->get = (void *)rna_def_property_get_func(f, srna, prop, dp, (const char *)pprop->get);
@@ -1356,7 +1367,8 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp)
                        }
                        break;
                }
-               case PROP_COLLECTION: {
+               case PROP_COLLECTION:
+               {
                        CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop;
                        const char *nextfunc = (const char *)cprop->next;
 
@@ -1421,7 +1433,8 @@ static void rna_def_property_funcs_header(FILE *f, StructRNA *srna, PropertyDefR
 
        switch (prop->type) {
                case PROP_BOOLEAN:
-               case PROP_INT: {
+               case PROP_INT:
+               {
                        if (!prop->arraydimension) {
                                fprintf(f, "int %sget(PointerRNA *ptr);\n", func);
                                /*fprintf(f, "void %sset(PointerRNA *ptr, int value);\n", func); */
@@ -1436,7 +1449,8 @@ static void rna_def_property_funcs_header(FILE *f, StructRNA *srna, PropertyDefR
                        }
                        break;
                }
-               case PROP_FLOAT: {
+               case PROP_FLOAT:
+               {
                        if (!prop->arraydimension) {
                                fprintf(f, "float %sget(PointerRNA *ptr);\n", func);
                                /*fprintf(f, "void %sset(PointerRNA *ptr, float value);\n", func); */
@@ -1451,7 +1465,8 @@ static void rna_def_property_funcs_header(FILE *f, StructRNA *srna, PropertyDefR
                        }
                        break;
                }
-               case PROP_ENUM: {
+               case PROP_ENUM:
+               {
                        EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
                        int i;
 
@@ -1471,7 +1486,8 @@ static void rna_def_property_funcs_header(FILE *f, StructRNA *srna, PropertyDefR
 
                        break;
                }
-               case PROP_STRING: {
+               case PROP_STRING:
+               {
                        StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
 
                        if (sprop->maxlength) {
@@ -1484,12 +1500,14 @@ static void rna_def_property_funcs_header(FILE *f, StructRNA *srna, PropertyDefR
 
                        break;
                }
-               case PROP_POINTER: {
+               case PROP_POINTER:
+               {
                        fprintf(f, "PointerRNA %sget(PointerRNA *ptr);\n", func);
                        /*fprintf(f, "void %sset(PointerRNA *ptr, PointerRNA value);\n", func); */
                        break;
                }
-               case PROP_COLLECTION: {
+               case PROP_COLLECTION:
+               {
                        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);
@@ -1520,28 +1538,32 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property
                fprintf(f, "\t/* */\n");
 
        switch (prop->type) {
-               case PROP_BOOLEAN: {
+               case PROP_BOOLEAN:
+               {
                        if (!prop->arraydimension)
                                fprintf(f, "\tinline bool %s(void);", rna_safe_id(prop->identifier));
                        else if (prop->totarraylength)
                                fprintf(f, "\tinline Array<int, %u> %s(void);", prop->totarraylength, rna_safe_id(prop->identifier));
                        break;
                }
-               case PROP_INT: {
+               case PROP_INT:
+               {
                        if (!prop->arraydimension)
                                fprintf(f, "\tinline int %s(void);", rna_safe_id(prop->identifier));
                        else if (prop->totarraylength)
                                fprintf(f, "\tinline Array<int, %u> %s(void);", prop->totarraylength, rna_safe_id(prop->identifier));
                        break;
                }
-               case PROP_FLOAT: {
+               case PROP_FLOAT:
+               {
                        if (!prop->arraydimension)
                                fprintf(f, "\tinline float %s(void);", rna_safe_id(prop->identifier));
                        else if (prop->totarraylength)
                                fprintf(f, "\tinline Array<float, %u> %s(void);", prop->totarraylength, rna_safe_id(prop->identifier));
                        break;
                }
-               case PROP_ENUM: {
+               case PROP_ENUM:
+               {
                        EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
                        int i;
 
@@ -1559,11 +1581,13 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property
                        fprintf(f, "\tinline %s_enum %s(void);", rna_safe_id(prop->identifier), rna_safe_id(prop->identifier));
                        break;
                }
-               case PROP_STRING: {
+               case PROP_STRING:
+               {
                        fprintf(f, "\tinline std::string %s(void);", rna_safe_id(prop->identifier));
                        break;
                }
-               case PROP_POINTER: {
+               case PROP_POINTER:
+               {
                        PointerPropertyRNA *pprop = (PointerPropertyRNA *)dp->prop;
 
                        if (pprop->type)
@@ -1572,7 +1596,8 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property
                                fprintf(f, "\tinline %s %s(void);", "UnknownType", rna_safe_id(prop->identifier));
                        break;
                }
-               case PROP_COLLECTION: {
+               case PROP_COLLECTION:
+               {
                        CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)dp->prop;
 
                        if (cprop->item_type)
@@ -1598,7 +1623,8 @@ static void rna_def_property_funcs_impl_cpp(FILE *f, StructRNA *srna, PropertyDe
                return;
 
        switch (prop->type) {
-               case PROP_BOOLEAN: {
+               case PROP_BOOLEAN:
+               {
                        if (!prop->arraydimension)
                                fprintf(f, "\tBOOLEAN_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier));
                        else if (prop->totarraylength)
@@ -1606,7 +1632,8 @@ static void rna_def_property_funcs_impl_cpp(FILE *f, StructRNA *srna, PropertyDe
                                        rna_safe_id(prop->identifier));
                        break;
                }
-               case PROP_INT: {
+               case PROP_INT:
+               {
                        if (!prop->arraydimension)
                                fprintf(f, "\tINT_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier));
                        else if (prop->totarraylength)
@@ -1614,7 +1641,8 @@ static void rna_def_property_funcs_impl_cpp(FILE *f, StructRNA *srna, PropertyDe
                                        rna_safe_id(prop->identifier));
                        break;
                }
-               case PROP_FLOAT: {
+               case PROP_FLOAT:
+               {
                        if (!prop->arraydimension)
                                fprintf(f, "\tFLOAT_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier));
                        else if (prop->totarraylength)
@@ -1622,17 +1650,20 @@ static void rna_def_property_funcs_impl_cpp(FILE *f, StructRNA *srna, PropertyDe
                                        rna_safe_id(prop->identifier));
                        break;
                }
-               case PROP_ENUM: {
+               case PROP_ENUM:
+               {
                        fprintf(f, "\tENUM_PROPERTY(%s_enum, %s, %s)", rna_safe_id(prop->identifier), srna->identifier,
                                rna_safe_id(prop->identifier));
 
                        break;
                }
-               case PROP_STRING: {
+               case PROP_STRING:
+               {
                        fprintf(f, "\tSTRING_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier));
                        break;
                }
-               case PROP_POINTER: {
+               case PROP_POINTER:
+               {
                        PointerPropertyRNA *pprop = (PointerPropertyRNA *)dp->prop;
 
                        if (pprop->type)
@@ -1643,7 +1674,8 @@ static void rna_def_property_funcs_impl_cpp(FILE *f, StructRNA *srna, PropertyDe
                                        rna_safe_id(prop->identifier));
                        break;
                }
-               case PROP_COLLECTION: {
+               case PROP_COLLECTION:
+               {
 #if 0
                        CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)dp->prop;
 
@@ -2218,7 +2250,8 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
        }
 
        switch (prop->type) {
-               case PROP_ENUM: {
+               case PROP_ENUM:
+               {
                        EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
                        int i, defaultfound = 0, totflag = 0;
 
@@ -2270,7 +2303,8 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
                        }
                        break;
                }
-               case PROP_BOOLEAN: {
+               case PROP_BOOLEAN:
+               {
                        BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop;
                        unsigned int i;
 
@@ -2291,7 +2325,8 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
                        }
                        break;
                }
-               case PROP_INT: {
+               case PROP_INT:
+               {
                        IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
                        unsigned int i;
 
@@ -2312,7 +2347,8 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
                        }
                        break;
                }
-               case PROP_FLOAT: {
+               case PROP_FLOAT:
+               {
                        FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
                        unsigned int i;
 
@@ -2380,7 +2416,8 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
        fprintf(f, "},\n");
 
        switch (prop->type) {
-               case PROP_BOOLEAN: {
+               case PROP_BOOLEAN:
+               {
                        BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop;
                        fprintf(f, "\t%s, %s, %s, %s, %d, ",
                                rna_function_string(bprop->get),
@@ -2393,7 +2430,8 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
                        else fprintf(f, "NULL\n");
                        break;
                }
-               case PROP_INT: {
+               case PROP_INT:
+               {
                        IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
                        fprintf(f, "\t%s, %s, %s, %s, %s,\n\t",
                                rna_function_string(iprop->get),
@@ -2412,7 +2450,8 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
                        else fprintf(f, "NULL\n");
                        break;
                }
-               case PROP_FLOAT: {
+               case PROP_FLOAT:
+               {
                        FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
                        fprintf(f, "\t%s, %s, %s, %s, %s, ",
                                rna_function_string(fprop->get),
@@ -2432,7 +2471,8 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
                        else fprintf(f, "NULL\n");
                        break;
                }
-               case PROP_STRING: {
+               case PROP_STRING:
+               {
                        StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
                        fprintf(f, "\t%s, %s, %s, %d, ",
                                rna_function_string(sprop->get),
@@ -2442,7 +2482,8 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
                        rna_print_c_string(f, sprop->defaultvalue); fprintf(f, "\n");
                        break;
                }
-               case PROP_ENUM: {
+               case PROP_ENUM:
+               {
                        EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
                        fprintf(f, "\t%s, %s, %s, NULL, ",
                                rna_function_string(eprop->get),
@@ -2455,7 +2496,8 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
                        fprintf(f, "%d, %d\n", eprop->totitem, eprop->defaultvalue);
                        break;
                }
-               case PROP_POINTER: {
+               case PROP_POINTER:
+               {
                        PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop;
                        fprintf(f, "\t%s, %s, %s, %s,", rna_function_string(pprop->get),
                                rna_function_string(pprop->set),
@@ -2465,7 +2507,8 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
                        else fprintf(f, "NULL\n");
                        break;
                }
-               case PROP_COLLECTION: {
+               case PROP_COLLECTION:
+               {
                        CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop;
                        fprintf(f, "\t%s, %s, %s, %s, %s, %s, %s, %s, ",
                                rna_function_string(cprop->begin),
@@ -2881,8 +2924,8 @@ static const char *cpp_classes = ""
 "      T data[Tsize];\n"
 "\n"
 "   Array() {}\n"
-"      Array(const Array<T, Tsize>& other) { memcpy(data, other.data, sizeof(T)*Tsize); }\n"
-"      const Array<T, Tsize>& operator=(const Array<T, Tsize>& other) { memcpy(data, other.data, sizeof(T)*Tsize); "
+"      Array(const Array<T, Tsize>& other) { memcpy(data, other.data, sizeof(T) * Tsize); }\n"
+"      const Array<T, Tsize>& operator=(const Array<T, Tsize>& other) { memcpy(data, other.data, sizeof(T) * Tsize); "
 "return *this; }\n"
 "\n"
 "      operator T*() { return data; }\n"