Blender V5.0
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
10#include "BLI_sys_types.h"
11#include "BLI_utildefines.h"
12#include "BLI_utility_mixins.hh"
13
18
19struct AssetMetaData;
20struct BHead;
22struct BlendHandle;
23struct BlendThumbnail;
24struct FileData;
25struct FileReader;
26struct ID;
27struct Library;
28struct LinkNode;
29struct ListBase;
30struct Main;
31struct MemFile;
32struct PreviewImage;
33struct ReportList;
34struct Scene;
35struct UserDef;
36struct View3D;
37struct ViewLayer;
38struct WorkSpace;
39struct bScreen;
40struct wmWindowManager;
41
43 Main *main; /* has to be freed when done reading file data */
44
46};
47
48/* -------------------------------------------------------------------- */
53
56 // BLENFILETYPE_PUB = 2, /* UNUSED */
57 // BLENFILETYPE_RUNTIME = 3, /* UNUSED */
58};
59
61 Main *main = nullptr;
62 UserDef *user = nullptr;
63
64 int fileflags = 0;
65 int globalf = 0;
71 char filepath[/*FILE_MAX*/ 1024] = {};
72
74 bScreen *curscreen = nullptr;
75 Scene *curscene = nullptr;
78
80};
81
95
97 uint skip_flags : 3; /* #eBLOReadSkip */
100
102 int undo_direction; /* #eUndoStepDir */
103};
104
152
164#define BLO_READ_SKIP_ALL (BLO_READ_SKIP_USERDEF | BLO_READ_SKIP_DATA)
165
174BlendFileData *BLO_read_from_file(const char *filepath,
175 eBLOReadSkip skip_flags,
176 BlendFileReadReport *reports);
186BlendFileData *BLO_read_from_memory(const void *mem,
187 int memsize,
188 eBLOReadSkip skip_flags,
189 ReportList *reports);
200 const char *filepath,
201 MemFile *memfile,
203 ReportList *reports);
204
212
224 BlendfileLinkAppendContext *lapp_context,
225 BlendFileReadReport *reports);
226
228
229/* -------------------------------------------------------------------- */
232
234 char name[/*MAX_ID_NAME-2*/ 256];
246};
247
251void BLO_datablock_info_free(BLODataBlockInfo *datablock_info);
255void BLO_datablock_info_linklist_free(LinkNode * /*BLODataBlockInfo*/ datablock_infos);
256
264BlendHandle *BLO_blendhandle_from_file(const char *filepath, BlendFileReadReport *reports);
272BlendHandle *BLO_blendhandle_from_memory(const void *mem,
273 int memsize,
274 BlendFileReadReport *reports);
275
277blender::int3 BLO_blendhandle_get_version(const BlendHandle *bh);
278
290 int ofblocktype,
291
292 bool use_assets_only,
293 int *r_tot_names);
308LinkNode * /*BLODataBlockInfo*/ BLO_blendhandle_get_datablock_info(BlendHandle *bh,
309 int ofblocktype,
310 bool use_assets_only,
311 int *r_tot_info_items);
322 int ofblocktype,
323 const char *name);
332
338void BLO_blendhandle_close(BlendHandle *bh) ATTR_NONNULL(1);
339
344void BLO_read_invalidate_message(BlendHandle *bh, Main *bmain, const char *message);
345
355#define BLO_read_assert_message(_check_expr, _ret_value, _bh, _bmain, _message) \
356 if (_check_expr) { \
357 BLO_read_invalidate_message((_bh), (_bmain), (_message)); \
358 return _ret_value; \
359 } \
360 (void)0
361
363
364#define BLO_GROUP_MAX 32
365#define BLO_EMBEDDED_STARTUP_BLEND "<startup.blend>"
366
367/* -------------------------------------------------------------------- */
370
414
437
439 Main *bmain,
440 int flag,
441 int id_tag_extra);
443 Main *bmain,
444 int flag,
445 int id_tag_extra,
446 Scene *scene,
447 ViewLayer *view_layer,
448 const View3D *v3d);
449
459Main *BLO_library_link_begin(BlendHandle **bh,
460 const char *filepath,
472 BlendHandle **bh,
473 short idcode,
474 const char *name,
485void BLO_library_link_end(Main *mainl,
486 BlendHandle **bh,
488 ReportList *reports);
489
501
503 const char *blend_file_path,
504 short idcode,
505 const char *idname,
506 ReportList *reports);
507void BLO_library_temp_free(TempLibraryContext *temp_lib_ctx);
508
510
511void *BLO_library_read_struct(FileData *fd, BHead *bh, const char *blockname);
512
526void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template);
527void BLO_update_defaults_workspace(WorkSpace *workspace, const char *app_template);
528
531
540BlendThumbnail *BLO_thumbnail_from_file(const char *filepath);
541
548short BLO_version_from_file(const char *filepath);
549
560 struct Tags {
561 /* General ID reading related tags. */
562
577
578 /* Specific ID-type reading/versioning related tags. */
579
588};
589
595
602
610
615
616#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:1456
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_SET_OB_ACTIVE_CLIPBOARD
@ 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_PACK
@ 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:5105
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:5293
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:2220
void BLO_blendhandle_close(BlendHandle *bh) ATTR_NONNULL(1)
blender::int3 BLO_blendhandle_get_version(const BlendHandle *bh)
ID * BLO_library_link_named_part(Main *mainl, BlendHandle **bh, short idcode, const char *name, const LibraryLink_Params *params)
Definition readfile.cc:5037
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:2206
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:5116
Main * BLO_library_link_begin(BlendHandle **bh, const char *filepath, const LibraryLink_Params *params)
Definition readfile.cc:5133
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:1483
void BLO_readfile_id_runtime_data_free_all(Main &bmain)
Definition readfile.cc:2225
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:5315
BlendFileData * BLO_read_from_file(const char *filepath, eBLOReadSkip skip_flags, BlendFileReadReport *reports)
ID_Readfile_Data::Tags & BLO_readfile_id_runtime_tags_for_write(ID &id)
Definition readfile.cc:2214
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.
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
int count
VecBase< int32_t, 3 > int3
const char * name
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
struct BlendFileReadReport::@077003321007012203371307366200326111253233132273 duration
bool do_resynced_lib_overrides_libraries_list
int resynced_lib_overrides_libraries_count
wmWindowManager * old_wm
struct ID_Readfile_Data::Tags tags
Definition DNA_ID.h:414
BlendFileReadReport bf_reports
char app_template[64]
Definition wm_files.cc:1191
uint8_t flag
Definition wm_window.cc:145