diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-07-07 16:57:35 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-07-07 16:57:35 +0300 |
commit | 084d545202c27fda5117817491c8d5761b4daafc (patch) | |
tree | 8fa4b7a6cdec77ce07237b5e37370406bcedfda5 /source/blender/blenkernel | |
parent | 28057d54de98687ed6ffdd47c2fcbb2e40f31d2e (diff) |
Cleanup: use BKE_packedfile prefix for function names
Avoid ambiguity with terms check & compare.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_packedFile.h | 76 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/font.c | 25 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 17 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/library.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/packedFile.c | 117 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sound.c | 4 |
6 files changed, 129 insertions, 112 deletions
diff --git a/source/blender/blenkernel/BKE_packedFile.h b/source/blender/blenkernel/BKE_packedFile.h index ad0f474a730..9eeb2ba076e 100644 --- a/source/blender/blenkernel/BKE_packedFile.h +++ b/source/blender/blenkernel/BKE_packedFile.h @@ -34,49 +34,63 @@ struct VFont; struct bSound; /* pack */ -struct PackedFile *dupPackedFile(const struct PackedFile *pf_src); -struct PackedFile *newPackedFile(struct ReportList *reports, - const char *filename, - const char *relabase); -struct PackedFile *newPackedFileMemory(void *mem, int memlen); +struct PackedFile *BKE_packedfile_duplicate(const struct PackedFile *pf_src); +struct PackedFile *BKE_packedfile_new(struct ReportList *reports, + const char *filename, + const char *relabase); +struct PackedFile *BKE_packedfile_new_from_memory(void *mem, int memlen); -void packAll(struct Main *bmain, struct ReportList *reports, bool verbose); -void packLibraries(struct Main *bmain, struct ReportList *reports); +void BKE_packedfile_pack_all(struct Main *bmain, struct ReportList *reports, bool verbose); +void BKE_packedfile_pack_all_libraries(struct Main *bmain, struct ReportList *reports); /* unpack */ -char *unpackFile(struct ReportList *reports, - const char *ref_file_name, - const char *abs_name, - const char *local_name, - struct PackedFile *pf, - int how); -int unpackVFont(struct Main *bmain, struct ReportList *reports, struct VFont *vfont, int how); -int unpackSound(struct Main *bmain, struct ReportList *reports, struct bSound *sound, int how); -int unpackImage(struct Main *bmain, struct ReportList *reports, struct Image *ima, int how); -void unpackAll(struct Main *bmain, struct ReportList *reports, int how); -int unpackLibraries(struct Main *bmain, struct ReportList *reports); +char *BKE_packedfile_unpack_to_file(struct ReportList *reports, + const char *ref_file_name, + const char *abs_name, + const char *local_name, + struct PackedFile *pf, + int how); +int BKE_packedfile_unpack_vfont(struct Main *bmain, + struct ReportList *reports, + struct VFont *vfont, + int how); +int BKE_packedfile_unpack_sound(struct Main *bmain, + struct ReportList *reports, + struct bSound *sound, + int how); +int BKE_packedfile_unpack_image(struct Main *bmain, + struct ReportList *reports, + struct Image *ima, + int how); +void BKE_packedfile_unpack_all(struct Main *bmain, struct ReportList *reports, int how); +int BKE_packedfile_unpack_all_libraries(struct Main *bmain, struct ReportList *reports); -int writePackedFile(struct ReportList *reports, - const char *ref_file_name, - const char *filename, - struct PackedFile *pf, - const bool guimode); +int BKE_packedfile_write_to_file(struct ReportList *reports, + const char *ref_file_name, + const char *filename, + struct PackedFile *pf, + const bool guimode); /* free */ -void freePackedFile(struct PackedFile *pf); +void BKE_packedfile_free(struct PackedFile *pf); /* info */ -int countPackedFiles(struct Main *bmain); -int checkPackedFile(const char *ref_file_name, const char *filename, struct PackedFile *pf); +int BKE_packedfile_count_all(struct Main *bmain); +int BKE_packedfile_compare_to_file(const char *ref_file_name, + const char *filename, + struct PackedFile *pf); /* read */ -int seekPackedFile(struct PackedFile *pf, int offset, int whence); -void rewindPackedFile(struct PackedFile *pf); -int readPackedFile(struct PackedFile *pf, void *data, int size); +int BKE_packedfile_seek(struct PackedFile *pf, int offset, int whence); +void BKE_packedfile_rewind(struct PackedFile *pf); +int BKE_packedfile_read(struct PackedFile *pf, void *data, int size); /* ID should be not NULL, return 1 if there's a packed file */ -bool BKE_pack_check(struct ID *id); +bool BKE_packedfile_id_check(struct ID *id); /* ID should be not NULL, throws error when ID is Library */ -void BKE_unpack_id(struct Main *bmain, struct ID *id, struct ReportList *reports, int how); +void BKE_packedfile_id_unpack(struct Main *bmain, + struct ID *id, + struct ReportList *reports, + int how); #endif diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index 3f8fc697c6c..a0216e9b413 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -86,7 +86,7 @@ void BKE_vfont_free_data(struct VFont *vfont) } if (vfont->temp_pf) { - freePackedFile(vfont->temp_pf); /* NULL when the font file can't be found on disk */ + BKE_packedfile_free(vfont->temp_pf); /* NULL when the font file can't be found on disk */ vfont->temp_pf = NULL; } } @@ -97,7 +97,7 @@ void BKE_vfont_free(struct VFont *vf) BKE_vfont_free_data(vf); if (vf->packedfile) { - freePackedFile(vf->packedfile); + BKE_packedfile_free(vf->packedfile); vf->packedfile = NULL; } } @@ -114,7 +114,7 @@ void BKE_vfont_copy_data(Main *UNUSED(bmain), vfont_dst->temp_pf = NULL; if (vfont_dst->packedfile) { - vfont_dst->packedfile = dupPackedFile(vfont_dst->packedfile); + vfont_dst->packedfile = BKE_packedfile_duplicate(vfont_dst->packedfile); } if (vfont_dst->data) { @@ -148,7 +148,7 @@ static PackedFile *get_builtin_packedfile(void) memcpy(mem, builtin_font_data, builtin_font_size); - return newPackedFileMemory(mem, builtin_font_size); + return BKE_packedfile_new_from_memory(mem, builtin_font_size); } } @@ -183,14 +183,15 @@ static VFontData *vfont_get_data(VFont *vfont) /* We need to copy a tmp font to memory unless it is already there */ if (vfont->temp_pf == NULL) { - vfont->temp_pf = dupPackedFile(pf); + vfont->temp_pf = BKE_packedfile_duplicate(pf); } } else { - pf = newPackedFile(NULL, vfont->name, ID_BLEND_PATH_FROM_GLOBAL(&vfont->id)); + pf = BKE_packedfile_new(NULL, vfont->name, ID_BLEND_PATH_FROM_GLOBAL(&vfont->id)); if (vfont->temp_pf == NULL) { - vfont->temp_pf = newPackedFile(NULL, vfont->name, ID_BLEND_PATH_FROM_GLOBAL(&vfont->id)); + vfont->temp_pf = BKE_packedfile_new( + NULL, vfont->name, ID_BLEND_PATH_FROM_GLOBAL(&vfont->id)); } } if (!pf) { @@ -208,7 +209,7 @@ static VFontData *vfont_get_data(VFont *vfont) if (pf) { vfont->data = BLI_vfontdata_from_freetypefont(pf); if (pf != vfont->packedfile) { - freePackedFile(pf); + BKE_packedfile_free(pf); } } @@ -234,7 +235,7 @@ void BKE_vfont_init(VFont *vfont) } /* Free the packed file */ - freePackedFile(pf); + BKE_packedfile_free(pf); } } @@ -253,7 +254,7 @@ VFont *BKE_vfont_load(Main *bmain, const char *filepath) } else { BLI_split_file_part(filepath, filename, sizeof(filename)); - pf = newPackedFile(NULL, filepath, BKE_main_blendfile_path(bmain)); + pf = BKE_packedfile_new(NULL, filepath, BKE_main_blendfile_path(bmain)); is_builtin = false; } @@ -279,13 +280,13 @@ VFont *BKE_vfont_load(Main *bmain, const char *filepath) /* Do not add FO_BUILTIN_NAME to temporary listbase */ if (!STREQ(filename, FO_BUILTIN_NAME)) { - vfont->temp_pf = newPackedFile(NULL, filepath, BKE_main_blendfile_path(bmain)); + vfont->temp_pf = BKE_packedfile_new(NULL, filepath, BKE_main_blendfile_path(bmain)); } } /* Free the packed file */ if (!vfont || vfont->packedfile != pf) { - freePackedFile(pf); + BKE_packedfile_free(pf); } } diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 72bad56990f..f03ca46b34e 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -198,7 +198,7 @@ static void image_free_packedfiles(Image *ima) while (ima->packedfiles.last) { ImagePackedFile *imapf = ima->packedfiles.last; if (imapf->packedfile) { - freePackedFile(imapf->packedfile); + BKE_packedfile_free(imapf->packedfile); } BLI_remlink(&ima->packedfiles, imapf); MEM_freeN(imapf); @@ -377,7 +377,7 @@ static void copy_image_packedfiles(ListBase *lb_dst, const ListBase *lb_src) STRNCPY(imapf_dst->filepath, imapf_src->filepath); if (imapf_src->packedfile) { - imapf_dst->packedfile = dupPackedFile(imapf_src->packedfile); + imapf_dst->packedfile = BKE_packedfile_duplicate(imapf_src->packedfile); } BLI_addtail(lb_dst, imapf_dst); @@ -838,7 +838,7 @@ void BKE_image_packfiles(ReportList *reports, Image *ima, const char *basepath) if (totfiles == 1) { ImagePackedFile *imapf = MEM_mallocN(sizeof(ImagePackedFile), "Image packed file"); BLI_addtail(&ima->packedfiles, imapf); - imapf->packedfile = newPackedFile(reports, ima->name, basepath); + imapf->packedfile = BKE_packedfile_new(reports, ima->name, basepath); if (imapf->packedfile) { STRNCPY(imapf->filepath, ima->name); } @@ -852,7 +852,7 @@ void BKE_image_packfiles(ReportList *reports, Image *ima, const char *basepath) ImagePackedFile *imapf = MEM_mallocN(sizeof(ImagePackedFile), "Image packed file"); BLI_addtail(&ima->packedfiles, imapf); - imapf->packedfile = newPackedFile(reports, iv->filepath, basepath); + imapf->packedfile = BKE_packedfile_new(reports, iv->filepath, basepath); if (imapf->packedfile) { STRNCPY(imapf->filepath, iv->filepath); } @@ -876,7 +876,7 @@ void BKE_image_packfiles_from_mem(ReportList *reports, else { ImagePackedFile *imapf = MEM_mallocN(sizeof(ImagePackedFile), __func__); BLI_addtail(&ima->packedfiles, imapf); - imapf->packedfile = newPackedFileMemory(data, data_len); + imapf->packedfile = BKE_packedfile_new_from_memory(data, data_len); STRNCPY(imapf->filepath, ima->name); } } @@ -3241,9 +3241,9 @@ void BKE_image_signal(Main *bmain, Image *ima, ImageUser *iuser, int signal) ImagePackedFile *imapf; for (imapf = ima->packedfiles.first; imapf; imapf = imapf->next) { PackedFile *pf; - pf = newPackedFile(NULL, imapf->filepath, ID_BLEND_PATH(bmain, &ima->id)); + pf = BKE_packedfile_new(NULL, imapf->filepath, ID_BLEND_PATH(bmain, &ima->id)); if (pf) { - freePackedFile(imapf->packedfile); + BKE_packedfile_free(imapf->packedfile); imapf->packedfile = pf; } else { @@ -4014,7 +4014,8 @@ static ImBuf *load_image_single(Image *ima, BLI_addtail(&ima->packedfiles, imapf); STRNCPY(imapf->filepath, filepath); - imapf->packedfile = newPackedFile(NULL, filepath, ID_BLEND_PATH_FROM_GLOBAL(&ima->id)); + imapf->packedfile = BKE_packedfile_new( + NULL, filepath, ID_BLEND_PATH_FROM_GLOBAL(&ima->id)); } } } diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index ab5ae7be5a6..7e8128945e7 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1502,7 +1502,7 @@ void *BKE_libblock_copy_for_localize(const ID *id) void BKE_library_free(Library *lib) { if (lib->packedfile) { - freePackedFile(lib->packedfile); + BKE_packedfile_free(lib->packedfile); } } diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c index dd91878a15b..d4deb6ee7e5 100644 --- a/source/blender/blenkernel/intern/packedFile.c +++ b/source/blender/blenkernel/intern/packedFile.c @@ -49,7 +49,7 @@ #include "BKE_report.h" #include "BKE_sound.h" -int seekPackedFile(PackedFile *pf, int offset, int whence) +int BKE_packedfile_seek(PackedFile *pf, int offset, int whence) { int oldseek = -1, seek = 0; @@ -81,12 +81,12 @@ int seekPackedFile(PackedFile *pf, int offset, int whence) return (oldseek); } -void rewindPackedFile(PackedFile *pf) +void BKE_packedfile_rewind(PackedFile *pf) { - seekPackedFile(pf, 0, SEEK_SET); + BKE_packedfile_seek(pf, 0, SEEK_SET); } -int readPackedFile(PackedFile *pf, void *data, int size) +int BKE_packedfile_read(PackedFile *pf, void *data, int size) { if ((pf != NULL) && (size >= 0) && (data != NULL)) { if (size + pf->seek > pf->size) { @@ -109,7 +109,7 @@ int readPackedFile(PackedFile *pf, void *data, int size) return (size); } -int countPackedFiles(Main *bmain) +int BKE_packedfile_count_all(Main *bmain) { Image *ima; VFont *vf; @@ -138,18 +138,18 @@ int countPackedFiles(Main *bmain) return count; } -void freePackedFile(PackedFile *pf) +void BKE_packedfile_free(PackedFile *pf) { if (pf) { MEM_freeN(pf->data); MEM_freeN(pf); } else { - printf("freePackedFile: Trying to free a NULL pointer\n"); + printf("BKE_packedfile_free: Trying to free a NULL pointer\n"); } } -PackedFile *dupPackedFile(const PackedFile *pf_src) +PackedFile *BKE_packedfile_duplicate(const PackedFile *pf_src) { PackedFile *pf_dst; @@ -159,7 +159,7 @@ PackedFile *dupPackedFile(const PackedFile *pf_src) return pf_dst; } -PackedFile *newPackedFileMemory(void *mem, int memlen) +PackedFile *BKE_packedfile_new_from_memory(void *mem, int memlen) { PackedFile *pf = MEM_callocN(sizeof(*pf), "PackedFile"); pf->data = mem; @@ -168,7 +168,7 @@ PackedFile *newPackedFileMemory(void *mem, int memlen) return pf; } -PackedFile *newPackedFile(ReportList *reports, const char *filename, const char *basepath) +PackedFile *BKE_packedfile_new(ReportList *reports, const char *filename, const char *basepath) { PackedFile *pf = NULL; int file, filelen; @@ -207,7 +207,7 @@ PackedFile *newPackedFile(ReportList *reports, const char *filename, const char data = MEM_mallocN(filelen, "packFile"); } if (read(file, data, filelen) == filelen) { - pf = newPackedFileMemory(data, filelen); + pf = BKE_packedfile_new_from_memory(data, filelen); } else { MEM_freeN(data); @@ -222,7 +222,7 @@ PackedFile *newPackedFile(ReportList *reports, const char *filename, const char } /* no libraries for now */ -void packAll(Main *bmain, ReportList *reports, bool verbose) +void BKE_packedfile_pack_all(Main *bmain, ReportList *reports, bool verbose) { Image *ima; VFont *vfont; @@ -247,14 +247,14 @@ void packAll(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 = newPackedFile(reports, vfont->name, BKE_main_blendfile_path(bmain)); + vfont->packedfile = BKE_packedfile_new(reports, vfont->name, 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 = newPackedFile(reports, sound->name, BKE_main_blendfile_path(bmain)); + sound->packedfile = BKE_packedfile_new(reports, sound->name, BKE_main_blendfile_path(bmain)); tot++; } } @@ -267,11 +267,11 @@ void packAll(Main *bmain, ReportList *reports, bool verbose) } } -int writePackedFile(ReportList *reports, - const char *ref_file_name, - const char *filename, - PackedFile *pf, - const bool guimode) +int BKE_packedfile_write_to_file(ReportList *reports, + const char *ref_file_name, + const char *filename, + PackedFile *pf, + const bool guimode) { int file, number; int ret_value = RET_OK; @@ -349,7 +349,7 @@ int writePackedFile(ReportList *reports, * - PF_DIFFERENT: the packed file and original file differ * - PF_NOFILE: the original file doesn't exist */ -int checkPackedFile(const char *ref_file_name, const char *filename, PackedFile *pf) +int BKE_packedfile_compare_to_file(const char *ref_file_name, const char *filename, PackedFile *pf) { BLI_stat_t st; int ret_val, i, len, file; @@ -402,7 +402,8 @@ int checkPackedFile(const char *ref_file_name, const char *filename, PackedFile } /** - * unpackFile() looks at the existing files (abs_name, local_name) and a packed file. + * #BKE_packedfile_unpack_to_file() looks at the existing files (abs_name, local_name) + * and a packed file. * * It returns a char *to the existing file name / new file name or NULL when * there was an error or when the user decides to cancel the operation. @@ -410,12 +411,12 @@ int checkPackedFile(const char *ref_file_name, const char *filename, PackedFile * \warning 'abs_name' may be relative still! (use a "//" prefix) * be sure to run #BLI_path_abs on it first. */ -char *unpackFile(ReportList *reports, - const char *ref_file_name, - const char *abs_name, - const char *local_name, - PackedFile *pf, - int how) +char *BKE_packedfile_unpack_to_file(ReportList *reports, + const char *ref_file_name, + const char *abs_name, + const char *local_name, + PackedFile *pf, + int how) { char *newname = NULL; const char *temp = NULL; @@ -443,7 +444,7 @@ char *unpackFile(ReportList *reports, ATTR_FALLTHROUGH; } case PF_WRITE_LOCAL: - if (writePackedFile(reports, ref_file_name, local_name, pf, 1) == RET_OK) { + if (BKE_packedfile_write_to_file(reports, ref_file_name, local_name, pf, 1) == RET_OK) { temp = local_name; } break; @@ -463,12 +464,12 @@ char *unpackFile(ReportList *reports, ATTR_FALLTHROUGH; } case PF_WRITE_ORIGINAL: - if (writePackedFile(reports, ref_file_name, abs_name, pf, 1) == RET_OK) { + if (BKE_packedfile_write_to_file(reports, ref_file_name, abs_name, pf, 1) == RET_OK) { temp = abs_name; } break; default: - printf("unpackFile: unknown return_value %d\n", how); + printf("BKE_packedfile_unpack_to_file: unknown return_value %d\n", how); break; } @@ -525,7 +526,7 @@ static void unpack_generate_paths(const char *name, } } -int unpackVFont(Main *bmain, ReportList *reports, VFont *vfont, int how) +int BKE_packedfile_unpack_vfont(Main *bmain, ReportList *reports, VFont *vfont, int how) { char localname[FILE_MAX], absname[FILE_MAX]; char *newname; @@ -534,11 +535,11 @@ int unpackVFont(Main *bmain, ReportList *reports, VFont *vfont, int how) if (vfont != NULL) { unpack_generate_paths( vfont->name, (ID *)vfont, absname, localname, sizeof(absname), sizeof(localname)); - newname = unpackFile( + newname = BKE_packedfile_unpack_to_file( reports, BKE_main_blendfile_path(bmain), absname, localname, vfont->packedfile, how); if (newname != NULL) { ret_value = RET_OK; - freePackedFile(vfont->packedfile); + BKE_packedfile_free(vfont->packedfile); vfont->packedfile = NULL; BLI_strncpy(vfont->name, newname, sizeof(vfont->name)); MEM_freeN(newname); @@ -548,7 +549,7 @@ int unpackVFont(Main *bmain, ReportList *reports, VFont *vfont, int how) return (ret_value); } -int unpackSound(Main *bmain, ReportList *reports, bSound *sound, int how) +int BKE_packedfile_unpack_sound(Main *bmain, ReportList *reports, bSound *sound, int how) { char localname[FILE_MAX], absname[FILE_MAX]; char *newname; @@ -557,13 +558,13 @@ int unpackSound(Main *bmain, ReportList *reports, bSound *sound, int how) if (sound != NULL) { unpack_generate_paths( sound->name, (ID *)sound, absname, localname, sizeof(absname), sizeof(localname)); - newname = unpackFile( + 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)); MEM_freeN(newname); - freePackedFile(sound->packedfile); + BKE_packedfile_free(sound->packedfile); sound->packedfile = NULL; BKE_sound_load(bmain, sound); @@ -575,7 +576,7 @@ int unpackSound(Main *bmain, ReportList *reports, bSound *sound, int how) return (ret_value); } -int unpackImage(Main *bmain, ReportList *reports, Image *ima, int how) +int BKE_packedfile_unpack_image(Main *bmain, ReportList *reports, Image *ima, int how) { int ret_value = RET_ERROR; @@ -587,14 +588,14 @@ int unpackImage(Main *bmain, ReportList *reports, Image *ima, int how) unpack_generate_paths( imapf->filepath, (ID *)ima, absname, localname, sizeof(absname), sizeof(localname)); - newname = unpackFile( + newname = BKE_packedfile_unpack_to_file( reports, BKE_main_blendfile_path(bmain), absname, localname, imapf->packedfile, how); if (newname != NULL) { ImageView *iv; ret_value = ret_value == RET_ERROR ? RET_ERROR : RET_OK; - freePackedFile(imapf->packedfile); + BKE_packedfile_free(imapf->packedfile); imapf->packedfile = NULL; /* update the new corresponding view filepath */ @@ -625,7 +626,7 @@ int unpackImage(Main *bmain, ReportList *reports, Image *ima, int how) return (ret_value); } -int unpackLibraries(Main *bmain, ReportList *reports) +int BKE_packedfile_unpack_all_libraries(Main *bmain, ReportList *reports) { Library *lib; char *newname; @@ -634,18 +635,18 @@ int unpackLibraries(Main *bmain, ReportList *reports) for (lib = bmain->libraries.first; lib; lib = lib->id.next) { if (lib->packedfile && lib->name[0]) { - newname = unpackFile(reports, - BKE_main_blendfile_path(bmain), - lib->filepath, - lib->filepath, - lib->packedfile, - PF_WRITE_ORIGINAL); + newname = BKE_packedfile_unpack_to_file(reports, + BKE_main_blendfile_path(bmain), + lib->filepath, + lib->filepath, + lib->packedfile, + PF_WRITE_ORIGINAL); if (newname != NULL) { ret_value = RET_OK; printf("Unpacked .blend library: %s\n", newname); - freePackedFile(lib->packedfile); + BKE_packedfile_free(lib->packedfile); lib->packedfile = NULL; MEM_freeN(newname); @@ -656,7 +657,7 @@ int unpackLibraries(Main *bmain, ReportList *reports) return (ret_value); } -void packLibraries(Main *bmain, ReportList *reports) +void BKE_packedfile_pack_all_libraries(Main *bmain, ReportList *reports) { Library *lib; @@ -674,12 +675,12 @@ void packLibraries(Main *bmain, ReportList *reports) for (lib = bmain->libraries.first; lib; lib = lib->id.next) { if (lib->packedfile == NULL) { - lib->packedfile = newPackedFile(reports, lib->name, BKE_main_blendfile_path(bmain)); + lib->packedfile = BKE_packedfile_new(reports, lib->name, BKE_main_blendfile_path(bmain)); } } } -void unpackAll(Main *bmain, ReportList *reports, int how) +void BKE_packedfile_unpack_all(Main *bmain, ReportList *reports, int how) { Image *ima; VFont *vf; @@ -687,25 +688,25 @@ void unpackAll(Main *bmain, ReportList *reports, int how) for (ima = bmain->images.first; ima; ima = ima->id.next) { if (BKE_image_has_packedfile(ima)) { - unpackImage(bmain, reports, ima, how); + BKE_packedfile_unpack_image(bmain, reports, ima, how); } } for (vf = bmain->fonts.first; vf; vf = vf->id.next) { if (vf->packedfile) { - unpackVFont(bmain, reports, vf, how); + BKE_packedfile_unpack_vfont(bmain, reports, vf, how); } } for (sound = bmain->sounds.first; sound; sound = sound->id.next) { if (sound->packedfile) { - unpackSound(bmain, reports, sound, how); + BKE_packedfile_unpack_sound(bmain, reports, sound, how); } } } /* ID should be not NULL, return 1 if there's a packed file */ -bool BKE_pack_check(ID *id) +bool BKE_packedfile_id_check(ID *id) { switch (GS(id->name)) { case ID_IM: { @@ -731,27 +732,27 @@ bool BKE_pack_check(ID *id) } /* ID should be not NULL */ -void BKE_unpack_id(Main *bmain, ID *id, ReportList *reports, int how) +void BKE_packedfile_id_unpack(Main *bmain, ID *id, ReportList *reports, int how) { switch (GS(id->name)) { case ID_IM: { Image *ima = (Image *)id; if (BKE_image_has_packedfile(ima)) { - unpackImage(bmain, reports, ima, how); + BKE_packedfile_unpack_image(bmain, reports, ima, how); } break; } case ID_VF: { VFont *vf = (VFont *)id; if (vf->packedfile) { - unpackVFont(bmain, reports, vf, how); + BKE_packedfile_unpack_vfont(bmain, reports, vf, how); } break; } case ID_SO: { bSound *snd = (bSound *)id; if (snd->packedfile) { - unpackSound(bmain, reports, snd, how); + BKE_packedfile_unpack_sound(bmain, reports, snd, how); } break; } diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index ad26314e877..1722b888d28 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -170,7 +170,7 @@ void BKE_sound_free(bSound *sound) /* No animdata here. */ if (sound->packedfile) { - freePackedFile(sound->packedfile); + BKE_packedfile_free(sound->packedfile); sound->packedfile = NULL; } @@ -211,7 +211,7 @@ void BKE_sound_copy_data(Main *UNUSED(bmain), sound_dst->newpackedfile = NULL; if (sound_dst->packedfile) { - sound_dst->packedfile = dupPackedFile(sound_dst->packedfile); + sound_dst->packedfile = BKE_packedfile_duplicate(sound_dst->packedfile); } BKE_sound_reset_runtime(sound_dst); |