Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/makesrna.c
| Context not available. | |||||
| fprintf(f, "\t_data = (char *)_parms->data;\n"); | fprintf(f, "\t_data = (char *)_parms->data;\n"); | ||||
| } | } | ||||
| int buf_size = 0; | |||||
| struct ParameterInfo this_parm_info; | |||||
| struct ParameterInfo next_parm_info; | |||||
| dparm = dfunc->cont.properties.first; | dparm = dfunc->cont.properties.first; | ||||
| next_parm_info = rna_parameter_info((dparm != NULLPTR) ? (dparm->prop) : NULLPTR); | |||||
| for (; dparm; dparm = dparm->next) { | for (; dparm; dparm = dparm->next) { | ||||
| this_parm_info = next_parm_info; | |||||
| next_parm_info = rna_parameter_info((dparm->next != NULLPTR) ? (dparm->next->prop) : NULLPTR); | |||||
| type = dparm->prop->type; | type = dparm->prop->type; | ||||
| flag = dparm->prop->flag; | flag = dparm->prop->flag; | ||||
| flag_parameter = dparm->prop->flag_parameter; | flag_parameter = dparm->prop->flag_parameter; | ||||
linux_dr: I really think this should be:
```
fprintf(f, "\t_data += sizeof(%s)", parm_typename);
if… | |||||
Done Inline ActionsWould improving the readability of the generated code be acceptable as a separate patch?0 linux_dr: Would improving the readability of the generated code be acceptable as a separate patch?0 | |||||
Done Inline ActionsI keep seeing parm and reading "parmesan"... May we rename this param? linux_dr: I keep seeing `parm` and reading "parmesan"... May we rename this `param`? | |||||
| Context not available. | |||||
| } | } | ||||
| if (dparm->next) { | if (dparm->next) { | ||||
| fprintf(f, "\t_data += %d;\n", rna_parameter_size(dparm->prop)); | size_t padding = rna_compute_parameter_padding( | ||||
| buf_size, this_parm_info.size, next_parm_info.alignment); | |||||
| buf_size += (this_parm_info.size + padding); | |||||
| fprintf(f, "\t_data += "); | |||||
| if (this_parm_info.orig_type_name != NULL) { | |||||
| fprintf(f, "/* sizeof(%s): */ ", this_parm_info.orig_type_name); | |||||
| } | |||||
| if (this_parm_info.c_type_name == NULL) { | |||||
| fprintf(f, "%lu", this_parm_info.size); | |||||
| } | |||||
| else if (this_parm_info.count == RNA_PARAMETER_INFO__COUNT__NOT_AN_ARRAY) { | |||||
| fprintf(f, "sizeof(%s)", this_parm_info.c_type_name); | |||||
| } | |||||
| else { | |||||
| fprintf(f, "sizeof(%s[%lu])", this_parm_info.c_type_name, this_parm_info.count); | |||||
| } | |||||
| if (padding > 0) { | |||||
| fprintf(f, " + /* Padding: */ %lu", padding); | |||||
| } | |||||
| fprintf(f, ";\n"); | |||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
I really think this should be:
fprintf(f, "\t_data += sizeof(%s)", parm_typename); if (parm_padding > 0) { fprintf(f, " + %d", parm_padding); } fprintf(f, ";\n");but we'd need the type name as a string, and the padding as a separate value.