mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
Fix T90417: font loading creates duplicate ID names
Also repair any errors in existing files.
Error from e0dd3fe587.
This commit is contained in:
parent
a1b687c7a4
commit
2bb38f3022
3 changed files with 8 additions and 7 deletions
|
|
@ -39,7 +39,7 @@ extern "C" {
|
|||
|
||||
/* Blender file format version. */
|
||||
#define BLENDER_FILE_VERSION BLENDER_VERSION
|
||||
#define BLENDER_FILE_SUBVERSION 20
|
||||
#define BLENDER_FILE_SUBVERSION 21
|
||||
|
||||
/* Minimum Blender version that supports reading file written with the current
|
||||
* version. Older Blender versions will test this and show a warning if the file
|
||||
|
|
|
|||
|
|
@ -337,13 +337,9 @@ VFont *BKE_vfont_load(Main *bmain, const char *filepath)
|
|||
|
||||
vfd = BLI_vfontdata_from_freetypefont(pf);
|
||||
if (vfd) {
|
||||
vfont = BKE_libblock_alloc(bmain, ID_VF, filename, 0);
|
||||
/* If there's a font name, use it for the ID name. */
|
||||
vfont = BKE_libblock_alloc(bmain, ID_VF, vfd->name[0] ? vfd->name : filename, 0);
|
||||
vfont->data = vfd;
|
||||
|
||||
/* if there's a font name, use it for the ID name */
|
||||
if (vfd->name[0] != '\0') {
|
||||
BLI_strncpy(vfont->id.name + 2, vfd->name, sizeof(vfont->id.name) - 2);
|
||||
}
|
||||
BLI_strncpy(vfont->filepath, filepath, sizeof(vfont->filepath));
|
||||
|
||||
/* if autopack is on store the packedfile in de font structure */
|
||||
|
|
|
|||
|
|
@ -2087,6 +2087,11 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
|||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 300, 20)) {
|
||||
ListBase *lb = which_libbase(bmain, ID_VF);
|
||||
BKE_main_id_repair_duplicate_names_listbase(lb);
|
||||
}
|
||||
|
||||
/**
|
||||
* Versioning code until next subversion bump goes here.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue