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
path: root/source
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-07-08 23:31:18 +0300
committerHans Goudey <h.goudey@me.com>2022-07-08 23:31:18 +0300
commit794819a45d74dcc071ee12a72e8339799e8f7619 (patch)
tree78f4103c6ce513f44a80e0121a2645b9d1f321bd /source
parentb3380ba360b4d7fa5c5c9c9d52eb7e9e33a5a355 (diff)
Fixes, cleanup, renaming
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_mesh_legacy_convert.h2
-rw-r--r--source/blender/blenkernel/BKE_mesh_mapping.h2
-rw-r--r--source/blender/blenkernel/BKE_paint.h2
-rw-r--r--source/blender/blenkernel/BKE_pbvh.h4
-rw-r--r--source/blender/blenkernel/intern/bvhutils.cc15
-rw-r--r--source/blender/blenkernel/intern/mesh.cc31
-rw-r--r--source/blender/blenkernel/intern/mesh_evaluate.cc113
-rw-r--r--source/blender/blenkernel/intern/mesh_legacy_convert.cc37
-rw-r--r--source/blender/blenkernel/intern/mesh_mapping.c6
-rw-r--r--source/blender/blenkernel/intern/paint.c18
-rw-r--r--source/blender/blenkernel/intern/pbvh.c34
-rw-r--r--source/blender/blenkernel/intern/pbvh_intern.h2
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh_convert.cc46
-rw-r--r--source/blender/draw/intern/draw_cache_extract_mesh_render_data.cc10
-rw-r--r--source/blender/draw/intern/draw_cache_impl_subdivision.cc2
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh.hh6
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc14
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_fdots.cc2
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines.cc16
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_adjacency.cc2
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_paint_mask.cc4
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_points.cc4
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_tris.cc2
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_lnor.cc4
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_pos_nor.cc8
-rw-r--r--source/blender/editors/include/ED_mesh.h4
-rw-r--r--source/blender/editors/mesh/editface.cc150
-rw-r--r--source/blender/editors/mesh/editmesh_undo.c2
-rw-r--r--source/blender/editors/mesh/meshtools.cc6
-rw-r--r--source/blender/editors/object/object_vgroup.c8
-rw-r--r--source/blender/editors/sculpt_paint/paint_hide.c10
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c8
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_dyntopo.c6
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_undo.c12
-rw-r--r--source/blender/editors/space_view3d/view3d_iterators.c6
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c14
-rw-r--r--source/blender/gpu/GPU_buffers.h4
-rw-r--r--source/blender/gpu/intern/gpu_buffers.c18
-rw-r--r--source/blender/gpu/intern/gpu_shader_builder_stubs.cc2
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c24
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_deform_curves_on_surface.cc9
41 files changed, 358 insertions, 311 deletions
diff --git a/source/blender/blenkernel/BKE_mesh_legacy_convert.h b/source/blender/blenkernel/BKE_mesh_legacy_convert.h
index 909fd0e0dea..6b625e8a6b5 100644
--- a/source/blender/blenkernel/BKE_mesh_legacy_convert.h
+++ b/source/blender/blenkernel/BKE_mesh_legacy_convert.h
@@ -17,6 +17,8 @@ struct CustomData;
struct Mesh;
struct MFace;
+void BKE_mesh_legacy_convert_hide_layers_to_flags(struct Mesh *mesh);
+
/**
* Recreate #MFace Tessellation.
*
diff --git a/source/blender/blenkernel/BKE_mesh_mapping.h b/source/blender/blenkernel/BKE_mesh_mapping.h
index e8e6ce19556..b78afa40203 100644
--- a/source/blender/blenkernel/BKE_mesh_mapping.h
+++ b/source/blender/blenkernel/BKE_mesh_mapping.h
@@ -79,7 +79,7 @@ typedef struct MeshElemMap {
/* mapping */
UvVertMap *BKE_mesh_uv_vert_map_create(const struct MPoly *mpoly,
- const bool *face_hide,
+ const bool *hide_face,
const struct MLoop *mloop,
const struct MLoopUV *mloopuv,
unsigned int totpoly,
diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h
index 34691bcc5f7..c706a86c6c8 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -207,7 +207,7 @@ bool BKE_paint_select_elem_test(struct Object *ob);
* Returns non-zero if any of the face's vertices are hidden, zero otherwise.
*/
bool paint_is_face_hidden(const struct MLoopTri *lt,
- const bool *vert_hide,
+ const bool *hide_vert,
const struct MLoop *mloop);
/**
* Returns non-zero if any of the corners of the grid
diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h
index e625ec25381..70c64744db0 100644
--- a/source/blender/blenkernel/BKE_pbvh.h
+++ b/source/blender/blenkernel/BKE_pbvh.h
@@ -413,7 +413,7 @@ typedef struct PBVHVertexIter {
/* mesh */
struct MVert *mverts;
float (*vert_normals)[3];
- const bool *vert_hide;
+ const bool *hide_vert;
int totvert;
const int *vert_indices;
float *vmask;
@@ -473,7 +473,7 @@ void pbvh_vertex_iter_init(PBVH *pbvh, PBVHNode *node, PBVHVertexIter *vi, int m
else if (vi.mverts) { \
vi.mvert = &vi.mverts[vi.vert_indices[vi.gx]]; \
if (vi.respect_hide) { \
- vi.visible = !(vi.vert_hide && vi.vert_hide[vi.vert_indices[vi.gx]]); \
+ vi.visible = !(vi.hide_vert && vi.hide_vert[vi.vert_indices[vi.gx]]); \
if (mode == PBVH_ITER_UNIQUE && !vi.visible) { \
continue; \
} \
diff --git a/source/blender/blenkernel/intern/bvhutils.cc b/source/blender/blenkernel/intern/bvhutils.cc
index 32db942784b..e032274816b 100644
--- a/source/blender/blenkernel/intern/bvhutils.cc
+++ b/source/blender/blenkernel/intern/bvhutils.cc
@@ -19,10 +19,9 @@
#include "BLI_threads.h"
#include "BLI_utildefines.h"
+#include "BKE_attribute.hh"
#include "BKE_bvhutils.h"
-#include "BKE_customdata.h"
#include "BKE_editmesh.h"
-#include "BKE_geometry_set.hh"
#include "BKE_mesh.h"
#include "BKE_mesh_runtime.h"
@@ -1184,11 +1183,11 @@ static BLI_bitmap *loose_edges_map_get(const MEdge *medge,
}
static BLI_bitmap *looptri_no_hidden_map_get(const MPoly *mpoly,
- const VArray<bool> &face_hide,
+ const VArray<bool> &hide_face,
const int looptri_len,
int *r_looptri_active_len)
{
- if (face_hide.is_single() && !face_hide.get_internal_single()) {
+ if (hide_face.is_single() && !hide_face.get_internal_single()) {
return nullptr;
}
BLI_bitmap *looptri_mask = BLI_BITMAP_NEW(looptri_len, __func__);
@@ -1198,7 +1197,7 @@ static BLI_bitmap *looptri_no_hidden_map_get(const MPoly *mpoly,
int i_poly = 0;
while (looptri_iter != looptri_len) {
int mp_totlooptri = mpoly[i_poly].totloop - 2;
- if (face_hide[i_poly]) {
+ if (hide_face[i_poly]) {
looptri_iter += mp_totlooptri;
}
else {
@@ -1283,12 +1282,10 @@ BVHTree *BKE_bvhtree_from_mesh_get(struct BVHTreeFromMesh *data,
break;
case BVHTREE_FROM_LOOPTRI_NO_HIDDEN: {
- MeshComponent component;
- component.replace(const_cast<Mesh *>(mesh), GeometryOwnershipType::ReadOnly);
-
+ blender::bke::AttributeAccessor attributes = blender::bke::mesh_attributes(*mesh);
mask = looptri_no_hidden_map_get(
mesh->mpoly,
- component.attribute_get_for_read<bool>(".hide_face", ATTR_DOMAIN_FACE, false),
+ attributes.lookup_or_default(".hide_face", ATTR_DOMAIN_FACE, false),
looptri_len,
&mask_bits_act_len);
ATTR_FALLTHROUGH;
diff --git a/source/blender/blenkernel/intern/mesh.cc b/source/blender/blenkernel/intern/mesh.cc
index 706aa349dfe..debf9988d89 100644
--- a/source/blender/blenkernel/intern/mesh.cc
+++ b/source/blender/blenkernel/intern/mesh.cc
@@ -37,10 +37,10 @@
#include "BLT_translation.h"
#include "BKE_anim_data.h"
+#include "BKE_attribute.hh"
#include "BKE_bpath.h"
#include "BKE_deform.h"
#include "BKE_editmesh.h"
-#include "BKE_geometry_set.hh"
#include "BKE_global.h"
#include "BKE_idtype.h"
#include "BKE_key.h"
@@ -210,33 +210,6 @@ static void mesh_foreach_path(ID *id, BPathForeachPathData *bpath_data)
}
}
-static void prepare_legacy_hide_data_for_writing(Mesh &mesh)
-{
- MeshComponent component;
- component.replace(&mesh, GeometryOwnershipType::ReadOnly);
-
- MutableSpan<MVert> verts(mesh.mvert, mesh.totvert);
- const VArray<bool> vert_hide = component.attribute_get_for_read<bool>(
- ".hide_vert", ATTR_DOMAIN_POINT, false);
- for (const int i : verts.index_range()) {
- SET_FLAG_FROM_TEST(verts[i].flag, vert_hide[i], ME_HIDE);
- }
-
- MutableSpan<MEdge> edges(mesh.medge, mesh.totedge);
- const VArray<bool> edge_hide = component.attribute_get_for_read<bool>(
- ".hide_edge", ATTR_DOMAIN_EDGE, false);
- for (const int i : edges.index_range()) {
- SET_FLAG_FROM_TEST(edges[i].flag, edge_hide[i], ME_HIDE);
- }
-
- MutableSpan<MPoly> polys(mesh.mpoly, mesh.totpoly);
- const VArray<bool> poly_hide = component.attribute_get_for_read<bool>(
- ".hide_face", ATTR_DOMAIN_FACE, false);
- for (const int i : polys.index_range()) {
- SET_FLAG_FROM_TEST(polys[i].flag, poly_hide[i], ME_HIDE);
- }
-}
-
static void mesh_blend_write(BlendWriter *writer, ID *id, const void *id_address)
{
Mesh *mesh = (Mesh *)id;
@@ -279,7 +252,7 @@ static void mesh_blend_write(BlendWriter *writer, ID *id, const void *id_address
}
if (BLO_write_use_legacy_mesh_format(writer)) {
- prepare_legacy_hide_data_for_writing(*mesh);
+ BKE_mesh_legacy_convert_hide_layers_to_flags(mesh);
}
BLO_write_id_struct(writer, Mesh, id_address, &mesh->id);
diff --git a/source/blender/blenkernel/intern/mesh_evaluate.cc b/source/blender/blenkernel/intern/mesh_evaluate.cc
index 7c7c4282ecc..5f55213e259 100644
--- a/source/blender/blenkernel/intern/mesh_evaluate.cc
+++ b/source/blender/blenkernel/intern/mesh_evaluate.cc
@@ -22,18 +22,17 @@
#include "BLI_math.h"
#include "BLI_span.hh"
#include "BLI_utildefines.h"
+#include "BLI_virtual_array.hh"
#include "BKE_customdata.h"
-#include "BKE_geometry_set.hh"
+#include "BKE_attribute.hh"
#include "BKE_mesh.h"
#include "BKE_multires.h"
-using blender::IndexRange;
using blender::MutableSpan;
using blender::Span;
using blender::VArray;
-using blender::bke::OutputAttribute_Typed;
/* -------------------------------------------------------------------- */
/** \name Polygon Calculations
@@ -737,54 +736,87 @@ void BKE_mesh_polygons_flip(MPoly *mpoly, MLoop *mloop, CustomData *ldata, int t
void BKE_mesh_flush_hidden_from_verts(Mesh *me)
{
- MeshComponent component;
- component.replace(me, GeometryOwnershipType::Editable);
+ using namespace blender;
+ using namespace blender::bke;
+ MutableAttributeAccessor attributes = mesh_attributes_for_write(*me);
- const VArray<bool> vert_hide = component.attribute_get_for_read<bool>(
+ const VArray<bool> hide_vert = attributes.lookup_or_default<bool>(
".hide_vert", ATTR_DOMAIN_POINT, false);
- if (vert_hide.is_single() && !vert_hide.get_internal_single()) {
- component.attribute_try_delete(".hide_edge");
- component.attribute_try_delete(".hide_face");
+ if (hide_vert.is_single() && !hide_vert.get_internal_single()) {
+ attributes.remove(".hide_edge");
+ attributes.remove(".hide_face");
return;
}
+ const VArraySpan<bool> hide_vert_span{hide_vert};
+ const Span<MEdge> edges(me->medge, me->totedge);
+ const Span<MPoly> polys(me->mpoly, me->totpoly);
+ const Span<MLoop> loops(me->mloop, me->totloop);
- OutputAttribute_Typed<bool> edge_hide = component.attribute_try_get_for_output_only<bool>(
+ /* Hide edges when both of their vertices are hidden. */
+ SpanAttributeWriter<bool> hide_edge = attributes.lookup_or_add_for_write_only_span<bool>(
".hide_edge", ATTR_DOMAIN_EDGE);
- component.attribute_try_adapt_domain(vert_hide, ATTR_DOMAIN_POINT, ATTR_DOMAIN_EDGE)
- .materialize(edge_hide.as_span());
- edge_hide.save();
+ for (const int i : edges.index_range()) {
+ const MEdge &edge = edges[i];
+ hide_edge.span[i] = hide_vert_span[edge.v1] && hide_vert_span[edge.v2];
+ }
+ hide_edge.finish();
- OutputAttribute_Typed<bool> face_hide = component.attribute_try_get_for_output_only<bool>(
+ /* Hide faces when any of their vertices are hidden. */
+ SpanAttributeWriter<bool> hide_face = attributes.lookup_or_add_for_write_only_span<bool>(
".hide_face", ATTR_DOMAIN_FACE);
- component.attribute_try_adapt_domain(vert_hide, ATTR_DOMAIN_POINT, ATTR_DOMAIN_FACE)
- .materialize(face_hide.as_span());
- face_hide.save();
+ for (const int i : polys.index_range()) {
+ const MPoly &poly = polys[i];
+ const Span<MLoop> loops = loops.slice(poly.loopstart, poly.totloop);
+ hide_face.span[i] = std::any_of(
+ loops.begin(), loops.end(), [&](const MLoop &loop) { return hide_vert_span[loop.v]; });
+ }
+ hide_face.finish();
}
void BKE_mesh_flush_hidden_from_polys(Mesh *me)
{
- MeshComponent component;
- component.replace(me, GeometryOwnershipType::Editable);
+ using namespace blender;
+ using namespace blender::bke;
+ MutableAttributeAccessor attributes = mesh_attributes_for_write(*me);
- const VArray<bool> face_hide = component.attribute_get_for_read<bool>(
+ const VArray<bool> hide_face = attributes.lookup_or_default<bool>(
".hide_face", ATTR_DOMAIN_FACE, false);
- if (face_hide.is_single() && !face_hide.get_internal_single()) {
- component.attribute_try_delete(".hide_vert");
- component.attribute_try_delete(".hide_edge");
+ if (hide_face.is_single() && !hide_face.get_internal_single()) {
+ attributes.remove(".hide_vert");
+ attributes.remove(".hide_edge");
return;
}
-
- OutputAttribute_Typed<bool> edge_hide = component.attribute_try_get_for_output_only<bool>(
+ const VArraySpan<bool> hide_face_span{hide_face};
+ const Span<MPoly> polys(me->mpoly, me->totpoly);
+ const Span<MLoop> loops(me->mloop, me->totloop);
+ SpanAttributeWriter<bool> hide_vert = attributes.lookup_or_add_for_write_only_span<bool>(
+ ".hide_vert", ATTR_DOMAIN_POINT);
+ SpanAttributeWriter<bool> hide_edge = attributes.lookup_or_add_for_write_only_span<bool>(
".hide_edge", ATTR_DOMAIN_EDGE);
- component.attribute_try_adapt_domain(face_hide, ATTR_DOMAIN_FACE, ATTR_DOMAIN_EDGE)
- .materialize(edge_hide.as_span());
- edge_hide.save();
- OutputAttribute_Typed<bool> vert_hide = component.attribute_try_get_for_output_only<bool>(
- ".hide_vert", ATTR_DOMAIN_POINT);
- component.attribute_try_adapt_domain(face_hide, ATTR_DOMAIN_FACE, ATTR_DOMAIN_POINT)
- .materialize(vert_hide.as_span());
- vert_hide.save();
+ /* Hide all edges or vertices connected to hidden faces. */
+ for (const int i : polys.index_range()) {
+ if (hide_face_span[i]) {
+ const MPoly &poly = polys[i];
+ for (const MLoop &loop : loops.slice(poly.loopstart, poly.totloop)) {
+ hide_vert.span[loop.v] = true;
+ hide_edge.span[loop.e] = true;
+ }
+ }
+ }
+ /* Unhide vertices and edges connected to visible faces. */
+ for (const int i : polys.index_range()) {
+ if (!hide_face_span[i]) {
+ const MPoly &poly = polys[i];
+ for (const MLoop &loop : loops.slice(poly.loopstart, poly.totloop)) {
+ hide_vert.span[loop.v] = false;
+ hide_edge.span[loop.e] = false;
+ }
+ }
+ }
+
+ hide_vert.finish();
+ hide_edge.finish();
}
void BKE_mesh_flush_select_from_polys_ex(MVert *mvert,
@@ -832,13 +864,13 @@ void BKE_mesh_flush_select_from_polys(Mesh *me)
static void mesh_flush_select_from_verts(const Span<MVert> verts,
const Span<MLoop> loops,
- const VArray<bool> &edge_hide,
- const VArray<bool> &poly_hide,
+ const VArray<bool> &hide_edge,
+ const VArray<bool> &hide_face,
MutableSpan<MEdge> edges,
MutableSpan<MPoly> polys)
{
for (const int i : edges.index_range()) {
- if (!edge_hide[i]) {
+ if (!hide_edge[i]) {
MEdge &edge = edges[i];
if ((verts[edge.v1].flag & SELECT) && (verts[edge.v2].flag & SELECT)) {
edge.flag |= SELECT;
@@ -850,7 +882,7 @@ static void mesh_flush_select_from_verts(const Span<MVert> verts,
}
for (const int i : polys.index_range()) {
- if (poly_hide[i]) {
+ if (hide_face[i]) {
continue;
}
MPoly &poly = polys[i];
@@ -871,14 +903,13 @@ static void mesh_flush_select_from_verts(const Span<MVert> verts,
void BKE_mesh_flush_select_from_verts(Mesh *me)
{
- MeshComponent component;
- component.replace(me, GeometryOwnershipType::Editable);
+ blender::bke::AttributeAccessor attributes = blender::bke::mesh_attributes(*me);
mesh_flush_select_from_verts(
{me->mvert, me->totvert},
{me->mloop, me->totloop},
- component.attribute_get_for_read<bool>(".hide_edge", ATTR_DOMAIN_EDGE, false),
- component.attribute_get_for_read<bool>(".hide_face", ATTR_DOMAIN_FACE, false),
+ attributes.lookup_or_default<bool>(".hide_edge", ATTR_DOMAIN_EDGE, false),
+ attributes.lookup_or_default<bool>(".hide_face", ATTR_DOMAIN_FACE, false),
{me->medge, me->totedge},
{me->mpoly, me->totpoly});
}
diff --git a/source/blender/blenkernel/intern/mesh_legacy_convert.cc b/source/blender/blenkernel/intern/mesh_legacy_convert.cc
index 479dd6a012a..e30db1f445f 100644
--- a/source/blender/blenkernel/intern/mesh_legacy_convert.cc
+++ b/source/blender/blenkernel/intern/mesh_legacy_convert.cc
@@ -7,7 +7,7 @@
* Functions to convert mesh data to and from legacy formats like #MFace.
*/
-// #include <climits>
+#define DNA_DEPRECATED_ALLOW
#include "MEM_guardedalloc.h"
@@ -20,6 +20,7 @@
#include "BLI_polyfill_2d.h"
#include "BLI_utildefines.h"
+#include "BKE_attribute.hh"
#include "BKE_customdata.h"
#include "BKE_mesh.h"
#include "BKE_mesh_legacy_convert.h"
@@ -874,3 +875,37 @@ void BKE_mesh_add_mface_layers(CustomData *fdata, CustomData *ldata, int total)
}
/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Conversion to Legacy Hidden Flags
+ * \{ */
+
+void BKE_mesh_legacy_convert_hide_layers_to_flags(Mesh *mesh)
+{
+ using namespace blender;
+ using namespace blender::bke;
+ const AttributeAccessor attributes = mesh_attributes(*mesh);
+
+ MutableSpan<MVert> verts(mesh->mvert, mesh->totvert);
+ const VArray<bool> hide_vert = attributes.lookup_or_default<bool>(
+ ".hide_vert", ATTR_DOMAIN_POINT, false);
+ for (const int i : verts.index_range()) {
+ SET_FLAG_FROM_TEST(verts[i].flag, hide_vert[i], ME_HIDE);
+ }
+
+ MutableSpan<MEdge> edges(mesh->medge, mesh->totedge);
+ const VArray<bool> hide_edge = attributes.lookup_or_default<bool>(
+ ".hide_edge", ATTR_DOMAIN_EDGE, false);
+ for (const int i : edges.index_range()) {
+ SET_FLAG_FROM_TEST(edges[i].flag, hide_edge[i], ME_HIDE);
+ }
+
+ MutableSpan<MPoly> polys(mesh->mpoly, mesh->totpoly);
+ const VArray<bool> hide_face = attributes.lookup_or_default<bool>(
+ ".hide_face", ATTR_DOMAIN_FACE, false);
+ for (const int i : polys.index_range()) {
+ SET_FLAG_FROM_TEST(polys[i].flag, hide_face[i], ME_HIDE);
+ }
+}
+
+/** \} */
diff --git a/source/blender/blenkernel/intern/mesh_mapping.c b/source/blender/blenkernel/intern/mesh_mapping.c
index da689feb331..80b16045056 100644
--- a/source/blender/blenkernel/intern/mesh_mapping.c
+++ b/source/blender/blenkernel/intern/mesh_mapping.c
@@ -29,7 +29,7 @@
/* ngon version wip, based on BM_uv_vert_map_create */
UvVertMap *BKE_mesh_uv_vert_map_create(const MPoly *mpoly,
- const bool *face_hide,
+ const bool *hide_face,
const MLoop *mloop,
const MLoopUV *mloopuv,
uint totpoly,
@@ -52,7 +52,7 @@ UvVertMap *BKE_mesh_uv_vert_map_create(const MPoly *mpoly,
/* generate UvMapVert array */
mp = mpoly;
for (a = 0; a < totpoly; a++, mp++) {
- if (!selected || (!(face_hide && face_hide[a]) && (mp->flag & ME_FACE_SEL))) {
+ if (!selected || (!(hide_face && hide_face[a]) && (mp->flag & ME_FACE_SEL))) {
totuv += mp->totloop;
}
}
@@ -75,7 +75,7 @@ UvVertMap *BKE_mesh_uv_vert_map_create(const MPoly *mpoly,
mp = mpoly;
for (a = 0; a < totpoly; a++, mp++) {
- if (!selected || (!(face_hide && face_hide[a]) && (mp->flag & ME_FACE_SEL))) {
+ if (!selected || (!(hide_face && hide_face[a]) && (mp->flag & ME_FACE_SEL))) {
float(*tf_uv)[2] = NULL;
if (use_winding) {
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index 3bc6be62629..b8ce5dd141e 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -1237,13 +1237,13 @@ void BKE_paint_blend_read_lib(BlendLibReader *reader, Scene *sce, Paint *p)
}
}
-bool paint_is_face_hidden(const MLoopTri *lt, const bool *vert_hide, const MLoop *mloop)
+bool paint_is_face_hidden(const MLoopTri *lt, const bool *hide_vert, const MLoop *mloop)
{
- if (!vert_hide) {
+ if (!hide_vert) {
return false;
}
- return ((vert_hide[mloop[lt->tri[0]].v]) || (vert_hide[mloop[lt->tri[1]].v]) ||
- (vert_hide[mloop[lt->tri[2]].v]));
+ return ((hide_vert[mloop[lt->tri[0]].v]) || (hide_vert[mloop[lt->tri[1]].v]) ||
+ (hide_vert[mloop[lt->tri[2]].v]));
}
bool paint_is_grid_face_hidden(const uint *grid_hidden, int gridsize, int x, int y)
@@ -2064,11 +2064,11 @@ void BKE_sculpt_face_sets_ensure_from_base_mesh_visibility(Mesh *mesh)
}
int *face_sets = CustomData_get_layer(&mesh->pdata, CD_SCULPT_FACE_SETS);
- const bool *face_hide = (const bool *)CustomData_get_layer_named(
+ const bool *hide_face = (const bool *)CustomData_get_layer_named(
&mesh->pdata, CD_PROP_BOOL, ".hide_face");
for (int i = 0; i < mesh->totpoly; i++) {
- if (!(face_hide && face_hide[i])) {
+ if (!(hide_face && hide_face[i])) {
continue;
}
@@ -2093,13 +2093,13 @@ void BKE_sculpt_sync_face_sets_visibility_to_base_mesh(Mesh *mesh)
return;
}
- bool *face_hide = (bool *)CustomData_get_layer_named(&mesh->pdata, CD_PROP_BOOL, ".hide_face");
- if (!face_hide) {
+ bool *hide_face = (bool *)CustomData_get_layer_named(&mesh->pdata, CD_PROP_BOOL, ".hide_face");
+ if (!hide_face) {
return;
}
for (int i = 0; i < mesh->totpoly; i++) {
- face_hide[i] = face_sets[i] < 0;
+ hide_face[i] = face_sets[i] < 0;
}
BKE_mesh_flush_hidden_from_polys(mesh);
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c
index c17676a63f1..0b2d0e51582 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -287,7 +287,7 @@ static void build_mesh_leaf_node(PBVH *pbvh, PBVHNode *node)
}
if (has_visible == false) {
- if (!paint_is_face_hidden(lt, pbvh->vert_hide, pbvh->mloop)) {
+ if (!paint_is_face_hidden(lt, pbvh->hide_vert, pbvh->mloop)) {
has_visible = true;
}
}
@@ -562,7 +562,7 @@ void BKE_pbvh_build_mesh(PBVH *pbvh,
pbvh->verts = verts;
BKE_mesh_vertex_normals_ensure(mesh);
pbvh->vert_normals = BKE_mesh_vertex_normals_for_write(mesh);
- pbvh->vert_hide = (bool *)CustomData_get_layer_named(&mesh->vdata, CD_PROP_BOOL, ".hide_vert");
+ pbvh->hide_vert = (bool *)CustomData_get_layer_named(&mesh->vdata, CD_PROP_BOOL, ".hide_vert");
pbvh->vert_bitmap = MEM_calloc_arrayN(totvert, sizeof(bool), "bvh->vert_bitmap");
pbvh->totvert = totvert;
pbvh->leaf_limit = LEAF_LIMIT;
@@ -1330,7 +1330,7 @@ static void pbvh_update_draw_buffer_cb(void *__restrict userdata,
pbvh->mpoly,
pbvh->mloop,
pbvh->looptri,
- pbvh->vert_hide,
+ pbvh->hide_vert,
node->prim_indices,
CustomData_get_layer(pbvh->pdata, CD_SCULPT_FACE_SETS),
node->totprim,
@@ -1365,7 +1365,7 @@ static void pbvh_update_draw_buffer_cb(void *__restrict userdata,
node->draw_buffers,
pbvh->verts,
pbvh->vert_normals,
- pbvh->vert_hide,
+ pbvh->hide_vert,
vdata,
ldata,
CustomData_get_layer(pbvh->vdata, CD_PAINT_MASK),
@@ -1604,12 +1604,12 @@ static void pbvh_faces_node_visibility_update(PBVH *pbvh, PBVHNode *node)
BKE_pbvh_node_num_verts(pbvh, node, NULL, &totvert);
BKE_pbvh_node_get_verts(pbvh, node, &vert_indices, &mvert);
- if (pbvh->vert_hide == NULL) {
+ if (pbvh->hide_vert == NULL) {
BKE_pbvh_node_fully_hidden_set(node, false);
return;
}
for (i = 0; i < totvert; i++) {
- if (!(pbvh->vert_hide[vert_indices[i]])) {
+ if (!(pbvh->hide_vert[vert_indices[i]])) {
BKE_pbvh_node_fully_hidden_set(node, false);
return;
}
@@ -2319,7 +2319,7 @@ static bool pbvh_faces_node_raycast(PBVH *pbvh,
const MLoopTri *lt = &pbvh->looptri[faces[i]];
const int *face_verts = node->face_vert_indices[i];
- if (pbvh->respect_hide && paint_is_face_hidden(lt, pbvh->vert_hide, mloop)) {
+ if (pbvh->respect_hide && paint_is_face_hidden(lt, pbvh->hide_vert, mloop)) {
continue;
}
@@ -2628,7 +2628,7 @@ static bool pbvh_faces_node_nearest_to_ray(PBVH *pbvh,
const MLoopTri *lt = &pbvh->looptri[faces[i]];
const int *face_verts = node->face_vert_indices[i];
- if (pbvh->respect_hide && paint_is_face_hidden(lt, pbvh->vert_hide, mloop)) {
+ if (pbvh->respect_hide && paint_is_face_hidden(lt, pbvh->hide_vert, mloop)) {
continue;
}
@@ -3154,7 +3154,7 @@ void pbvh_vertex_iter_init(PBVH *pbvh, PBVHNode *node, PBVHVertexIter *vi, int m
vi->mask = NULL;
if (pbvh->type == PBVH_FACES) {
vi->vert_normals = pbvh->vert_normals;
- vi->vert_hide = pbvh->vert_hide;
+ vi->hide_vert = pbvh->hide_vert;
vi->vmask = CustomData_get_layer(pbvh->vdata, CD_PAINT_MASK);
}
@@ -3237,22 +3237,22 @@ const float (*BKE_pbvh_get_vert_normals(const PBVH *pbvh))[3]
const bool *BKE_pbvh_get_vert_hide(const PBVH *pbvh)
{
BLI_assert(pbvh->type == PBVH_FACES);
- return pbvh->vert_hide;
+ return pbvh->hide_vert;
}
bool *BKE_pbvh_get_vert_hide_for_write(PBVH *pbvh)
{
BLI_assert(pbvh->type == PBVH_FACES);
- if (pbvh->vert_hide) {
- return pbvh->vert_hide;
+ if (pbvh->hide_vert) {
+ return pbvh->hide_vert;
}
- pbvh->vert_hide = CustomData_get_layer_named(&pbvh->mesh->vdata, CD_PROP_BOOL, ".hide_vert");
- if (pbvh->vert_hide) {
- return pbvh->vert_hide;
+ pbvh->hide_vert = CustomData_get_layer_named(&pbvh->mesh->vdata, CD_PROP_BOOL, ".hide_vert");
+ if (pbvh->hide_vert) {
+ return pbvh->hide_vert;
}
- pbvh->vert_hide = (bool *)CustomData_add_layer_named(
+ pbvh->hide_vert = (bool *)CustomData_add_layer_named(
&pbvh->mesh->vdata, CD_PROP_BOOL, CD_CALLOC, NULL, pbvh->mesh->totvert, ".hide_vert");
- return pbvh->vert_hide;
+ return pbvh->hide_vert;
}
void BKE_pbvh_subdiv_cgg_set(PBVH *pbvh, SubdivCCG *subdiv_ccg)
diff --git a/source/blender/blenkernel/intern/pbvh_intern.h b/source/blender/blenkernel/intern/pbvh_intern.h
index 1599da10667..3f3cfd23ab7 100644
--- a/source/blender/blenkernel/intern/pbvh_intern.h
+++ b/source/blender/blenkernel/intern/pbvh_intern.h
@@ -148,7 +148,7 @@ struct PBVH {
/* NOTE: Normals are not `const` because they can be updated for drawing by sculpt code. */
float (*vert_normals)[3];
- bool *vert_hide;
+ bool *hide_vert;
struct MVert *verts;
const struct MPoly *mpoly;
const struct MLoop *mloop;
diff --git a/source/blender/bmesh/intern/bmesh_mesh_convert.cc b/source/blender/bmesh/intern/bmesh_mesh_convert.cc
index b4a319f2fe5..82ac4246486 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_convert.cc
+++ b/source/blender/bmesh/intern/bmesh_mesh_convert.cc
@@ -85,8 +85,8 @@
#include "BLI_span.hh"
#include "BLI_string_ref.hh"
+#include "BKE_attribute.hh"
#include "BKE_customdata.h"
-#include "BKE_geometry_set.hh"
#include "BKE_mesh.h"
#include "BKE_mesh_runtime.h"
#include "BKE_multires.h"
@@ -356,11 +356,11 @@ void BM_mesh_bm_from_me(BMesh *bm, const Mesh *me, const struct BMeshFromMeshPar
CustomData_get_offset(&bm->vdata, CD_SHAPE_KEYINDEX) :
-1;
- const bool *vert_hide = (const bool *)CustomData_get_layer_named(
+ const bool *hide_vert = (const bool *)CustomData_get_layer_named(
&me->vdata, CD_PROP_BOOL, ".hide_vert");
- const bool *edge_hide = (const bool *)CustomData_get_layer_named(
+ const bool *hide_edge = (const bool *)CustomData_get_layer_named(
&me->edata, CD_PROP_BOOL, ".hide_edge");
- const bool *face_hide = (const bool *)CustomData_get_layer_named(
+ const bool *hide_face = (const bool *)CustomData_get_layer_named(
&me->pdata, CD_PROP_BOOL, ".hide_face");
Span<MVert> mvert{me->mvert, me->totvert};
@@ -372,7 +372,7 @@ void BM_mesh_bm_from_me(BMesh *bm, const Mesh *me, const struct BMeshFromMeshPar
/* Transfer flag. */
v->head.hflag = BM_vert_flag_from_mflag(mvert[i].flag & ~SELECT);
- if (vert_hide && vert_hide[i]) {
+ if (hide_vert && hide_vert[i]) {
BM_elem_flag_enable(v, BM_ELEM_HIDDEN);
}
@@ -418,7 +418,7 @@ void BM_mesh_bm_from_me(BMesh *bm, const Mesh *me, const struct BMeshFromMeshPar
/* Transfer flags. */
e->head.hflag = BM_edge_flag_from_mflag(medge[i].flag & ~SELECT);
- if (edge_hide && edge_hide[i]) {
+ if (hide_edge && hide_edge[i]) {
BM_elem_flag_enable(e, BM_ELEM_HIDDEN);
}
@@ -474,7 +474,7 @@ void BM_mesh_bm_from_me(BMesh *bm, const Mesh *me, const struct BMeshFromMeshPar
/* Transfer flag. */
f->head.hflag = BM_face_flag_from_mflag(mpoly[i].flag & ~ME_FACE_SEL);
- if (face_hide && face_hide[i]) {
+ if (hide_face && hide_face[i]) {
BM_elem_flag_enable(f, BM_ELEM_HIDDEN);
}
@@ -923,23 +923,24 @@ BLI_INLINE void bmesh_quick_edgedraw_flag(MEdge *med, BMEdge *e)
}
template<typename GetFn>
-static void write_elem_flag_to_attribute(MeshComponent &mesh,
+static void write_elem_flag_to_attribute(blender::bke::MutableAttributeAccessor &attributes,
const StringRef attribute_name,
const eAttrDomain domain,
const bool do_write,
const GetFn &get_fn)
{
- if (!do_write) {
- mesh.attribute_try_delete(attribute_name);
+ using namespace blender;
+ if (do_write) {
+ bke::SpanAttributeWriter<bool> attribute = attributes.lookup_or_add_for_write_only_span<bool>(
+ attribute_name, domain);
+ for (const int i : attribute.span.index_range()) {
+ attribute.span[i] = get_fn(i);
+ }
+ attribute.finish();
}
else {
- blender::bke::OutputAttribute_Typed<bool> attribute =
- mesh.attribute_try_get_for_output_only<bool>(attribute_name, domain);
- MutableSpan<bool> hide = attribute.as_span();
- for (const int i : hide.index_range()) {
- hide[i] = get_fn(i);
- }
- attribute.save();
+ /* To avoid overhead, remove the hide attribute if possible. */
+ attributes.remove(attribute_name);
}
}
@@ -949,26 +950,25 @@ static void convert_bmesh_hide_flags_to_mesh_attributes(BMesh &bm,
const bool need_hide_face,
Mesh &mesh)
{
+ using namespace blender;
/* The "hide" attributes are stored as flags on #BMesh. */
BLI_assert(CustomData_get_layer_named(&bm.vdata, CD_PROP_BOOL, ".hide_vert") == nullptr);
BLI_assert(CustomData_get_layer_named(&bm.edata, CD_PROP_BOOL, ".edge_vert") == nullptr);
BLI_assert(CustomData_get_layer_named(&bm.pdata, CD_PROP_BOOL, ".face_vert") == nullptr);
- MeshComponent component;
- component.replace(&mesh, GeometryOwnershipType::Editable);
-
+ bke::MutableAttributeAccessor attributes = bke::mesh_attributes_for_write(mesh);
BM_mesh_elem_table_ensure(&bm, BM_VERT | BM_EDGE | BM_FACE);
write_elem_flag_to_attribute(
- component, ".hide_vert", ATTR_DOMAIN_POINT, need_hide_vert, [&](const int i) {
+ attributes, ".hide_vert", ATTR_DOMAIN_POINT, need_hide_vert, [&](const int i) {
return BM_elem_flag_test(BM_vert_at_index(&bm, i), BM_ELEM_HIDDEN);
});
write_elem_flag_to_attribute(
- component, ".hide_edge", ATTR_DOMAIN_EDGE, need_hide_edge, [&](const int i) {
+ attributes, ".hide_edge", ATTR_DOMAIN_EDGE, need_hide_edge, [&](const int i) {
return BM_elem_flag_test(BM_edge_at_index(&bm, i), BM_ELEM_HIDDEN);
});
write_elem_flag_to_attribute(
- component, ".hide_face", ATTR_DOMAIN_FACE, need_hide_face, [&](const int i) {
+ attributes, ".hide_face", ATTR_DOMAIN_FACE, need_hide_face, [&](const int i) {
return BM_elem_flag_test(BM_face_at_index(&bm, i), BM_ELEM_HIDDEN);
});
}
diff --git a/source/blender/draw/intern/draw_cache_extract_mesh_render_data.cc b/source/blender/draw/intern/draw_cache_extract_mesh_render_data.cc
index be55db3dd31..e1b3218eb4b 100644
--- a/source/blender/draw/intern/draw_cache_extract_mesh_render_data.cc
+++ b/source/blender/draw/intern/draw_cache_extract_mesh_render_data.cc
@@ -229,7 +229,7 @@ static void mesh_render_data_polys_sorted_build(MeshRenderData *mr, MeshBufferCa
}
else {
for (int i = 0; i < mr->poly_len; i++) {
- if (!(mr->use_hide && mr->face_hide && mr->face_hide[i])) {
+ if (!(mr->use_hide && mr->hide_face && mr->hide_face[i])) {
const MPoly *mp = &mr->mpoly[i];
const int mat = min_ii(mp->mat_nr, mat_last);
tri_first_index[i] = mat_tri_offs[mat];
@@ -269,7 +269,7 @@ static void mesh_render_data_mat_tri_len_mesh_range_fn(void *__restrict userdata
int *mat_tri_len = static_cast<int *>(tls->userdata_chunk);
const MPoly *mp = &mr->mpoly[iter];
- if (!(mr->use_hide && mr->face_hide && mr->face_hide[iter])) {
+ if (!(mr->use_hide && mr->hide_face && mr->hide_face[iter])) {
int mat = min_ii(mp->mat_nr, mr->mat_len - 1);
mat_tri_len[mat] += mp->totloop - 2;
}
@@ -555,11 +555,11 @@ MeshRenderData *mesh_render_data_create(Object *object,
mr->e_origindex = static_cast<const int *>(CustomData_get_layer(&mr->me->edata, CD_ORIGINDEX));
mr->p_origindex = static_cast<const int *>(CustomData_get_layer(&mr->me->pdata, CD_ORIGINDEX));
- mr->vert_hide = static_cast<const bool *>(
+ mr->hide_vert = static_cast<const bool *>(
CustomData_get_layer_named(&me->vdata, CD_PROP_BOOL, ".hide_vert"));
- mr->edge_hide = static_cast<const bool *>(
+ mr->hide_edge = static_cast<const bool *>(
CustomData_get_layer_named(&me->edata, CD_PROP_BOOL, ".hide_edge"));
- mr->face_hide = static_cast<const bool *>(
+ mr->hide_face = static_cast<const bool *>(
CustomData_get_layer_named(&me->pdata, CD_PROP_BOOL, ".hide_face"));
}
else {
diff --git a/source/blender/draw/intern/draw_cache_impl_subdivision.cc b/source/blender/draw/intern/draw_cache_impl_subdivision.cc
index 24964f311b3..70e0ac1bd16 100644
--- a/source/blender/draw/intern/draw_cache_impl_subdivision.cc
+++ b/source/blender/draw/intern/draw_cache_impl_subdivision.cc
@@ -680,7 +680,7 @@ static void draw_subdiv_cache_extra_coarse_face_data_mesh(const MeshRenderData *
if ((mesh->mpoly[i].flag & ME_FACE_SEL) != 0) {
flag |= SUBDIV_COARSE_FACE_FLAG_SELECT;
}
- if (mr->face_hide && mr->face_hide[i]) {
+ if (mr->hide_face && mr->hide_face[i]) {
flag |= SUBDIV_COARSE_FACE_FLAG_HIDDEN;
}
flags_data[i] = (uint)(mesh->mpoly[i].loopstart) | (flag << SUBDIV_COARSE_FACE_FLAG_OFFSET);
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh.hh b/source/blender/draw/intern/mesh_extractors/extract_mesh.hh
index 4a4122a0fe1..ba44309bec3 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh.hh
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh.hh
@@ -83,9 +83,9 @@ struct MeshRenderData {
MLoopTri *mlooptri;
const float (*vert_normals)[3];
const float (*poly_normals)[3];
- const bool *vert_hide;
- const bool *edge_hide;
- const bool *face_hide;
+ const bool *hide_vert;
+ const bool *hide_edge;
+ const bool *hide_face;
float (*loop_normals)[3];
int *lverts, *ledges;
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc
index 074a98e3fa5..b018c848a74 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc
@@ -61,7 +61,7 @@ static void extract_edituv_tris_iter_looptri_mesh(const MeshRenderData *mr,
MeshExtract_EditUvElem_Data *data = static_cast<MeshExtract_EditUvElem_Data *>(_data);
const MPoly *mp = &mr->mpoly[mlt->poly];
edituv_tri_add(data,
- mr->face_hide && mr->face_hide[mlt->poly],
+ mr->hide_face && mr->hide_face[mlt->poly],
(mp->flag & ME_FACE_SEL) != 0,
mlt->tri[0],
mlt->tri[1],
@@ -125,7 +125,7 @@ static void extract_edituv_tris_iter_subdiv_mesh(const DRWSubdivCache *UNUSED(su
MeshExtract_EditUvElem_Data *data = static_cast<MeshExtract_EditUvElem_Data *>(_data);
const uint loop_idx = subdiv_quad_index * 4;
- const bool hidden = mr->face_hide && mr->face_hide[coarse_quad - mr->mpoly];
+ const bool hidden = mr->hide_face && mr->hide_face[coarse_quad - mr->mpoly];
edituv_tri_add(
data, hidden, (coarse_quad->flag & ME_FACE_SEL) != 0, loop_idx, loop_idx + 1, loop_idx + 2);
@@ -212,7 +212,7 @@ static void extract_edituv_lines_iter_poly_mesh(const MeshRenderData *mr,
void *_data)
{
MeshExtract_EditUvElem_Data *data = static_cast<MeshExtract_EditUvElem_Data *>(_data);
- const bool hidden = mr->face_hide && mr->face_hide[mp - mr->mpoly];
+ const bool hidden = mr->hide_face && mr->hide_face[mp - mr->mpoly];
const MLoop *mloop = mr->mloop;
const int ml_index_end = mp->loopstart + mp->totloop;
@@ -281,7 +281,7 @@ static void extract_edituv_lines_iter_subdiv_mesh(const DRWSubdivCache *subdiv_c
const MPoly *coarse_poly)
{
MeshExtract_EditUvElem_Data *data = static_cast<MeshExtract_EditUvElem_Data *>(_data);
- const bool hidden = mr->face_hide && mr->face_hide[coarse_poly - mr->mpoly];
+ const bool hidden = mr->hide_face && mr->hide_face[coarse_poly - mr->mpoly];
int *subdiv_loop_edge_index = (int *)GPU_vertbuf_get_data(subdiv_cache->edges_orig_index);
@@ -377,7 +377,7 @@ static void extract_edituv_points_iter_poly_mesh(const MeshRenderData *mr,
void *_data)
{
MeshExtract_EditUvElem_Data *data = static_cast<MeshExtract_EditUvElem_Data *>(_data);
- const bool hidden = mr->face_hide && mr->face_hide[mp - mr->mpoly];
+ const bool hidden = mr->hide_face && mr->hide_face[mp - mr->mpoly];
const MLoop *mloop = mr->mloop;
const int ml_index_end = mp->loopstart + mp->totloop;
@@ -438,7 +438,7 @@ static void extract_edituv_points_iter_subdiv_mesh(const DRWSubdivCache *subdiv_
const MPoly *coarse_quad)
{
MeshExtract_EditUvElem_Data *data = static_cast<MeshExtract_EditUvElem_Data *>(_data);
- const bool hidden = mr->face_hide && mr->face_hide[coarse_quad - mr->mpoly];
+ const bool hidden = mr->hide_face && mr->hide_face[coarse_quad - mr->mpoly];
int *subdiv_loop_vert_index = (int *)GPU_vertbuf_get_data(subdiv_cache->verts_orig_index);
uint start_loop_idx = subdiv_quad_index * 4;
@@ -527,7 +527,7 @@ static void extract_edituv_fdots_iter_poly_mesh(const MeshRenderData *mr,
void *_data)
{
MeshExtract_EditUvElem_Data *data = static_cast<MeshExtract_EditUvElem_Data *>(_data);
- const bool hidden = mr->face_hide && mr->face_hide[mp - mr->mpoly];
+ const bool hidden = mr->hide_face && mr->hide_face[mp - mr->mpoly];
if (mr->use_subsurf_fdots) {
const BLI_bitmap *facedot_tags = mr->me->runtime.subsurf_face_dot_tags;
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_fdots.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_fdots.cc
index 2b7d45ed285..846f57eef3e 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_fdots.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_fdots.cc
@@ -42,7 +42,7 @@ static void extract_fdots_iter_poly_mesh(const MeshRenderData *mr,
const int mp_index,
void *_userdata)
{
- const bool hidden = mr->use_hide && mr->face_hide && mr->face_hide[mp - mr->mpoly];
+ const bool hidden = mr->use_hide && mr->hide_face && mr->hide_face[mp - mr->mpoly];
GPUIndexBufBuilder *elb = static_cast<GPUIndexBufBuilder *>(_userdata);
if (mr->use_subsurf_fdots) {
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines.cc
index 256cc4c5d4e..fe883fb0c96 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines.cc
@@ -63,7 +63,7 @@ static void extract_lines_iter_poly_mesh(const MeshRenderData *mr,
int ml_index = ml_index_last, ml_index_next = mp->loopstart;
do {
const MLoop *ml = &mloop[ml_index];
- if (!((mr->use_hide && mr->edge_hide && mr->edge_hide[ml->e]) ||
+ if (!((mr->use_hide && mr->hide_edge && mr->hide_edge[ml->e]) ||
((mr->extract_type == MR_EXTRACT_MAPPED) && (mr->e_origindex) &&
(mr->e_origindex[ml->e] == ORIGINDEX_NONE)))) {
GPU_indexbuf_set_line_verts(elb, ml->e, ml_index, ml_index_next);
@@ -109,7 +109,7 @@ static void extract_lines_iter_ledge_mesh(const MeshRenderData *mr,
GPUIndexBufBuilder *elb = static_cast<GPUIndexBufBuilder *>(data);
const int l_index_offset = mr->edge_len + ledge_index;
const int e_index = mr->ledges[ledge_index];
- if (!((mr->use_hide && mr->edge_hide && mr->edge_hide[med - mr->medge]) ||
+ if (!((mr->use_hide && mr->hide_edge && mr->hide_edge[med - mr->medge]) ||
((mr->extract_type == MR_EXTRACT_MAPPED) && (mr->e_origindex) &&
(mr->e_origindex[e_index] == ORIGINDEX_NONE)))) {
const int l_index = mr->loop_len + ledge_index * 2;
@@ -183,10 +183,10 @@ static void extract_lines_loose_geom_subdiv(const DRWSubdivCache *subdiv_cache,
switch (mr->extract_type) {
case MR_EXTRACT_MESH: {
- const bool *vert_hide = mr->vert_hide;
- if (vert_hide) {
+ const bool *hide_vert = mr->hide_vert;
+ if (hide_vert) {
for (DRWSubdivLooseEdge edge : loose_edges) {
- *flags_data++ = vert_hide[edge.coarse_edge_index];
+ *flags_data++ = hide_vert[edge.coarse_edge_index];
}
}
else {
@@ -202,13 +202,13 @@ static void extract_lines_loose_geom_subdiv(const DRWSubdivCache *subdiv_cache,
}
}
else {
- const bool *vert_hide = mr->vert_hide;
- if (vert_hide) {
+ const bool *hide_vert = mr->hide_vert;
+ if (hide_vert) {
for (DRWSubdivLooseEdge edge : loose_edges) {
int e = edge.coarse_edge_index;
if (mr->e_origindex && mr->e_origindex[e] != ORIGINDEX_NONE) {
- *flags_data++ = vert_hide[edge.coarse_edge_index];
+ *flags_data++ = hide_vert[edge.coarse_edge_index];
}
else {
*flags_data++ = false;
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_adjacency.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_adjacency.cc
index dfeecb7688b..27ad5ecef80 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_adjacency.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_adjacency.cc
@@ -119,7 +119,7 @@ static void extract_lines_adjacency_iter_looptri_mesh(const MeshRenderData *mr,
void *_data)
{
MeshExtract_LineAdjacency_Data *data = static_cast<MeshExtract_LineAdjacency_Data *>(_data);
- const bool hidden = mr->use_hide && mr->face_hide && mr->face_hide[mlt->poly];
+ const bool hidden = mr->use_hide && mr->hide_face && mr->hide_face[mlt->poly];
if (hidden) {
return;
}
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_paint_mask.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_paint_mask.cc
index a657dbd8650..d5f31c08eaf 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_paint_mask.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_paint_mask.cc
@@ -47,7 +47,7 @@ static void extract_lines_paint_mask_iter_poly_mesh(const MeshRenderData *mr,
const MLoop *ml = &mloop[ml_index];
const int e_index = ml->e;
- if (!((mr->use_hide && mr->edge_hide && mr->edge_hide[e_index]) ||
+ if (!((mr->use_hide && mr->hide_edge && mr->hide_edge[e_index]) ||
((mr->extract_type == MR_EXTRACT_MAPPED) && (mr->e_origindex) &&
(mr->e_origindex[e_index] == ORIGINDEX_NONE)))) {
@@ -121,7 +121,7 @@ static void extract_lines_paint_mask_iter_subdiv_mesh(const DRWSubdivCache *subd
GPU_indexbuf_set_line_restart(&data->elb, subdiv_edge_index);
}
else {
- if (!((mr->use_hide && mr->edge_hide && mr->edge_hide[coarse_edge_index]) ||
+ if (!((mr->use_hide && mr->hide_edge && mr->hide_edge[coarse_edge_index]) ||
((mr->extract_type == MR_EXTRACT_MAPPED) && (mr->e_origindex) &&
(mr->e_origindex[coarse_edge_index] == ORIGINDEX_NONE)))) {
const uint ml_index_other = (loop_idx == (end_loop_idx - 1)) ? start_loop_idx :
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_points.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_points.cc
index c4117c906eb..ca46a38823d 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_points.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_points.cc
@@ -43,7 +43,7 @@ BLI_INLINE void vert_set_mesh(GPUIndexBufBuilder *elb,
const int v_index,
const int l_index)
{
- const bool hidden = mr->use_hide && mr->vert_hide && mr->vert_hide[v_index];
+ const bool hidden = mr->use_hide && mr->hide_vert && mr->hide_vert[v_index];
if (!(hidden || ((mr->extract_type == MR_EXTRACT_MAPPED) && (mr->v_origindex) &&
(mr->v_origindex[v_index] == ORIGINDEX_NONE)))) {
@@ -181,7 +181,7 @@ static void extract_points_iter_subdiv_common(GPUIndexBufBuilder *elb,
}
}
else {
- if (mr->use_hide && mr->vert_hide && mr->vert_hide[coarse_vertex_index]) {
+ if (mr->use_hide && mr->hide_vert && mr->hide_vert[coarse_vertex_index]) {
GPU_indexbuf_set_point_restart(elb, coarse_vertex_index);
continue;
}
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_tris.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_tris.cc
index 5dba183d869..d35cc4a204b 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_tris.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_tris.cc
@@ -189,7 +189,7 @@ static void extract_tris_single_mat_iter_looptri_mesh(const MeshRenderData *mr,
void *_data)
{
GPUIndexBufBuilder *elb = static_cast<GPUIndexBufBuilder *>(_data);
- const bool hidden = mr->use_hide && mr->face_hide && mr->face_hide[mlt->poly];
+ const bool hidden = mr->use_hide && mr->hide_face && mr->hide_face[mlt->poly];
if (hidden) {
GPU_indexbuf_set_tri_restart(elb, mlt_index);
}
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_lnor.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_lnor.cc
index c0a1c46f504..67246af594d 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_lnor.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_lnor.cc
@@ -62,7 +62,7 @@ static void extract_lnor_iter_poly_mesh(const MeshRenderData *mr,
const int mp_index,
void *data)
{
- const bool hidden = mr->face_hide && mr->face_hide[mp_index];
+ const bool hidden = mr->hide_face && mr->hide_face[mp_index];
const MLoop *mloop = mr->mloop;
const int ml_index_end = mp->loopstart + mp->totloop;
@@ -187,7 +187,7 @@ static void extract_lnor_hq_iter_poly_mesh(const MeshRenderData *mr,
const int mp_index,
void *data)
{
- const bool hidden = mr->face_hide && mr->face_hide[mp_index];
+ const bool hidden = mr->hide_face && mr->hide_face[mp_index];
const MLoop *mloop = mr->mloop;
const int ml_index_end = mp->loopstart + mp->totloop;
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_pos_nor.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_pos_nor.cc
index ff7fdd239c0..6a9fdf76e2b 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_pos_nor.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_pos_nor.cc
@@ -87,7 +87,7 @@ static void extract_pos_nor_iter_poly_mesh(const MeshRenderData *mr,
void *_data)
{
MeshExtract_PosNor_Data *data = static_cast<MeshExtract_PosNor_Data *>(_data);
- const bool face_hidden = mr->face_hide && mr->face_hide[mp_index];
+ const bool face_hidden = mr->hide_face && mr->hide_face[mp_index];
const MLoop *mloop = mr->mloop;
const int ml_index_end = mp->loopstart + mp->totloop;
@@ -96,7 +96,7 @@ static void extract_pos_nor_iter_poly_mesh(const MeshRenderData *mr,
PosNorLoop *vert = &data->vbo_data[ml_index];
const MVert *mv = &mr->mvert[ml->v];
- const bool vert_hidden = mr->vert_hide && mr->vert_hide[ml->v];
+ const bool vert_hidden = mr->hide_vert && mr->hide_vert[ml->v];
copy_v3_v3(vert->pos, mv->co);
vert->nor = data->normals[ml->v].low;
/* Flag for paint mode overlay. */
@@ -434,14 +434,14 @@ static void extract_pos_nor_hq_iter_poly_mesh(const MeshRenderData *mr,
void *_data)
{
MeshExtract_PosNorHQ_Data *data = static_cast<MeshExtract_PosNorHQ_Data *>(_data);
- const bool face_hidden = mr->face_hide && mr->face_hide[mp - mr->mpoly];
+ const bool face_hidden = mr->hide_face && mr->hide_face[mp - mr->mpoly];
const MLoop *mloop = mr->mloop;
const int ml_index_end = mp->loopstart + mp->totloop;
for (int ml_index = mp->loopstart; ml_index < ml_index_end; ml_index += 1) {
const MLoop *ml = &mloop[ml_index];
- const bool vert_hidden = mr->vert_hide && mr->vert_hide[ml->v];
+ const bool vert_hidden = mr->hide_vert && mr->hide_vert[ml->v];
PosNorHQLoop *vert = &data->vbo_data[ml_index];
const MVert *mv = &mr->mvert[ml->v];
copy_v3_v3(vert->pos, mv->co);
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h
index 01d2cfc959f..24c7e9073a3 100644
--- a/source/blender/editors/include/ED_mesh.h
+++ b/source/blender/editors/include/ED_mesh.h
@@ -392,8 +392,8 @@ void ED_keymap_mesh(struct wmKeyConfig *keyconf);
*/
void paintface_flush_flags(struct bContext *C,
struct Object *ob,
- short flag,
- const bool flush_hidden);
+ bool flush_selection,
+ bool flush_hidden);
/**
* \return True when pick finds an element or the selection changed.
*/
diff --git a/source/blender/editors/mesh/editface.cc b/source/blender/editors/mesh/editface.cc
index 4dd0c40c91b..6bc8a20bf31 100644
--- a/source/blender/editors/mesh/editface.cc
+++ b/source/blender/editors/mesh/editface.cc
@@ -9,8 +9,6 @@
#include "BLI_bitmap.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
-#include "BLI_span.hh"
-#include "BLI_virtual_array.hh"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
@@ -19,9 +17,9 @@
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
+#include "BKE_attribute.hh"
#include "BKE_context.h"
#include "BKE_customdata.h"
-#include "BKE_geometry_set.hh"
#include "BKE_global.h"
#include "BKE_mesh.h"
#include "BKE_object.h"
@@ -37,20 +35,20 @@
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
-using blender::MutableSpan;
-using blender::VArray;
-using blender::bke::OutputAttribute_Typed;
-
/* own include */
-void paintface_flush_flags(bContext *C, Object *ob, short flag, const bool flush_hidden)
+void paintface_flush_flags(bContext *C,
+ Object *ob,
+ const bool flush_selection,
+ const bool flush_hidden)
{
+ using namespace blender;
Mesh *me = BKE_mesh_from_object(ob);
MPoly *polys, *mp_orig;
const int *index_array = nullptr;
int totpoly;
- BLI_assert((flag & SELECT) || flush_hidden);
+ BLI_assert(flush_selection || flush_hidden);
if (me == nullptr) {
return;
@@ -60,7 +58,7 @@ void paintface_flush_flags(bContext *C, Object *ob, short flag, const bool flush
/* we could call this directly in all areas that change selection,
* since this could become slow for realtime updates (circle-select for eg) */
- if (flag & SELECT) {
+ if (flush_selection) {
BKE_mesh_flush_select_from_polys(me);
}
@@ -71,8 +69,11 @@ void paintface_flush_flags(bContext *C, Object *ob, short flag, const bool flush
return;
}
+ bke::AttributeAccessor attributes_me = bke::mesh_attributes(*me);
Mesh *me_orig = (Mesh *)ob_eval->runtime.data_orig;
+ bke::MutableAttributeAccessor attributes_orig = bke::mesh_attributes_for_write(*me_orig);
Mesh *me_eval = (Mesh *)ob_eval->runtime.data_eval;
+ bke::MutableAttributeAccessor attributes_eval = bke::mesh_attributes_for_write(*me_eval);
bool updated = false;
if (me_orig != nullptr && me_eval != nullptr && me_orig->totpoly == me->totpoly) {
@@ -80,13 +81,17 @@ void paintface_flush_flags(bContext *C, Object *ob, short flag, const bool flush
for (int i = 0; i < me->totpoly; i++) {
me_orig->mpoly[i].flag = me->mpoly[i].flag;
}
-
- /* If the mesh has only deform modifiers, the evaluated mesh shares arrays. */
- if (me_eval->mpoly == me_orig->mpoly) {
- updated = true;
+ if (flush_hidden) {
+ const VArray<bool> hide_face_me = attributes_me.lookup_or_default<bool>(
+ ".hide_face", ATTR_DOMAIN_FACE, false);
+ bke::SpanAttributeWriter<bool> hide_face_orig =
+ attributes_orig.lookup_or_add_for_write_only_span<bool>(".hide_face", ATTR_DOMAIN_FACE);
+ hide_face_me.materialize(hide_face_orig.span);
+ hide_face_orig.finish();
}
+
/* Mesh polys => Final derived polys */
- else if ((index_array = (const int *)CustomData_get_layer(&me_eval->pdata, CD_ORIGINDEX))) {
+ if ((index_array = (const int *)CustomData_get_layer(&me_eval->pdata, CD_ORIGINDEX))) {
polys = me_eval->mpoly;
totpoly = me_eval->totpoly;
@@ -98,6 +103,17 @@ void paintface_flush_flags(bContext *C, Object *ob, short flag, const bool flush
polys[i].flag = mp_orig->flag;
}
}
+ const VArray<bool> hide_face_orig = attributes_orig.lookup_or_default<bool>(
+ ".hide_face", ATTR_DOMAIN_FACE, false);
+ bke::SpanAttributeWriter<bool> hide_face_eval =
+ attributes_eval.lookup_or_add_for_write_only_span<bool>(".hide_face", ATTR_DOMAIN_FACE);
+ for (const int i : IndexRange(me_eval->totpoly)) {
+ const int orig_face_index = index_array[i];
+ if (orig_face_index != ORIGINDEX_NONE) {
+ hide_face_eval.span[i] = hide_face_orig[orig_face_index];
+ }
+ }
+ hide_face_eval.finish();
updated = true;
}
@@ -122,80 +138,77 @@ void paintface_flush_flags(bContext *C, Object *ob, short flag, const bool flush
void paintface_hide(bContext *C, Object *ob, const bool unselected)
{
+ using namespace blender;
Mesh *me = BKE_mesh_from_object(ob);
if (me == nullptr || me->totpoly == 0) {
return;
}
- MeshComponent component;
- component.replace(me, GeometryOwnershipType::Editable);
-
- OutputAttribute_Typed<bool> face_hide_attribute =
- component.attribute_try_get_for_output_only<bool>(".hide_face", ATTR_DOMAIN_FACE);
- MutableSpan<bool> face_hide = face_hide_attribute.as_span();
+ bke::MutableAttributeAccessor attributes = bke::mesh_attributes_for_write(*me);
+ bke::SpanAttributeWriter<bool> hide_face = attributes.lookup_or_add_for_write_span<bool>(
+ ".hide_face", ATTR_DOMAIN_FACE);
for (int i = 0; i < me->totpoly; i++) {
MPoly *mpoly = &me->mpoly[i];
- if (!face_hide[i]) {
+ if (!hide_face.span[i]) {
if (((mpoly->flag & ME_FACE_SEL) == 0) == unselected) {
- face_hide[i] = true;
+ hide_face.span[i] = true;
}
}
- if (face_hide[i]) {
+ if (hide_face.span[i]) {
mpoly->flag &= ~ME_FACE_SEL;
}
}
- face_hide_attribute.save();
+ hide_face.finish();
BKE_mesh_flush_hidden_from_polys(me);
- paintface_flush_flags(C, ob, SELECT, true);
+ paintface_flush_flags(C, ob, true, true);
}
void paintface_reveal(bContext *C, Object *ob, const bool select)
{
+ using namespace blender;
Mesh *me = BKE_mesh_from_object(ob);
if (me == nullptr || me->totpoly == 0) {
return;
}
- MeshComponent component;
- component.replace(me, GeometryOwnershipType::Editable);
+ bke::MutableAttributeAccessor attributes = bke::mesh_attributes_for_write(*me);
if (select) {
- const VArray<bool> face_hide = component.attribute_get_for_read<bool>(
+ const VArray<bool> hide_face = attributes.lookup_or_default<bool>(
".hide_face", ATTR_DOMAIN_FACE, false);
for (int i = 0; i < me->totpoly; i++) {
MPoly *mpoly = &me->mpoly[i];
- if (face_hide[i]) {
+ if (hide_face[i]) {
mpoly->flag |= ME_FACE_SEL;
}
}
}
- component.attribute_try_delete(".hide_face");
+ attributes.remove(".hide_face");
BKE_mesh_flush_hidden_from_polys(me);
- paintface_flush_flags(C, ob, SELECT, true);
+ paintface_flush_flags(C, ob, true, true);
}
/* Set object-mode face selection seams based on edge data, uses hash table to find seam edges. */
static void select_linked_tfaces_with_seams(Mesh *me, const uint index, const bool select)
{
+ using namespace blender;
bool do_it = true;
bool mark = false;
BLI_bitmap *edge_tag = BLI_BITMAP_NEW(me->totedge, __func__);
BLI_bitmap *poly_tag = BLI_BITMAP_NEW(me->totpoly, __func__);
- MeshComponent component;
- component.replace(me, GeometryOwnershipType::Editable);
-
- const VArray<bool> face_hide = component.attribute_get_for_read<bool>(
+ bke::AttributeAccessor attributes = bke::mesh_attributes(*me);
+ const VArray<bool> hide_face = attributes.lookup_or_default<bool>(
".hide_face", ATTR_DOMAIN_FACE, false);
if (index != (uint)-1) {
@@ -208,7 +221,7 @@ static void select_linked_tfaces_with_seams(Mesh *me, const uint index, const bo
/* fill array by selection */
for (int i = 0; i < me->totpoly; i++) {
MPoly *mp = &me->mpoly[i];
- if (face_hide[i]) {
+ if (hide_face[i]) {
/* pass */
}
else if (mp->flag & ME_FACE_SEL) {
@@ -224,7 +237,7 @@ static void select_linked_tfaces_with_seams(Mesh *me, const uint index, const bo
/* expand selection */
for (int i = 0; i < me->totpoly; i++) {
MPoly *mp = &me->mpoly[i];
- if (face_hide[i]) {
+ if (hide_face[i]) {
continue;
}
@@ -279,20 +292,19 @@ void paintface_select_linked(bContext *C, Object *ob, const int mval[2], const b
select_linked_tfaces_with_seams(me, index, select);
- paintface_flush_flags(C, ob, SELECT, false);
+ paintface_flush_flags(C, ob, true, false);
}
bool paintface_deselect_all_visible(bContext *C, Object *ob, int action, bool flush_flags)
{
+ using namespace blender;
Mesh *me = BKE_mesh_from_object(ob);
if (me == nullptr) {
return false;
}
- MeshComponent component;
- component.replace(me, GeometryOwnershipType::Editable);
-
- const VArray<bool> face_hide = component.attribute_get_for_read<bool>(
+ bke::AttributeAccessor attributes = bke::mesh_attributes(*me);
+ const VArray<bool> hide_face = attributes.lookup_or_default<bool>(
".hide_face", ATTR_DOMAIN_FACE, false);
if (action == SEL_TOGGLE) {
@@ -300,7 +312,7 @@ bool paintface_deselect_all_visible(bContext *C, Object *ob, int action, bool fl
for (int i = 0; i < me->totpoly; i++) {
MPoly *mpoly = &me->mpoly[i];
- if (!face_hide[i] && mpoly->flag & ME_FACE_SEL) {
+ if (!hide_face[i] && mpoly->flag & ME_FACE_SEL) {
action = SEL_DESELECT;
break;
}
@@ -311,7 +323,7 @@ bool paintface_deselect_all_visible(bContext *C, Object *ob, int action, bool fl
for (int i = 0; i < me->totpoly; i++) {
MPoly *mpoly = &me->mpoly[i];
- if (!face_hide[i]) {
+ if (!hide_face[i]) {
switch (action) {
case SEL_SELECT:
if ((mpoly->flag & ME_FACE_SEL) == 0) {
@@ -335,7 +347,7 @@ bool paintface_deselect_all_visible(bContext *C, Object *ob, int action, bool fl
if (changed) {
if (flush_flags) {
- paintface_flush_flags(C, ob, SELECT, false);
+ paintface_flush_flags(C, ob, true, false);
}
}
return changed;
@@ -343,6 +355,7 @@ bool paintface_deselect_all_visible(bContext *C, Object *ob, int action, bool fl
bool paintface_minmax(Object *ob, float r_min[3], float r_max[3])
{
+ using namespace blender;
bool ok = false;
float vec[3], bmat[3][3];
@@ -354,15 +367,13 @@ bool paintface_minmax(Object *ob, float r_min[3], float r_max[3])
copy_m3_m4(bmat, ob->obmat);
- MeshComponent component;
- component.replace(const_cast<Mesh *>(me), GeometryOwnershipType::ReadOnly);
-
- const VArray<bool> face_hide = component.attribute_get_for_read<bool>(
+ bke::AttributeAccessor attributes = bke::mesh_attributes(*me);
+ const VArray<bool> hide_face = attributes.lookup_or_default<bool>(
".hide_face", ATTR_DOMAIN_FACE, false);
for (int i = 0; i < me->totpoly; i++) {
MPoly *mp = &me->mpoly[i];
- if (face_hide[i] || !(mp->flag & ME_FACE_SEL)) {
+ if (hide_face[i] || !(mp->flag & ME_FACE_SEL)) {
continue;
}
@@ -384,6 +395,7 @@ bool paintface_mouse_select(bContext *C,
const SelectPick_Params *params,
Object *ob)
{
+ using namespace blender;
MPoly *mpoly_sel = nullptr;
uint index;
bool changed = false;
@@ -392,16 +404,14 @@ bool paintface_mouse_select(bContext *C,
/* Get the face under the cursor */
Mesh *me = BKE_mesh_from_object(ob);
- MeshComponent component;
- component.replace(const_cast<Mesh *>(me), GeometryOwnershipType::ReadOnly);
-
- const VArray<bool> face_hide = component.attribute_get_for_read<bool>(
+ bke::AttributeAccessor attributes = bke::mesh_attributes(*me);
+ const VArray<bool> hide_face = attributes.lookup_or_default<bool>(
".hide_face", ATTR_DOMAIN_FACE, false);
if (ED_mesh_pick_face(C, ob, mval, ED_MESH_PICK_DEFAULT_FACE_DIST, &index)) {
if (index < me->totpoly) {
mpoly_sel = me->mpoly + index;
- if (!face_hide[index]) {
+ if (!hide_face[index]) {
found = true;
}
}
@@ -450,7 +460,7 @@ bool paintface_mouse_select(bContext *C,
/* image window redraw */
- paintface_flush_flags(C, ob, SELECT, false);
+ paintface_flush_flags(C, ob, true, false);
ED_region_tag_redraw(CTX_wm_region(C)); /* XXX: should redraw all 3D views. */
changed = true;
}
@@ -511,23 +521,24 @@ void paintvert_tag_select_update(bContext *C, Object *ob)
bool paintvert_deselect_all_visible(Object *ob, int action, bool flush_flags)
{
+ using namespace blender;
Mesh *me = BKE_mesh_from_object(ob);
if (me == nullptr) {
return false;
}
- MeshComponent component;
- component.replace(const_cast<Mesh *>(me), GeometryOwnershipType::ReadOnly);
-
- const VArray<bool> vert_hide = component.attribute_get_for_read<bool>(
- "vert_hide", ATTR_DOMAIN_POINT, false);
+ bke::AttributeAccessor attributes = bke::mesh_attributes(*me);
+ const VArray<bool> hide_vert = attributes.lookup_or_default<bool>(
+ ".hide_vert", ATTR_DOMAIN_POINT, false);
+ const VArray<bool> hide_face = attributes.lookup_or_default<bool>(
+ ".hide_face", ATTR_DOMAIN_FACE, false);
if (action == SEL_TOGGLE) {
action = SEL_SELECT;
for (int i = 0; i < me->totvert; i++) {
MVert *mvert = &me->mvert[i];
- if (!vert_hide[i] && mvert->flag & SELECT) {
+ if (!hide_face[i] && mvert->flag & SELECT) {
action = SEL_DESELECT;
break;
}
@@ -537,7 +548,7 @@ bool paintvert_deselect_all_visible(Object *ob, int action, bool flush_flags)
bool changed = false;
for (int i = 0; i < me->totvert; i++) {
MVert *mvert = &me->mvert[i];
- if (!vert_hide[i]) {
+ if (!hide_vert[i]) {
switch (action) {
case SEL_SELECT:
if ((mvert->flag & SELECT) == 0) {
@@ -580,6 +591,7 @@ bool paintvert_deselect_all_visible(Object *ob, int action, bool flush_flags)
void paintvert_select_ungrouped(Object *ob, bool extend, bool flush_flags)
{
+ using namespace blender;
Mesh *me = BKE_mesh_from_object(ob);
if (me == nullptr || me->dvert == nullptr) {
@@ -590,16 +602,14 @@ void paintvert_select_ungrouped(Object *ob, bool extend, bool flush_flags)
paintvert_deselect_all_visible(ob, SEL_DESELECT, false);
}
- MeshComponent component;
- component.replace(const_cast<Mesh *>(me), GeometryOwnershipType::ReadOnly);
-
- const VArray<bool> vert_hide = component.attribute_get_for_read<bool>(
- "vert_hide", ATTR_DOMAIN_POINT, false);
+ bke::AttributeAccessor attributes = bke::mesh_attributes(*me);
+ const VArray<bool> hide_face = attributes.lookup_or_default<bool>(
+ ".hide_face", ATTR_DOMAIN_FACE, false);
for (int i = 0; i < me->totvert; i++) {
MVert *mv = &me->mvert[i];
MDeformVert *dv = &me->dvert[i];
- if (!vert_hide[i]) {
+ if (!hide_face[i]) {
if (dv->dw == nullptr) {
/* if null weight then not grouped */
mv->flag |= SELECT;
diff --git a/source/blender/editors/mesh/editmesh_undo.c b/source/blender/editors/mesh/editmesh_undo.c
index 4bd3ef166f3..af8084e16c4 100644
--- a/source/blender/editors/mesh/editmesh_undo.c
+++ b/source/blender/editors/mesh/editmesh_undo.c
@@ -596,7 +596,7 @@ static void *undomesh_from_editmesh(UndoMesh *um, BMEditMesh *em, Key *key, Undo
/* Copy the ID name characters to the mesh so code that depends on accessing the ID type can work
* on it. Necessary to use the attribute API. */
- strcpy(um->me.id.name, "ME");
+ strcpy(um->me.id.name, "MEundomesh_from_editmesh");
BM_mesh_bm_to_me(
NULL,
diff --git a/source/blender/editors/mesh/meshtools.cc b/source/blender/editors/mesh/meshtools.cc
index 33dfab95e7b..b1004b23a21 100644
--- a/source/blender/editors/mesh/meshtools.cc
+++ b/source/blender/editors/mesh/meshtools.cc
@@ -1329,7 +1329,7 @@ bool ED_mesh_pick_face_vert(
*/
struct VertPickData {
const MVert *mvert;
- const bool *vert_hide;
+ const bool *hide_vert;
const float *mval_f; /* [2] */
ARegion *region;
@@ -1344,7 +1344,7 @@ static void ed_mesh_pick_vert__mapFunc(void *userData,
const float UNUSED(no[3]))
{
VertPickData *data = static_cast<VertPickData *>(userData);
- if (data->vert_hide && data->vert_hide[index]) {
+ if (data->hide_vert && data->hide_vert[index]) {
return;
}
float sco[2];
@@ -1417,7 +1417,7 @@ bool ED_mesh_pick_vert(
data.mval_f = mval_f;
data.len_best = FLT_MAX;
data.v_idx_best = -1;
- data.vert_hide = (const bool *)CustomData_get_layer_named(
+ data.hide_vert = (const bool *)CustomData_get_layer_named(
&me_eval->vdata, CD_PROP_BOOL, ".hide_vert");
BKE_mesh_foreach_mapped_vert(me_eval, ed_mesh_pick_vert__mapFunc, &data, MESH_FOREACH_NOP);
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index d3c5f22ff6d..4bba316d48b 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -1034,7 +1034,7 @@ static void vgroup_select_verts(Object *ob, int select)
}
else {
if (me->dvert) {
- const bool *vert_hide = CustomData_get_layer_named(&me->vdata, CD_PROP_BOOL, ".hide_vert");
+ const bool *hide_vert = CustomData_get_layer_named(&me->vdata, CD_PROP_BOOL, ".hide_vert");
MVert *mv;
MDeformVert *dv;
int i;
@@ -1043,7 +1043,7 @@ static void vgroup_select_verts(Object *ob, int select)
dv = me->dvert;
for (i = 0; i < me->totvert; i++, mv++, dv++) {
- if (!vert_hide[i]) {
+ if (hide_vert != NULL && !hide_vert[i]) {
if (BKE_defvert_find_index(dv, def_nr)) {
if (select) {
mv->flag |= SELECT;
@@ -1931,11 +1931,11 @@ static void vgroup_smooth_subset(Object *ob,
#define IS_BM_VERT_READ(v) (use_hide ? (BM_elem_flag_test(v, BM_ELEM_HIDDEN) == 0) : true)
#define IS_BM_VERT_WRITE(v) (use_select ? (BM_elem_flag_test(v, BM_ELEM_SELECT) != 0) : true)
- const bool *vert_hide = me ? (const bool *)CustomData_get_layer_named(
+ const bool *hide_vert = me ? (const bool *)CustomData_get_layer_named(
&me->vdata, CD_PROP_BOOL, ".hide_vert") :
NULL;
-#define IS_ME_VERT_READ(v) (use_hide ? (vert_hide && vert_hide[v]) : true)
+#define IS_ME_VERT_READ(v) (use_hide ? (hide_vert && hide_vert[v]) : true)
#define IS_ME_VERT_WRITE(v) (use_select ? (((v)->flag & SELECT) != 0) : true)
/* initialize used verts */
diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c
index 564a90238b7..c904d533db8 100644
--- a/source/blender/editors/sculpt_paint/paint_hide.c
+++ b/source/blender/editors/sculpt_paint/paint_hide.c
@@ -78,9 +78,9 @@ static void partialvis_update_mesh(Object *ob,
BKE_pbvh_node_get_verts(pbvh, node, &vert_indices, &mvert);
paint_mask = CustomData_get_layer(&me->vdata, CD_PAINT_MASK);
- bool *vert_hide = CustomData_get_layer_named(&me->vdata, CD_PROP_BOOL, ".hide_vert");
- if (!vert_hide) {
- vert_hide = CustomData_add_layer_named(
+ bool *hide_vert = CustomData_get_layer_named(&me->vdata, CD_PROP_BOOL, ".hide_vert");
+ if (hide_vert == NULL) {
+ hide_vert = CustomData_add_layer_named(
&me->vdata, CD_PROP_BOOL, CD_CALLOC, NULL, me->totvert, ".hide_vert");
}
@@ -92,11 +92,11 @@ static void partialvis_update_mesh(Object *ob,
/* Hide vertex if in the hide volume. */
if (is_effected(area, planes, v->co, vmask)) {
- vert_hide[vert_indices[i]] = (action == PARTIALVIS_HIDE);
+ hide_vert[vert_indices[i]] = (action == PARTIALVIS_HIDE);
any_changed = true;
}
- if (!vert_hide[vert_indices[i]]) {
+ if (!hide_vert[vert_indices[i]]) {
any_visible = true;
}
}
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 60d2a5b07f7..7b7d620d9b3 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -342,8 +342,8 @@ void SCULPT_vertex_visible_set(SculptSession *ss, int index, bool visible)
{
switch (BKE_pbvh_type(ss->pbvh)) {
case PBVH_FACES: {
- bool *vert_hide = BKE_pbvh_get_vert_hide_for_write(ss->pbvh);
- vert_hide[index] = visible;
+ bool *hide_vert = BKE_pbvh_get_vert_hide_for_write(ss->pbvh);
+ hide_vert[index] = visible;
BKE_pbvh_vert_mark_update(ss->pbvh, index);
break;
}
@@ -359,8 +359,8 @@ bool SCULPT_vertex_visible_get(SculptSession *ss, int index)
{
switch (BKE_pbvh_type(ss->pbvh)) {
case PBVH_FACES: {
- const bool *vert_hide = BKE_pbvh_get_vert_hide(ss->pbvh);
- return vert_hide == NULL || !vert_hide[index];
+ const bool *hide_vert = BKE_pbvh_get_vert_hide(ss->pbvh);
+ return hide_vert == NULL || !hide_vert[index];
}
case PBVH_BMESH:
return !BM_elem_flag_test(BM_vert_at_index(ss->bm, index), BM_ELEM_HIDDEN);
diff --git a/source/blender/editors/sculpt_paint/sculpt_dyntopo.c b/source/blender/editors/sculpt_paint/sculpt_dyntopo.c
index 01c1866eeca..bed9af79b9c 100644
--- a/source/blender/editors/sculpt_paint/sculpt_dyntopo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_dyntopo.c
@@ -223,9 +223,9 @@ static void SCULPT_dynamic_topology_disable_ex(
me->face_sets_color_default = 1;
/* Sync the visibility to vertices manually as the pmap is still not initialized. */
- bool *vert_hide = (bool *)CustomData_get_layer_named(&me->vdata, CD_PROP_BOOL, ".hide_vert");
- if (vert_hide) {
- memset(vert_hide, 0, sizeof(bool) * me->totvert);
+ bool *hide_vert = (bool *)CustomData_get_layer_named(&me->vdata, CD_PROP_BOOL, ".hide_vert");
+ if (hide_vert != NULL) {
+ memset(hide_vert, 0, sizeof(bool) * me->totvert);
}
}
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c
index a70e8b9aa32..a2758937e10 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -312,13 +312,13 @@ static bool sculpt_undo_restore_hidden(bContext *C, SculptUndoNode *unode)
SculptSession *ss = ob->sculpt;
SubdivCCG *subdiv_ccg = ss->subdiv_ccg;
- bool *vert_hide = BKE_pbvh_get_vert_hide_for_write(ss->pbvh);
+ bool *hide_vert = BKE_pbvh_get_vert_hide_for_write(ss->pbvh);
if (unode->maxvert) {
for (int i = 0; i < unode->totvert; i++) {
- if ((BLI_BITMAP_TEST(unode->vert_hidden, i) != 0) != vert_hide[i]) {
+ if ((BLI_BITMAP_TEST(unode->vert_hidden, i) != 0) != hide_vert[i]) {
BLI_BITMAP_FLIP(unode->vert_hidden, i);
- vert_hide[i] = !vert_hide[i];
+ hide_vert[i] = !hide_vert[i];
BKE_pbvh_vert_mark_update(ss->pbvh, unode->index[i]);
}
}
@@ -1190,8 +1190,8 @@ static void sculpt_undo_store_hidden(Object *ob, SculptUndoNode *unode)
PBVH *pbvh = ob->sculpt->pbvh;
PBVHNode *node = unode->node;
- const bool *vert_hide = BKE_pbvh_get_vert_hide(pbvh);
- if (vert_hide == NULL) {
+ const bool *hide_vert = BKE_pbvh_get_vert_hide(pbvh);
+ if (hide_vert == NULL) {
return;
}
@@ -1206,7 +1206,7 @@ static void sculpt_undo_store_hidden(Object *ob, SculptUndoNode *unode)
BKE_pbvh_node_num_verts(pbvh, node, NULL, &allvert);
BKE_pbvh_node_get_verts(pbvh, node, &vert_indices, &mvert);
for (int i = 0; i < allvert; i++) {
- BLI_BITMAP_SET(unode->vert_hidden, i, vert_hide[vert_indices[i]]);
+ BLI_BITMAP_SET(unode->vert_hidden, i, hide_vert[vert_indices[i]]);
}
}
}
diff --git a/source/blender/editors/space_view3d/view3d_iterators.c b/source/blender/editors/space_view3d/view3d_iterators.c
index 09285006aaf..6256eeb9621 100644
--- a/source/blender/editors/space_view3d/view3d_iterators.c
+++ b/source/blender/editors/space_view3d/view3d_iterators.c
@@ -205,7 +205,7 @@ typedef struct foreachScreenObjectVert_userData {
void (*func)(void *userData, MVert *mv, const float screen_co[2], int index);
void *userData;
ViewContext vc;
- const bool *vert_hide;
+ const bool *hide_vert;
eV3DProjTest clip_flag;
} foreachScreenObjectVert_userData;
@@ -263,7 +263,7 @@ static void meshobject_foreachScreenVert__mapFunc(void *userData,
const float UNUSED(no[3]))
{
foreachScreenObjectVert_userData *data = userData;
- if (data->vert_hide && data->vert_hide[index]) {
+ if (data->hide_vert && data->hide_vert[index]) {
return;
}
struct MVert *mv = &((Mesh *)(data->vc.obact->data))->mvert[index];
@@ -299,7 +299,7 @@ void meshobject_foreachScreenVert(
data.func = func;
data.userData = userData;
data.clip_flag = clip_flag;
- data.vert_hide = (const bool *)CustomData_get_layer_named(
+ data.hide_vert = (const bool *)CustomData_get_layer_named(
&me->vdata, CD_PROP_BOOL, ".hide_vert");
if (clip_flag & V3D_PROJ_TEST_CLIP_BB) {
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index 0163f2a171a..f589ecb233d 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -342,11 +342,11 @@ static bool edbm_backbuf_check_and_select_verts_obmode(Mesh *me,
const BLI_bitmap *select_bitmap = esel->select_bitmap;
- const bool *vert_hide = (const bool *)CustomData_get_layer_named(
+ const bool *hide_vert = (const bool *)CustomData_get_layer_named(
&me->vdata, CD_PROP_BOOL, ".hide_vert");
for (int index = 0; index < me->totvert; index++, mv++) {
- if (!(vert_hide && vert_hide[index])) {
+ if (!(hide_vert && hide_vert[index])) {
const bool is_select = mv->flag & SELECT;
const bool is_inside = BLI_BITMAP_TEST_BOOL(select_bitmap, index);
const int sel_op_result = ED_select_op_action_deselected(sel_op, is_select, is_inside);
@@ -373,11 +373,11 @@ static bool edbm_backbuf_check_and_select_faces_obmode(Mesh *me,
const BLI_bitmap *select_bitmap = esel->select_bitmap;
- const bool *face_hide = (const bool *)CustomData_get_layer_named(
+ const bool *hide_face = (const bool *)CustomData_get_layer_named(
&me->vdata, CD_PROP_BOOL, ".hide_face");
for (int index = 0; index < me->totpoly; index++, mpoly++) {
- if (!(face_hide && face_hide[index])) {
+ if (!(hide_face && hide_face[index])) {
const bool is_select = mpoly->flag & ME_FACE_SEL;
const bool is_inside = BLI_BITMAP_TEST_BOOL(select_bitmap, index);
const int sel_op_result = ED_select_op_action_deselected(sel_op, is_select, is_inside);
@@ -1268,7 +1268,7 @@ static bool do_lasso_select_paintface(ViewContext *vc,
}
if (changed) {
- paintface_flush_flags(vc->C, ob, SELECT, false);
+ paintface_flush_flags(vc->C, ob, true, false);
}
return changed;
}
@@ -3192,7 +3192,7 @@ static bool do_paintface_box_select(ViewContext *vc,
}
if (changed) {
- paintface_flush_flags(vc->C, vc->obact, SELECT, false);
+ paintface_flush_flags(vc->C, vc->obact, true, false);
}
return changed;
}
@@ -4093,7 +4093,7 @@ static bool paint_facesel_circle_select(ViewContext *vc,
}
if (changed) {
- paintface_flush_flags(vc->C, ob, SELECT, false);
+ paintface_flush_flags(vc->C, ob, true, false);
}
return changed;
}
diff --git a/source/blender/gpu/GPU_buffers.h b/source/blender/gpu/GPU_buffers.h
index 5f269f4bee7..10b700f563f 100644
--- a/source/blender/gpu/GPU_buffers.h
+++ b/source/blender/gpu/GPU_buffers.h
@@ -49,7 +49,7 @@ typedef struct GPU_PBVH_Buffers GPU_PBVH_Buffers;
GPU_PBVH_Buffers *GPU_pbvh_mesh_buffers_build(const struct MPoly *mpoly,
const struct MLoop *mloop,
const struct MLoopTri *looptri,
- const bool *vert_hide,
+ const bool *hide_vert,
const int *face_indices,
const int *sculpt_face_sets,
int face_indices_len,
@@ -93,7 +93,7 @@ void GPU_pbvh_mesh_buffers_update(PBVHGPUFormat *vbo_id,
GPU_PBVH_Buffers *buffers,
const struct MVert *mvert,
const float (*vert_normals)[3],
- const bool *vert_hide,
+ const bool *hide_vert,
const CustomData *vdata,
const CustomData *ldata,
const float *vmask,
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c
index 1fa4fb6e8a7..33322fe7988 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -211,11 +211,11 @@ static void gpu_pbvh_batch_init(GPU_PBVH_Buffers *buffers, GPUPrimType prim)
* \{ */
static bool gpu_pbvh_is_looptri_visible(const MLoopTri *lt,
- const bool *vert_hide,
+ const bool *hide_vert,
const MLoop *mloop,
const int *sculpt_face_sets)
{
- return (!paint_is_face_hidden(lt, vert_hide, mloop) && sculpt_face_sets &&
+ return (!paint_is_face_hidden(lt, hide_vert, mloop) && sculpt_face_sets &&
sculpt_face_sets[lt->poly] > SCULPT_FACE_SET_NONE);
}
@@ -223,7 +223,7 @@ void GPU_pbvh_mesh_buffers_update(PBVHGPUFormat *vbo_id,
GPU_PBVH_Buffers *buffers,
const MVert *mvert,
const float (*vert_normals)[3],
- const bool *vert_hide,
+ const bool *hide_vert,
const CustomData *vdata,
const CustomData *ldata,
const float *vmask,
@@ -315,7 +315,7 @@ void GPU_pbvh_mesh_buffers_update(PBVHGPUFormat *vbo_id,
for (uint i = 0; i < buffers->face_indices_len; i++) {
const MLoopTri *lt = &buffers->looptri[buffers->face_indices[i]];
- if (!gpu_pbvh_is_looptri_visible(lt, vert_hide, buffers->mloop, sculpt_face_sets)) {
+ if (!gpu_pbvh_is_looptri_visible(lt, hide_vert, buffers->mloop, sculpt_face_sets)) {
continue;
}
@@ -355,7 +355,7 @@ void GPU_pbvh_mesh_buffers_update(PBVHGPUFormat *vbo_id,
buffers->mloop[lt->tri[2]].v,
};
- if (!gpu_pbvh_is_looptri_visible(lt, vert_hide, buffers->mloop, sculpt_face_sets)) {
+ if (!gpu_pbvh_is_looptri_visible(lt, hide_vert, buffers->mloop, sculpt_face_sets)) {
continue;
}
@@ -395,7 +395,7 @@ void GPU_pbvh_mesh_buffers_update(PBVHGPUFormat *vbo_id,
buffers->mloop[lt->tri[2]].v,
};
- if (!gpu_pbvh_is_looptri_visible(lt, vert_hide, buffers->mloop, sculpt_face_sets)) {
+ if (!gpu_pbvh_is_looptri_visible(lt, hide_vert, buffers->mloop, sculpt_face_sets)) {
continue;
}
@@ -461,7 +461,7 @@ void GPU_pbvh_mesh_buffers_update(PBVHGPUFormat *vbo_id,
GPU_PBVH_Buffers *GPU_pbvh_mesh_buffers_build(const MPoly *mpoly,
const MLoop *mloop,
const MLoopTri *looptri,
- const bool *vert_hide,
+ const bool *hide_vert,
const int *face_indices,
const int *sculpt_face_sets,
const int face_indices_len,
@@ -481,7 +481,7 @@ GPU_PBVH_Buffers *GPU_pbvh_mesh_buffers_build(const MPoly *mpoly,
/* Count the number of visible triangles */
for (i = 0, tottri = 0; i < face_indices_len; i++) {
const MLoopTri *lt = &looptri[face_indices[i]];
- if (gpu_pbvh_is_looptri_visible(lt, vert_hide, mloop, sculpt_face_sets)) {
+ if (gpu_pbvh_is_looptri_visible(lt, hide_vert, mloop, sculpt_face_sets)) {
int r_edges[3];
BKE_mesh_looptri_get_real_edges(mesh, lt, r_edges);
for (int j = 0; j < 3; j++) {
@@ -514,7 +514,7 @@ GPU_PBVH_Buffers *GPU_pbvh_mesh_buffers_build(const MPoly *mpoly,
const MLoopTri *lt = &looptri[face_indices[i]];
/* Skip hidden faces */
- if (!gpu_pbvh_is_looptri_visible(lt, vert_hide, mloop, sculpt_face_sets)) {
+ if (!gpu_pbvh_is_looptri_visible(lt, hide_vert, mloop, sculpt_face_sets)) {
continue;
}
diff --git a/source/blender/gpu/intern/gpu_shader_builder_stubs.cc b/source/blender/gpu/intern/gpu_shader_builder_stubs.cc
index 28f352dd5da..ee818ee75f8 100644
--- a/source/blender/gpu/intern/gpu_shader_builder_stubs.cc
+++ b/source/blender/gpu/intern/gpu_shader_builder_stubs.cc
@@ -104,7 +104,7 @@ void UI_GetThemeColorShadeAlpha4ubv(int UNUSED(colorid),
/** \name Stubs of BKE_paint.h
* \{ */
bool paint_is_face_hidden(const struct MLoopTri *UNUSED(lt),
- const bool *UNUSED(vert_hide),
+ const bool *UNUSED(hide_vert),
const struct MLoop *UNUSED(mloop))
{
BLI_assert_unreachable();
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index a2bb707b06d..a331320a118 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -359,22 +359,22 @@ static void rna_MeshVertex_normal_get(PointerRNA *ptr, float *value)
static bool rna_MeshVertex_hide_get(PointerRNA *ptr)
{
const Mesh *mesh = rna_mesh(ptr);
- const bool *vert_hide = (const bool *)CustomData_get_layer_named(
+ const bool *hide_vert = (const bool *)CustomData_get_layer_named(
&mesh->vdata, CD_PROP_BOOL, ".hide_vert");
const int index = (const MVert *)ptr->data - mesh->mvert;
BLI_assert(index >= 0);
BLI_assert(index < mesh->totvert);
- return vert_hide[index];
+ return hide_vert[index];
}
static void rna_MeshVertex_hide_set(PointerRNA *ptr, bool value)
{
Mesh *mesh = rna_mesh(ptr);
- bool *vert_hide = (bool *)CustomData_get_layer_named(&mesh->vdata, CD_PROP_BOOL, ".hide_vert");
+ bool *hide_vert = (bool *)CustomData_get_layer_named(&mesh->vdata, CD_PROP_BOOL, ".hide_vert");
const int index = (const MVert *)ptr->data - mesh->mvert;
BLI_assert(index >= 0);
BLI_assert(index < mesh->totvert);
- vert_hide[index] = value;
+ hide_vert[index] = value;
}
static float rna_MeshVertex_bevel_weight_get(PointerRNA *ptr)
@@ -488,22 +488,22 @@ static void rna_MeshPolygon_normal_get(PointerRNA *ptr, float *values)
static bool rna_MeshPolygon_hide_get(PointerRNA *ptr)
{
const Mesh *mesh = rna_mesh(ptr);
- const bool *poly_hide = (const bool *)CustomData_get_layer_named(
+ const bool *hide_face = (const bool *)CustomData_get_layer_named(
&mesh->pdata, CD_PROP_BOOL, ".hide_face");
const int index = (const MPoly *)ptr->data - mesh->mpoly;
BLI_assert(index >= 0);
BLI_assert(index < mesh->totpoly);
- return poly_hide[index];
+ return hide_face[index];
}
static void rna_MeshPolygon_hide_set(PointerRNA *ptr, bool value)
{
Mesh *mesh = rna_mesh(ptr);
- bool *poly_hide = (bool *)CustomData_get_layer_named(&mesh->pdata, CD_PROP_BOOL, ".hide_face");
+ bool *hide_face = (bool *)CustomData_get_layer_named(&mesh->pdata, CD_PROP_BOOL, ".hide_face");
const int index = (const MPoly *)ptr->data - mesh->mpoly;
BLI_assert(index >= 0);
BLI_assert(index < mesh->totpoly);
- poly_hide[index] = value;
+ hide_face[index] = value;
}
static void rna_MeshPolygon_center_get(PointerRNA *ptr, float *values)
@@ -1233,22 +1233,22 @@ static int rna_MeshEdge_index_get(PointerRNA *ptr)
static bool rna_MeshEdge_hide_get(PointerRNA *ptr)
{
const Mesh *mesh = rna_mesh(ptr);
- const bool *edge_hide = (const bool *)CustomData_get_layer_named(
+ const bool *hide_edge = (const bool *)CustomData_get_layer_named(
&mesh->pdata, CD_PROP_BOOL, ".hide_edge");
const int index = (const MEdge *)ptr->data - mesh->medge;
BLI_assert(index >= 0);
BLI_assert(index < mesh->totedge);
- return edge_hide[index];
+ return hide_edge[index];
}
static void rna_MeshEdge_hide_set(PointerRNA *ptr, bool value)
{
Mesh *mesh = rna_mesh(ptr);
- bool *edge_hide = (bool *)CustomData_get_layer_named(&mesh->edata, CD_PROP_BOOL, ".hide_edge");
+ bool *hide_edge = (bool *)CustomData_get_layer_named(&mesh->edata, CD_PROP_BOOL, ".hide_edge");
const int index = (const MEdge *)ptr->data - mesh->medge;
BLI_assert(index >= 0);
BLI_assert(index < mesh->totedge);
- edge_hide[index] = value;
+ hide_edge[index] = value;
}
static int rna_MeshLoopTriangle_index_get(PointerRNA *ptr)
diff --git a/source/blender/nodes/geometry/nodes/node_geo_deform_curves_on_surface.cc b/source/blender/nodes/geometry/nodes/node_geo_deform_curves_on_surface.cc
index ab7ddfa71f1..43ac0be0825 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_deform_curves_on_surface.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_deform_curves_on_surface.cc
@@ -274,8 +274,7 @@ static void node_geo_exec(GeoNodeExecParams params)
}
if (!mesh_attributes_orig.contains(uv_map_name)) {
pass_through_input();
- char *message = BLI_sprintfN(TIP_("Original surface missing UV map: %s."),
- uv_map_name.c_str());
+ char *message = BLI_sprintfN(TIP_("Original surface missing UV map: %s"), uv_map_name.c_str());
params.error_message_add(NodeWarningType::Error, message);
MEM_freeN(message);
return;
@@ -283,13 +282,13 @@ static void node_geo_exec(GeoNodeExecParams params)
if (!mesh_attributes_eval.contains(rest_position_name)) {
pass_through_input();
params.error_message_add(NodeWarningType::Error,
- TIP_("Evaluated surface missing attribute: rest_position."));
+ TIP_("Evaluated surface missing attribute: \"rest_position\""));
return;
}
if (curves.surface_uv_coords().is_empty()) {
pass_through_input();
params.error_message_add(NodeWarningType::Error,
- TIP_("Curves are not attached to any UV map."));
+ TIP_("Curves are not attached to any UV map"));
return;
}
const VArraySpan<float2> uv_map_orig = mesh_attributes_orig.lookup<float2>(uv_map_name,
@@ -337,7 +336,7 @@ static void node_geo_exec(GeoNodeExecParams params)
curves.tag_positions_changed();
if (invalid_uv_count) {
- char *message = BLI_sprintfN(TIP_("Invalid surface UVs on %d curves."),
+ char *message = BLI_sprintfN(TIP_("Invalid surface UVs on %d curves"),
invalid_uv_count.load());
params.error_message_add(NodeWarningType::Warning, message);
MEM_freeN(message);