Blender V4.5
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_listBase.h"
7
9#include "BLI_sys_types.h"
10#include "BLI_utildefines.h"
11#include "BLI_utility_mixins.hh"
12
17
18struct AssetMetaData;
19struct BHead;
21struct BlendHandle;
22struct BlendThumbnail;
23struct FileData;
24struct FileReader;
25struct ID;
26struct Library;
27struct LinkNode;
28struct ListBase;
29struct Main;
30struct MemFile;
31struct PreviewImage;
32struct ReportList;
33struct Scene;
34struct UserDef;
35struct View3D;
36struct ViewLayer;
37struct WorkSpace;
38struct bScreen;
39struct wmWindowManager;
40
42 Main *main; /* has to be freed when done reading file data */
43
45};
46
47/* -------------------------------------------------------------------- */
52
55 // BLENFILETYPE_PUB = 2, /* UNUSED */
56 // BLENFILETYPE_RUNTIME = 3, /* UNUSED */
57};
58
60 Main *main = nullptr;
61 UserDef *user = nullptr;
62
63 int fileflags = 0;
64 int globalf = 0;
70 char filepath[/*FILE_MAX*/ 1024] = {};
71
73 bScreen *curscreen = nullptr;
74 Scene *curscene = nullptr;
77
79};
80
94
96 uint skip_flags : 3; /* #eBLOReadSkip */
99
101 int undo_direction; /* #eUndoStepDir */
102};
103
148
160#define BLO_READ_SKIP_ALL (BLO_READ_SKIP_USERDEF | BLO_READ_SKIP_DATA)
161
170BlendFileData *BLO_read_from_file(const char *filepath,
171 eBLOReadSkip skip_flags,
182BlendFileData *BLO_read_from_memory(const void *mem,
183 int memsize,
184 eBLOReadSkip skip_flags,
196 const char *filepath,
197 MemFile *memfile,
200
208
220 BlendfileLinkAppendContext *lapp_context,
222
224
225/* -------------------------------------------------------------------- */
228
230 char name[/*MAX_ID_NAME-2*/ 64];
242};
243
247void BLO_datablock_info_free(BLODataBlockInfo *datablock_info);
251void BLO_datablock_info_linklist_free(LinkNode * /*BLODataBlockInfo*/ datablock_infos);
252
260BlendHandle *BLO_blendhandle_from_file(const char *filepath, BlendFileReadReport *reports);
268BlendHandle *BLO_blendhandle_from_memory(const void *mem,
269 int memsize,
271
283 int ofblocktype,
284
285 bool use_assets_only,
286 int *r_tot_names);
301LinkNode * /*BLODataBlockInfo*/ BLO_blendhandle_get_datablock_info(BlendHandle *bh,
302 int ofblocktype,
303 bool use_assets_only,
304 int *r_tot_info_items);
315 int ofblocktype,
316 const char *name);
325
331void BLO_blendhandle_close(BlendHandle *bh) ATTR_NONNULL(1);
332
337void BLO_read_invalidate_message(BlendHandle *bh, Main *bmain, const char *message);
338
348#define BLO_read_assert_message(_check_expr, _ret_value, _bh, _bmain, _message) \
349 if (_check_expr) { \
350 BLO_read_invalidate_message((_bh), (_bmain), (_message)); \
351 return _ret_value; \
352 } \
353 (void)0
354
356
357#define BLO_GROUP_MAX 32
358#define BLO_EMBEDDED_STARTUP_BLEND "<startup.blend>"
359
360/* -------------------------------------------------------------------- */
363
398
421
423 Main *bmain,
424 int flag,
425 int id_tag_extra);
427 Main *bmain,
428 int flag,
429 int id_tag_extra,
430 Scene *scene,
431 ViewLayer *view_layer,
432 const View3D *v3d);
433
443Main *BLO_library_link_begin(BlendHandle **bh,
444 const char *filepath,
456 BlendHandle **bh,
457 short idcode,
458 const char *name,
469void BLO_library_link_end(Main *mainl,
470 BlendHandle **bh,
473
485
487 const char *blend_file_path,
488 short idcode,
489 const char *idname,
491void BLO_library_temp_free(TempLibraryContext *temp_lib_ctx);
492
494
495void *BLO_library_read_struct(FileData *fd, BHead *bh, const char *blockname);
496
497using BLOExpandDoitCallback = void (*)(void *fdhandle, Main *mainvar, void *idv);
498
508void BLO_expand_main(void *fdhandle, Main *mainvar, BLOExpandDoitCallback callback);
509
523void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template);
524void BLO_update_defaults_workspace(WorkSpace *workspace, const char *app_template);
525
528
537BlendThumbnail *BLO_thumbnail_from_file(const char *filepath);
538
545short BLO_version_from_file(const char *filepath);
546
557 struct Tags {
558 /* General ID reading related tags. */
559
574
575 /* Specific ID-type reading/versioning related tags. */
576
585};
586
592
599
607
612
613#define BLEN_THUMB_MEMSIZE_FILE(_x, _y) (sizeof(int) * (2 + (size_t)(_x) * (size_t)(_y)))
#define ATTR_NONNULL(...)
unsigned int uint
#define ENUM_OPERATORS(_type, _max)
TempLibraryContext * BLO_library_temp_load_id(Main *real_main, const char *blend_file_path, short idcode, const char *idname, ReportList *reports)
void BLO_datablock_info_linklist_free(LinkNode *datablock_infos)
void BLO_datablock_info_free(BLODataBlockInfo *datablock_info)
BlendThumbnail * BLO_thumbnail_from_file(const char *filepath)
Definition readfile.cc:1467
void(*)(void *fdhandle, Main *mainvar, void *idv) BLOExpandDoitCallback
void BLO_update_defaults_workspace(WorkSpace *workspace, const char *app_template)
void BLO_read_invalidate_message(BlendHandle *bh, Main *bmain, const char *message)
PreviewImage * BLO_blendhandle_get_preview_for_id(BlendHandle *bh, int ofblocktype, const char *name)
LinkNode * BLO_blendhandle_get_datablock_info(BlendHandle *bh, int ofblocktype, bool use_assets_only, int *r_tot_info_items)
void BLO_sanitize_experimental_features_userpref_blend(UserDef *userdef)
eBLOLibLinkFlags
@ BLO_LIBLINK_APPEND_RECURSIVE
@ BLO_LIBLINK_USE_PLACEHOLDERS
@ BLO_LIBLINK_APPEND_ASSET_DATA_CLEAR
@ BLO_LIBLINK_OBDATA_INSTANCE
@ BLO_LIBLINK_APPEND_SET_FAKEUSER
@ BLO_LIBLINK_COLLECTION_NO_HIERARCHY_REBUILD
@ BLO_LIBLINK_FORCE_INDIRECT
@ BLO_LIBLINK_APPEND_LOCAL_ID_REUSE
@ BLO_LIBLINK_COLLECTION_INSTANCE
void BLO_library_link_params_init(LibraryLink_Params *params, Main *bmain, int flag, int id_tag_extra)
Definition readfile.cc:4603
eBLOReadSkip
@ BLO_READ_SKIP_DATA
@ BLO_READ_SKIP_USERDEF
@ BLO_READ_SKIP_UNDO_OLD_MAIN
@ BLO_READ_SKIP_NONE
void BLO_library_link_end(Main *mainl, BlendHandle **bh, const LibraryLink_Params *params, ReportList *reports)
Definition readfile.cc:4787
BlendHandle * BLO_blendhandle_from_file(const char *filepath, BlendFileReadReport *reports)
void BLO_library_temp_free(TempLibraryContext *temp_lib_ctx)
BlendHandle * BLO_blendhandle_from_memory(const void *mem, int memsize, BlendFileReadReport *reports)
void BLO_readfile_id_runtime_data_free(ID &id)
Definition readfile.cc:2245
void BLO_blendhandle_close(BlendHandle *bh) ATTR_NONNULL(1)
ID * BLO_library_link_named_part(Main *mainl, BlendHandle **bh, short idcode, const char *name, const LibraryLink_Params *params)
Definition readfile.cc:4549
BlendFileData * BLO_read_from_memfile(Main *oldmain, const char *filepath, MemFile *memfile, const BlendFileReadParams *params, ReportList *reports)
ID_Readfile_Data::Tags BLO_readfile_id_runtime_tags(ID &id)
Definition readfile.cc:2231
LinkNode * BLO_blendhandle_get_datablock_names(BlendHandle *bh, int ofblocktype, bool use_assets_only, int *r_tot_names)
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:4614
Main * BLO_library_link_begin(BlendHandle **bh, const char *filepath, const LibraryLink_Params *params)
Definition readfile.cc:4631
BlendFileData * BLO_read_from_memory(const void *mem, int memsize, eBLOReadSkip skip_flags, ReportList *reports)
short BLO_version_from_file(const char *filepath)
Definition readfile.cc:1494
void BLO_readfile_id_runtime_data_free_all(Main &bmain)
Definition readfile.cc:2250
void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
void * BLO_library_read_struct(FileData *fd, BHead *bh, const char *blockname)
Definition readfile.cc:4819
BlendFileData * BLO_read_from_file(const char *filepath, eBLOReadSkip skip_flags, BlendFileReadReport *reports)
void BLO_expand_main(void *fdhandle, Main *mainvar, BLOExpandDoitCallback callback)
Definition readfile.cc:4458
ID_Readfile_Data::Tags & BLO_readfile_id_runtime_tags_for_write(ID &id)
Definition readfile.cc:2239
void BLO_read_do_version_after_setup(Main *new_bmain, BlendfileLinkAppendContext *lapp_context, BlendFileReadReport *reports)
LinkNode * BLO_blendhandle_get_linkable_groups(BlendHandle *bh)
eBlenFileType
@ BLENFILETYPE_BLEND
void BLO_blendfiledata_free(BlendFileData *bfd)
These structs are the foundation for all linked lists in the library system.
ReportList * reports
Definition WM_types.hh:1025
BKE_main_namemap_clear * new_bmain
Definition blendfile.cc:603
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
int count
The meta-data of an asset. By creating and giving this for a data-block (ID.asset_data),...
AssetMetaData * asset_data
UserDef * user
ViewLayer * cur_view_layer
char filepath[1024]
eBlenFileType type
bScreen * curscreen
LinkNode * resynced_lib_overrides_libraries
double lib_overrides_recursive_resync
bool do_resynced_lib_overrides_libraries_list
int resynced_lib_overrides_libraries_count
struct BlendFileReadReport::@140267113215111030100161154125212310177247344001 duration
wmWindowManager * old_wm
struct ID_Readfile_Data::Tags tags
Definition DNA_ID.h:404
BlendFileReadReport bf_reports
char app_template[64]
Definition wm_files.cc:1183
uint8_t flag
Definition wm_window.cc:139