[Bf-blender-cvs] [35c601269b7] master: Fix T100482: Face Set visibility reset after saving
Hans Goudey
noreply at git.blender.org
Tue Aug 23 18:17:25 CEST 2022
Commit: 35c601269b7c6920f8646ed743130065b93786b4
Author: Hans Goudey
Date: Tue Aug 23 12:17:16 2022 -0400
Branches: master
https://developer.blender.org/rB35c601269b7c6920f8646ed743130065b93786b4
Fix T100482: Face Set visibility reset after saving
The face hide attribute wasn't created in order to store the visiblity
from the face sets, it was only updated if it already existed.
===================================================================
M source/blender/blenkernel/intern/paint.cc
===================================================================
diff --git a/source/blender/blenkernel/intern/paint.cc b/source/blender/blenkernel/intern/paint.cc
index cc3355a9a36..83a6ce72b2f 100644
--- a/source/blender/blenkernel/intern/paint.cc
+++ b/source/blender/blenkernel/intern/paint.cc
@@ -30,6 +30,7 @@
#include "BLT_translation.h"
#include "BKE_attribute.h"
+#include "BKE_attribute.hh"
#include "BKE_brush.h"
#include "BKE_ccg.h"
#include "BKE_colortools.h"
@@ -2094,20 +2095,23 @@ void BKE_sculpt_face_sets_ensure_from_base_mesh_visibility(Mesh *mesh)
void BKE_sculpt_sync_face_sets_visibility_to_base_mesh(Mesh *mesh)
{
+ using namespace blender::bke;
const int *face_sets = static_cast<const int *>(
CustomData_get_layer(&mesh->pdata, CD_SCULPT_FACE_SETS));
if (!face_sets) {
return;
}
- bool *hide_poly = (bool *)CustomData_get_layer_named(&mesh->pdata, CD_PROP_BOOL, ".hide_poly");
+ MutableAttributeAccessor attributes = mesh_attributes_for_write(*mesh);
+ SpanAttributeWriter<bool> hide_poly = attributes.lookup_or_add_for_write_only_span<bool>(
+ ".hide_poly", ATTR_DOMAIN_FACE);
if (!hide_poly) {
return;
}
-
- for (int i = 0; i < mesh->totpoly; i++) {
- hide_poly[i] = face_sets[i] < 0;
+ for (const int i : hide_poly.span.index_range()) {
+ hide_poly.span[i] = face_sets[i] < 0;
}
+ hide_poly.finish();
BKE_mesh_flush_hidden_from_polys(mesh);
}
More information about the Bf-blender-cvs
mailing list