Cleanup: remove redundant preference check
[blender.git] / source / blender / blenkernel / BKE_blendfile.h
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 #ifndef __BKE_BLENDFILE_H__
17 #define __BKE_BLENDFILE_H__
18
19 /** \file
20  * \ingroup bke
21  */
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 struct BlendFileReadParams;
28 struct ID;
29 struct Main;
30 struct MemFile;
31 struct ReportList;
32 struct UserDef;
33 struct bContext;
34
35 enum {
36   BKE_BLENDFILE_READ_FAIL = 0,         /* no load */
37   BKE_BLENDFILE_READ_OK = 1,           /* OK */
38   BKE_BLENDFILE_READ_OK_USERPREFS = 2, /* OK, and with new user settings */
39 };
40
41 int BKE_blendfile_read(struct bContext *C,
42                        const char *filepath,
43                        const struct BlendFileReadParams *params,
44                        struct ReportList *reports);
45 bool BKE_blendfile_read_from_memory(struct bContext *C,
46                                     const void *filebuf,
47                                     int filelength,
48                                     bool update_defaults,
49                                     const struct BlendFileReadParams *params,
50                                     struct ReportList *reports);
51 bool BKE_blendfile_read_from_memfile(struct bContext *C,
52                                      struct MemFile *memfile,
53                                      const struct BlendFileReadParams *params,
54                                      struct ReportList *reports);
55 void BKE_blendfile_read_make_empty(struct bContext *C);
56
57 struct UserDef *BKE_blendfile_userdef_read(const char *filepath, struct ReportList *reports);
58 struct UserDef *BKE_blendfile_userdef_read_from_memory(const void *filebuf,
59                                                        int filelength,
60                                                        struct ReportList *reports);
61
62 bool BKE_blendfile_userdef_write(const char *filepath, struct ReportList *reports);
63 bool BKE_blendfile_userdef_write_app_template(const char *filepath, struct ReportList *reports);
64
65 bool BKE_blendfile_userdef_write_all(struct ReportList *reports);
66
67 struct WorkspaceConfigFileData *BKE_blendfile_workspace_config_read(const char *filepath,
68                                                                     const void *filebuf,
69                                                                     int filelength,
70                                                                     struct ReportList *reports);
71 bool BKE_blendfile_workspace_config_write(struct Main *bmain,
72                                           const char *filepath,
73                                           struct ReportList *reports);
74 void BKE_blendfile_workspace_config_data_free(struct WorkspaceConfigFileData *workspace_config);
75
76 /* partial blend file writing */
77 void BKE_blendfile_write_partial_tag_ID(struct ID *id, bool set);
78 void BKE_blendfile_write_partial_begin(struct Main *bmain_src);
79 bool BKE_blendfile_write_partial(struct Main *bmain_src,
80                                  const char *filepath,
81                                  const int write_flags,
82                                  struct ReportList *reports);
83 void BKE_blendfile_write_partial_end(struct Main *bmain_src);
84
85 #ifdef __cplusplus
86 }
87 #endif
88
89 #endif /* __BKE_BLENDFILE_H__ */