Blender
V3.3
|
#include <fcntl.h>
#include <stdio.h>
#include <sys/stat.h>
#include <unistd.h>
#include "MEM_guardedalloc.h"
#include <string.h>
#include "DNA_ID.h"
#include "DNA_image_types.h"
#include "DNA_packedFile_types.h"
#include "DNA_sound_types.h"
#include "DNA_vfont_types.h"
#include "DNA_volume_types.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
#include "BKE_image.h"
#include "BKE_image_format.h"
#include "BKE_main.h"
#include "BKE_packedFile.h"
#include "BKE_report.h"
#include "BKE_sound.h"
#include "BKE_vfont.h"
#include "BKE_volume.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
#include "BLO_read_write.h"
Go to the source code of this file.
void BKE_packedfile_blend_read | ( | BlendDataReader * | reader, |
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 | ( | BlendWriter * | writer, |
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 | ( | 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().
PackedFile* BKE_packedfile_duplicate | ( | const PackedFile * | pf_src | ) |
Definition at line 153 of file packedFile.c.
References BLI_assert, PackedFile::data, MEM_dupallocN, and NULL.
void BKE_packedfile_free | ( | 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().
Definition at line 785 of file packedFile.c.
References BKE_image_has_packedfile(), GS, id, ID_IM, ID_LI, ID_SO, ID_VF, ID_VO, ID::name, NULL, Library::packedfile, bSound::packedfile, VFont::packedfile, and Volume::packedfile.
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().
PackedFile* BKE_packedfile_new | ( | 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().
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 | ( | Main * | bmain, |
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 | ( | PackedFile * | pf, |
void * | data, | ||
int | size | ||
) |
void BKE_packedfile_rewind | ( | PackedFile * | pf | ) |
Definition at line 76 of file packedFile.c.
References BKE_packedfile_seek(), and pf.
int BKE_packedfile_seek | ( | PackedFile * | pf, |
int | offset, | ||
int | whence | ||
) |
Definition at line 44 of file packedFile.c.
Referenced by BKE_packedfile_rewind().
char* BKE_packedfile_unpack | ( | Main * | bmain, |
ReportList * | reports, | ||
ID * | id, | ||
const char * | orig_file_path, | ||
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 | ( | Main * | bmain, |
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 | ( | Main * | bmain, |
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 | ( | Main * | bmain, |
ReportList * | reports, | ||
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 | ( | Main * | bmain, |
ReportList * | reports, | ||
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 | ( | Main * | bmain, |
ReportList * | reports, | ||
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 | ( | Main * | bmain, |
ReportList * | reports, | ||
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 | ( | ReportList * | reports, |
const char * | ref_file_name, | ||
const char * | filepath, | ||
PackedFile * | pf, | ||
const bool | guimode | ||
) |
Definition at line 286 of file packedFile.c.
Referenced by BKE_packedfile_unpack_to_file().
|
static |
Definition at line 482 of file packedFile.c.
References BKE_ftype_to_imtype(), BKE_image_path_ensure_ext_from_imtype(), BLI_filename_make_safe(), BLI_snprintf(), BLI_split_dirfile(), BLI_strncpy(), BLI_strncpy_rlen(), FILE_MAX, FILE_MAXDIR, GS, id, ID_IM, ID_SO, ID_VF, ID_VO, IMA_SRC_TILED, IMB_FTYPE_NONE, IMB_ispic_type_from_memory(), ListBase::last, len, ID::name, NULL, ImagePackedFile::packedfile, Image::packedfiles, pf, Image::source, and ImagePackedFile::tile_number.
Referenced by BKE_packedfile_unpack().