Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-08-23 20:50:47 +0300
committerHans Goudey <h.goudey@me.com>2022-08-23 20:50:47 +0300
commite36ced1dce96f980fd844181946b3318fcc6233c (patch)
treeef7625986e1db27babad51b683fa22160fb43984 /source/blender/blenkernel/intern/mesh.cc
parent35c601269b7c6920f8646ed743130065b93786b4 (diff)
Fix: Write hide status attributes for undo steps
We don't convert to the old mesh format when writing undo steps to avoid overhead. So we can't skip writing the hide attributes then.
Diffstat (limited to 'source/blender/blenkernel/intern/mesh.cc')
-rw-r--r--source/blender/blenkernel/intern/mesh.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/mesh.cc b/source/blender/blenkernel/intern/mesh.cc
index 1b8d094e9d3..7f2c09f049b 100644
--- a/source/blender/blenkernel/intern/mesh.cc
+++ b/source/blender/blenkernel/intern/mesh.cc
@@ -212,6 +212,7 @@ static void mesh_foreach_path(ID *id, BPathForeachPathData *bpath_data)
static void mesh_blend_write(BlendWriter *writer, ID *id, const void *id_address)
{
+ using namespace blender;
Mesh *mesh = (Mesh *)id;
const bool is_undo = BLO_write_is_undo(writer);
@@ -245,14 +246,17 @@ static void mesh_blend_write(BlendWriter *writer, ID *id, const void *id_address
memset(&mesh->pdata, 0, sizeof(mesh->pdata));
}
else {
+ Set<std::string> names_to_skip;
if (!BLO_write_is_undo(writer)) {
BKE_mesh_legacy_convert_hide_layers_to_flags(mesh);
+ /* When converting to the old mesh format, don't save redunant attributes. */
+ names_to_skip.add_multiple_new({".hide_vert", ".hide_edge", ".hide_poly"});
}
- CustomData_blend_write_prepare(mesh->vdata, vert_layers, {".hide_vert"});
- CustomData_blend_write_prepare(mesh->edata, edge_layers, {".hide_edge"});
- CustomData_blend_write_prepare(mesh->ldata, loop_layers);
- CustomData_blend_write_prepare(mesh->pdata, poly_layers, {".hide_poly"});
+ CustomData_blend_write_prepare(mesh->vdata, vert_layers, names_to_skip);
+ CustomData_blend_write_prepare(mesh->edata, edge_layers, names_to_skip);
+ CustomData_blend_write_prepare(mesh->ldata, loop_layers, names_to_skip);
+ CustomData_blend_write_prepare(mesh->pdata, poly_layers, names_to_skip);
}
BLO_write_id_struct(writer, Mesh, id_address, &mesh->id);