Blender
V3.3
|
Go to the source code of this file.
Macros | |
#define | RET_OK 0 |
#define | RET_ERROR 1 |
Enumerations | |
enum | ePF_FileCompare { PF_CMP_EQUAL = 0 , PF_CMP_DIFFERS = 1 , PF_CMP_NOFILE = 2 } |
enum | ePF_FileStatus { PF_WRITE_ORIGINAL = 3 , PF_WRITE_LOCAL = 4 , PF_USE_LOCAL = 5 , PF_USE_ORIGINAL = 6 , PF_KEEP = 7 , PF_REMOVE = 8 , PF_ASK = 10 } |
Functions | |
struct PackedFile * | BKE_packedfile_duplicate (const struct PackedFile *pf_src) |
struct PackedFile * | BKE_packedfile_new (struct ReportList *reports, const char *filepath, const char *basepath) |
struct PackedFile * | BKE_packedfile_new_from_memory (void *mem, int memlen) |
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) |
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, enum ePF_FileStatus how) |
char * | BKE_packedfile_unpack (struct Main *bmain, struct ReportList *reports, struct ID *id, const char *orig_file_path, struct PackedFile *pf, enum ePF_FileStatus how) |
int | BKE_packedfile_unpack_vfont (struct Main *bmain, struct ReportList *reports, struct VFont *vfont, enum ePF_FileStatus how) |
int | BKE_packedfile_unpack_sound (struct Main *bmain, struct ReportList *reports, struct bSound *sound, enum ePF_FileStatus how) |
int | BKE_packedfile_unpack_image (struct Main *bmain, struct ReportList *reports, struct Image *ima, enum ePF_FileStatus how) |
int | BKE_packedfile_unpack_volume (struct Main *bmain, struct ReportList *reports, struct Volume *volume, enum ePF_FileStatus how) |
void | BKE_packedfile_unpack_all (struct Main *bmain, struct ReportList *reports, enum ePF_FileStatus how) |
int | BKE_packedfile_unpack_all_libraries (struct Main *bmain, struct ReportList *reports) |
int | BKE_packedfile_write_to_file (struct ReportList *reports, const char *ref_file_name, const char *filepath, struct PackedFile *pf, bool guimode) |
void | BKE_packedfile_free (struct PackedFile *pf) |
int | BKE_packedfile_count_all (struct Main *bmain) |
enum ePF_FileCompare | BKE_packedfile_compare_to_file (const char *ref_file_name, const char *filepath_rel, struct PackedFile *pf) |
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) |
bool | BKE_packedfile_id_check (const struct ID *id) |
void | BKE_packedfile_id_unpack (struct Main *bmain, struct ID *id, struct ReportList *reports, enum ePF_FileStatus how) |
void | BKE_packedfile_blend_write (struct BlendWriter *writer, struct PackedFile *pf) |
void | BKE_packedfile_blend_read (struct BlendDataReader *reader, struct PackedFile **pf_p) |
#define RET_ERROR 1 |
Definition at line 14 of file BKE_packedFile.h.
#define RET_OK 0 |
Definition at line 13 of file BKE_packedFile.h.
enum ePF_FileCompare |
Enumerator | |
---|---|
PF_CMP_EQUAL | |
PF_CMP_DIFFERS | |
PF_CMP_NOFILE |
Definition at line 27 of file BKE_packedFile.h.
enum ePF_FileStatus |
Enumerator | |
---|---|
PF_WRITE_ORIGINAL | |
PF_WRITE_LOCAL | |
PF_USE_LOCAL | |
PF_USE_ORIGINAL | |
PF_KEEP | |
PF_REMOVE | |
PF_ASK |
Definition at line 33 of file BKE_packedFile.h.
void BKE_packedfile_blend_read | ( | struct BlendDataReader * | reader, |
struct PackedFile ** | pf_p | ||
) |
Definition at line 864 of file packedFile.c.
References BLO_read_packed_address, MEM_SAFE_FREE, NULL, and pf.
Referenced by direct_link_library(), image_blend_read_data(), sound_blend_read_data(), vfont_blend_read_data(), and volume_blend_read_data().
void BKE_packedfile_blend_write | ( | struct BlendWriter * | writer, |
struct PackedFile * | pf | ||
) |
Definition at line 855 of file packedFile.c.
References BLO_write_raw(), BLO_write_struct, NULL, and pf.
Referenced by image_blend_write(), sound_blend_write(), vfont_blend_write(), volume_blend_write(), and write_libraries().
enum ePF_FileCompare BKE_packedfile_compare_to_file | ( | const char * | ref_file_name, |
const char * | filepath_rel, | ||
struct PackedFile * | pf | ||
) |
This function compares a packed file to a 'real' file. It returns an integer indicating if:
Definition at line 286 of file packedFile.c.
References BKE_reportf(), BLI_copy(), BLI_delete(), BLI_exists(), BLI_make_existing_file(), BLI_open(), BLI_path_abs(), BLI_rename(), BLI_snprintf(), BLI_strncpy(), file, FILE_MAX, O_BINARY, pf, RET_ERROR, RET_OK, RPT_ERROR, and RPT_INFO.
Referenced by unpack_menu().
int BKE_packedfile_count_all | ( | struct Main * | bmain | ) |
Definition at line 104 of file packedFile.c.
References BKE_image_has_packedfile(), count, ListBase::first, Main::fonts, Image::id, bSound::id, VFont::id, Volume::id, Main::images, ID::next, bSound::packedfile, VFont::packedfile, Volume::packedfile, Main::sounds, and Main::volumes.
Referenced by unpack_all_invoke().
struct PackedFile* BKE_packedfile_duplicate | ( | const struct PackedFile * | pf_src | ) |
Referenced by copy_image_packedfiles(), sound_copy_data(), vfont_copy_data(), vfont_get_data(), and volume_copy_data().
void BKE_packedfile_free | ( | struct PackedFile * | pf | ) |
Definition at line 140 of file packedFile.c.
References BLI_assert, MEM_freeN, MEM_SAFE_FREE, NULL, and pf.
Referenced by BKE_image_signal(), BKE_packedfile_unpack_all_libraries(), BKE_packedfile_unpack_image(), BKE_packedfile_unpack_sound(), BKE_packedfile_unpack_vfont(), BKE_packedfile_unpack_volume(), BKE_vfont_free_data(), BKE_vfont_load(), image_free_packedfiles(), library_free_data(), sound_free_data(), vfont_free_data(), vfont_get_data(), and vfont_init_data().
ID should be not NULL, return true if there's a packed file.
Referenced by template_ID().
void BKE_packedfile_id_unpack | ( | struct Main * | bmain, |
struct ID * | id, | ||
struct ReportList * | reports, | ||
enum ePF_FileStatus | how | ||
) |
ID should be not NULL, throws error when ID is Library.
Definition at line 814 of file packedFile.c.
References BKE_image_has_packedfile(), BKE_packedfile_unpack_image(), BKE_packedfile_unpack_sound(), BKE_packedfile_unpack_vfont(), BKE_packedfile_unpack_volume(), BKE_reportf(), Library::filepath, GS, id, ID_IM, ID_LI, ID_SO, ID_VF, ID_VO, ID::name, bSound::packedfile, VFont::packedfile, Volume::packedfile, and RPT_ERROR.
Referenced by unpack_item_exec().
struct PackedFile* BKE_packedfile_new | ( | struct ReportList * | reports, |
const char * | filepath, | ||
const char * | basepath | ||
) |
Definition at line 177 of file packedFile.c.
References BKE_packedfile_new_from_memory(), BKE_reportf(), BLI_file_descriptor_size(), BLI_open(), BLI_path_abs(), BLI_strncpy(), data, file, FILE_MAX, MEM_freeN, MEM_mallocN, NULL, O_BINARY, pf, and RPT_ERROR.
Referenced by BKE_image_packfiles(), BKE_image_signal(), BKE_packedfile_pack_all(), BKE_packedfile_pack_all_libraries(), BKE_vfont_load(), load_image_single(), sound_pack_exec(), and vfont_get_data().
struct PackedFile* BKE_packedfile_new_from_memory | ( | void * | mem, |
int | memlen | ||
) |
Definition at line 166 of file packedFile.c.
References BLI_assert, MEM_callocN, NULL, and pf.
Referenced by BKE_image_packfiles_from_mem(), BKE_packedfile_new(), and get_builtin_packedfile().
void BKE_packedfile_pack_all | ( | struct Main * | bmain, |
struct ReportList * | reports, | ||
bool | verbose | ||
) |
No libraries for now.
Definition at line 230 of file packedFile.c.
References BKE_image_has_packedfile(), BKE_image_packfiles(), BKE_main_blendfile_path(), BKE_packedfile_new(), BKE_report(), BKE_reportf(), BKE_vfont_is_builtin(), ELEM, bSound::filepath, VFont::filepath, Volume::filepath, ListBase::first, Main::fonts, Image::id, bSound::id, VFont::id, Volume::id, ID_BLEND_PATH, ID_IS_LINKED, IMA_SRC_FILE, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE, IMA_SRC_TILED, Main::images, ID::name, ID::next, NULL, bSound::packedfile, VFont::packedfile, Volume::packedfile, RPT_INFO, RPT_WARNING, Main::sounds, Image::source, verbose, and Main::volumes.
Referenced by autopack_toggle_exec(), pack_all_exec(), and wm_file_write().
void BKE_packedfile_pack_all_libraries | ( | struct Main * | bmain, |
struct ReportList * | reports | ||
) |
Definition at line 730 of file packedFile.c.
References BKE_main_blendfile_path(), BKE_packedfile_new(), BKE_reportf(), BLI_path_is_rel(), ListBase::first, lib, Main::libraries, NULL, and RPT_ERROR.
Referenced by pack_libraries_exec().
int BKE_packedfile_read | ( | struct PackedFile * | pf, |
void * | data, | ||
int | size | ||
) |
void BKE_packedfile_rewind | ( | struct PackedFile * | pf | ) |
Definition at line 76 of file packedFile.c.
References BKE_packedfile_seek(), and pf.
int BKE_packedfile_seek | ( | struct PackedFile * | pf, |
int | offset, | ||
int | whence | ||
) |
Definition at line 44 of file packedFile.c.
Referenced by BKE_packedfile_rewind().
char* BKE_packedfile_unpack | ( | struct Main * | bmain, |
struct ReportList * | reports, | ||
struct ID * | id, | ||
const char * | orig_file_path, | ||
struct PackedFile * | pf, | ||
enum ePF_FileStatus | how | ||
) |
Definition at line 552 of file packedFile.c.
References BKE_main_blendfile_path(), BKE_packedfile_unpack_to_file(), FILE_MAX, NULL, pf, and unpack_generate_paths().
Referenced by BKE_packedfile_unpack_image(), BKE_packedfile_unpack_sound(), BKE_packedfile_unpack_vfont(), and BKE_packedfile_unpack_volume().
void BKE_packedfile_unpack_all | ( | struct Main * | bmain, |
struct ReportList * | reports, | ||
enum ePF_FileStatus | how | ||
) |
Definition at line 753 of file packedFile.c.
References BKE_image_has_packedfile(), BKE_packedfile_unpack_image(), BKE_packedfile_unpack_sound(), BKE_packedfile_unpack_vfont(), BKE_packedfile_unpack_volume(), ListBase::first, Main::fonts, Image::id, bSound::id, VFont::id, Volume::id, Main::images, ID::next, bSound::packedfile, VFont::packedfile, Volume::packedfile, Main::sounds, and Main::volumes.
Referenced by unpack_all_exec().
int BKE_packedfile_unpack_all_libraries | ( | struct Main * | bmain, |
struct ReportList * | reports | ||
) |
Definition at line 699 of file packedFile.c.
References BKE_main_blendfile_path(), BKE_packedfile_free(), BKE_packedfile_unpack_to_file(), ListBase::first, lib, Main::libraries, MEM_freeN, NULL, PF_WRITE_ORIGINAL, RET_ERROR, and RET_OK.
Referenced by unpack_libraries_exec().
int BKE_packedfile_unpack_image | ( | struct Main * | bmain, |
struct ReportList * | reports, | ||
struct Image * | ima, | ||
enum ePF_FileStatus | how | ||
) |
Definition at line 620 of file packedFile.c.
References BKE_image_ensure_tile_token(), BKE_image_signal(), BKE_packedfile_free(), BKE_packedfile_unpack(), BLI_findstring(), BLI_path_basename(), BLI_remlink(), BLI_strncpy(), ImageView::filepath, ImagePackedFile::filepath, IMA_SIGNAL_RELOAD, IMA_SRC_TILED, ListBase::last, MEM_freeN, NULL, ImagePackedFile::packedfile, Image::packedfiles, PF_REMOVE, RET_ERROR, and RET_OK.
Referenced by BKE_packedfile_id_unpack(), BKE_packedfile_unpack_all(), and image_unpack_exec().
int BKE_packedfile_unpack_sound | ( | struct Main * | bmain, |
struct ReportList * | reports, | ||
struct bSound * | sound, | ||
enum ePF_FileStatus | how | ||
) |
Definition at line 594 of file packedFile.c.
References BKE_packedfile_free(), BKE_packedfile_unpack(), BKE_sound_load(), BLI_strncpy(), MEM_freeN, NULL, RET_ERROR, and RET_OK.
Referenced by BKE_packedfile_id_unpack(), BKE_packedfile_unpack_all(), and sound_unpack_exec().
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, | ||
enum ePF_FileStatus | how | ||
) |
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.
Definition at line 413 of file packedFile.c.
References ATTR_FALLTHROUGH, BKE_packedfile_write_to_file(), BKE_reportf(), BLI_exists(), BLI_path_abs(), BLI_strdup(), BLI_strncpy(), FILE_MAX, NULL, pf, PF_KEEP, PF_REMOVE, PF_USE_LOCAL, PF_USE_ORIGINAL, PF_WRITE_LOCAL, PF_WRITE_ORIGINAL, RET_OK, and RPT_INFO.
Referenced by BKE_packedfile_unpack(), and BKE_packedfile_unpack_all_libraries().
int BKE_packedfile_unpack_vfont | ( | struct Main * | bmain, |
struct ReportList * | reports, | ||
struct VFont * | vfont, | ||
enum ePF_FileStatus | how | ||
) |
Definition at line 572 of file packedFile.c.
References BKE_packedfile_free(), BKE_packedfile_unpack(), BLI_strncpy(), MEM_freeN, NULL, RET_ERROR, and RET_OK.
Referenced by BKE_packedfile_id_unpack(), and BKE_packedfile_unpack_all().
int BKE_packedfile_unpack_volume | ( | struct Main * | bmain, |
struct ReportList * | reports, | ||
struct Volume * | volume, | ||
enum ePF_FileStatus | how | ||
) |
Definition at line 673 of file packedFile.c.
References BKE_packedfile_free(), BKE_packedfile_unpack(), BKE_volume_unload(), BLI_strncpy(), MEM_freeN, NULL, RET_ERROR, and RET_OK.
Referenced by BKE_packedfile_id_unpack(), and BKE_packedfile_unpack_all().
int BKE_packedfile_write_to_file | ( | struct ReportList * | reports, |
const char * | ref_file_name, | ||
const char * | filepath, | ||
struct PackedFile * | pf, | ||
bool | guimode | ||
) |
Definition at line 286 of file packedFile.c.
Referenced by BKE_packedfile_unpack_to_file().