This patch supports forward compatible renaming of structs and struct members.
Tested the patch to rename:
- Lamp to Light
- Light.clipsta to Light.clip_start
- Camera.YF_dofdist to Camera.dof_dist.
- SpaceOops to SpaceOutliner.
See: T61500 for proposed changes.
Blend files saves with this renaming load with the patch applied or not.
However these changes aren't included in this patch, instead the patch includes a utility, run:
How it Works
Once a struct or struct member is renamed the old name only needs to be referenced once in dna_rename_defs.h, this causes the SDNA written to disk to use the old name.
Only makesdna and makesrna need to handle this, so it's all managed at build time.
- No run-time penalty since all versioning happens in makesdna and makesrna.
- Collisions caused by renaming aren't allowed (a makesdna error for struct members, structs themselves cause a duplicate enum - also failing).
- The changes in dna_rename_defs.h are just suggestions & to test renaming works.
- All versioning is done in dna_rename_defs.h (nice to keep DNA versioning in the one place).
Current naming conventions:
- struct_* the name of a struct.
- elem_* a struct member.
- *_static name of data stored on disk (changes from dna_rename_defs.c applied).
- *_runtime name of data used at runtime (names used in DNA_*.h headers).
- _trimmed variable names without pointer/array sizes, eg *var would be trimmed to var.
- DNA_alias_* is used for the API, since this isn't renaming DNA, the original members still exist and can't be used again.