Undo: support implicit-sharing in memfile undo step #106903

Merged
Jacques Lucke merged 78 commits from JacquesLucke/blender:implicit-sharing-undo into main 2024-02-29 17:15:09 +01:00
4 changed files with 6 additions and 4 deletions
Showing only changes of commit ca4cd00946 - Show all commits

View File

@ -1623,7 +1623,7 @@ void CurvesGeometry::blend_read(BlendDataReader &reader)
if (this->curve_offsets) {
this->runtime->curve_offsets_sharing_info = BLO_read_shared(
&reader, (void **)&this->curve_offsets, [&]() {
&reader, &this->curve_offsets, [&]() {
BLO_read_int32_array(&reader, this->curve_num + 1, &this->curve_offsets);
return implicit_sharing::info_for_mem_free(this->curve_offsets);
});

View File

@ -398,7 +398,7 @@ static void mesh_blend_read_data(BlendDataReader *reader, ID *id)
if (mesh->poly_offset_indices) {
mesh->runtime->poly_offsets_sharing_info = BLO_read_shared(
reader, (void **)&mesh->poly_offset_indices, [&]() {
reader, &mesh->poly_offset_indices, [&]() {
BLO_read_int32_array(reader, mesh->totpoly + 1, &mesh->poly_offset_indices);
return blender::implicit_sharing::info_for_mem_free(mesh->poly_offset_indices);
});

View File

@ -268,10 +268,12 @@ void BLO_read_pointer_array(BlendDataReader *reader, void **ptr_p);
/* Misc. */
#ifdef __cplusplus
const blender::ImplicitSharingInfo *BLO_read_shared(
const blender::ImplicitSharingInfo *BLO_read_shared_impl(
BlendDataReader *reader,
void **data_ptr,
blender::FunctionRef<const blender::ImplicitSharingInfo *()> read_cb);
# define BLO_read_shared(reader, ptr_p, read_cb) \
BLO_read_shared_impl(reader, (void **)ptr_p, read_cb)
#endif
int BLO_read_fileversion_get(BlendDataReader *reader);

View File

@ -5133,7 +5133,7 @@ void BLO_read_pointer_array(BlendDataReader *reader, void **ptr_p)
*ptr_p = final_array;
}
const blender::ImplicitSharingInfo *BLO_read_shared(
const blender::ImplicitSharingInfo *BLO_read_shared_impl(
BlendDataReader *reader,
void **data_ptr,
blender::FunctionRef<const blender::ImplicitSharingInfo *()> read_cb)