Blender  V2.93
BKE_packedFile.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
17  * All rights reserved.
18  */
19 #pragma once
20 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 #define RET_OK 0
30 #define RET_ERROR 1
31 
32 struct BlendDataReader;
33 struct BlendWriter;
34 struct ID;
35 struct Image;
36 struct Main;
37 struct PackedFile;
38 struct ReportList;
39 struct VFont;
40 struct Volume;
41 struct bSound;
42 
47 };
48 
54  PF_KEEP = 7,
55  PF_REMOVE = 8,
56 
57  PF_ASK = 10,
58 };
59 
60 /* pack */
61 struct PackedFile *BKE_packedfile_duplicate(const struct PackedFile *pf_src);
62 struct PackedFile *BKE_packedfile_new(struct ReportList *reports,
63  const char *filename,
64  const char *basepath);
65 struct PackedFile *BKE_packedfile_new_from_memory(void *mem, int memlen);
66 
67 void BKE_packedfile_pack_all(struct Main *bmain, struct ReportList *reports, bool verbose);
68 void BKE_packedfile_pack_all_libraries(struct Main *bmain, struct ReportList *reports);
69 
70 /* unpack */
71 char *BKE_packedfile_unpack_to_file(struct ReportList *reports,
72  const char *ref_file_name,
73  const char *abs_name,
74  const char *local_name,
75  struct PackedFile *pf,
76  enum ePF_FileStatus how);
77 int BKE_packedfile_unpack_vfont(struct Main *bmain,
78  struct ReportList *reports,
79  struct VFont *vfont,
80  enum ePF_FileStatus how);
81 int BKE_packedfile_unpack_sound(struct Main *bmain,
82  struct ReportList *reports,
83  struct bSound *sound,
84  enum ePF_FileStatus how);
85 int BKE_packedfile_unpack_image(struct Main *bmain,
86  struct ReportList *reports,
87  struct Image *ima,
88  enum ePF_FileStatus how);
89 int BKE_packedfile_unpack_volume(struct Main *bmain,
90  struct ReportList *reports,
91  struct Volume *volume,
92  enum ePF_FileStatus how);
93 void BKE_packedfile_unpack_all(struct Main *bmain,
94  struct ReportList *reports,
95  enum ePF_FileStatus how);
96 int BKE_packedfile_unpack_all_libraries(struct Main *bmain, struct ReportList *reports);
97 
98 int BKE_packedfile_write_to_file(struct ReportList *reports,
99  const char *ref_file_name,
100  const char *filename,
101  struct PackedFile *pf,
102  const bool guimode);
103 
104 /* free */
105 void BKE_packedfile_free(struct PackedFile *pf);
106 
107 /* info */
108 int BKE_packedfile_count_all(struct Main *bmain);
109 enum ePF_FileCompare BKE_packedfile_compare_to_file(const char *ref_file_name,
110  const char *filename,
111  struct PackedFile *pf);
112 
113 /* read */
114 int BKE_packedfile_seek(struct PackedFile *pf, int offset, int whence);
115 void BKE_packedfile_rewind(struct PackedFile *pf);
116 int BKE_packedfile_read(struct PackedFile *pf, void *data, int size);
117 
118 /* ID should be not NULL, return 1 if there's a packed file */
119 bool BKE_packedfile_id_check(struct ID *id);
120 /* ID should be not NULL, throws error when ID is Library */
121 void BKE_packedfile_id_unpack(struct Main *bmain,
122  struct ID *id,
123  struct ReportList *reports,
124  enum ePF_FileStatus how);
125 
126 void BKE_packedfile_blend_write(struct BlendWriter *writer, struct PackedFile *pf);
127 void BKE_packedfile_blend_read(struct BlendDataReader *reader, struct PackedFile **pf_p);
128 
129 #ifdef __cplusplus
130 }
131 #endif
ePF_FileCompare
@ PF_CMP_EQUAL
@ PF_CMP_NOFILE
@ PF_CMP_DIFFERS
int BKE_packedfile_write_to_file(struct ReportList *reports, const char *ref_file_name, const char *filename, struct PackedFile *pf, const bool guimode)
Definition: packedFile.c:302
int BKE_packedfile_unpack_vfont(struct Main *bmain, struct ReportList *reports, struct VFont *vfont, enum ePF_FileStatus how)
Definition: packedFile.c:579
void BKE_packedfile_id_unpack(struct Main *bmain, struct ID *id, struct ReportList *reports, enum ePF_FileStatus how)
Definition: packedFile.c:835
void BKE_packedfile_pack_all(struct Main *bmain, struct ReportList *reports, bool verbose)
Definition: packedFile.c:246
int BKE_packedfile_unpack_sound(struct Main *bmain, struct ReportList *reports, struct bSound *sound, enum ePF_FileStatus how)
Definition: packedFile.c:605
int BKE_packedfile_seek(struct PackedFile *pf, int offset, int whence)
Definition: packedFile.c:59
void BKE_packedfile_unpack_all(struct Main *bmain, struct ReportList *reports, enum ePF_FileStatus how)
Definition: packedFile.c:772
int BKE_packedfile_unpack_image(struct Main *bmain, struct ReportList *reports, struct Image *ima, enum ePF_FileStatus how)
Definition: packedFile.c:635
void BKE_packedfile_pack_all_libraries(struct Main *bmain, struct ReportList *reports)
Definition: packedFile.c:749
struct PackedFile * BKE_packedfile_new_from_memory(void *mem, int memlen)
Definition: packedFile.c:181
int BKE_packedfile_read(struct PackedFile *pf, void *data, int size)
Definition: packedFile.c:96
struct PackedFile * BKE_packedfile_duplicate(const struct PackedFile *pf_src)
int BKE_packedfile_unpack_all_libraries(struct Main *bmain, struct ReportList *reports)
Definition: packedFile.c:718
int BKE_packedfile_unpack_volume(struct Main *bmain, struct ReportList *reports, struct Volume *volume, enum ePF_FileStatus how)
Definition: packedFile.c:688
void BKE_packedfile_blend_write(struct BlendWriter *writer, struct PackedFile *pf)
Definition: packedFile.c:876
enum ePF_FileCompare BKE_packedfile_compare_to_file(const char *ref_file_name, const char *filename, struct PackedFile *pf)
Definition: packedFile.c:384
struct PackedFile * BKE_packedfile_new(struct ReportList *reports, const char *filename, const char *basepath)
Definition: packedFile.c:192
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)
Definition: packedFile.c:447
ePF_FileStatus
@ PF_USE_ORIGINAL
@ PF_USE_LOCAL
@ PF_ASK
@ PF_KEEP
@ PF_REMOVE
@ PF_WRITE_ORIGINAL
@ PF_WRITE_LOCAL
bool BKE_packedfile_id_check(struct ID *id)
Definition: packedFile.c:805
void BKE_packedfile_blend_read(struct BlendDataReader *reader, struct PackedFile **pf_p)
Definition: packedFile.c:885
int BKE_packedfile_count_all(struct Main *bmain)
Definition: packedFile.c:119
void BKE_packedfile_rewind(struct PackedFile *pf)
Definition: packedFile.c:91
void BKE_packedfile_free(struct PackedFile *pf)
Definition: packedFile.c:155
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
static int verbose
Definition: cineonlib.c:44
#define pf(_x, _i)
Prefetch 64.
Definition: gim_memory.h:48
Definition: DNA_ID.h:273
Definition: BKE_main.h:116