diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-06-23 02:54:14 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-06-23 04:29:36 +0300 |
commit | 716a8241d387180fd8ad69cdec33633bc7a0f963 (patch) | |
tree | d4674969beacfa6f9d50726f5943e050a373f2b5 /source/blender/blenkernel/intern/packedFile.c | |
parent | a573d7e8a14ce5e49b8c05ff762a00e181e905aa (diff) |
Cleanup: rename 'name' to 'filepath' for DNA types
Using 'name' for the full path of a file reads badly,
especially when id.name is used in related code.
Diffstat (limited to 'source/blender/blenkernel/intern/packedFile.c')
-rw-r--r-- | source/blender/blenkernel/intern/packedFile.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c index 476d1a3a91f..2cd5588ccb8 100644 --- a/source/blender/blenkernel/intern/packedFile.c +++ b/source/blender/blenkernel/intern/packedFile.c @@ -264,14 +264,16 @@ void BKE_packedfile_pack_all(Main *bmain, ReportList *reports, bool verbose) for (vfont = bmain->fonts.first; vfont; vfont = vfont->id.next) { if (vfont->packedfile == NULL && !ID_IS_LINKED(vfont) && BKE_vfont_is_builtin(vfont) == false) { - vfont->packedfile = BKE_packedfile_new(reports, vfont->name, BKE_main_blendfile_path(bmain)); + vfont->packedfile = BKE_packedfile_new( + reports, vfont->filepath, BKE_main_blendfile_path(bmain)); tot++; } } for (sound = bmain->sounds.first; sound; sound = sound->id.next) { if (sound->packedfile == NULL && !ID_IS_LINKED(sound)) { - sound->packedfile = BKE_packedfile_new(reports, sound->name, BKE_main_blendfile_path(bmain)); + sound->packedfile = BKE_packedfile_new( + reports, sound->filepath, BKE_main_blendfile_path(bmain)); tot++; } } @@ -566,14 +568,14 @@ int BKE_packedfile_unpack_vfont(Main *bmain, if (vfont != NULL) { unpack_generate_paths( - vfont->name, (ID *)vfont, absname, localname, sizeof(absname), sizeof(localname)); + vfont->filepath, (ID *)vfont, absname, localname, sizeof(absname), sizeof(localname)); newname = BKE_packedfile_unpack_to_file( reports, BKE_main_blendfile_path(bmain), absname, localname, vfont->packedfile, how); if (newname != NULL) { ret_value = RET_OK; BKE_packedfile_free(vfont->packedfile); vfont->packedfile = NULL; - BLI_strncpy(vfont->name, newname, sizeof(vfont->name)); + BLI_strncpy(vfont->filepath, newname, sizeof(vfont->filepath)); MEM_freeN(newname); } } @@ -592,11 +594,11 @@ int BKE_packedfile_unpack_sound(Main *bmain, if (sound != NULL) { unpack_generate_paths( - sound->name, (ID *)sound, absname, localname, sizeof(absname), sizeof(localname)); + sound->filepath, (ID *)sound, absname, localname, sizeof(absname), sizeof(localname)); newname = BKE_packedfile_unpack_to_file( reports, BKE_main_blendfile_path(bmain), absname, localname, sound->packedfile, how); if (newname != NULL) { - BLI_strncpy(sound->name, newname, sizeof(sound->name)); + BLI_strncpy(sound->filepath, newname, sizeof(sound->filepath)); MEM_freeN(newname); BKE_packedfile_free(sound->packedfile); @@ -644,7 +646,7 @@ int BKE_packedfile_unpack_image(Main *bmain, /* keep the new name in the image for non-pack specific reasons */ if (how != PF_REMOVE) { - BLI_strncpy(ima->name, newname, sizeof(imapf->filepath)); + BLI_strncpy(ima->filepath, newname, sizeof(imapf->filepath)); } MEM_freeN(newname); } @@ -701,7 +703,7 @@ int BKE_packedfile_unpack_all_libraries(Main *bmain, ReportList *reports) int ret_value = RET_ERROR; for (lib = bmain->libraries.first; lib; lib = lib->id.next) { - if (lib->packedfile && lib->name[0]) { + if (lib->packedfile && lib->filepath[0]) { newname = BKE_packedfile_unpack_to_file(reports, BKE_main_blendfile_path(bmain), @@ -731,19 +733,19 @@ void BKE_packedfile_pack_all_libraries(Main *bmain, ReportList *reports) /* test for relativenss */ for (lib = bmain->libraries.first; lib; lib = lib->id.next) { - if (!BLI_path_is_rel(lib->name)) { + if (!BLI_path_is_rel(lib->filepath)) { break; } } if (lib) { - BKE_reportf(reports, RPT_ERROR, "Cannot pack absolute file: '%s'", lib->name); + BKE_reportf(reports, RPT_ERROR, "Cannot pack absolute file: '%s'", lib->filepath); return; } for (lib = bmain->libraries.first; lib; lib = lib->id.next) { if (lib->packedfile == NULL) { - lib->packedfile = BKE_packedfile_new(reports, lib->name, BKE_main_blendfile_path(bmain)); + lib->packedfile = BKE_packedfile_new(reports, lib->filepath, BKE_main_blendfile_path(bmain)); } } } @@ -844,7 +846,7 @@ void BKE_packedfile_id_unpack(Main *bmain, ID *id, ReportList *reports, enum ePF } case ID_LI: { Library *li = (Library *)id; - BKE_reportf(reports, RPT_ERROR, "Cannot unpack individual Library file, '%s'", li->name); + BKE_reportf(reports, RPT_ERROR, "Cannot unpack individual Library file, '%s'", li->filepath); break; } default: |