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
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')
-rw-r--r--source/blender/blenkernel/BKE_customdata.h2
-rw-r--r--source/blender/blenkernel/intern/customdata.cc2
-rw-r--r--source/blender/blenkernel/intern/mesh.cc12
3 files changed, 10 insertions, 6 deletions
diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h
index 2ced685884b..6461ff30cd6 100644
--- a/source/blender/blenkernel/BKE_customdata.h
+++ b/source/blender/blenkernel/BKE_customdata.h
@@ -718,7 +718,7 @@ void CustomData_data_transfer(const struct MeshPairRemap *me_remap,
*/
void CustomData_blend_write_prepare(CustomData &data,
blender::Vector<CustomDataLayer, 16> &layers_to_write,
- const blender::Set<blender::StringRef> &skip_names = {});
+ const blender::Set<std::string> &skip_names = {});
/**
* \param layers_to_write: Layers created by #CustomData_blend_write_prepare.
diff --git a/source/blender/blenkernel/intern/customdata.cc b/source/blender/blenkernel/intern/customdata.cc
index 69825031795..90bc79f6907 100644
--- a/source/blender/blenkernel/intern/customdata.cc
+++ b/source/blender/blenkernel/intern/customdata.cc
@@ -4355,7 +4355,7 @@ void CustomData_file_write_info(int type, const char **r_struct_name, int *r_str
void CustomData_blend_write_prepare(CustomData &data,
Vector<CustomDataLayer, 16> &layers_to_write,
- const Set<StringRef> &skip_names)
+ const Set<std::string> &skip_names)
{
for (const CustomDataLayer &layer : Span(data.layers, data.totlayer)) {
if (layer.flag & CD_FLAG_NOCOPY) {
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);