Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/makesrna/intern/makesrna.c')
-rw-r--r--source/blender/makesrna/intern/makesrna.c236
1 files changed, 153 insertions, 83 deletions
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index 23a1b0a83d7..4c5fc709d7e 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -75,19 +75,19 @@ static int replace_if_different(char *tmpfile, const char *dep_files[])
#define REN_IF_DIFF \
{ \
- FILE *file_test = fopen(orgfile, "rb"); \
- if (file_test) { \
+ FILE *file_test = fopen(orgfile, "rb"); \
+ if (file_test) { \
fclose(file_test); \
- if (fp_org) fclose(fp_org); \
- if (fp_new) fclose(fp_new); \
- if (remove(orgfile) != 0) { \
+ if (fp_org) fclose(fp_org); \
+ if (fp_new) fclose(fp_new); \
+ if (remove(orgfile) != 0) { \
fprintf(stderr, "%s:%d, Remove Error (%s): \"%s\"\n", \
__FILE__, __LINE__, strerror(errno), orgfile); \
return -1; \
} \
} \
} \
- if (rename(tmpfile, orgfile) != 0) { \
+ if (rename(tmpfile, orgfile) != 0) { \
fprintf(stderr, "%s:%d, Rename Error (%s): \"%s\" -> \"%s\"\n", \
__FILE__, __LINE__, strerror(errno), tmpfile, orgfile); \
return -1; \
@@ -304,7 +304,8 @@ static void rna_print_c_string(FILE *f, const char *str)
static void rna_print_data_get(FILE *f, PropertyDefRNA *dp)
{
if (dp->dnastructfromname && dp->dnastructfromprop)
- fprintf(f, " %s *data= (%s*)(((%s*)ptr->data)->%s);\n", dp->dnastructname, dp->dnastructname, dp->dnastructfromname, dp->dnastructfromprop);
+ fprintf(f, " %s *data= (%s*)(((%s*)ptr->data)->%s);\n", dp->dnastructname, dp->dnastructname,
+ dp->dnastructfromname, dp->dnastructfromprop);
else
fprintf(f, " %s *data= (%s*)(ptr->data);\n", dp->dnastructname, dp->dnastructname);
}
@@ -476,7 +477,8 @@ static void rna_int_print(FILE *f, int num)
else fprintf(f, "%d", num);
}
-static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc)
+static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp,
+ const char *manualfunc)
{
char *func;
@@ -498,7 +500,8 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
if (IS_DNATYPE_FLOAT_COMPAT(dp->dnatype) == 0) {
if (prop->subtype != PROP_COLOR_GAMMA) { /* colors are an exception. these get translated */
fprintf(stderr, "%s (1): %s.%s is a '%s' but wrapped as type '%s'.\n",
- __func__, srna->identifier, prop->identifier, dp->dnatype, RNA_property_typename(prop->type));
+ __func__, srna->identifier, prop->identifier, dp->dnatype,
+ RNA_property_typename(prop->type));
DefRNA.error = 1;
return NULL;
}
@@ -507,7 +510,8 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
else if (prop->type == PROP_INT || prop->type == PROP_BOOLEAN || prop->type == PROP_ENUM) {
if (IS_DNATYPE_INT_COMPAT(dp->dnatype) == 0) {
fprintf(stderr, "%s (2): %s.%s is a '%s' but wrapped as type '%s'.\n",
- __func__, srna->identifier, prop->identifier, dp->dnatype, RNA_property_typename(prop->type));
+ __func__, srna->identifier, prop->identifier, dp->dnatype,
+ RNA_property_typename(prop->type));
DefRNA.error = 1;
return NULL;
}
@@ -538,7 +542,8 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
if (sprop->maxlength)
fprintf(f, " %s(value, data->%s, %d);\n", string_copy_func, dp->dnaname, sprop->maxlength);
else
- fprintf(f, " %s(value, data->%s, sizeof(data->%s));\n", string_copy_func, dp->dnaname, dp->dnaname);
+ fprintf(f, " %s(value, data->%s, sizeof(data->%s));\n", string_copy_func,
+ dp->dnaname, dp->dnaname);
}
fprintf(f, "}\n\n");
break;
@@ -553,9 +558,11 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
PointerPropertyRNA *pprop = (PointerPropertyRNA*)prop;
rna_print_data_get(f, dp);
if (dp->dnapointerlevel == 0)
- fprintf(f, " return rna_pointer_inherit_refine(ptr, &RNA_%s, &data->%s);\n", (const char*)pprop->type, dp->dnaname);
+ fprintf(f, " return rna_pointer_inherit_refine(ptr, &RNA_%s, &data->%s);\n",
+ (const char*)pprop->type, dp->dnaname);
else
- fprintf(f, " return rna_pointer_inherit_refine(ptr, &RNA_%s, data->%s);\n", (const char*)pprop->type, dp->dnaname);
+ fprintf(f, " return rna_pointer_inherit_refine(ptr, &RNA_%s, data->%s);\n",
+ (const char*)pprop->type, dp->dnaname);
}
fprintf(f, "}\n\n");
break;
@@ -585,7 +592,8 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
if (prop->flag & PROP_DYNAMIC)
fprintf(f, "void %s(PointerRNA *ptr, %s values[])\n", func, rna_type_type(prop));
else
- fprintf(f, "void %s(PointerRNA *ptr, %s values[%u])\n", func, rna_type_type(prop), prop->totarraylength);
+ fprintf(f, "void %s(PointerRNA *ptr, %s values[%u])\n", func, rna_type_type(prop),
+ prop->totarraylength);
fprintf(f, "{\n");
if (manualfunc) {
@@ -595,7 +603,8 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
rna_print_data_get(f, dp);
if (prop->flag & PROP_DYNAMIC) {
- char *lenfunc = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "get_length");
+ char *lenfunc = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier),
+ "get_length");
fprintf(f, " int i, arraylen[RNA_MAX_ARRAY_DIMENSION];\n");
fprintf(f, " int len= %s(ptr, arraylen);\n\n", lenfunc);
fprintf(f, " for(i=0; i<len; i++) {\n");
@@ -618,7 +627,8 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
}
else {
if (prop->type == PROP_BOOLEAN && dp->booleanbit) {
- fprintf(f, " values[i]= %s((data->%s[i] & ", (dp->booleannegative)? "!": "", dp->dnaname);
+ fprintf(f, " values[i]= %s((data->%s[i] & ", (dp->booleannegative)? "!": "",
+ dp->dnaname);
rna_int_print(f, dp->booleanbit);
fprintf(f, ") != 0);\n");
}
@@ -659,7 +669,8 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
fprintf(f, ");\n");
}
else
- fprintf(f, " return (%s)%s(data->%s);\n", rna_type_type(prop), (dp->booleannegative)? "!": "", dp->dnaname);
+ fprintf(f, " return (%s)%s(data->%s);\n", rna_type_type(prop),
+ (dp->booleannegative)? "!": "", dp->dnaname);
}
fprintf(f, "}\n\n");
@@ -730,7 +741,8 @@ static void rna_clamp_value(FILE *f, PropertyRNA *prop, int array)
fprintf(f, "value;\n");
}
-static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc)
+static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp,
+ const char *manualfunc)
{
char *func;
@@ -772,7 +784,8 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
if (sprop->maxlength)
fprintf(f, " %s(data->%s, value, %d);\n", string_copy_func, dp->dnaname, sprop->maxlength);
else
- fprintf(f, " %s(data->%s, value, sizeof(data->%s));\n", string_copy_func, dp->dnaname, dp->dnaname);
+ fprintf(f, " %s(data->%s, value, sizeof(data->%s));\n", string_copy_func,
+ dp->dnaname, dp->dnaname);
}
fprintf(f, "}\n\n");
break;
@@ -817,7 +830,8 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
if (prop->flag & PROP_DYNAMIC)
fprintf(f, "void %s(PointerRNA *ptr, const %s values[])\n", func, rna_type_type(prop));
else
- fprintf(f, "void %s(PointerRNA *ptr, const %s values[%u])\n", func, rna_type_type(prop), prop->totarraylength);
+ fprintf(f, "void %s(PointerRNA *ptr, const %s values[%u])\n", func,
+ rna_type_type(prop), prop->totarraylength);
fprintf(f, "{\n");
if (manualfunc) {
@@ -827,7 +841,8 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
rna_print_data_get(f, dp);
if (prop->flag & PROP_DYNAMIC) {
- char *lenfunc = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "set_length");
+ char *lenfunc = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier),
+ "set_length");
fprintf(f, " int i, arraylen[RNA_MAX_ARRAY_DIMENSION];\n");
fprintf(f, " int len= %s(ptr, arraylen);\n\n", lenfunc);
rna_clamp_value_range(f, prop);
@@ -842,17 +857,19 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
if (dp->dnaarraylength == 1) {
if (prop->type == PROP_BOOLEAN && dp->booleanbit) {
- fprintf(f, " if(%svalues[i]) data->%s |= (%d<<i);\n", (dp->booleannegative)? "!": "", dp->dnaname, dp->booleanbit);
+ fprintf(f, " if(%svalues[i]) data->%s |= (%d<<i);\n",
+ (dp->booleannegative)? "!": "", dp->dnaname, dp->booleanbit);
fprintf(f, " else data->%s &= ~(%d<<i);\n", dp->dnaname, dp->booleanbit);
}
else {
- fprintf(f, " (&data->%s)[i]= %s", dp->dnaname, (dp->booleannegative)? "!": "");
+ fprintf(f, " (&data->%s)[i]= %s", dp->dnaname, (dp->booleannegative) ? "!" : "");
rna_clamp_value(f, prop, 1);
}
}
else {
if (prop->type == PROP_BOOLEAN && dp->booleanbit) {
- fprintf(f, " if(%svalues[i]) data->%s[i] |= ", (dp->booleannegative)? "!": "", dp->dnaname);
+ fprintf(f, " if(%svalues[i]) data->%s[i] |= ", (dp->booleannegative) ? "!" : "",
+ dp->dnaname);
rna_int_print(f, dp->booleanbit);
fprintf(f, ";\n");
fprintf(f, " else data->%s[i] &= ~", dp->dnaname);
@@ -864,9 +881,10 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
}
else {
if (dp->dnatype)
- fprintf(f, " ((%s*)data->%s)[i]= %s", dp->dnatype, dp->dnaname, (dp->booleannegative)? "!": "");
+ fprintf(f, " ((%s*)data->%s)[i]= %s", dp->dnatype, dp->dnaname,
+ (dp->booleannegative) ? "!" : "");
else
- fprintf(f, " (data->%s)[i]= %s", dp->dnaname, (dp->booleannegative)? "!": "");
+ fprintf(f, " (data->%s)[i]= %s", dp->dnaname, (dp->booleannegative) ? "!" : "");
rna_clamp_value(f, prop, 1);
}
}
@@ -884,7 +902,7 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
else {
rna_print_data_get(f, dp);
if (prop->type == PROP_BOOLEAN && dp->booleanbit) {
- fprintf(f, " if(%svalue) data->%s |= ", (dp->booleannegative)? "!": "", dp->dnaname);
+ fprintf(f, " if(%svalue) data->%s |= ", (dp->booleannegative) ? "!" : "", dp->dnaname);
rna_int_print(f, dp->booleanbit);
fprintf(f, ";\n");
fprintf(f, " else data->%s &= ~", dp->dnaname);
@@ -899,7 +917,7 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
}
else {
rna_clamp_value_range(f, prop);
- fprintf(f, " data->%s= %s", dp->dnaname, (dp->booleannegative)? "!": "");
+ fprintf(f, " data->%s= %s", dp->dnaname, (dp->booleannegative) ? "!" : "");
rna_clamp_value(f, prop, 0);
}
}
@@ -911,7 +929,8 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
return func;
}
-static char *rna_def_property_length_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc)
+static char *rna_def_property_length_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp,
+ const char *manualfunc)
{
char *func = NULL;
@@ -971,7 +990,8 @@ static char *rna_def_property_length_func(FILE *f, StructRNA *srna, PropertyRNA
return func;
}
-static char *rna_def_property_begin_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc)
+static char *rna_def_property_begin_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp,
+ const char *manualfunc)
{
char *func, *getfunc;
@@ -1005,9 +1025,11 @@ static char *rna_def_property_begin_func(FILE *f, StructRNA *srna, PropertyRNA *
}
else {
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);
+ 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
- fprintf(f, "\n rna_iterator_array_begin(iter, data->%s, sizeof(data->%s[0]), %d, 0, NULL);\n", dp->dnaname, dp->dnaname, dp->dnalengthfixed);
+ 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 {
@@ -1030,7 +1052,8 @@ static char *rna_def_property_begin_func(FILE *f, StructRNA *srna, PropertyRNA *
return func;
}
-static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc, const char *nextfunc)
+static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp,
+ const char *manualfunc, const char *nextfunc)
{
/* note on indices, this is for external functions and ignores skipped values.
* so the the index can only be checked against the length when there is no 'skip' funcion. */
@@ -1113,13 +1136,16 @@ static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, Property
if (dp->dnalengthname || dp->dnalengthfixed) {
if (dp->dnalengthname)
- fprintf(f, "\n rna_array_lookup_int(ptr, &RNA_%s, data->%s, sizeof(data->%s[0]), data->%s, index);\n", item_type, dp->dnaname, dp->dnaname, dp->dnalengthname);
+ fprintf(f, "\n rna_array_lookup_int(ptr, &RNA_%s, data->%s, sizeof(data->%s[0]), data->%s, index);\n",
+ item_type, dp->dnaname, dp->dnaname, dp->dnalengthname);
else
- fprintf(f, "\n rna_array_lookup_int(ptr, &RNA_%s, data->%s, sizeof(data->%s[0]), %d, index);\n", item_type, dp->dnaname, dp->dnaname, dp->dnalengthfixed);
+ fprintf(f, "\n rna_array_lookup_int(ptr, &RNA_%s, data->%s, sizeof(data->%s[0]), %d, index);\n",
+ item_type, dp->dnaname, dp->dnaname, dp->dnalengthfixed);
}
else {
if (dp->dnapointerlevel == 0)
- fprintf(f, "\n return rna_listbase_lookup_int(ptr, &RNA_%s, &data->%s, index);\n", item_type, dp->dnaname);
+ fprintf(f, "\n return rna_listbase_lookup_int(ptr, &RNA_%s, &data->%s, index);\n",
+ item_type, dp->dnaname);
else
fprintf(f, "\n return rna_listbase_lookup_int(ptr, &RNA_%s, data->%s, index);\n", item_type, dp->dnaname);
}
@@ -1130,7 +1156,8 @@ static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, Property
return func;
}
-static char *rna_def_property_next_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc)
+static char *rna_def_property_next_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp,
+ const char *manualfunc)
{
char *func, *getfunc;
@@ -1156,7 +1183,8 @@ static char *rna_def_property_next_func(FILE *f, StructRNA *srna, PropertyRNA *p
return func;
}
-static char *rna_def_property_end_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc)
+static char *rna_def_property_end_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp,
+ const char *manualfunc)
{
char *func;
@@ -1317,7 +1345,8 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp)
cprop->begin = (void*)rna_def_property_begin_func(f, srna, prop, dp, (const char*)cprop->begin);
cprop->next = (void*)rna_def_property_next_func(f, srna, prop, dp, (const char*)cprop->next);
cprop->end = (void*)rna_def_property_end_func(f, srna, prop, dp, (const char*)cprop->end);
- cprop->lookupint = (void*)rna_def_property_lookup_int_func(f, srna, prop, dp, (const char*)cprop->lookupint, nextfunc);
+ cprop->lookupint = (void*)rna_def_property_lookup_int_func(f, srna, prop, dp,
+ (const char*)cprop->lookupint, nextfunc);
if (!(prop->flag & PROP_IDPROPERTY)) {
if (!cprop->begin) {
@@ -1399,7 +1428,8 @@ static void rna_def_property_funcs_header(FILE *f, StructRNA *srna, PropertyDefR
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, "\t%s_%s_%s = %d,\n", srna->identifier, prop->identifier,
+ eprop->item[i].identifier, eprop->item[i].value);
fprintf(f, "};\n\n");
}
@@ -1488,7 +1518,8 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property
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\t%s_%s = %d,\n", rna_safe_id(prop->identifier), eprop->item[i].identifier,
+ eprop->item[i].value);
fprintf(f, "\t};\n");
}
@@ -1513,9 +1544,11 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property
CollectionPropertyRNA *cprop = (CollectionPropertyRNA*)dp->prop;
if (cprop->item_type)
- fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", (const char*)cprop->item_type, srna->identifier, rna_safe_id(prop->identifier));
+ fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", (const char*)cprop->item_type, srna->identifier,
+ rna_safe_id(prop->identifier));
else
- fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", "UnknownType", srna->identifier, rna_safe_id(prop->identifier));
+ fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", "UnknownType", srna->identifier,
+ rna_safe_id(prop->identifier));
break;
}
}
@@ -1537,25 +1570,29 @@ static void rna_def_property_funcs_impl_cpp(FILE *f, StructRNA *srna, PropertyDe
if (!prop->arraydimension)
fprintf(f, "\tBOOLEAN_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier));
else if (prop->totarraylength)
- fprintf(f, "\tBOOLEAN_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength, rna_safe_id(prop->identifier));
+ fprintf(f, "\tBOOLEAN_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength,
+ rna_safe_id(prop->identifier));
break;
}
case PROP_INT: {
if (!prop->arraydimension)
fprintf(f, "\tINT_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier));
else if (prop->totarraylength)
- fprintf(f, "\tINT_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength, rna_safe_id(prop->identifier));
+ fprintf(f, "\tINT_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength,
+ rna_safe_id(prop->identifier));
break;
}
case PROP_FLOAT: {
if (!prop->arraydimension)
fprintf(f, "\tFLOAT_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier));
else if (prop->totarraylength)
- fprintf(f, "\tFLOAT_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength, rna_safe_id(prop->identifier));
+ fprintf(f, "\tFLOAT_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength,
+ rna_safe_id(prop->identifier));
break;
}
case PROP_ENUM: {
- fprintf(f, "\tENUM_PROPERTY(%s_enum, %s, %s)", rna_safe_id(prop->identifier), srna->identifier, rna_safe_id(prop->identifier));
+ fprintf(f, "\tENUM_PROPERTY(%s_enum, %s, %s)", rna_safe_id(prop->identifier), srna->identifier,
+ rna_safe_id(prop->identifier));
break;
}
@@ -1567,17 +1604,20 @@ static void rna_def_property_funcs_impl_cpp(FILE *f, StructRNA *srna, PropertyDe
PointerPropertyRNA *pprop = (PointerPropertyRNA*)dp->prop;
if (pprop->type)
- fprintf(f, "\tPOINTER_PROPERTY(%s, %s, %s)", (const char*)pprop->type, srna->identifier, rna_safe_id(prop->identifier));
+ fprintf(f, "\tPOINTER_PROPERTY(%s, %s, %s)", (const char*)pprop->type, srna->identifier,
+ rna_safe_id(prop->identifier));
else
- fprintf(f, "\tPOINTER_PROPERTY(%s, %s, %s)", "UnknownType", srna->identifier, rna_safe_id(prop->identifier));
+ fprintf(f, "\tPOINTER_PROPERTY(%s, %s, %s)", "UnknownType", srna->identifier,
+ rna_safe_id(prop->identifier));
break;
}
case PROP_COLLECTION: {
#if 0
- CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)dp->prop;
+ CollectionPropertyRNA *cprop = (CollectionPropertyRNA*)dp->prop;
- if(cprop->type)
- fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", (const char*)cprop->type, srna->identifier, prop->identifier);
+ if (cprop->type)
+ fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", (const char*)cprop->type, srna->identifier,
+ prop->identifier);
else
fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", "UnknownType", srna->identifier, prop->identifier);
#endif
@@ -1637,7 +1677,8 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
/* 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)
ptrstr = "*";
- /* PROP_THICK_WRAP strings are pre-allocated on the ParameterList stack, but type name for string props is already char*, so leave empty */
+ /* 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))
ptrstr = "";
else
@@ -1647,7 +1688,8 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
if (flag & PROP_DYNAMIC)
fprintf(f, "\tint %s%s_len;\n", pout ? "*" : "", dparm->prop->identifier);
- fprintf(f, "\t%s%s %s%s;\n", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), ptrstr, dparm->prop->identifier);
+ fprintf(f, "\t%s%s %s%s;\n", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop),
+ ptrstr, dparm->prop->identifier);
}
if (has_data) {
@@ -1699,7 +1741,8 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
valstr = "*";
}
- /* this must be kept in sync with RNA_parameter_length_get_data, we could just call the function directly, but this is faster */
+ /* this must be kept in sync with RNA_parameter_length_get_data,
+ * we could just call the function directly, but this is faster */
if (flag & PROP_DYNAMIC) {
fprintf(f, "\t%s_len= %s((int *)_data);\n", dparm->prop->identifier, pout ? "" : "*");
data_str = "(&(((char *)_data)[sizeof(void *)]))";
@@ -1712,7 +1755,8 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
if (!pout)
fprintf(f, "%s", valstr);
- fprintf(f, "((%s%s%s)%s);\n", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), ptrstr, data_str);
+ fprintf(f, "((%s%s%s)%s);\n", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop),
+ ptrstr, data_str);
}
if (dparm->next)
@@ -1774,8 +1818,10 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
if (func->c_ret) {
dparm = rna_find_parameter_def(func->c_ret);
- ptrstr = (((dparm->prop->type == PROP_POINTER) && !(dparm->prop->flag & PROP_RNAPTR)) || (dparm->prop->arraydimension))? "*": "";
- fprintf(f, "\t*((%s%s%s*)_retdata)= %s;\n", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), ptrstr, func->c_ret->identifier);
+ ptrstr = (((dparm->prop->type == PROP_POINTER) && !(dparm->prop->flag & PROP_RNAPTR)) ||
+ (dparm->prop->arraydimension)) ? "*" : "";
+ fprintf(f, "\t*((%s%s%s*)_retdata)= %s;\n", rna_type_struct(dparm->prop),
+ rna_parameter_type_name(dparm->prop), ptrstr, func->c_ret->identifier);
}
}
@@ -1944,7 +1990,8 @@ static void rna_generate_property_prototypes(BlenderRNA *brna, StructRNA *srna,
while (base) {
fprintf(f, "\n");
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);
+ fprintf(f, "%s%s rna_%s_%s;\n", "extern ", rna_property_structname(prop->type),
+ base->identifier, prop->identifier);
base = base->base;
}
@@ -1952,7 +1999,8 @@ static void rna_generate_property_prototypes(BlenderRNA *brna, StructRNA *srna,
fprintf(f, "\n");
for (prop = srna->cont.properties.first; prop; prop = prop->next)
- fprintf(f, "%s%s rna_%s_%s;\n", (prop->flag & PROP_EXPORT)? "": "", rna_property_structname(prop->type), srna->identifier, prop->identifier);
+ fprintf(f, "%s%s rna_%s_%s;\n", (prop->flag & PROP_EXPORT)? "": "", rna_property_structname(prop->type),
+ srna->identifier, prop->identifier);
fprintf(f, "\n");
}
@@ -1961,7 +2009,8 @@ static void rna_generate_parameter_prototypes(BlenderRNA *brna, StructRNA *srna,
PropertyRNA *parm;
for (parm = func->cont.properties.first; parm; parm = parm->next)
- fprintf(f, "%s%s rna_%s_%s_%s;\n", "extern ", rna_property_structname(parm->type), srna->identifier, func->identifier, parm->identifier);
+ fprintf(f, "%s%s rna_%s_%s_%s;\n", "extern ", rna_property_structname(parm->type), srna->identifier,
+ func->identifier, parm->identifier);
if (func->cont.properties.first)
fprintf(f, "\n");
@@ -2032,7 +2081,7 @@ static void rna_generate_static_parameter_prototypes(BlenderRNA *brna, StructRNA
/* self, context and reports parameters */
if (func->flag & FUNC_USE_SELF_ID) {
fprintf(f, "struct ID *_selfid");
- first = 0;
+ first = 0;
}
if ((func->flag & FUNC_NO_SELF) == 0) {
@@ -2086,9 +2135,11 @@ static void rna_generate_static_parameter_prototypes(BlenderRNA *brna, StructRNA
fprintf(f, "int %s%s_len, ", pout ? "*" : "", dparm->prop->identifier);
if (!(flag & PROP_DYNAMIC) && dparm->prop->arraydimension)
- fprintf(f, "%s%s %s[%u]", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), dparm->prop->identifier, dparm->prop->totarraylength);
+ fprintf(f, "%s%s %s[%u]", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop),
+ dparm->prop->identifier, dparm->prop->totarraylength);
else
- fprintf(f, "%s%s %s%s", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), ptrstr, dparm->prop->identifier);
+ fprintf(f, "%s%s %s%s", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop),
+ ptrstr, dparm->prop->identifier);
}
@@ -2117,7 +2168,7 @@ static void rna_generate_static_function_prototypes(BlenderRNA *brna, StructRNA
fprintf(f, "\n");
}
-static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, PropertyRNA *prop)
+static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, PropertyRNA *prop)
{
char *strnest = "", *errnest = "";
int len, freenest = 0;
@@ -2140,7 +2191,8 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
int i, defaultfound = 0, totflag = 0;
if (eprop->item) {
- fprintf(f, "static EnumPropertyItem rna_%s%s_%s_items[%d] = {\n\t", 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);
@@ -2166,7 +2218,8 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
if (prop->flag & PROP_ENUM_FLAG) {
if (eprop->defaultvalue & ~totflag) {
fprintf(stderr, "%s: %s%s.%s, enum default includes unused bits (%d).\n",
- __func__, srna->identifier, errnest, prop->identifier, eprop->defaultvalue & ~totflag);
+ __func__, srna->identifier, errnest, prop->identifier,
+ eprop->defaultvalue & ~totflag);
DefRNA.error = 1;
}
}
@@ -2190,7 +2243,8 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
unsigned int i;
if (prop->arraydimension && prop->totarraylength) {
- fprintf(f, "static int rna_%s%s_%s_default[%u] = {\n\t", srna->identifier, strnest, prop->identifier, prop->totarraylength);
+ fprintf(f, "static int rna_%s%s_%s_default[%u] = {\n\t", srna->identifier, strnest,
+ prop->identifier, prop->totarraylength);
for (i = 0; i<prop->totarraylength; i++) {
if (bprop->defaultarray)
@@ -2210,7 +2264,8 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
unsigned int i;
if (prop->arraydimension && prop->totarraylength) {
- fprintf(f, "static int rna_%s%s_%s_default[%u] = {\n\t", srna->identifier, strnest, prop->identifier, prop->totarraylength);
+ fprintf(f, "static int rna_%s%s_%s_default[%u] = {\n\t", srna->identifier, strnest,
+ prop->identifier, prop->totarraylength);
for (i = 0; i<prop->totarraylength; i++) {
if (iprop->defaultarray)
@@ -2230,7 +2285,8 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
unsigned int i;
if (prop->arraydimension && prop->totarraylength) {
- fprintf(f, "static float rna_%s%s_%s_default[%u] = {\n\t", srna->identifier, strnest, prop->identifier, prop->totarraylength);
+ fprintf(f, "static float rna_%s%s_%s_default[%u] = {\n\t", srna->identifier, strnest,
+ prop->identifier, prop->totarraylength);
for (i = 0; i<prop->totarraylength; i++) {
if (fprop->defaultarray)
@@ -2420,10 +2476,16 @@ static void rna_generate_struct(BlenderRNA *brna, StructRNA *srna, FILE *f)
fprintf(f, "%s%s rna_%s_%s_func = {\n", "", "FunctionRNA", srna->identifier, func->identifier);
- if (func->cont.next) fprintf(f, "\t{(FunctionRNA*)&rna_%s_%s_func, ", srna->identifier, ((FunctionRNA*)func->cont.next)->identifier);
- else fprintf(f, "\t{NULL, ");
- if (func->cont.prev) fprintf(f, "(FunctionRNA*)&rna_%s_%s_func,\n", srna->identifier, ((FunctionRNA*)func->cont.prev)->identifier);
- else fprintf(f, "NULL,\n");
+ if (func->cont.next)
+ fprintf(f, "\t{(FunctionRNA*)&rna_%s_%s_func, ", srna->identifier,
+ ((FunctionRNA*)func->cont.next)->identifier);
+ else
+ fprintf(f, "\t{NULL, ");
+ if (func->cont.prev)
+ fprintf(f, "(FunctionRNA*)&rna_%s_%s_func,\n", srna->identifier,
+ ((FunctionRNA*)func->cont.prev)->identifier);
+ else
+ fprintf(f, "NULL,\n");
fprintf(f, "\tNULL,\n");
@@ -2444,8 +2506,10 @@ static void rna_generate_struct(BlenderRNA *brna, StructRNA *srna, FILE *f)
if (dfunc->gencall) fprintf(f, "\t%s,\n", dfunc->gencall);
else fprintf(f, "\tNULL,\n");
- if (func->c_ret) fprintf(f, "\t(PropertyRNA*)&rna_%s_%s_%s\n", srna->identifier, func->identifier, func->c_ret->identifier);
- else fprintf(f, "\tNULL\n");
+ if (func->c_ret)
+ fprintf(f, "\t(PropertyRNA*)&rna_%s_%s_%s\n", srna->identifier, func->identifier, func->c_ret->identifier);
+ else
+ fprintf(f, "\tNULL\n");
fprintf(f, "};\n");
fprintf(f, "\n");
@@ -2589,7 +2653,7 @@ static RNAProcessItem PROCESS_ITEMS[] = {
{"rna_userdef.c", NULL, RNA_def_userdef},
{"rna_vfont.c", NULL, RNA_def_vfont},
{"rna_wm.c", "rna_wm_api.c", RNA_def_wm},
- {"rna_world.c", NULL, RNA_def_world},
+ {"rna_world.c", NULL, RNA_def_world},
{"rna_movieclip.c", NULL, RNA_def_movieclip},
{"rna_tracking.c", NULL, RNA_def_tracking},
{NULL, NULL}};
@@ -2690,7 +2754,8 @@ static void rna_generate_header(BlenderRNA *brna, FILE *f)
fprintf(f, "#define FOREACH_BEGIN(property, sptr, itemptr) \\\n");
fprintf(f, " { \\\n");
fprintf(f, " CollectionPropertyIterator rna_macro_iter; \\\n");
- fprintf(f, " for(property##_begin(&rna_macro_iter, sptr); rna_macro_iter.valid; property##_next(&rna_macro_iter)) { \\\n");
+ fprintf(f, " for(property##_begin(&rna_macro_iter, sptr); rna_macro_iter.valid; "
+ "property##_next(&rna_macro_iter)) { \\\n");
fprintf(f, " itemptr= rna_macro_iter.ptr;\n\n");
fprintf(f, "#define FOREACH_END(property) \\\n");
@@ -2783,7 +2848,8 @@ static const char *cpp_classes = ""
"\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); return *this; }\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"
"};\n"
@@ -2804,14 +2870,17 @@ static const char *cpp_classes = ""
"\n"
" T& operator*(void) { return t; }\n"
" T* operator->(void) { return &t; }\n"
-" bool operator==(const CollectionIterator<T, Tbegin, Tnext, Tend>& other) { return iter.valid == other.iter.valid; }\n"
-" bool operator!=(const CollectionIterator<T, Tbegin, Tnext, Tend>& other) { return iter.valid != other.iter.valid; }\n"
+" bool operator==(const CollectionIterator<T, Tbegin, Tnext, Tend>& other) "
+"{ return iter.valid == other.iter.valid; }\n"
+" bool operator!=(const CollectionIterator<T, Tbegin, Tnext, Tend>& other) "
+"{ return iter.valid != other.iter.valid; }\n"
"\n"
" void begin(const Pointer& ptr)\n"
" { if(init) Tend(&iter); Tbegin(&iter, (PointerRNA*)&ptr.ptr); t = T(iter.ptr); init = true; }\n"
"\n"
"private:\n"
-" const CollectionIterator<T, Tbegin, Tnext, Tend>& operator=(const CollectionIterator<T, Tbegin, Tnext, Tend>& copy) {}\n"
+" const CollectionIterator<T, Tbegin, Tnext, Tend>& operator="
+"(const CollectionIterator<T, Tbegin, Tnext, Tend>& copy) {}\n"
""
" CollectionPropertyIterator iter;\n"
" T t;\n"
@@ -2865,7 +2934,8 @@ static void rna_generate_header_cpp(BlenderRNA *brna, FILE *f)
fprintf(f, "class %s : public %s {\n", srna->identifier, (srna->base)? srna->base->identifier: "Pointer");
fprintf(f, "public:\n");
- fprintf(f, "\t%s(const PointerRNA& ptr) :\n\t\t%s(ptr)", srna->identifier, (srna->base)? srna->base->identifier: "Pointer");
+ fprintf(f, "\t%s(const PointerRNA& ptr) :\n\t\t%s(ptr)", srna->identifier,
+ (srna->base)? srna->base->identifier: "Pointer");
for (dp = ds->cont.properties.first; dp; dp = dp->next)
if (!(dp->prop->flag & (PROP_IDPROPERTY|PROP_BUILTIN)))
if (dp->prop->type == PROP_COLLECTION)