Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/makesrna.c
| Show First 20 Lines • Show All 457 Lines • ▼ Show 20 Lines | static const char *rna_parameter_type_name(PropertyRNA *parm) | ||||
| if (type) | if (type) | ||||
| return type; | return type; | ||||
| switch (parm->type) { | switch (parm->type) { | ||||
| case PROP_POINTER: | case PROP_POINTER: | ||||
| { | { | ||||
| PointerPropertyRNA *pparm = (PointerPropertyRNA *)parm; | PointerPropertyRNA *pparm = (PointerPropertyRNA *)parm; | ||||
| if (parm->flag & PROP_RNAPTR) | if (parm->flag_parameter & PARM_RNAPTR) | ||||
| return "PointerRNA"; | return "PointerRNA"; | ||||
| else | else | ||||
| return rna_find_dna_type((const char *)pparm->type); | return rna_find_dna_type((const char *)pparm->type); | ||||
| } | } | ||||
| case PROP_COLLECTION: | case PROP_COLLECTION: | ||||
| { | { | ||||
| return "CollectionListBase"; | return "CollectionListBase"; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 929 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| if (dp->dnapointerlevel != 0) | if (dp->dnapointerlevel != 0) | ||||
| return; | return; | ||||
| if (!dp->dnatype || !dp->dnaname || !dp->dnastructname) | if (!dp->dnatype || !dp->dnaname || !dp->dnastructname) | ||||
| return; | return; | ||||
| if (STREQ(dp->dnatype, "char")) { | if (STREQ(dp->dnatype, "char")) { | ||||
| prop->rawtype = PROP_RAW_CHAR; | prop->rawtype = PROP_RAW_CHAR; | ||||
| prop->flag |= PROP_RAW_ACCESS; | prop->flag_internal |= PROP_INTERN_RAW_ACCESS; | ||||
| } | } | ||||
| else if (STREQ(dp->dnatype, "short")) { | else if (STREQ(dp->dnatype, "short")) { | ||||
| prop->rawtype = PROP_RAW_SHORT; | prop->rawtype = PROP_RAW_SHORT; | ||||
| prop->flag |= PROP_RAW_ACCESS; | prop->flag_internal |= PROP_INTERN_RAW_ACCESS; | ||||
| } | } | ||||
| else if (STREQ(dp->dnatype, "int")) { | else if (STREQ(dp->dnatype, "int")) { | ||||
| prop->rawtype = PROP_RAW_INT; | prop->rawtype = PROP_RAW_INT; | ||||
| prop->flag |= PROP_RAW_ACCESS; | prop->flag_internal |= PROP_INTERN_RAW_ACCESS; | ||||
| } | } | ||||
| else if (STREQ(dp->dnatype, "float")) { | else if (STREQ(dp->dnatype, "float")) { | ||||
| prop->rawtype = PROP_RAW_FLOAT; | prop->rawtype = PROP_RAW_FLOAT; | ||||
| prop->flag |= PROP_RAW_ACCESS; | prop->flag_internal |= PROP_INTERN_RAW_ACCESS; | ||||
| } | } | ||||
| else if (STREQ(dp->dnatype, "double")) { | else if (STREQ(dp->dnatype, "double")) { | ||||
| prop->rawtype = PROP_RAW_DOUBLE; | prop->rawtype = PROP_RAW_DOUBLE; | ||||
| prop->flag |= PROP_RAW_ACCESS; | prop->flag_internal |= PROP_INTERN_RAW_ACCESS; | ||||
| } | } | ||||
| } | } | ||||
| static void rna_set_raw_offset(FILE *f, StructRNA *srna, PropertyRNA *prop) | static void rna_set_raw_offset(FILE *f, StructRNA *srna, PropertyRNA *prop) | ||||
| { | { | ||||
| PropertyDefRNA *dp = rna_find_struct_property_def(srna, prop); | PropertyDefRNA *dp = rna_find_struct_property_def(srna, prop); | ||||
| fprintf(f, "\toffsetof(%s, %s), %d", dp->dnastructname, dp->dnaname, prop->rawtype); | fprintf(f, "\toffsetof(%s, %s), %d", dp->dnastructname, dp->dnaname, prop->rawtype); | ||||
| ▲ Show 20 Lines • Show All 111 Lines • ▼ Show 20 Lines | case PROP_COLLECTION: | ||||
| } | } | ||||
| /* test if we can allow raw array access, if it is using our standard | /* 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 */ | * 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") && | if (STREQ((const char *)cprop->next, "rna_iterator_array_next") && | ||||
| STREQ((const char *)cprop->get, "rna_iterator_array_get")) | STREQ((const char *)cprop->get, "rna_iterator_array_get")) | ||||
| { | { | ||||
| prop->flag |= PROP_RAW_ARRAY; | prop->flag_internal |= PROP_INTERN_RAW_ARRAY; | ||||
| } | } | ||||
| cprop->get = (void *)rna_def_property_get_func(f, srna, prop, dp, (const char *)cprop->get); | cprop->get = (void *)rna_def_property_get_func(f, srna, prop, dp, (const char *)cprop->get); | ||||
| cprop->begin = (void *)rna_def_property_begin_func(f, srna, prop, dp, (const char *)cprop->begin); | 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->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->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, | cprop->lookupint = (void *)rna_def_property_lookup_int_func(f, srna, prop, dp, | ||||
| (const char *)cprop->lookupint, nextfunc); | (const char *)cprop->lookupint, nextfunc); | ||||
| Show All 29 Lines | |||||
| static void rna_def_property_funcs_header(FILE *f, StructRNA *srna, PropertyDefRNA *dp) | static void rna_def_property_funcs_header(FILE *f, StructRNA *srna, PropertyDefRNA *dp) | ||||
| { | { | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| const char *func; | const char *func; | ||||
| prop = dp->prop; | prop = dp->prop; | ||||
| if (prop->flag & (PROP_IDPROPERTY | PROP_BUILTIN)) | if (prop->flag & PROP_IDPROPERTY || prop->flag_internal & PROP_INTERN_BUILTIN) { | ||||
| return; | return; | ||||
| } | |||||
| func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), ""); | func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), ""); | ||||
| switch (prop->type) { | switch (prop->type) { | ||||
| case PROP_BOOLEAN: | case PROP_BOOLEAN: | ||||
| case PROP_INT: | case PROP_INT: | ||||
| { | { | ||||
| if (!prop->arraydimension) { | if (!prop->arraydimension) { | ||||
| ▲ Show 20 Lines • Show All 102 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, PropertyDefRNA *dp) | static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, PropertyDefRNA *dp) | ||||
| { | { | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| prop = dp->prop; | prop = dp->prop; | ||||
| if (prop->flag & (PROP_IDPROPERTY | PROP_BUILTIN)) | if (prop->flag & PROP_IDPROPERTY || prop->flag_internal & PROP_INTERN_BUILTIN) { | ||||
| return; | return; | ||||
| } | |||||
| /* disabled for now to avoid msvc compiler error due to large file size */ | /* disabled for now to avoid msvc compiler error due to large file size */ | ||||
| #if 0 | #if 0 | ||||
| if (prop->name && prop->description && prop->description[0] != '\0') | if (prop->name && prop->description && prop->description[0] != '\0') | ||||
| fprintf(f, "\t/* %s: %s */\n", prop->name, prop->description); | fprintf(f, "\t/* %s: %s */\n", prop->name, prop->description); | ||||
| else if (prop->name) | else if (prop->name) | ||||
| fprintf(f, "\t/* %s */\n", prop->name); | fprintf(f, "\t/* %s */\n", prop->name); | ||||
| else | else | ||||
| ▲ Show 20 Lines • Show All 85 Lines • ▼ Show 20 Lines | case PROP_POINTER: | ||||
| fprintf(f, "\tinline %s %s(void);", "UnknownType", rna_safe_id(prop->identifier)); | fprintf(f, "\tinline %s %s(void);", "UnknownType", rna_safe_id(prop->identifier)); | ||||
| break; | break; | ||||
| } | } | ||||
| case PROP_COLLECTION: | case PROP_COLLECTION: | ||||
| { | { | ||||
| CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)dp->prop; | CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)dp->prop; | ||||
| const char *collection_funcs = "DefaultCollectionFunctions"; | const char *collection_funcs = "DefaultCollectionFunctions"; | ||||
| if (!(dp->prop->flag & (PROP_IDPROPERTY | PROP_BUILTIN)) && cprop->property.srna) | if (!(dp->prop->flag & PROP_IDPROPERTY || dp->prop->flag_internal & PROP_INTERN_BUILTIN) && cprop->property.srna) { | ||||
| collection_funcs = (char *)cprop->property.srna; | 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, (const char *)cprop->item_type, srna->identifier, | fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s, %s, %s, %s, %s)", collection_funcs, (const char *)cprop->item_type, srna->identifier, | ||||
| rna_safe_id(prop->identifier), (cprop->length ? "true" : "false"), | rna_safe_id(prop->identifier), (cprop->length ? "true" : "false"), | ||||
| (cprop->lookupint ? "true" : "false"), (cprop->lookupstring ? "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, "UnknownType", srna->identifier, | fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s, %s, %s, %s, %s)", collection_funcs, "UnknownType", srna->identifier, | ||||
| rna_safe_id(prop->identifier), (cprop->length ? "true" : "false"), | rna_safe_id(prop->identifier), (cprop->length ? "true" : "false"), | ||||
| Show All 39 Lines | static void rna_def_struct_function_prototype_cpp(FILE *f, StructRNA *UNUSED(srna), FunctionDefRNA *dfunc, | ||||
| if (func->flag & FUNC_USE_MAIN) | if (func->flag & FUNC_USE_MAIN) | ||||
| WRITE_PARAM("void *main"); | WRITE_PARAM("void *main"); | ||||
| if (func->flag & FUNC_USE_CONTEXT) | if (func->flag & FUNC_USE_CONTEXT) | ||||
| WRITE_PARAM("Context C"); | WRITE_PARAM("Context C"); | ||||
| for (dp = dfunc->cont.properties.first; dp; dp = dp->next) { | for (dp = dfunc->cont.properties.first; dp; dp = dp->next) { | ||||
| int type, flag, pout; | int type, flag, flag_parameter, pout; | ||||
| const char *ptrstr; | const char *ptrstr; | ||||
| if (dp->prop == func->c_ret) | if (dp->prop == func->c_ret) | ||||
| continue; | continue; | ||||
| type = dp->prop->type; | type = dp->prop->type; | ||||
| flag = dp->prop->flag; | flag = dp->prop->flag; | ||||
| pout = (flag & PROP_OUTPUT); | flag_parameter = dp->prop->flag_parameter; | ||||
| pout = (flag_parameter & PARM_OUTPUT); | |||||
| if (flag & PROP_DYNAMIC) | if (flag & PROP_DYNAMIC) | ||||
| ptrstr = pout ? "**" : "*"; | ptrstr = pout ? "**" : "*"; | ||||
| else if (type == PROP_POINTER) | else if (type == PROP_POINTER) | ||||
| ptrstr = pout ? "*" : ""; | ptrstr = pout ? "*" : ""; | ||||
| else if (dp->prop->arraydimension) | else if (dp->prop->arraydimension) | ||||
| ptrstr = "*"; | ptrstr = "*"; | ||||
| else if (type == PROP_STRING && (flag & PROP_THICK_WRAP)) | else if (type == PROP_STRING && (flag & PROP_THICK_WRAP)) | ||||
| ptrstr = ""; | ptrstr = ""; | ||||
| else | else | ||||
| ptrstr = pout ? "*" : ""; | ptrstr = pout ? "*" : ""; | ||||
| WRITE_COMMA; | WRITE_COMMA; | ||||
| if (flag & PROP_DYNAMIC) | if (flag & PROP_DYNAMIC) | ||||
| fprintf(f, "int %s%s_len, ", (flag & PROP_OUTPUT) ? "*" : "", dp->prop->identifier); | 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), | fprintf(f, "%s %s[%u]", rna_parameter_type_cpp_name(dp->prop), | ||||
| rna_safe_id(dp->prop->identifier), dp->prop->totarraylength); | rna_safe_id(dp->prop->identifier), dp->prop->totarraylength); | ||||
| else { | else { | ||||
| fprintf(f, "%s%s%s%s", | fprintf(f, "%s%s%s%s", | ||||
| rna_parameter_type_cpp_name(dp->prop), | rna_parameter_type_cpp_name(dp->prop), | ||||
| (dp->prop->type == PROP_POINTER && ptrstr[0] == '\0') ? "& " : " ", | (dp->prop->type == PROP_POINTER && ptrstr[0] == '\0') ? "& " : " ", | ||||
| Show All 21 Lines | |||||
| } | } | ||||
| static void rna_def_property_funcs_impl_cpp(FILE *f, StructRNA *srna, PropertyDefRNA *dp) | static void rna_def_property_funcs_impl_cpp(FILE *f, StructRNA *srna, PropertyDefRNA *dp) | ||||
| { | { | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| prop = dp->prop; | prop = dp->prop; | ||||
| if (prop->flag & (PROP_IDPROPERTY | PROP_BUILTIN)) | if (prop->flag & PROP_IDPROPERTY || prop->flag_internal & PROP_INTERN_BUILTIN) { | ||||
| return; | return; | ||||
| } | |||||
| switch (prop->type) { | switch (prop->type) { | ||||
| case PROP_BOOLEAN: | case PROP_BOOLEAN: | ||||
| { | { | ||||
| if (!prop->arraydimension) | if (!prop->arraydimension) | ||||
| fprintf(f, "\tBOOLEAN_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier)); | 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, | fprintf(f, "\tBOOLEAN_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength, | ||||
| ▲ Show 20 Lines • Show All 116 Lines • ▼ Show 20 Lines | if (dp->prop == func->c_ret) | ||||
| continue; | continue; | ||||
| WRITE_COMMA; | WRITE_COMMA; | ||||
| if (dp->prop->flag & PROP_DYNAMIC) | if (dp->prop->flag & PROP_DYNAMIC) | ||||
| fprintf(f, "%s_len, ", dp->prop->identifier); | fprintf(f, "%s_len, ", dp->prop->identifier); | ||||
| if (dp->prop->type == PROP_POINTER) | if (dp->prop->type == PROP_POINTER) | ||||
| if ((dp->prop->flag & PROP_RNAPTR) && !(dp->prop->flag & PROP_THICK_WRAP)) | 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)); | fprintf(f, "(::%s *) &%s.ptr", rna_parameter_type_name(dp->prop), rna_safe_id(dp->prop->identifier)); | ||||
| else if (dp->prop->flag & PROP_OUTPUT) | else if (dp->prop->flag_parameter & PARM_OUTPUT) | ||||
| fprintf(f, "(::%s **) &%s->ptr.data", rna_parameter_type_name(dp->prop), rna_safe_id(dp->prop->identifier)); | fprintf(f, "(::%s **) &%s->ptr.data", rna_parameter_type_name(dp->prop), 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)); | 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, "%s", rna_safe_id(dp->prop->identifier)); | ||||
| } | } | ||||
| fprintf(f, ");\n"); | fprintf(f, ");\n"); | ||||
| Show All 16 Lines | static void rna_def_struct_function_impl_cpp(FILE *f, StructRNA *srna, FunctionDefRNA *dfunc) | ||||
| if (func->c_ret) { | if (func->c_ret) { | ||||
| dp = rna_find_parameter_def(func->c_ret); | dp = rna_find_parameter_def(func->c_ret); | ||||
| if (dp->prop->type == PROP_POINTER) { | if (dp->prop->type == PROP_POINTER) { | ||||
| pprop = (PointerPropertyRNA *) dp->prop; | pprop = (PointerPropertyRNA *) dp->prop; | ||||
| fprintf(f, "\t\tPointerRNA result;\n"); | fprintf(f, "\t\tPointerRNA result;\n"); | ||||
| if ((dp->prop->flag & PROP_RNAPTR) == 0) { | if ((dp->prop->flag_parameter & PARM_RNAPTR) == 0) { | ||||
| StructRNA *ret_srna = rna_find_struct((const char *) pprop->type); | StructRNA *ret_srna = rna_find_struct((const char *) pprop->type); | ||||
| fprintf(f, "\t\t::%s *retdata = ", rna_parameter_type_name(dp->prop)); | fprintf(f, "\t\t::%s *retdata = ", rna_parameter_type_name(dp->prop)); | ||||
| rna_def_struct_function_call_impl_cpp(f, srna, dfunc); | 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"); | 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); | fprintf(f, "\t\tRNA_pointer_create((::ID *) ptr.id.data, &RNA_%s, retdata, &result);\n", (const char *) pprop->type); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 94 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| StructRNA *srna; | StructRNA *srna; | ||||
| FunctionRNA *func; | FunctionRNA *func; | ||||
| PropertyDefRNA *dparm; | PropertyDefRNA *dparm; | ||||
| PropertyType type; | PropertyType type; | ||||
| const char *funcname, *valstr; | const char *funcname, *valstr; | ||||
| const char *ptrstr; | const char *ptrstr; | ||||
| const bool has_data = (dfunc->cont.properties.first != NULL); | const bool has_data = (dfunc->cont.properties.first != NULL); | ||||
| int flag, pout, cptr, first; | int flag, flag_parameter, pout, cptr, first; | ||||
| srna = dsrna->srna; | srna = dsrna->srna; | ||||
| func = dfunc->func; | func = dfunc->func; | ||||
| if (!dfunc->call) | if (!dfunc->call) | ||||
| return; | return; | ||||
| funcname = rna_alloc_function_name(srna->identifier, func->identifier, "call"); | funcname = rna_alloc_function_name(srna->identifier, func->identifier, "call"); | ||||
| Show All 16 Lines | static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA *dfunc) | ||||
| else if (func->flag & FUNC_USE_SELF_TYPE) { | else if (func->flag & FUNC_USE_SELF_TYPE) { | ||||
| fprintf(f, "\tstruct StructRNA *_type;\n"); | fprintf(f, "\tstruct StructRNA *_type;\n"); | ||||
| } | } | ||||
| dparm = dfunc->cont.properties.first; | dparm = dfunc->cont.properties.first; | ||||
| for (; dparm; dparm = dparm->next) { | for (; dparm; dparm = dparm->next) { | ||||
| type = dparm->prop->type; | type = dparm->prop->type; | ||||
| flag = dparm->prop->flag; | flag = dparm->prop->flag; | ||||
| pout = (flag & PROP_OUTPUT); | flag_parameter = dparm->prop->flag_parameter; | ||||
| cptr = ((type == PROP_POINTER) && !(flag & PROP_RNAPTR)); | 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 ? "*" : ""; | ptrstr = cptr || dparm->prop->arraydimension ? "*" : ""; | ||||
| /* XXX only arrays and strings are allowed to be dynamic, is this checked anywhere? */ | /* XXX only arrays and strings are allowed to be dynamic, is this checked anywhere? */ | ||||
| else if (cptr || (flag & PROP_DYNAMIC)) | else if (cptr || (flag & PROP_DYNAMIC)) | ||||
| ptrstr = pout ? "**" : "*"; | ptrstr = pout ? "**" : "*"; | ||||
| /* fixed size arrays and RNA pointers are pre-allocated on the ParameterList stack, pass a pointer to it */ | /* 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 = "*"; | ptrstr = "*"; | ||||
| else if ((type == PROP_POINTER) && (flag & PROP_RNAPTR) && !(flag & PROP_THICK_WRAP)) | else if ((type == PROP_POINTER) && (flag_parameter & PARM_RNAPTR) && !(flag & PROP_THICK_WRAP)) | ||||
| ptrstr = "*"; | 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 */ | * 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 = ""; | ptrstr = ""; | ||||
| else | else | ||||
| ptrstr = pout ? "*" : ""; | ptrstr = pout ? "*" : ""; | ||||
| Show All 29 Lines | static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA *dfunc) | ||||
| if (has_data) { | if (has_data) { | ||||
| fprintf(f, "\t_data = (char *)_parms->data;\n"); | fprintf(f, "\t_data = (char *)_parms->data;\n"); | ||||
| } | } | ||||
| dparm = dfunc->cont.properties.first; | dparm = dfunc->cont.properties.first; | ||||
| for (; dparm; dparm = dparm->next) { | for (; dparm; dparm = dparm->next) { | ||||
| type = dparm->prop->type; | type = dparm->prop->type; | ||||
| flag = dparm->prop->flag; | flag = dparm->prop->flag; | ||||
| pout = (flag & PROP_OUTPUT); | flag_parameter = dparm->prop->flag_parameter; | ||||
| cptr = ((type == PROP_POINTER) && !(flag & PROP_RNAPTR)); | 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"); | fprintf(f, "\t_retdata = _data;\n"); | ||||
| else { | else { | ||||
| const char *data_str; | const char *data_str; | ||||
| if (cptr || (flag & PROP_DYNAMIC)) { | if (cptr || (flag & PROP_DYNAMIC)) { | ||||
| ptrstr = "**"; | ptrstr = "**"; | ||||
| valstr = "*"; | valstr = "*"; | ||||
| ▲ Show 20 Lines • Show All 93 Lines • ▼ Show 20 Lines | for (; dparm; dparm = dparm->next) { | ||||
| else | else | ||||
| fprintf(f, "%s", dparm->prop->identifier); | fprintf(f, "%s", dparm->prop->identifier); | ||||
| } | } | ||||
| fprintf(f, ");\n"); | fprintf(f, ");\n"); | ||||
| if (func->c_ret) { | if (func->c_ret) { | ||||
| dparm = rna_find_parameter_def(func->c_ret); | dparm = rna_find_parameter_def(func->c_ret); | ||||
| ptrstr = (((dparm->prop->type == PROP_POINTER) && !(dparm->prop->flag & PROP_RNAPTR)) || | ptrstr = (((dparm->prop->type == PROP_POINTER) && !(dparm->prop->flag_parameter & PARM_RNAPTR)) || | ||||
| (dparm->prop->arraydimension)) ? "*" : ""; | (dparm->prop->arraydimension)) ? "*" : ""; | ||||
| fprintf(f, "\t*((%s%s %s*)_retdata) = %s;\n", rna_type_struct(dparm->prop), | 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); | rna_parameter_type_name(dparm->prop), ptrstr, func->c_ret->identifier); | ||||
| } | } | ||||
| } | } | ||||
| fprintf(f, "}\n\n"); | fprintf(f, "}\n\n"); | ||||
| ▲ Show 20 Lines • Show All 218 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| static void rna_generate_static_parameter_prototypes(FILE *f, StructRNA *srna, FunctionDefRNA *dfunc, const char *name_override, int close_prototype) | static void rna_generate_static_parameter_prototypes(FILE *f, StructRNA *srna, FunctionDefRNA *dfunc, const char *name_override, int close_prototype) | ||||
| { | { | ||||
| FunctionRNA *func; | FunctionRNA *func; | ||||
| PropertyDefRNA *dparm; | PropertyDefRNA *dparm; | ||||
| StructDefRNA *dsrna; | StructDefRNA *dsrna; | ||||
| PropertyType type; | PropertyType type; | ||||
| int flag, pout, cptr, first; | int flag, flag_parameter, pout, cptr, first; | ||||
| const char *ptrstr; | const char *ptrstr; | ||||
| dsrna = rna_find_struct_def(srna); | dsrna = rna_find_struct_def(srna); | ||||
| func = dfunc->func; | func = dfunc->func; | ||||
| /* return type */ | /* return type */ | ||||
| for (dparm = dfunc->cont.properties.first; dparm; dparm = dparm->next) { | for (dparm = dfunc->cont.properties.first; dparm; dparm = dparm->next) { | ||||
| if (dparm->prop == func->c_ret) { | 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 */ | fprintf(f, "XXX no array return types yet"); /* XXX not supported */ | ||||
| else if (dparm->prop->type == PROP_POINTER && !(dparm->prop->flag & PROP_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)); | 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)); | fprintf(f, "%s%s ", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop)); | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | if (func->flag & FUNC_USE_REPORTS) { | ||||
| first = 0; | first = 0; | ||||
| fprintf(f, "ReportList *reports"); | fprintf(f, "ReportList *reports"); | ||||
| } | } | ||||
| /* defined parameters */ | /* defined parameters */ | ||||
| for (dparm = dfunc->cont.properties.first; dparm; dparm = dparm->next) { | for (dparm = dfunc->cont.properties.first; dparm; dparm = dparm->next) { | ||||
| type = dparm->prop->type; | type = dparm->prop->type; | ||||
| flag = dparm->prop->flag; | flag = dparm->prop->flag; | ||||
| pout = (flag & PROP_OUTPUT); | flag_parameter = dparm->prop->flag_parameter; | ||||
| cptr = ((type == PROP_POINTER) && !(flag & PROP_RNAPTR)); | 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; | continue; | ||||
| if (cptr || (flag & PROP_DYNAMIC)) | if (cptr || (flag & PROP_DYNAMIC)) | ||||
| ptrstr = pout ? "**" : "*"; | ptrstr = pout ? "**" : "*"; | ||||
| else if (type == PROP_POINTER || dparm->prop->arraydimension) | else if (type == PROP_POINTER || dparm->prop->arraydimension) | ||||
| ptrstr = "*"; | ptrstr = "*"; | ||||
| ▲ Show 20 Lines • Show All 238 Lines • ▼ Show 20 Lines | fprintf(f, "%s%s rna_%s%s_%s = {\n", | ||||
| srna->identifier, strnest, prop->identifier); | srna->identifier, strnest, prop->identifier); | ||||
| if (prop->next) fprintf(f, "\t{(PropertyRNA *)&rna_%s%s_%s, ", srna->identifier, strnest, prop->next->identifier); | if (prop->next) fprintf(f, "\t{(PropertyRNA *)&rna_%s%s_%s, ", srna->identifier, strnest, prop->next->identifier); | ||||
| else fprintf(f, "\t{NULL, "); | else fprintf(f, "\t{NULL, "); | ||||
| if (prop->prev) fprintf(f, "(PropertyRNA *)&rna_%s%s_%s,\n", srna->identifier, strnest, prop->prev->identifier); | if (prop->prev) fprintf(f, "(PropertyRNA *)&rna_%s%s_%s,\n", srna->identifier, strnest, prop->prev->identifier); | ||||
| else fprintf(f, "NULL,\n"); | else fprintf(f, "NULL,\n"); | ||||
| fprintf(f, "\t%d, ", prop->magic); | fprintf(f, "\t%d, ", prop->magic); | ||||
| rna_print_c_string(f, prop->identifier); | rna_print_c_string(f, prop->identifier); | ||||
| fprintf(f, ", %d, ", prop->flag); | fprintf(f, ", %d, %d, %d, ", prop->flag, prop->flag_parameter, prop->flag_internal); | ||||
| rna_print_c_string(f, prop->name); fprintf(f, ",\n\t"); | rna_print_c_string(f, prop->name); fprintf(f, ",\n\t"); | ||||
| rna_print_c_string(f, prop->description); fprintf(f, ",\n\t"); | rna_print_c_string(f, prop->description); fprintf(f, ",\n\t"); | ||||
| fprintf(f, "%d, ", prop->icon); | fprintf(f, "%d, ", prop->icon); | ||||
| rna_print_c_string(f, prop->translation_context); fprintf(f, ",\n"); | rna_print_c_string(f, prop->translation_context); fprintf(f, ",\n"); | ||||
| fprintf(f, "\t%s, %s | %s, %s, %u, {%u, %u, %u}, %u,\n", | fprintf(f, "\t%s, %s | %s, %s, %u, {%u, %u, %u}, %u,\n", | ||||
| RNA_property_typename(prop->type), | RNA_property_typename(prop->type), | ||||
| rna_property_subtypename(prop->subtype), | rna_property_subtypename(prop->subtype), | ||||
| rna_property_subtype_unit(prop->subtype), | rna_property_subtype_unit(prop->subtype), | ||||
| rna_function_string(prop->getlength), | rna_function_string(prop->getlength), | ||||
| prop->arraydimension, | prop->arraydimension, | ||||
| prop->arraylength[0], | prop->arraylength[0], | ||||
| prop->arraylength[1], | prop->arraylength[1], | ||||
| prop->arraylength[2], | prop->arraylength[2], | ||||
| prop->totarraylength); | prop->totarraylength); | ||||
| fprintf(f, "\t%s%s, %d, %s, %s,\n", | fprintf(f, "\t%s%s, %d, %s, %s,\n", | ||||
| (prop->flag & PROP_CONTEXT_UPDATE) ? "(UpdateFunc)" : "", | (prop->flag & PROP_CONTEXT_UPDATE) ? "(UpdateFunc)" : "", | ||||
| rna_function_string(prop->update), | rna_function_string(prop->update), | ||||
| prop->noteflag, | prop->noteflag, | ||||
| rna_function_string(prop->editable), | rna_function_string(prop->editable), | ||||
| rna_function_string(prop->itemeditable)); | rna_function_string(prop->itemeditable)); | ||||
| if (prop->flag & PROP_RAW_ACCESS) rna_set_raw_offset(f, srna, prop); | if (prop->flag_internal & PROP_INTERN_RAW_ACCESS) rna_set_raw_offset(f, srna, prop); | ||||
| else fprintf(f, "\t0, -1"); | else fprintf(f, "\t0, -1"); | ||||
| /* our own type - collections/arrays only */ | /* our own type - collections/arrays only */ | ||||
| if (prop->srna) fprintf(f, ", &RNA_%s", (const char *)prop->srna); | if (prop->srna) fprintf(f, ", &RNA_%s", (const char *)prop->srna); | ||||
| else fprintf(f, ", NULL"); | else fprintf(f, ", NULL"); | ||||
| fprintf(f, "},\n"); | fprintf(f, "},\n"); | ||||
| ▲ Show 20 Lines • Show All 771 Lines • ▼ Show 20 Lines | |||||
| "public:\n" | "public:\n" | ||||
| " DefaultCollectionFunctions(const PointerRNA & /*p*/) {}\n" | " DefaultCollectionFunctions(const PointerRNA & /*p*/) {}\n" | ||||
| "};\n" | "};\n" | ||||
| "\n" | "\n" | ||||
| "\n"; | "\n"; | ||||
| static int rna_is_collection_prop(PropertyRNA *prop) | static int rna_is_collection_prop(PropertyRNA *prop) | ||||
| { | { | ||||
| if (!(prop->flag & (PROP_IDPROPERTY | PROP_BUILTIN))) | if (!(prop->flag & PROP_IDPROPERTY || prop->flag_internal & PROP_INTERN_BUILTIN)) { | ||||
| if (prop->type == PROP_COLLECTION) | if (prop->type == PROP_COLLECTION) { | ||||
| return 1; | return 1; | ||||
| } | |||||
| } | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| static int rna_is_collection_functions_struct(const char **collection_structs, const char *struct_name) | static int rna_is_collection_functions_struct(const char **collection_structs, const char *struct_name) | ||||
| { | { | ||||
| int a = 0, found = 0; | int a = 0, found = 0; | ||||
| ▲ Show 20 Lines • Show All 325 Lines • Show Last 20 Lines | |||||