Blender V5.3
BLO_readfile.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4#pragma once
5
6#include "DNA_ID_enums.h"
7#include "DNA_listBase.h"
8
10#include "BLI_enum_flags.hh"
12#include "BLI_sys_types.hh"
13#include "BLI_utility_mixins.hh"
14struct BlendHandle;
15namespace blender {
16
21
22struct AssetMetaData;
23struct BHead;
25struct BlendThumbnail;
26struct FileData;
27struct FileReader;
28struct ID;
29struct Library;
30struct LinkNode;
31struct Main;
32struct MemFile;
33struct PreviewImage;
34struct ReportList;
35struct Scene;
36struct UserDef;
37struct View3D;
38struct ViewLayer;
39struct WorkSpace;
40struct bScreen;
41struct wmWindowManager;
42
44 Main *main; /* has to be freed when done reading file data */
45
46 ListBaseT<WorkSpace> workspaces;
47};
48
49/* -------------------------------------------------------------------- */
54
57 // BLENFILETYPE_PUB = 2, /* UNUSED */
58 // BLENFILETYPE_RUNTIME = 3, /* UNUSED */
59};
60
62 Main *main = nullptr;
63 UserDef *user = nullptr;
64
65 int fileflags = 0;
66 int globalf = 0;
74 char filepath[/*FILE_MAX*/ 1024] = {};
75
77 bScreen *curscreen = nullptr;
78 Scene *curscene = nullptr;
81
83};
84
98
100 uint skip_flags : 3; /* #eBLOReadSkip */
103
105 int undo_direction; /* #eUndoStepDir */
106};
107
155
167#define BLO_READ_SKIP_ALL (BLO_READ_SKIP_USERDEF | BLO_READ_SKIP_DATA)
168
177BlendFileData *BLO_read_from_file(const char *filepath,
178 eBLOReadSkip skip_flags,
179 BlendFileReadReport *reports);
189BlendFileData *BLO_read_from_memory(const void *mem,
190 int memsize,
191 eBLOReadSkip skip_flags,
192 ReportList *reports);
202BlendFileData *BLO_read_from_memfile(Main *oldmain,
203 const char *filepath,
204 MemFile *memfile,
205 const BlendFileReadParams *params,
206 ReportList *reports);
207
214void BLO_blendfiledata_free(BlendFileData *bfd);
215
226void BLO_read_do_version_after_setup(Main *new_bmain,
227 BlendfileLinkAppendContext *lapp_context,
228 BlendFileReadReport *reports);
229
231
232/* -------------------------------------------------------------------- */
235
237 struct Library {
238 const char *filepath = nullptr;
240 };
241
242 char name[/*MAX_ID_NAME-2*/ 256] = "";
250 bool free_asset_data = false;
257 bool no_preview_found = false;
258};
259
263void BLO_datablock_info_free(BLODataBlockInfo *datablock_info);
267void BLO_datablock_info_linklist_free(LinkNode * /*BLODataBlockInfo*/ datablock_infos);
268
276BlendHandle *BLO_blendhandle_from_file(const char *filepath, BlendFileReadReport *reports);
284BlendHandle *BLO_blendhandle_from_memory(const void *mem,
285 int memsize,
286 BlendFileReadReport *reports);
287
289int3 BLO_blendhandle_get_version(const BlendHandle *bh);
290
302 int ofblocktype,
303
304 bool use_assets_only,
305 int *r_tot_names);
320LinkNode * /*BLODataBlockInfo*/ BLO_blendhandle_get_datablock_info(BlendHandle *bh,
321 int ofblocktype,
322 bool use_assets_only,
323 int *r_tot_info_items);
334 int ofblocktype,
335 const char *name);
344
350void BLO_blendhandle_close(BlendHandle *bh) ATTR_NONNULL(1);
351
356void BLO_read_invalidate_message(BlendHandle *bh, Main *bmain, const char *message);
357
367#define BLO_read_assert_message(_check_expr, _ret_value, _bh, _bmain, _message) \
368 if (_check_expr) { \
369 BLO_read_invalidate_message((_bh), (_bmain), (_message)); \
370 return _ret_value; \
371 } \
372 (void)0
373
375
376#define BLO_GROUP_MAX 32
377#define BLO_EMBEDDED_STARTUP_BLEND "<startup.blend>"
378
379/* -------------------------------------------------------------------- */
382
426
436 int flag;
440 struct {
442 Scene *scene;
446 const View3D *v3d;
448};
449
450void BLO_library_link_params_init(LibraryLink_Params *params,
451 Main *bmain,
452 int flag,
453 int id_tag_extra);
454void BLO_library_link_params_init_with_context(LibraryLink_Params *params,
455 Main *bmain,
456 int flag,
457 int id_tag_extra,
458 Scene *scene,
459 ViewLayer *view_layer,
460 const View3D *v3d);
461
471Main *BLO_library_link_begin(BlendHandle **bh,
472 const char *filepath,
473 const LibraryLink_Params *params);
483ID *BLO_library_link_named_part(Main *mainl,
484 BlendHandle **bh,
485 short idcode,
486 const char *name,
487 const LibraryLink_Params *params);
497void BLO_library_link_end(Main *mainl,
498 BlendHandle **bh,
499 const LibraryLink_Params *params,
500 ReportList *reports);
501
513
515 const char *blend_file_path,
516 short idcode,
517 const char *idname,
518 ReportList *reports);
519void BLO_library_temp_free(TempLibraryContext *temp_lib_ctx);
520
522
523void *BLO_library_read_struct(FileData *fd, BHead *bh, const char *blockname);
524
538void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template);
539void BLO_update_defaults_workspace(WorkSpace *workspace, const char *app_template);
540
543
552BlendThumbnail *BLO_thumbnail_from_file(const char *filepath);
553
560short BLO_version_from_file(const char *filepath);
561
572 struct Tags {
573 /* General ID reading related tags. */
574
589
598
599 /* Specific ID-type reading/versioning related tags. */
600
609};
610
615ID_Readfile_Data::Tags BLO_readfile_id_runtime_tags(const ID &id);
616
622ID_Readfile_Data::Tags &BLO_readfile_id_runtime_tags_for_write(ID &id);
623
631
636
637#define BLEN_THUMB_MEMSIZE_FILE(_x, _y) (sizeof(int) * (2 + size_t(_x) * size_t(_y)))
638
639} // namespace blender
#define ENUM_OPERATORS(_enum_type)
Enumerations for DNA_ID.h.
These structs are the foundation for all linked lists in the library system.
Definition scene.h:133
NonCopyable(const NonCopyable &other)=delete
NonMovable(NonMovable &&other)=delete
BMesh Iterators.
ID_Readfile_Data::Tags & BLO_readfile_id_runtime_tags_for_write(ID &id)
Definition readfile.cc:2307
int3 BLO_blendhandle_get_version(const BlendHandle *bh)
BlendHandle * BLO_blendhandle_from_file(const char *filepath, BlendFileReadReport *reports)
LinkNode * BLO_blendhandle_get_datablock_info(BlendHandle *bh, int ofblocktype, bool use_assets_only, int *r_tot_info_items)
void BLO_datablock_info_linklist_free(LinkNode *datablock_infos)
void BLO_library_link_params_init_with_context(LibraryLink_Params *params, Main *bmain, int flag, int id_tag_extra, Scene *scene, ViewLayer *view_layer, const View3D *v3d)
Definition readfile.cc:5758
unsigned int uint
Definition BKE_text.h:55
short BLO_version_from_file(const char *filepath)
Definition readfile.cc:1485
void BLO_blendhandle_close(BlendHandle *bh) ATTR_NONNULL(1)
void * BLO_library_read_struct(FileData *fd, BHead *bh, const char *blockname)
Definition readfile.cc:5957
void BLO_blendfiledata_free(BlendFileData *bfd)
BlendThumbnail * BLO_thumbnail_from_file(const char *filepath)
Definition readfile.cc:1458
void BLO_update_defaults_workspace(WorkSpace *workspace, const char *app_template)
@ BLENFILETYPE_BLEND
void BLO_read_do_version_after_setup(Main *new_bmain, BlendfileLinkAppendContext *lapp_context, BlendFileReadReport *reports)
ID * BLO_library_link_named_part(Main *mainl, BlendHandle **bh, short idcode, const char *name, const LibraryLink_Params *params)
Definition readfile.cc:5679
@ BLO_LIBLINK_APPEND_LOCAL_ID_REUSE
@ BLO_LIBLINK_APPEND_RECURSIVE
@ BLO_LIBLINK_APPEND_SET_FAKEUSER
@ BLO_LIBLINK_FORCE_INDIRECT
@ BLO_LIBLINK_OBDATA_INSTANCE
@ BLO_LIBLINK_COLLECTION_NO_HIERARCHY_REBUILD
@ BLO_LIBLINK_APPEND_ASSET_DATA_CLEAR
@ BLO_LIBLINK_USE_PLACEHOLDERS
@ BLO_LIBLINK_APPEND_SET_OB_ACTIVE_CLIPBOARD
@ BLO_LIBLINK_COLLECTION_INSTANCE
void BLO_library_link_params_init(LibraryLink_Params *params, Main *bmain, int flag, int id_tag_extra)
Definition readfile.cc:5747
BlendFileData * BLO_read_from_file(const char *filepath, eBLOReadSkip skip_flags, BlendFileReadReport *reports)
BlendHandle * BLO_blendhandle_from_memory(const void *mem, int memsize, BlendFileReadReport *reports)
VecBase< int32_t, 3 > int3
void BLO_library_link_end(Main *mainl, BlendHandle **bh, const LibraryLink_Params *params, ReportList *reports)
Definition readfile.cc:5935
void BLO_sanitize_experimental_features_userpref_blend(UserDef *userdef)
void BLO_library_temp_free(TempLibraryContext *temp_lib_ctx)
void BLO_datablock_info_free(BLODataBlockInfo *datablock_info)
@ BLO_READ_SKIP_USERDEF
@ BLO_READ_SKIP_NONE
@ BLO_READ_SKIP_UNDO_OLD_MAIN
@ BLO_READ_SKIP_DATA
Main * BLO_library_link_begin(BlendHandle **bh, const char *filepath, const LibraryLink_Params *params)
Definition readfile.cc:5775
void BLO_readfile_id_runtime_data_free(ID &id)
Definition readfile.cc:2313
LinkNode * BLO_blendhandle_get_datablock_names(BlendHandle *bh, int ofblocktype, bool use_assets_only, int *r_tot_names)
LinkNode * BLO_blendhandle_get_linkable_groups(BlendHandle *bh)
BlendFileData * BLO_read_from_memory(const void *mem, int memsize, eBLOReadSkip skip_flags, ReportList *reports)
void ATTR_NONNULL(1, 2)
BlendFileData * BLO_read_from_memfile(Main *oldmain, const char *filepath, MemFile *memfile, const BlendFileReadParams *params, ReportList *reports)
PreviewImage * BLO_blendhandle_get_preview_for_id(BlendHandle *bh, int ofblocktype, const char *name)
void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
void BLO_readfile_id_runtime_data_free_all(Main &bmain)
Definition readfile.cc:2318
TempLibraryContext * BLO_library_temp_load_id(Main *real_main, const char *blend_file_path, short idcode, const char *idname, ReportList *reports)
void BLO_read_invalidate_message(BlendHandle *bh, Main *bmain, const char *message)
ID_Readfile_Data::Tags BLO_readfile_id_runtime_tags(const ID &id)
Definition readfile.cc:2297
The meta-data of an asset. By creating and giving this for a data-block (ID.asset_data),...
BLODataBlockInfo::Library library_data
struct blender::BlendFileReadReport::@140003175311343306107257242277261221002217304000 count
LinkNode * resynced_lib_overrides_libraries
struct blender::BlendFileReadReport::@070156237370130334241363347365056360307125257043 duration
struct blender::ID_Readfile_Data::Tags tags
BlendFileReadReport bf_reports
ListBaseT< WorkSpace > workspaces