Blender
V3.3
|
#include <fcntl.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "BLI_utildefines.h"
#include "CLG_log.h"
#include "DNA_collection_types.h"
#include "DNA_fileglobal_types.h"
#include "DNA_genfile.h"
#include "DNA_sdna_types.h"
#include "BLI_bitmap.h"
#include "BLI_blenlib.h"
#include "BLI_endian_defines.h"
#include "BLI_endian_switch.h"
#include "BLI_link_utils.h"
#include "BLI_linklist.h"
#include "BLI_math_base.h"
#include "BLI_mempool.h"
#include "BLI_threads.h"
#include "MEM_guardedalloc.h"
#include "BKE_blender_version.h"
#include "BKE_bpath.h"
#include "BKE_global.h"
#include "BKE_idprop.h"
#include "BKE_idtype.h"
#include "BKE_layer.h"
#include "BKE_lib_id.h"
#include "BKE_lib_override.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_packedFile.h"
#include "BKE_report.h"
#include "BKE_workspace.h"
#include "BLO_blend_defs.h"
#include "BLO_blend_validate.h"
#include "BLO_read_write.h"
#include "BLO_readfile.h"
#include "BLO_undofile.h"
#include "BLO_writefile.h"
#include "readfile.h"
#include <errno.h>
#include <zstd.h>
Go to the source code of this file.
Classes | |
struct | ZstdFrame |
struct | WriteWrap |
struct | ZstdWriteBlockTask |
struct | WriteData |
struct | BlendWriter |
struct | RenderInfo |
Macros | |
#define | DNA_DEPRECATED_ALLOW |
#define | U (*((const UserDef *)&U)) |
#define | MEM_BUFFER_SIZE (MEM_SIZE_OPTIMAL(1 << 17)) /* 128kb */ |
#define | MEM_CHUNK_SIZE (MEM_SIZE_OPTIMAL(1 << 15)) /* ~32kb */ |
#define | ZSTD_BUFFER_SIZE (1 << 21) /* 2mb */ |
#define | ZSTD_CHUNK_SIZE (1 << 20) /* 1mb */ |
#define | ZSTD_COMPRESSION_LEVEL 3 |
#define | ID_BUFFER_STATIC_SIZE 8192 |
Functions | |
Local Writing API 'mywrite' | |
static void | mywrite_flush (WriteData *wd) |
static void | mywrite (WriteData *wd, const void *adr, size_t len) |
static WriteData * | mywrite_begin (WriteWrap *ww, MemFile *compare, MemFile *current) |
static bool | mywrite_end (WriteData *wd) |
static void | mywrite_id_begin (WriteData *wd, ID *id) |
static void | mywrite_id_end (WriteData *wd, ID *UNUSED(id)) |
File Writing (Private) | |
static bool | write_file_handle (Main *mainvar, WriteWrap *ww, MemFile *compare, MemFile *current, int write_flags, bool use_userdef, const BlendThumbnail *thumb) |
static bool | do_history (const char *name, ReportList *reports) |
File Writing (Public) | |
bool | BLO_write_file (Main *mainvar, const char *filepath, const int write_flags, const struct BlendFileWriteParams *params, ReportList *reports) |
bool | BLO_write_file_mem (Main *mainvar, MemFile *compare, MemFile *current, int write_flags) |
void | BLO_write_raw (BlendWriter *writer, size_t size_in_bytes, const void *data_ptr) |
void | BLO_write_struct_by_name (BlendWriter *writer, const char *struct_name, const void *data_ptr) |
void | BLO_write_struct_array_by_name (BlendWriter *writer, const char *struct_name, int array_size, const void *data_ptr) |
void | BLO_write_struct_by_id (BlendWriter *writer, int struct_id, const void *data_ptr) |
void | BLO_write_struct_at_address_by_id (BlendWriter *writer, int struct_id, const void *address, const void *data_ptr) |
void | BLO_write_struct_at_address_by_id_with_filecode (BlendWriter *writer, int filecode, int struct_id, const void *address, const void *data_ptr) |
void | BLO_write_struct_array_by_id (BlendWriter *writer, int struct_id, int array_size, const void *data_ptr) |
void | BLO_write_struct_array_at_address_by_id (BlendWriter *writer, int struct_id, int array_size, const void *address, const void *data_ptr) |
void | BLO_write_struct_list_by_id (BlendWriter *writer, int struct_id, ListBase *list) |
void | BLO_write_struct_list_by_name (BlendWriter *writer, const char *struct_name, ListBase *list) |
void | blo_write_id_struct (BlendWriter *writer, int struct_id, const void *id_address, const ID *id) |
int | BLO_get_struct_id_by_name (BlendWriter *writer, const char *struct_name) |
void | BLO_write_int32_array (BlendWriter *writer, uint num, const int32_t *data_ptr) |
void | BLO_write_uint32_array (BlendWriter *writer, uint num, const uint32_t *data_ptr) |
void | BLO_write_float_array (BlendWriter *writer, uint num, const float *data_ptr) |
void | BLO_write_double_array (BlendWriter *writer, uint num, const double *data_ptr) |
void | BLO_write_pointer_array (BlendWriter *writer, uint num, const void *data_ptr) |
void | BLO_write_float3_array (BlendWriter *writer, uint num, const float *data_ptr) |
void | BLO_write_string (BlendWriter *writer, const char *data_ptr) |
bool | BLO_write_is_undo (BlendWriter *writer) |
Variables | |
static CLG_LogRef | LOG = {"blo.writefile"} |
Generic DNA File Writing | |
#define | writestruct_at_address(wd, filecode, struct_id, nr, adr, data) writestruct_at_address_nr(wd, filecode, SDNA_TYPE_FROM_STRUCT(struct_id), nr, adr, data) |
#define | writestruct(wd, filecode, struct_id, nr, adr) writestruct_nr(wd, filecode, SDNA_TYPE_FROM_STRUCT(struct_id), nr, adr) |
#define | writelist(wd, filecode, struct_id, lb) writelist_nr(wd, filecode, SDNA_TYPE_FROM_STRUCT(struct_id), lb) |
static void | writestruct_at_address_nr (WriteData *wd, int filecode, const int struct_nr, int nr, const void *adr, const void *data) |
static void | writestruct_nr (WriteData *wd, int filecode, const int struct_nr, int nr, const void *adr) |
static void | writedata (WriteData *wd, int filecode, size_t len, const void *adr) |
static void | writelist_nr (WriteData *wd, int filecode, const int struct_nr, const ListBase *lb) |
Internal Write Wrapper's (Abstracts Compression) | |
Use if we want to store how many bytes have been written to the file. | |
enum | eWriteWrapType { WW_WRAP_NONE = 1 , WW_WRAP_ZSTD } |
typedef struct ZstdFrame | ZstdFrame |
typedef struct WriteWrap | WriteWrap |
static bool | ww_open_none (WriteWrap *ww, const char *filepath) |
static bool | ww_close_none (WriteWrap *ww) |
static size_t | ww_write_none (WriteWrap *ww, const char *buf, size_t buf_len) |
static void * | zstd_write_task (void *userdata) |
static bool | ww_open_zstd (WriteWrap *ww, const char *filepath) |
static void | zstd_write_u32_le (WriteWrap *ww, uint32_t val) |
static void | zstd_write_seekable_frames (WriteWrap *ww) |
static bool | ww_close_zstd (WriteWrap *ww) |
static size_t | ww_write_zstd (WriteWrap *ww, const char *buf, size_t buf_len) |
static void | ww_handle_init (eWriteWrapType ww_type, WriteWrap *r_ww) |
Write Data Type & Functions | |
typedef struct BlendWriter | BlendWriter |
static WriteData * | writedata_new (WriteWrap *ww) |
static void | writedata_do_write (WriteData *wd, const void *mem, size_t memlen) |
static void | writedata_free (WriteData *wd) |
Typed DNA File Writing | |
These functions are used by blender's .blend system for file saving/loading. | |
typedef struct RenderInfo | RenderInfo |
static void | current_screen_compat (Main *mainvar, bool use_active_win, bScreen **r_screen, Scene **r_scene, ViewLayer **r_view_layer) |
static void | write_renderinfo (WriteData *wd, Main *mainvar) |
static void | write_keymapitem (BlendWriter *writer, const wmKeyMapItem *kmi) |
static void | write_userdef (BlendWriter *writer, const UserDef *userdef) |
static void | write_libraries (WriteData *wd, Main *main) |
static void | write_global (WriteData *wd, int fileflags, Main *mainvar) |
static void | write_thumb (WriteData *wd, const BlendThumbnail *thumb) |
#define DNA_DEPRECATED_ALLOW |
IFF-style structure (but not IFF compatible!)
Start file:
`BLENDER_V100` `12` bytes (version 1.00 is just an example). `V` = big endian, `v` = little endian. `_` = 4 byte pointer, `-` = 8 byte pointer.
data-blocks: (also see struct BHead).
`bh.code` `char[4]` see `BLO_blend_defs.h` for a list of known types. `bh.len` `int32` length data after BHead in bytes. `bh.old` `void *` old pointer (the address at the time of writing the file). `bh.SDNAnr` `int32` struct index of structs stored in DNA1 data. `bh.nr` `int32` in case of array: number of structs. data ... ...
Almost all data in Blender are structures. Each struct saved gets a BHead header. With BHead the struct can be linked again and compared with #StructDNA.
Preferred writing order: (not really a must, but why would you do it random?) Any case: direct data is ALWAYS after the lib block.
(Local file data)
~/.config/blender/X.XX/config/startup.blend
. Definition at line 79 of file writefile.c.
#define ID_BUFFER_STATIC_SIZE 8192 |
#define MEM_BUFFER_SIZE (MEM_SIZE_OPTIMAL(1 << 17)) /* 128kb */ |
Definition at line 130 of file writefile.c.
#define MEM_CHUNK_SIZE (MEM_SIZE_OPTIMAL(1 << 15)) /* ~32kb */ |
Definition at line 131 of file writefile.c.
#define writelist | ( | wd, | |
filecode, | |||
struct_id, | |||
lb | |||
) | writelist_nr(wd, filecode, SDNA_TYPE_FROM_STRUCT(struct_id), lb) |
Definition at line 759 of file writefile.c.
#define writestruct | ( | wd, | |
filecode, | |||
struct_id, | |||
nr, | |||
adr | |||
) | writestruct_nr(wd, filecode, SDNA_TYPE_FROM_STRUCT(struct_id), nr, adr) |
Definition at line 756 of file writefile.c.
#define writestruct_at_address | ( | wd, | |
filecode, | |||
struct_id, | |||
nr, | |||
adr, | |||
data | |||
) | writestruct_at_address_nr(wd, filecode, SDNA_TYPE_FROM_STRUCT(struct_id), nr, adr, data) |
Definition at line 753 of file writefile.c.
#define ZSTD_BUFFER_SIZE (1 << 21) /* 2mb */ |
Definition at line 133 of file writefile.c.
#define ZSTD_CHUNK_SIZE (1 << 20) /* 1mb */ |
Definition at line 134 of file writefile.c.
#define ZSTD_COMPRESSION_LEVEL 3 |
Definition at line 136 of file writefile.c.
typedef struct BlendWriter BlendWriter |
typedef struct RenderInfo RenderInfo |
Definition at line 138 of file writefile.c.
enum eWriteWrapType |
Enumerator | |
---|---|
WW_WRAP_NONE | |
WW_WRAP_ZSTD |
Definition at line 147 of file writefile.c.
int BLO_get_struct_id_by_name | ( | BlendWriter * | writer, |
const char * | struct_name | ||
) |
Mapping between names and ids.
Definition at line 1565 of file writefile.c.
References DNA_struct_find_nr(), WriteData::sdna, and BlendWriter::wd.
Referenced by BLO_write_struct_array_by_name(), and BLO_write_struct_list_by_name().
void BLO_write_double_array | ( | BlendWriter * | writer, |
uint | num, | ||
const double * | data_ptr | ||
) |
Definition at line 1586 of file writefile.c.
References BLO_write_raw().
Referenced by write_ui_data().
bool BLO_write_file | ( | struct Main * | mainvar, |
const char * | filepath, | ||
int | write_flags, | ||
const struct BlendFileWriteParams * | params, | ||
struct ReportList * | reports | ||
) |
Definition at line 1315 of file writefile.c.
References BKE_bpath_absolute_convert(), BKE_BPATH_FOREACH_PATH_SKIP_LINKED, BKE_BPATH_FOREACH_PATH_SKIP_MULTIFILE, BKE_bpath_list_backup(), BKE_bpath_list_free(), BKE_bpath_list_restore(), BKE_bpath_relative_convert(), BKE_bpath_relative_rebase(), BKE_report(), BKE_reportf(), BLI_assert, BLI_assert_unreachable, BLI_path_cmp, BLI_path_is_abs_from_cwd(), BLI_path_is_rel(), BLI_path_normalize(), BLI_rename(), BLI_snprintf(), BLI_split_dir_part(), BLO_main_validate_libraries(), BLO_main_validate_shapekeys(), BLO_WRITE_PATH_REMAP_ABSOLUTE, BLO_WRITE_PATH_REMAP_NONE, BLO_WRITE_PATH_REMAP_RELATIVE, BLO_WRITE_PATH_REMAP_RELATIVE_ALL, WriteWrap::close, do_history(), err, FILE_MAX, Main::filepath, G, G_DEBUG_IO, G_FILE_COMPRESS, Main::lock, NULL, WriteWrap::open, params, blender::bke::attribute_accessor_functions::remove(), RPT_ERROR, RPT_INFO, STRNCPY, UNLIKELY, write_file_handle(), ww_handle_init(), WW_WRAP_NONE, and WW_WRAP_ZSTD.
Referenced by BKE_blendfile_userdef_write(), BKE_blendfile_write_partial(), BKE_memfile_undo_encode(), wm_autosave_write(), WM_exit_ex(), wm_file_write(), wm_homefile_write_exec(), and write_crash_blend().
bool BLO_write_file_mem | ( | struct Main * | mainvar, |
struct MemFile * | compare, | ||
struct MemFile * | current, | ||
int | write_flags | ||
) |
Definition at line 1479 of file writefile.c.
References err, NULL, and write_file_handle().
Referenced by BKE_memfile_undo_encode().
void BLO_write_float3_array | ( | BlendWriter * | writer, |
uint | num, | ||
const float * | data_ptr | ||
) |
Definition at line 1596 of file writefile.c.
References BLO_write_raw().
Referenced by blendWrite(), and write_mdisps().
void BLO_write_float_array | ( | BlendWriter * | writer, |
uint | num, | ||
const float * | data_ptr | ||
) |
Definition at line 1581 of file writefile.c.
References BLO_write_raw().
Referenced by BKE_constraint_blend_write(), BKE_fmodifiers_blend_write(), blendWrite(), curve_blend_write(), and mask_blend_write().
void blo_write_id_struct | ( | BlendWriter * | writer, |
int | struct_id, | ||
const void * | id_address, | ||
const ID * | id | ||
) |
Definition at line 1560 of file writefile.c.
References GS, id, ID::name, BlendWriter::wd, and writestruct_at_address_nr().
void BLO_write_int32_array | ( | BlendWriter * | writer, |
uint | num, | ||
const int32_t * | data_ptr | ||
) |
Definition at line 1571 of file writefile.c.
References BLO_write_raw().
Referenced by blendWrite(), curves_blend_write(), and write_ui_data().
bool BLO_write_is_undo | ( | BlendWriter * | writer | ) |
Sometimes different data is written depending on whether the file is saved to disk or used for undo. This function returns true when the current file-writing is done for undo.
Definition at line 1608 of file writefile.c.
References WriteData::use_memfile, and BlendWriter::wd.
Referenced by blendWrite(), CustomData_blend_write(), image_blend_write(), mesh_blend_write(), ntreeBlendWrite(), object_blend_write(), scene_blend_write(), shapekey_blend_write(), sound_blend_write(), vfont_blend_write(), and volume_blend_write().
void BLO_write_pointer_array | ( | BlendWriter * | writer, |
uint | num, | ||
const void * | data_ptr | ||
) |
Definition at line 1591 of file writefile.c.
References BLO_write_raw().
Referenced by curve_blend_write(), curves_blend_write(), greasepencil_blend_write(), mesh_blend_write(), metaball_blend_write(), object_blend_write(), pointcloud_blend_write(), volume_blend_write(), and write_moviePlaneTracks().
void BLO_write_raw | ( | BlendWriter * | writer, |
size_t | size_in_bytes, | ||
const void * | data_ptr | ||
) |
Write raw data.
Definition at line 1489 of file writefile.c.
References DATA, BlendWriter::wd, and writedata().
Referenced by BKE_packedfile_blend_write(), BKE_ptcache_blend_write(), BLO_write_double_array(), BLO_write_float3_array(), BLO_write_float_array(), BLO_write_int32_array(), BLO_write_pointer_array(), BLO_write_string(), BLO_write_uint32_array(), curve_blend_write(), CustomData_blend_write(), IDP_WriteArray(), IDP_WriteString(), mesh_blend_write(), object_blend_write(), scene_blend_write(), shapekey_blend_write(), text_blend_write(), write_area(), write_grid_paint_mask(), write_lightcache_texture(), and write_mdisps().
void BLO_write_string | ( | BlendWriter * | writer, |
const char * | data_ptr | ||
) |
Write a null terminated string.
Definition at line 1601 of file writefile.c.
References BLO_write_raw(), and NULL.
Referenced by BKE_animdata_blend_write(), BKE_asset_metadata_write(), BKE_fcurve_blend_write(), BKE_id_blend_write(), BKE_keyingsets_blend_write(), curves_blend_write(), ntreeBlendWrite(), text_blend_write(), write_area(), write_node_socket_interface(), and write_ui_data().
void BLO_write_struct_array_at_address_by_id | ( | BlendWriter * | writer, |
int | struct_id, | ||
int | array_size, | ||
const void * | address, | ||
const void * | data_ptr | ||
) |
Write struct array at address.
Definition at line 1539 of file writefile.c.
References DATA, BlendWriter::wd, and writestruct_at_address_nr().
void BLO_write_struct_array_by_id | ( | BlendWriter * | writer, |
int | struct_id, | ||
int | array_size, | ||
const void * | data_ptr | ||
) |
Definition at line 1531 of file writefile.c.
References DATA, BlendWriter::wd, and writestruct_nr().
Referenced by BLO_write_struct_array_by_name().
void BLO_write_struct_array_by_name | ( | BlendWriter * | writer, |
const char * | struct_name, | ||
int | array_size, | ||
const void * | data_ptr | ||
) |
Write struct array.
Definition at line 1499 of file writefile.c.
References BLO_get_struct_id_by_name(), BLO_write_struct_array_by_id(), CLOG_ERROR, LOG, and UNLIKELY.
Referenced by BKE_ptcache_blend_write(), BLO_write_struct_by_name(), and CustomData_blend_write().
void BLO_write_struct_at_address_by_id | ( | BlendWriter * | writer, |
int | struct_id, | ||
const void * | address, | ||
const void * | data_ptr | ||
) |
Write single struct at address.
Definition at line 1517 of file writefile.c.
References BLO_write_struct_at_address_by_id_with_filecode(), and DATA.
void BLO_write_struct_at_address_by_id_with_filecode | ( | BlendWriter * | writer, |
int | filecode, | ||
int | struct_id, | ||
const void * | address, | ||
const void * | data_ptr | ||
) |
Write single struct at address and specify a file-code.
Definition at line 1525 of file writefile.c.
References BlendWriter::wd, and writestruct_at_address_nr().
Referenced by BLO_write_struct_at_address_by_id().
void BLO_write_struct_by_id | ( | BlendWriter * | writer, |
int | struct_id, | ||
const void * | data_ptr | ||
) |
Definition at line 1512 of file writefile.c.
References DATA, BlendWriter::wd, and writestruct_nr().
Referenced by write_linestyle_alpha_modifiers(), write_linestyle_color_modifiers(), write_linestyle_geometry_modifiers(), and write_linestyle_thickness_modifiers().
void BLO_write_struct_by_name | ( | BlendWriter * | writer, |
const char * | struct_name, | ||
const void * | data_ptr | ||
) |
Write single struct.
Definition at line 1494 of file writefile.c.
References BLO_write_struct_array_by_name().
Referenced by BKE_constraint_blend_write(), BKE_fmodifiers_blend_write(), BKE_gpencil_modifier_blend_write(), BKE_modifier_blend_write(), BKE_pose_blend_write(), BKE_shaderfx_blend_write(), ntreeBlendWrite(), and SEQ_modifier_blend_write().
void BLO_write_struct_list_by_id | ( | BlendWriter * | writer, |
int | struct_id, | ||
ListBase * | list | ||
) |
Definition at line 1545 of file writefile.c.
References DATA, BlendWriter::wd, and writelist_nr().
Referenced by BLO_write_struct_list_by_name().
void BLO_write_struct_list_by_name | ( | BlendWriter * | writer, |
const char * | struct_name, | ||
struct ListBase * | list | ||
) |
Write struct list.
Definition at line 1550 of file writefile.c.
References BLO_get_struct_id_by_name(), BLO_write_struct_list_by_id(), CLOG_ERROR, LOG, and UNLIKELY.
void BLO_write_uint32_array | ( | BlendWriter * | writer, |
uint | num, | ||
const uint32_t * | data_ptr | ||
) |
Definition at line 1576 of file writefile.c.
References BLO_write_raw().
Referenced by BKE_previewimg_blend_write(), and blendWrite().
|
static |
Take care using 'use_active_win', since we won't want the currently active window to change which scene renders (currently only used for undo).
Definition at line 774 of file writefile.c.
References wmWindow::active, BKE_view_layer_find(), BKE_workspace_active_screen_get(), ListBase::first, wmWindow::next, NULL, wmWindow::scene, wmWindow::view_layer_name, wmWindowManager::windows, Main::wm, and wmWindow::workspace_hook.
Referenced by write_global(), and write_renderinfo().
|
static |
Definition at line 1269 of file writefile.c.
References BKE_report(), BLI_exists(), BLI_rename(), BLI_snprintf(), FILE_MAX, and RPT_ERROR.
Referenced by BLO_write_file(), uv_select_similar_face_exec(), uvedit_edge_select_enable(), uvedit_edge_select_set(), uvedit_edge_select_set_with_sticky(), uvedit_edge_select_shared_vert(), uvedit_face_select_enable(), uvedit_face_select_set(), uvedit_face_select_set_with_sticky(), uvedit_face_select_shared_vert(), uvedit_uv_select_enable(), uvedit_uv_select_set(), uvedit_uv_select_set_with_sticky(), and uvedit_uv_select_shared_vert().
Low level WRITE(2) wrapper that buffers data
adr | Pointer to new chunk of data |
len | Length of new chunk of data |
Definition at line 517 of file writefile.c.
References BLI_assert, WriteData::buf, WriteData::buffer, WriteData::chunk_size, WriteData::error, len, WriteData::max_size, MIN2, NULL, UNLIKELY, WriteData::used_len, and writedata_do_write().
Referenced by write_file_handle(), writedata(), and writestruct_at_address_nr().
BeGiN initializer for mywrite
ww | File write wrapper. |
compare | Previous memory file (can be NULL). |
current | The current memory file (can be NULL). |
Definition at line 573 of file writefile.c.
References BLO_memfile_write_init(), WriteData::mem, NULL, WriteData::use_memfile, and writedata_new().
Referenced by write_file_handle().
END the mywrite wrapper
Definition at line 591 of file writefile.c.
References BLO_memfile_write_finalize(), WriteData::buf, WriteData::buffer, err, WriteData::error, WriteData::mem, WriteData::use_memfile, WriteData::used_len, writedata_do_write(), and writedata_free().
Referenced by write_file_handle().
Flush helps the de-duplicating memory for undo-save by logically segmenting data, so differences in one part of memory won't cause unrelated data to be duplicated.
Definition at line 504 of file writefile.c.
References WriteData::buf, WriteData::buffer, WriteData::used_len, and writedata_do_write().
Referenced by mywrite_id_end(), write_file_handle(), and write_libraries().
Start writing of data related to a single ID.
Only does something when storing an undo step.
Definition at line 613 of file writefile.c.
References BLI_ghash_lookup(), MemFileWriteData::current_id_session_uuid, id, MemFileChunk::id_session_uuid, MemFileWriteData::id_session_uuid_mapping, WriteData::mem, NULL, POINTER_FROM_UINT, MemFileChunk::prev, MemFileWriteData::reference_current_chunk, ID::session_uuid, and WriteData::use_memfile.
Referenced by write_file_handle().
Start writing of data related to a single ID.
Only does something when storing an undo step.
Definition at line 643 of file writefile.c.
References MemFileWriteData::current_id_session_uuid, MAIN_ID_SESSION_UUID_UNSET, WriteData::mem, mywrite_flush(), and WriteData::use_memfile.
Referenced by write_file_handle().
|
static |
Definition at line 1085 of file writefile.c.
References Freestyle::a, B_ENDIAN, BKE_idtype_get_info_from_id(), BKE_lib_override_library_operations_store_end(), BKE_lib_override_library_operations_store_finalize(), BKE_lib_override_library_operations_store_init(), BKE_lib_override_library_operations_store_start(), IDTypeInfo::blend_write, BLENDER_FILE_VERSION, BLI_assert, blo_join_main(), blo_split_main(), CLOG_ERROR, BHead::code, SDNA::data, SDNA::data_len, DNA1, ELEM, ENDB, ENDIAN_ORDER, ListBase::first, GS, id, Collection::id, bNodeTree::id, ID_BUFFER_STATIC_SIZE, ID_IS_OVERRIDE_LIBRARY_REAL, ID_LI, ID_SCE, ID_WM, ID_WS, INDEX_ID_MAX, LIB_TAG_NO_MAIN, LIB_TAG_NO_USER_REFCOUNT, LIB_TAG_NOT_ALLOCATED, LOG, Scene::master_collection, MEM_mallocN, MEM_SAFE_FREE, mywrite(), mywrite_begin(), mywrite_end(), mywrite_flush(), mywrite_id_begin(), mywrite_id_end(), IDTypeInfo::name, ID::name, Main::next, ID::next, ntreeFromID(), NULL, ID::recalc_after_undo_push, ID::recalc_up_to_undo_push, scene, WriteData::sdna, set_listbasepointers(), IDTypeInfo::struct_size, ID::tag, ID::us, WriteData::use_memfile, write_global(), write_libraries(), write_renderinfo(), write_thumb(), write_userdef(), and writedata().
Referenced by BLO_write_file(), and BLO_write_file_mem().
Definition at line 1015 of file writefile.c.
References FileGlobal::_pad, FileGlobal::_pad1, BLENDER_FILE_MIN_SUBVERSION, BLENDER_FILE_MIN_VERSION, BLENDER_FILE_SUBVERSION, BLI_strncpy(), FileGlobal::build_commit_timestamp, build_commit_timestamp, FileGlobal::build_hash, build_hash, FileGlobal::cur_view_layer, current_screen_compat(), FileGlobal::curscene, FileGlobal::curscreen, FileGlobal::fileflags, Main::filepath, FileGlobal::filepath, G, G_FILE_FLAG_ALL_RUNTIME, G_FILE_RECOVER_WRITE, GLOB, FileGlobal::globalf, FileGlobal::minsubversion, FileGlobal::minversion, NULL, scene, STRNCPY, FileGlobal::subversion, FileGlobal::subvstr, WriteData::use_memfile, and writestruct.
Referenced by write_file_handle().
|
static |
Definition at line 847 of file writefile.c.
References BLO_write_struct, IDP_BlendWrite(), and wmKeyMapItem::properties.
Referenced by write_userdef().
Definition at line 933 of file writefile.c.
References Freestyle::a, BKE_id_blend_write(), BKE_idtype_idcode_is_linkable(), BKE_packedfile_blend_write(), CLOG_ERROR, CLOG_INFO, ID::flag, GS, id, ID_LI, ID_LINK_PLACEHOLDER, INDEX_ID_MAX, LIB_INDIRECT_WEAK_LINK, LIB_TAG_EXTERN, LIB_TAG_INDIRECT, LOG, main(), mywrite_flush(), ID::name, ID::next, NULL, set_listbasepointers(), ID::tag, ID::us, WriteData::use_memfile, and writestruct.
Referenced by write_file_handle().
This was originally added for the historic render-daemon feature, now write because it can be easily extracted without reading the whole blend file.
See: release/scripts/modules/blend_render_info.py
Definition at line 824 of file writefile.c.
References BLI_strncpy(), current_screen_compat(), data, ID_IS_LINKED, LISTBASE_FOREACH, NULL, R_BG_RENDER, REND, Main::scenes, and writedata().
Referenced by write_file_handle().
|
static |
Preview image, first 2 values are width and height second are an RGBA image (uchar).
Definition at line 1071 of file writefile.c.
References BLEN_THUMB_MEMSIZE_FILE, BlendThumbnail::height, TEST, BlendThumbnail::width, and writedata().
Referenced by write_file_handle().
|
static |
Definition at line 855 of file writefile.c.
References UserDef::addons, UserDef::asset_libraries, UserDef::autoexec_paths, BLO_write_struct, IDP_BlendWrite(), LISTBASE_FOREACH, bUserMenuItem_Op::prop, UserDef::themes, UserDef::uistyles, USER, UserDef::user_keyconfig_prefs, UserDef::user_keymaps, USER_MENU_TYPE_MENU, USER_MENU_TYPE_OPERATOR, USER_MENU_TYPE_PROP, UserDef::user_menus, BlendWriter::wd, write_keymapitem(), and writestruct.
Referenced by write_file_handle().
Definition at line 695 of file writefile.c.
References BLI_assert_msg, BHead::code, len, BHead::len, mywrite(), BHead::nr, NULL, BHead::old, and BHead::SDNAnr.
Referenced by BLO_write_raw(), write_file_handle(), write_renderinfo(), and write_thumb().
Definition at line 460 of file writefile.c.
References BLI_assert_msg, BLO_memfile_chunk_add(), WriteData::error, WriteData::mem, NULL, UNLIKELY, WriteData::use_memfile, WriteWrap::write, and WriteData::ww.
Referenced by mywrite(), mywrite_end(), and mywrite_flush().
Definition at line 486 of file writefile.c.
References WriteData::buf, WriteData::buffer, and MEM_freeN.
Referenced by mywrite_end().
Definition at line 437 of file writefile.c.
References WriteData::buf, WriteData::buffer, WriteData::chunk_size, DNA_sdna_current_get(), WriteData::max_size, MEM_BUFFER_SIZE, MEM_callocN, MEM_CHUNK_SIZE, MEM_mallocN, NULL, WriteData::sdna, WriteWrap::use_buf, WriteData::ww, ZSTD_BUFFER_SIZE, and ZSTD_CHUNK_SIZE.
Referenced by mywrite_begin().
|
static |
Definition at line 723 of file writefile.c.
References ListBase::first, Link::next, and writestruct_nr().
Referenced by BLO_write_struct_list_by_id().
|
static |
Definition at line 659 of file writefile.c.
References BLI_assert, BHead::code, data, BHead::len, mywrite(), BHead::nr, NULL, BHead::old, WriteData::sdna, BHead::SDNAnr, SDNA::structs, SDNA_Struct::type, and SDNA::types_size.
Referenced by blo_write_id_struct(), BLO_write_struct_array_at_address_by_id(), BLO_write_struct_at_address_by_id_with_filecode(), and writestruct_nr().
|
static |
Definition at line 688 of file writefile.c.
References writestruct_at_address_nr().
Referenced by BLO_write_struct_array_by_id(), BLO_write_struct_by_id(), and writelist_nr().
Definition at line 200 of file writefile.c.
References WriteWrap::file_handle.
Referenced by ww_close_zstd(), and ww_handle_init().
Definition at line 317 of file writefile.c.
References BLI_condition_end(), BLI_freelistN(), BLI_mutex_end(), BLI_threadpool_end(), WriteWrap::condition, WriteWrap::frames, WriteWrap::mutex, WriteWrap::tasks, WriteWrap::threadpool, WriteWrap::write_error, ZstdWriteBlockTask::ww, ww_close_none(), WriteWrap::zstd, and zstd_write_seekable_frames().
Referenced by ww_handle_init().
|
static |
Definition at line 369 of file writefile.c.
References WriteWrap::close, WriteWrap::open, WriteWrap::use_buf, WriteWrap::write, ww_close_none(), ww_close_zstd(), ww_open_none(), ww_open_zstd(), WW_WRAP_ZSTD, ww_write_none(), and ww_write_zstd().
Referenced by BLO_write_file().
Definition at line 187 of file writefile.c.
References BLI_open(), file, WriteWrap::file_handle, and O_BINARY.
Referenced by ww_handle_init(), and ww_open_zstd().
Definition at line 261 of file writefile.c.
References BLI_condition_init(), BLI_mutex_init(), BLI_system_thread_count(), BLI_threadpool_init(), WriteWrap::condition, max_ii(), WriteWrap::mutex, WriteWrap::threadpool, ZstdWriteBlockTask::ww, ww_open_none(), WriteWrap::zstd, and zstd_write_task().
Referenced by ww_handle_init().
|
static |
Definition at line 204 of file writefile.c.
References WriteWrap::file_handle.
Referenced by ww_handle_init(), zstd_write_seekable_frames(), zstd_write_task(), and zstd_write_u32_le().
|
static |
Definition at line 331 of file writefile.c.
References BLI_addtail(), BLI_assert, BLI_available_threads(), BLI_mutex_lock(), BLI_mutex_unlock(), BLI_remlink(), BLI_threadpool_insert(), BLI_threadpool_remove(), ListBase::first, MEM_freeN, MEM_mallocN, WriteWrap::mutex, WriteWrap::num_frames, blender::compositor::task, WriteWrap::tasks, WriteWrap::threadpool, WriteWrap::write_error, ZstdWriteBlockTask::ww, and WriteWrap::zstd.
Referenced by ww_handle_init().
Definition at line 292 of file writefile.c.
References BLI_listbase_count(), WriteWrap::frames, LISTBASE_FOREACH, ZstdWriteBlockTask::ww, ww_write_none(), WriteWrap::zstd, and zstd_write_u32_le().
Referenced by ww_close_zstd().
Definition at line 219 of file writefile.c.
References BLI_addtail(), BLI_condition_notify_all(), BLI_condition_wait(), BLI_mutex_lock(), BLI_mutex_unlock(), ZstdFrame::compressed_size, WriteWrap::condition, WriteWrap::frames, MEM_freeN, MEM_mallocN, WriteWrap::mutex, WriteWrap::next_frame, NULL, blender::compositor::task, ZstdFrame::uncompressed_size, WriteWrap::write_error, ZstdWriteBlockTask::ww, ww_write_none(), WriteWrap::zstd, and ZSTD_COMPRESSION_LEVEL.
Referenced by ww_open_zstd().
Definition at line 276 of file writefile.c.
References BLI_endian_switch_uint32(), ZstdWriteBlockTask::ww, and ww_write_none().
Referenced by zstd_write_seekable_frames().
|
static |
Definition at line 138 of file writefile.c.
Referenced by BLO_write_struct_array_by_name(), BLO_write_struct_list_by_name(), write_file_handle(), and write_libraries().