Mesh: Replace MLoop struct with generic attributes #104424
|
@ -93,7 +93,7 @@ typedef struct MeshElemMap {
|
|||
/* mapping */
|
||||
UvVertMap *BKE_mesh_uv_vert_map_create(const struct MPoly *mpoly,
|
||||
const bool *hide_poly,
|
||||
const bool *selection_poly,
|
||||
const bool *select_poly,
|
||||
const struct MLoop *mloop,
|
||||
const struct MLoopUV *mloopuv,
|
||||
unsigned int totpoly,
|
||||
|
|
|
@ -58,7 +58,7 @@ const char *no_procedural_access_message =
|
|||
|
||||
bool allow_procedural_attribute_access(StringRef attribute_name)
|
||||
{
|
||||
return !attribute_name.startswith(".sculpt") && !attribute_name.startswith(".selection") &&
|
||||
return !attribute_name.startswith(".sculpt") && !attribute_name.startswith(".select") &&
|
||||
!attribute_name.startswith(".hide");
|
||||
}
|
||||
|
||||
|
|
|
@ -2376,9 +2376,9 @@ static bool attribute_stored_in_bmesh_flag(const StringRef name)
|
|||
".hide_vert",
|
||||
".hide_edge",
|
||||
".hide_poly",
|
||||
".selection_vert",
|
||||
".selection_edge",
|
||||
".selection_poly",
|
||||
".select_vert",
|
||||
".select_edge",
|
||||
".select_poly",
|
||||
"material_index");
|
||||
}
|
||||
|
||||
|
|
|
@ -259,9 +259,9 @@ static void mesh_blend_write(BlendWriter *writer, ID *id, const void *id_address
|
|||
".hide_edge",
|
||||
".hide_poly",
|
||||
"material_index",
|
||||
".selection_vert",
|
||||
".selection_edge",
|
||||
".selection_poly"});
|
||||
".select_vert",
|
||||
".select_edge",
|
||||
".select_poly"});
|
||||
|
||||
/* Set deprecated mesh data pointers for forward compatibility. */
|
||||
mesh->mvert = const_cast<MVert *>(mesh->verts().data());
|
||||
|
@ -697,11 +697,6 @@ static int customdata_compare(
|
|||
case CD_PROP_BOOL: {
|
||||
const bool *l1_data = (bool *)l1->data;
|
||||
const bool *l2_data = (bool *)l2->data;
|
||||
/* TODO(@HooglyBoogly): Remove this after test files have been updated for selection
|
||||
* attribute changes. */
|
||||
if (StringRef(l1->name).startswith(".selection")) {
|
||||
continue;
|
||||
}
|
||||
for (int i = 0; i < total_length; i++) {
|
||||
if (l1_data[i] != l2_data[i]) {
|
||||
return MESHCMP_ATTRIBUTE_VALUE_MISMATCH;
|
||||
|
@ -1664,32 +1659,32 @@ void BKE_mesh_mselect_validate(Mesh *me)
|
|||
(me->totselect), sizeof(MSelect), "Mesh selection history");
|
||||
|
||||
const AttributeAccessor attributes = me->attributes();
|
||||
const VArray<bool> selection_vert = attributes.lookup_or_default<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT, false);
|
||||
const VArray<bool> selection_edge = attributes.lookup_or_default<bool>(
|
||||
".selection_edge", ATTR_DOMAIN_EDGE, false);
|
||||
const VArray<bool> selection_poly = attributes.lookup_or_default<bool>(
|
||||
".selection_poly", ATTR_DOMAIN_FACE, false);
|
||||
const VArray<bool> select_vert = attributes.lookup_or_default<bool>(
|
||||
".select_vert", ATTR_DOMAIN_POINT, false);
|
||||
const VArray<bool> select_edge = attributes.lookup_or_default<bool>(
|
||||
".select_edge", ATTR_DOMAIN_EDGE, false);
|
||||
const VArray<bool> select_poly = attributes.lookup_or_default<bool>(
|
||||
".select_poly", ATTR_DOMAIN_FACE, false);
|
||||
|
||||
for (i_src = 0, i_dst = 0; i_src < me->totselect; i_src++) {
|
||||
int index = mselect_src[i_src].index;
|
||||
switch (mselect_src[i_src].type) {
|
||||
case ME_VSEL: {
|
||||
if (selection_vert[index]) {
|
||||
if (select_vert[index]) {
|
||||
mselect_dst[i_dst] = mselect_src[i_src];
|
||||
i_dst++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ME_ESEL: {
|
||||
if (selection_edge[index]) {
|
||||
if (select_edge[index]) {
|
||||
mselect_dst[i_dst] = mselect_src[i_src];
|
||||
i_dst++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ME_FSEL: {
|
||||
if (selection_poly[index]) {
|
||||
if (select_poly[index]) {
|
||||
mselect_dst[i_dst] = mselect_src[i_src];
|
||||
i_dst++;
|
||||
}
|
||||
|
|
|
@ -247,19 +247,19 @@ void BKE_mesh_calc_edges(Mesh *mesh, bool keep_existing_edges, const bool select
|
|||
|
||||
if (select_new_edges) {
|
||||
MutableAttributeAccessor attributes = mesh->attributes_for_write();
|
||||
SpanAttributeWriter<bool> selection_edge = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".selection_edge", ATTR_DOMAIN_EDGE);
|
||||
if (selection_edge) {
|
||||
SpanAttributeWriter<bool> select_edge = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".select_edge", ATTR_DOMAIN_EDGE);
|
||||
if (select_edge) {
|
||||
int new_edge_index = 0;
|
||||
for (const EdgeMap &edge_map : edge_maps) {
|
||||
for (EdgeMap::Item item : edge_map.items()) {
|
||||
if (item.value.original_edge == nullptr) {
|
||||
selection_edge.span[new_edge_index] = true;
|
||||
select_edge.span[new_edge_index] = true;
|
||||
}
|
||||
new_edge_index++;
|
||||
}
|
||||
}
|
||||
selection_edge.finish();
|
||||
select_edge.finish();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -822,27 +822,27 @@ void BKE_mesh_flush_select_from_polys(Mesh *me)
|
|||
{
|
||||
using namespace blender::bke;
|
||||
MutableAttributeAccessor attributes = me->attributes_for_write();
|
||||
const VArray<bool> selection_poly = attributes.lookup_or_default<bool>(
|
||||
".selection_poly", ATTR_DOMAIN_FACE, false);
|
||||
if (selection_poly.is_single() && !selection_poly.get_internal_single()) {
|
||||
attributes.remove(".selection_vert");
|
||||
attributes.remove(".selection_edge");
|
||||
const VArray<bool> select_poly = attributes.lookup_or_default<bool>(
|
||||
".select_poly", ATTR_DOMAIN_FACE, false);
|
||||
if (select_poly.is_single() && !select_poly.get_internal_single()) {
|
||||
attributes.remove(".select_vert");
|
||||
attributes.remove(".select_edge");
|
||||
return;
|
||||
}
|
||||
SpanAttributeWriter<bool> selection_vert = attributes.lookup_or_add_for_write_only_span<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT);
|
||||
SpanAttributeWriter<bool> selection_edge = attributes.lookup_or_add_for_write_only_span<bool>(
|
||||
".selection_edge", ATTR_DOMAIN_EDGE);
|
||||
SpanAttributeWriter<bool> select_vert = attributes.lookup_or_add_for_write_only_span<bool>(
|
||||
".select_vert", ATTR_DOMAIN_POINT);
|
||||
SpanAttributeWriter<bool> select_edge = attributes.lookup_or_add_for_write_only_span<bool>(
|
||||
".select_edge", ATTR_DOMAIN_EDGE);
|
||||
|
||||
/* Use generic domain interpolation to read the polygon attribute on the other domains.
|
||||
* Assume selected faces are not hidden and none of their vertices/edges are hidden. */
|
||||
attributes.lookup_or_default<bool>(".selection_poly", ATTR_DOMAIN_POINT, false)
|
||||
.materialize(selection_vert.span);
|
||||
attributes.lookup_or_default<bool>(".selection_poly", ATTR_DOMAIN_EDGE, false)
|
||||
.materialize(selection_edge.span);
|
||||
attributes.lookup_or_default<bool>(".select_poly", ATTR_DOMAIN_POINT, false)
|
||||
.materialize(select_vert.span);
|
||||
attributes.lookup_or_default<bool>(".select_poly", ATTR_DOMAIN_EDGE, false)
|
||||
.materialize(select_edge.span);
|
||||
|
||||
selection_vert.finish();
|
||||
selection_edge.finish();
|
||||
select_vert.finish();
|
||||
select_edge.finish();
|
||||
}
|
||||
|
||||
static void mesh_flush_select_from_verts(const Span<MEdge> edges,
|
||||
|
@ -850,15 +850,15 @@ static void mesh_flush_select_from_verts(const Span<MEdge> edges,
|
|||
const Span<MLoop> loops,
|
||||
const VArray<bool> &hide_edge,
|
||||
const VArray<bool> &hide_poly,
|
||||
const VArray<bool> &selection_vert,
|
||||
MutableSpan<bool> selection_edge,
|
||||
MutableSpan<bool> selection_poly)
|
||||
const VArray<bool> &select_vert,
|
||||
MutableSpan<bool> select_edge,
|
||||
MutableSpan<bool> select_poly)
|
||||
{
|
||||
/* Select visible edges that have both of their vertices selected. */
|
||||
for (const int i : edges.index_range()) {
|
||||
if (!hide_edge[i]) {
|
||||
const MEdge &edge = edges[i];
|
||||
selection_edge[i] = selection_vert[edge.v1] && selection_vert[edge.v2];
|
||||
select_edge[i] = select_vert[edge.v1] && select_vert[edge.v2];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -867,9 +867,9 @@ static void mesh_flush_select_from_verts(const Span<MEdge> edges,
|
|||
if (!hide_poly[i]) {
|
||||
const MPoly &poly = polys[i];
|
||||
const Span<MLoop> poly_loops = loops.slice(poly.loopstart, poly.totloop);
|
||||
selection_poly[i] = std::all_of(poly_loops.begin(),
|
||||
poly_loops.end(),
|
||||
[&](const MLoop &loop) { return selection_vert[loop.v]; });
|
||||
select_poly[i] = std::all_of(poly_loops.begin(), poly_loops.end(), [&](const MLoop &loop) {
|
||||
return select_vert[loop.v];
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -878,28 +878,28 @@ void BKE_mesh_flush_select_from_verts(Mesh *me)
|
|||
{
|
||||
using namespace blender::bke;
|
||||
MutableAttributeAccessor attributes = me->attributes_for_write();
|
||||
const VArray<bool> selection_vert = attributes.lookup_or_default<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT, false);
|
||||
if (selection_vert.is_single() && !selection_vert.get_internal_single()) {
|
||||
attributes.remove(".selection_edge");
|
||||
attributes.remove(".selection_poly");
|
||||
const VArray<bool> select_vert = attributes.lookup_or_default<bool>(
|
||||
".select_vert", ATTR_DOMAIN_POINT, false);
|
||||
if (select_vert.is_single() && !select_vert.get_internal_single()) {
|
||||
attributes.remove(".select_edge");
|
||||
attributes.remove(".select_poly");
|
||||
return;
|
||||
}
|
||||
SpanAttributeWriter<bool> selection_edge = attributes.lookup_or_add_for_write_only_span<bool>(
|
||||
".selection_edge", ATTR_DOMAIN_EDGE);
|
||||
SpanAttributeWriter<bool> selection_poly = attributes.lookup_or_add_for_write_only_span<bool>(
|
||||
".selection_poly", ATTR_DOMAIN_FACE);
|
||||
SpanAttributeWriter<bool> select_edge = attributes.lookup_or_add_for_write_only_span<bool>(
|
||||
".select_edge", ATTR_DOMAIN_EDGE);
|
||||
SpanAttributeWriter<bool> select_poly = attributes.lookup_or_add_for_write_only_span<bool>(
|
||||
".select_poly", ATTR_DOMAIN_FACE);
|
||||
mesh_flush_select_from_verts(
|
||||
me->edges(),
|
||||
me->polys(),
|
||||
me->loops(),
|
||||
attributes.lookup_or_default<bool>(".hide_edge", ATTR_DOMAIN_EDGE, false),
|
||||
attributes.lookup_or_default<bool>(".hide_poly", ATTR_DOMAIN_FACE, false),
|
||||
selection_vert,
|
||||
selection_edge.span,
|
||||
selection_poly.span);
|
||||
selection_edge.finish();
|
||||
selection_poly.finish();
|
||||
select_vert,
|
||||
select_edge.span,
|
||||
select_poly.span);
|
||||
select_edge.finish();
|
||||
select_poly.finish();
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
|
|
@ -1059,7 +1059,7 @@ void BKE_mesh_legacy_convert_hide_layers_to_flags(Mesh *mesh)
|
|||
".hide_vert", ATTR_DOMAIN_POINT, false);
|
||||
threading::parallel_for(verts.index_range(), 4096, [&](IndexRange range) {
|
||||
for (const int i : range) {
|
||||
SET_FLAG_FROM_TEST(verts[i].flag, hide_vert[i], ME_HIDE);
|
||||
SET_FLAG_FROM_TEST(verts[i].flag_legacy, hide_vert[i], ME_HIDE);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1089,13 +1089,14 @@ void BKE_mesh_legacy_convert_flags_to_hide_layers(Mesh *mesh)
|
|||
MutableAttributeAccessor attributes = mesh->attributes_for_write();
|
||||
|
||||
const Span<MVert> verts = mesh->verts();
|
||||
if (std::any_of(
|
||||
verts.begin(), verts.end(), [](const MVert &vert) { return vert.flag & ME_HIDE; })) {
|
||||
if (std::any_of(verts.begin(), verts.end(), [](const MVert &vert) {
|
||||
return vert.flag_legacy & ME_HIDE;
|
||||
})) {
|
||||
SpanAttributeWriter<bool> hide_vert = attributes.lookup_or_add_for_write_only_span<bool>(
|
||||
".hide_vert", ATTR_DOMAIN_POINT);
|
||||
threading::parallel_for(verts.index_range(), 4096, [&](IndexRange range) {
|
||||
for (const int i : range) {
|
||||
hide_vert.span[i] = verts[i].flag & ME_HIDE;
|
||||
hide_vert.span[i] = verts[i].flag_legacy & ME_HIDE;
|
||||
}
|
||||
});
|
||||
hide_vert.finish();
|
||||
|
@ -1181,29 +1182,29 @@ void BKE_mesh_legacy_convert_selection_layers_to_flags(Mesh *mesh)
|
|||
const AttributeAccessor attributes = mesh->attributes();
|
||||
|
||||
MutableSpan<MVert> verts = mesh->verts_for_write();
|
||||
const VArray<bool> selection_vert = attributes.lookup_or_default<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT, false);
|
||||
const VArray<bool> select_vert = attributes.lookup_or_default<bool>(
|
||||
".select_vert", ATTR_DOMAIN_POINT, false);
|
||||
threading::parallel_for(verts.index_range(), 4096, [&](IndexRange range) {
|
||||
for (const int i : range) {
|
||||
SET_FLAG_FROM_TEST(verts[i].flag, selection_vert[i], SELECT);
|
||||
SET_FLAG_FROM_TEST(verts[i].flag_legacy, select_vert[i], SELECT);
|
||||
}
|
||||
});
|
||||
|
||||
MutableSpan<MEdge> edges = mesh->edges_for_write();
|
||||
const VArray<bool> selection_edge = attributes.lookup_or_default<bool>(
|
||||
".selection_edge", ATTR_DOMAIN_EDGE, false);
|
||||
const VArray<bool> select_edge = attributes.lookup_or_default<bool>(
|
||||
".select_edge", ATTR_DOMAIN_EDGE, false);
|
||||
threading::parallel_for(edges.index_range(), 4096, [&](IndexRange range) {
|
||||
for (const int i : range) {
|
||||
SET_FLAG_FROM_TEST(edges[i].flag, selection_edge[i], SELECT);
|
||||
SET_FLAG_FROM_TEST(edges[i].flag, select_edge[i], SELECT);
|
||||
}
|
||||
});
|
||||
|
||||
MutableSpan<MPoly> polys = mesh->polys_for_write();
|
||||
const VArray<bool> selection_poly = attributes.lookup_or_default<bool>(
|
||||
".selection_poly", ATTR_DOMAIN_FACE, false);
|
||||
const VArray<bool> select_poly = attributes.lookup_or_default<bool>(
|
||||
".select_poly", ATTR_DOMAIN_FACE, false);
|
||||
threading::parallel_for(polys.index_range(), 4096, [&](IndexRange range) {
|
||||
for (const int i : range) {
|
||||
SET_FLAG_FROM_TEST(polys[i].flag, selection_poly[i], ME_FACE_SEL);
|
||||
SET_FLAG_FROM_TEST(polys[i].flag, select_poly[i], ME_FACE_SEL);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1215,42 +1216,43 @@ void BKE_mesh_legacy_convert_flags_to_selection_layers(Mesh *mesh)
|
|||
MutableAttributeAccessor attributes = mesh->attributes_for_write();
|
||||
|
||||
const Span<MVert> verts = mesh->verts();
|
||||
if (std::any_of(
|
||||
verts.begin(), verts.end(), [](const MVert &vert) { return vert.flag & SELECT; })) {
|
||||
SpanAttributeWriter<bool> selection_vert = attributes.lookup_or_add_for_write_only_span<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT);
|
||||
if (std::any_of(verts.begin(), verts.end(), [](const MVert &vert) {
|
||||
return vert.flag_legacy & SELECT;
|
||||
})) {
|
||||
SpanAttributeWriter<bool> select_vert = attributes.lookup_or_add_for_write_only_span<bool>(
|
||||
".select_vert", ATTR_DOMAIN_POINT);
|
||||
threading::parallel_for(verts.index_range(), 4096, [&](IndexRange range) {
|
||||
for (const int i : range) {
|
||||
selection_vert.span[i] = verts[i].flag & SELECT;
|
||||
select_vert.span[i] = verts[i].flag_legacy & SELECT;
|
||||
}
|
||||
});
|
||||
selection_vert.finish();
|
||||
select_vert.finish();
|
||||
}
|
||||
|
||||
const Span<MEdge> edges = mesh->edges();
|
||||
if (std::any_of(
|
||||
edges.begin(), edges.end(), [](const MEdge &edge) { return edge.flag & SELECT; })) {
|
||||
SpanAttributeWriter<bool> selection_edge = attributes.lookup_or_add_for_write_only_span<bool>(
|
||||
".selection_edge", ATTR_DOMAIN_EDGE);
|
||||
SpanAttributeWriter<bool> select_edge = attributes.lookup_or_add_for_write_only_span<bool>(
|
||||
".select_edge", ATTR_DOMAIN_EDGE);
|
||||
threading::parallel_for(edges.index_range(), 4096, [&](IndexRange range) {
|
||||
for (const int i : range) {
|
||||
selection_edge.span[i] = edges[i].flag & SELECT;
|
||||
select_edge.span[i] = edges[i].flag & SELECT;
|
||||
}
|
||||
});
|
||||
selection_edge.finish();
|
||||
select_edge.finish();
|
||||
}
|
||||
|
||||
const Span<MPoly> polys = mesh->polys();
|
||||
if (std::any_of(
|
||||
polys.begin(), polys.end(), [](const MPoly &poly) { return poly.flag & ME_FACE_SEL; })) {
|
||||
SpanAttributeWriter<bool> selection_poly = attributes.lookup_or_add_for_write_only_span<bool>(
|
||||
".selection_poly", ATTR_DOMAIN_FACE);
|
||||
SpanAttributeWriter<bool> select_poly = attributes.lookup_or_add_for_write_only_span<bool>(
|
||||
".select_poly", ATTR_DOMAIN_FACE);
|
||||
threading::parallel_for(polys.index_range(), 4096, [&](IndexRange range) {
|
||||
for (const int i : range) {
|
||||
selection_poly.span[i] = polys[i].flag & ME_FACE_SEL;
|
||||
select_poly.span[i] = polys[i].flag & ME_FACE_SEL;
|
||||
}
|
||||
});
|
||||
selection_poly.finish();
|
||||
select_poly.finish();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
/* ngon version wip, based on BM_uv_vert_map_create */
|
||||
UvVertMap *BKE_mesh_uv_vert_map_create(const MPoly *mpoly,
|
||||
const bool *hide_poly,
|
||||
const bool *selection_poly,
|
||||
const bool *select_poly,
|
||||
const MLoop *mloop,
|
||||
const MLoopUV *mloopuv,
|
||||
uint totpoly,
|
||||
|
@ -54,7 +54,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 || (!(hide_poly && hide_poly[a]) && (selection_poly && selection_poly[a]))) {
|
||||
if (!selected || (!(hide_poly && hide_poly[a]) && (select_poly && select_poly[a]))) {
|
||||
totuv += mp->totloop;
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ UvVertMap *BKE_mesh_uv_vert_map_create(const MPoly *mpoly,
|
|||
|
||||
mp = mpoly;
|
||||
for (a = 0; a < totpoly; a++, mp++) {
|
||||
if (!selected || (!(hide_poly && hide_poly[a]) && (selection_poly && selection_poly[a]))) {
|
||||
if (!selected || (!(hide_poly && hide_poly[a]) && (select_poly && select_poly[a]))) {
|
||||
float(*tf_uv)[2] = NULL;
|
||||
|
||||
if (use_winding) {
|
||||
|
|
|
@ -163,14 +163,14 @@ bool BKE_object_defgroup_clear(Object *ob, bDeformGroup *dg, const bool use_sele
|
|||
}
|
||||
else {
|
||||
if (BKE_mesh_deform_verts(me)) {
|
||||
const bool *selection_vert = (const bool *)CustomData_get_layer_named(
|
||||
&me->vdata, CD_PROP_BOOL, ".selection_vert");
|
||||
const bool *select_vert = (const bool *)CustomData_get_layer_named(
|
||||
&me->vdata, CD_PROP_BOOL, ".select_vert");
|
||||
int i;
|
||||
|
||||
dv = BKE_mesh_deform_verts_for_write(me);
|
||||
|
||||
for (i = 0; i < me->totvert; i++, dv++) {
|
||||
if (dv->dw && (!use_selection || (selection_vert && selection_vert[i]))) {
|
||||
if (dv->dw && (!use_selection || (select_vert && select_vert[i]))) {
|
||||
MDeformWeight *dw = BKE_defvert_find_index(dv, def_nr);
|
||||
BKE_defvert_remove_group(dv, dw); /* dw can be NULL */
|
||||
changed = true;
|
||||
|
|
|
@ -212,7 +212,7 @@ static void precalc_uv_layer(const OpenSubdiv_Converter *converter, const int la
|
|||
UvVertMap *uv_vert_map = BKE_mesh_uv_vert_map_create(
|
||||
storage->polys,
|
||||
(const bool *)CustomData_get_layer_named(&mesh->pdata, CD_PROP_BOOL, ".hide_poly"),
|
||||
(const bool *)CustomData_get_layer_named(&mesh->pdata, CD_PROP_BOOL, ".selection_poly"),
|
||||
(const bool *)CustomData_get_layer_named(&mesh->pdata, CD_PROP_BOOL, ".select_poly"),
|
||||
storage->loops,
|
||||
mloopuv,
|
||||
num_poly,
|
||||
|
|
|
@ -268,12 +268,12 @@ 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 *selection_vert = (const bool *)CustomData_get_layer_named(
|
||||
&me->vdata, CD_PROP_BOOL, ".selection_vert");
|
||||
const bool *selection_edge = (const bool *)CustomData_get_layer_named(
|
||||
&me->edata, CD_PROP_BOOL, ".selection_edge");
|
||||
const bool *selection_poly = (const bool *)CustomData_get_layer_named(
|
||||
&me->pdata, CD_PROP_BOOL, ".selection_poly");
|
||||
const bool *select_vert = (const bool *)CustomData_get_layer_named(
|
||||
&me->vdata, CD_PROP_BOOL, ".select_vert");
|
||||
const bool *select_edge = (const bool *)CustomData_get_layer_named(
|
||||
&me->edata, CD_PROP_BOOL, ".select_edge");
|
||||
const bool *select_poly = (const bool *)CustomData_get_layer_named(
|
||||
&me->pdata, CD_PROP_BOOL, ".select_poly");
|
||||
const bool *hide_vert = (const bool *)CustomData_get_layer_named(
|
||||
&me->vdata, CD_PROP_BOOL, ".hide_vert");
|
||||
const bool *hide_edge = (const bool *)CustomData_get_layer_named(
|
||||
|
@ -293,7 +293,7 @@ void BM_mesh_bm_from_me(BMesh *bm, const Mesh *me, const struct BMeshFromMeshPar
|
|||
if (hide_vert && hide_vert[i]) {
|
||||
BM_elem_flag_enable(v, BM_ELEM_HIDDEN);
|
||||
}
|
||||
if (selection_vert && selection_vert[i]) {
|
||||
if (select_vert && select_vert[i]) {
|
||||
BM_vert_select_set(bm, v, true);
|
||||
}
|
||||
|
||||
|
@ -333,7 +333,7 @@ void BM_mesh_bm_from_me(BMesh *bm, const Mesh *me, const struct BMeshFromMeshPar
|
|||
if (hide_edge && hide_edge[i]) {
|
||||
BM_elem_flag_enable(e, BM_ELEM_HIDDEN);
|
||||
}
|
||||
if (selection_edge && selection_edge[i]) {
|
||||
if (select_edge && select_edge[i]) {
|
||||
BM_edge_select_set(bm, e, true);
|
||||
}
|
||||
|
||||
|
@ -380,7 +380,7 @@ void BM_mesh_bm_from_me(BMesh *bm, const Mesh *me, const struct BMeshFromMeshPar
|
|||
if (hide_poly && hide_poly[i]) {
|
||||
BM_elem_flag_enable(f, BM_ELEM_HIDDEN);
|
||||
}
|
||||
if (selection_poly && selection_poly[i]) {
|
||||
if (select_poly && select_poly[i]) {
|
||||
BM_face_select_set(bm, f, true);
|
||||
}
|
||||
|
||||
|
@ -849,9 +849,9 @@ static void assert_bmesh_has_no_mesh_only_attributes(const BMesh &bm)
|
|||
BLI_assert(CustomData_get_layer_named(&bm.edata, CD_PROP_BOOL, ".hide_edge") == nullptr);
|
||||
BLI_assert(CustomData_get_layer_named(&bm.pdata, CD_PROP_BOOL, ".hide_poly") == nullptr);
|
||||
/* The "selection" attributes are stored as flags on #BMesh. */
|
||||
BLI_assert(CustomData_get_layer_named(&bm.vdata, CD_PROP_BOOL, ".selection_vert") == nullptr);
|
||||
BLI_assert(CustomData_get_layer_named(&bm.edata, CD_PROP_BOOL, ".selection_edge") == nullptr);
|
||||
BLI_assert(CustomData_get_layer_named(&bm.pdata, CD_PROP_BOOL, ".selection_poly") == nullptr);
|
||||
BLI_assert(CustomData_get_layer_named(&bm.vdata, CD_PROP_BOOL, ".select_vert") == nullptr);
|
||||
BLI_assert(CustomData_get_layer_named(&bm.edata, CD_PROP_BOOL, ".select_edge") == nullptr);
|
||||
BLI_assert(CustomData_get_layer_named(&bm.pdata, CD_PROP_BOOL, ".select_poly") == nullptr);
|
||||
}
|
||||
|
||||
static void convert_bmesh_hide_flags_to_mesh_attributes(BMesh &bm,
|
||||
|
@ -889,32 +889,31 @@ static void convert_bmesh_hide_flags_to_mesh_attributes(BMesh &bm,
|
|||
}
|
||||
|
||||
static void convert_bmesh_selection_flags_to_mesh_attributes(BMesh &bm,
|
||||
const bool need_selection_vert,
|
||||
const bool need_selection_edge,
|
||||
const bool need_selection_poly,
|
||||
const bool need_select_vert,
|
||||
const bool need_select_edge,
|
||||
const bool need_select_poly,
|
||||
Mesh &mesh)
|
||||
{
|
||||
using namespace blender;
|
||||
if (!(need_selection_vert || need_selection_edge || need_selection_poly)) {
|
||||
if (!(need_select_vert || need_select_edge || need_select_poly)) {
|
||||
return;
|
||||
}
|
||||
|
||||
bke::MutableAttributeAccessor attributes = mesh.attributes_for_write();
|
||||
BM_mesh_elem_table_ensure(&bm, BM_VERT | BM_EDGE | BM_FACE);
|
||||
|
||||
if (need_selection_vert) {
|
||||
write_fn_to_attribute<bool>(
|
||||
attributes, ".selection_vert", ATTR_DOMAIN_POINT, [&](const int i) {
|
||||
return BM_elem_flag_test(BM_vert_at_index(&bm, i), BM_ELEM_SELECT);
|
||||
});
|
||||
if (need_select_vert) {
|
||||
write_fn_to_attribute<bool>(attributes, ".select_vert", ATTR_DOMAIN_POINT, [&](const int i) {
|
||||
return BM_elem_flag_test(BM_vert_at_index(&bm, i), BM_ELEM_SELECT);
|
||||
});
|
||||
}
|
||||
if (need_selection_edge) {
|
||||
write_fn_to_attribute<bool>(attributes, ".selection_edge", ATTR_DOMAIN_EDGE, [&](const int i) {
|
||||
if (need_select_edge) {
|
||||
write_fn_to_attribute<bool>(attributes, ".select_edge", ATTR_DOMAIN_EDGE, [&](const int i) {
|
||||
return BM_elem_flag_test(BM_edge_at_index(&bm, i), BM_ELEM_SELECT);
|
||||
});
|
||||
}
|
||||
if (need_selection_poly) {
|
||||
write_fn_to_attribute<bool>(attributes, ".selection_poly", ATTR_DOMAIN_FACE, [&](const int i) {
|
||||
if (need_select_poly) {
|
||||
write_fn_to_attribute<bool>(attributes, ".select_poly", ATTR_DOMAIN_FACE, [&](const int i) {
|
||||
return BM_elem_flag_test(BM_face_at_index(&bm, i), BM_ELEM_SELECT);
|
||||
});
|
||||
}
|
||||
|
@ -967,9 +966,9 @@ void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *me, const struct BMeshToMesh
|
|||
MutableSpan<MPoly> mpoly = me->polys_for_write();
|
||||
MutableSpan<MLoop> mloop = me->loops_for_write();
|
||||
|
||||
bool need_selection_vert = false;
|
||||
bool need_selection_edge = false;
|
||||
bool need_selection_poly = false;
|
||||
bool need_select_vert = false;
|
||||
bool need_select_edge = false;
|
||||
bool need_select_poly = false;
|
||||
bool need_hide_vert = false;
|
||||
bool need_hide_edge = false;
|
||||
bool need_hide_poly = false;
|
||||
|
@ -987,7 +986,7 @@ void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *me, const struct BMeshToMesh
|
|||
need_hide_vert = true;
|
||||
}
|
||||
if (BM_elem_flag_test(v, BM_ELEM_SELECT)) {
|
||||
need_selection_vert = true;
|
||||
need_select_vert = true;
|
||||
}
|
||||
|
||||
BM_elem_index_set(v, i); /* set_inline */
|
||||
|
@ -1011,7 +1010,7 @@ void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *me, const struct BMeshToMesh
|
|||
need_hide_edge = true;
|
||||
}
|
||||
if (BM_elem_flag_test(e, BM_ELEM_SELECT)) {
|
||||
need_selection_edge = true;
|
||||
need_select_edge = true;
|
||||
}
|
||||
|
||||
BM_elem_index_set(e, i); /* set_inline */
|
||||
|
@ -1040,7 +1039,7 @@ void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *me, const struct BMeshToMesh
|
|||
need_hide_poly = true;
|
||||
}
|
||||
if (BM_elem_flag_test(f, BM_ELEM_SELECT)) {
|
||||
need_selection_poly = true;
|
||||
need_select_poly = true;
|
||||
}
|
||||
|
||||
l_iter = l_first = BM_FACE_FIRST_LOOP(f);
|
||||
|
@ -1143,7 +1142,7 @@ void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *me, const struct BMeshToMesh
|
|||
convert_bmesh_hide_flags_to_mesh_attributes(
|
||||
*bm, need_hide_vert, need_hide_edge, need_hide_poly, *me);
|
||||
convert_bmesh_selection_flags_to_mesh_attributes(
|
||||
*bm, need_selection_vert, need_selection_edge, need_selection_poly, *me);
|
||||
*bm, need_select_vert, need_select_edge, need_select_poly, *me);
|
||||
|
||||
{
|
||||
me->totselect = BLI_listbase_count(&(bm->selected));
|
||||
|
@ -1244,7 +1243,7 @@ void BM_mesh_bm_to_me_for_eval(BMesh *bm, Mesh *me, const CustomData_MeshMasks *
|
|||
bke::MutableAttributeAccessor mesh_attributes = me->attributes_for_write();
|
||||
|
||||
bke::SpanAttributeWriter<bool> hide_vert_attribute;
|
||||
bke::SpanAttributeWriter<bool> selection_vert_attribute;
|
||||
bke::SpanAttributeWriter<bool> select_vert_attribute;
|
||||
BM_ITER_MESH_INDEX (eve, &iter, bm, BM_VERTS_OF_MESH, i) {
|
||||
MVert *mv = &mvert[i];
|
||||
|
||||
|
@ -1260,11 +1259,11 @@ void BM_mesh_bm_to_me_for_eval(BMesh *bm, Mesh *me, const CustomData_MeshMasks *
|
|||
hide_vert_attribute.span[i] = true;
|
||||
}
|
||||
if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
|
||||
if (!selection_vert_attribute) {
|
||||
selection_vert_attribute = mesh_attributes.lookup_or_add_for_write_only_span<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT);
|
||||
if (!select_vert_attribute) {
|
||||
select_vert_attribute = mesh_attributes.lookup_or_add_for_write_only_span<bool>(
|
||||
".select_vert", ATTR_DOMAIN_POINT);
|
||||
}
|
||||
selection_vert_attribute.span[i] = true;
|
||||
select_vert_attribute.span[i] = true;
|
||||
}
|
||||
|
||||
CustomData_from_bmesh_block(&bm->vdata, &me->vdata, eve->head.data, i);
|
||||
|
@ -1272,7 +1271,7 @@ void BM_mesh_bm_to_me_for_eval(BMesh *bm, Mesh *me, const CustomData_MeshMasks *
|
|||
bm->elem_index_dirty &= ~BM_VERT;
|
||||
|
||||
bke::SpanAttributeWriter<bool> hide_edge_attribute;
|
||||
bke::SpanAttributeWriter<bool> selection_edge_attribute;
|
||||
bke::SpanAttributeWriter<bool> select_edge_attribute;
|
||||
BM_ITER_MESH_INDEX (eed, &iter, bm, BM_EDGES_OF_MESH, i) {
|
||||
MEdge *med = &medge[i];
|
||||
|
||||
|
@ -1290,11 +1289,11 @@ void BM_mesh_bm_to_me_for_eval(BMesh *bm, Mesh *me, const CustomData_MeshMasks *
|
|||
hide_edge_attribute.span[i] = true;
|
||||
}
|
||||
if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
|
||||
if (!selection_edge_attribute) {
|
||||
selection_edge_attribute = mesh_attributes.lookup_or_add_for_write_only_span<bool>(
|
||||
".selection_edge", ATTR_DOMAIN_EDGE);
|
||||
if (!select_edge_attribute) {
|
||||
select_edge_attribute = mesh_attributes.lookup_or_add_for_write_only_span<bool>(
|
||||
".select_edge", ATTR_DOMAIN_EDGE);
|
||||
}
|
||||
selection_edge_attribute.span[i] = true;
|
||||
select_edge_attribute.span[i] = true;
|
||||
}
|
||||
|
||||
/* Handle this differently to editmode switching,
|
||||
|
@ -1312,7 +1311,7 @@ void BM_mesh_bm_to_me_for_eval(BMesh *bm, Mesh *me, const CustomData_MeshMasks *
|
|||
j = 0;
|
||||
bke::SpanAttributeWriter<int> material_index_attribute;
|
||||
bke::SpanAttributeWriter<bool> hide_poly_attribute;
|
||||
bke::SpanAttributeWriter<bool> selection_poly_attribute;
|
||||
bke::SpanAttributeWriter<bool> select_poly_attribute;
|
||||
BM_ITER_MESH_INDEX (efa, &iter, bm, BM_FACES_OF_MESH, i) {
|
||||
BMLoop *l_iter;
|
||||
BMLoop *l_first;
|
||||
|
@ -1330,11 +1329,11 @@ void BM_mesh_bm_to_me_for_eval(BMesh *bm, Mesh *me, const CustomData_MeshMasks *
|
|||
hide_poly_attribute.span[i] = true;
|
||||
}
|
||||
if (BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
|
||||
if (!selection_poly_attribute) {
|
||||
selection_poly_attribute = mesh_attributes.lookup_or_add_for_write_only_span<bool>(
|
||||
".selection_poly", ATTR_DOMAIN_FACE);
|
||||
if (!select_poly_attribute) {
|
||||
select_poly_attribute = mesh_attributes.lookup_or_add_for_write_only_span<bool>(
|
||||
".select_poly", ATTR_DOMAIN_FACE);
|
||||
}
|
||||
selection_poly_attribute.span[i] = true;
|
||||
select_poly_attribute.span[i] = true;
|
||||
}
|
||||
|
||||
mp->loopstart = j;
|
||||
|
@ -1368,7 +1367,7 @@ void BM_mesh_bm_to_me_for_eval(BMesh *bm, Mesh *me, const CustomData_MeshMasks *
|
|||
hide_vert_attribute.finish();
|
||||
hide_edge_attribute.finish();
|
||||
hide_poly_attribute.finish();
|
||||
selection_vert_attribute.finish();
|
||||
selection_edge_attribute.finish();
|
||||
selection_poly_attribute.finish();
|
||||
select_vert_attribute.finish();
|
||||
select_edge_attribute.finish();
|
||||
select_poly_attribute.finish();
|
||||
}
|
||||
|
|
|
@ -570,12 +570,12 @@ MeshRenderData *mesh_render_data_create(Object *object,
|
|||
mr->hide_poly = static_cast<const bool *>(
|
||||
CustomData_get_layer_named(&me->pdata, CD_PROP_BOOL, ".hide_poly"));
|
||||
|
||||
mr->selection_vert = static_cast<const bool *>(
|
||||
CustomData_get_layer_named(&me->vdata, CD_PROP_BOOL, ".selection_vert"));
|
||||
mr->selection_edge = static_cast<const bool *>(
|
||||
CustomData_get_layer_named(&me->edata, CD_PROP_BOOL, ".selection_edge"));
|
||||
mr->selection_poly = static_cast<const bool *>(
|
||||
CustomData_get_layer_named(&me->pdata, CD_PROP_BOOL, ".selection_poly"));
|
||||
mr->select_vert = static_cast<const bool *>(
|
||||
CustomData_get_layer_named(&me->vdata, CD_PROP_BOOL, ".select_vert"));
|
||||
mr->select_edge = static_cast<const bool *>(
|
||||
CustomData_get_layer_named(&me->edata, CD_PROP_BOOL, ".select_edge"));
|
||||
mr->select_poly = static_cast<const bool *>(
|
||||
CustomData_get_layer_named(&me->pdata, CD_PROP_BOOL, ".select_poly"));
|
||||
}
|
||||
else {
|
||||
/* #BMesh */
|
||||
|
|
|
@ -678,7 +678,7 @@ static void draw_subdiv_cache_extra_coarse_face_data_mesh(const MeshRenderData *
|
|||
if ((polys[i].flag & ME_SMOOTH) != 0) {
|
||||
flag |= SUBDIV_COARSE_FACE_FLAG_SMOOTH;
|
||||
}
|
||||
if (mr->selection_poly && mr->selection_poly[i]) {
|
||||
if (mr->select_poly && mr->select_poly[i]) {
|
||||
flag |= SUBDIV_COARSE_FACE_FLAG_SELECT;
|
||||
}
|
||||
if (mr->hide_poly && mr->hide_poly[i]) {
|
||||
|
|
|
@ -86,9 +86,9 @@ struct MeshRenderData {
|
|||
const bool *hide_vert;
|
||||
const bool *hide_edge;
|
||||
const bool *hide_poly;
|
||||
const bool *selection_vert;
|
||||
const bool *selection_edge;
|
||||
const bool *selection_poly;
|
||||
const bool *select_vert;
|
||||
const bool *select_edge;
|
||||
const bool *select_poly;
|
||||
float (*loop_normals)[3];
|
||||
int *lverts, *ledges;
|
||||
|
||||
|
|
|
@ -220,7 +220,7 @@ static void extract_edituv_lines_iter_poly_mesh(const MeshRenderData *mr,
|
|||
}
|
||||
else {
|
||||
mp_hidden = (mr->hide_poly) ? mr->hide_poly[mp_index] : false;
|
||||
mp_select = mr->selection_poly && mr->selection_poly[mp_index];
|
||||
mp_select = mr->select_poly && mr->select_poly[mp_index];
|
||||
}
|
||||
|
||||
for (int ml_index = mp->loopstart; ml_index < ml_index_end; ml_index += 1) {
|
||||
|
@ -300,7 +300,7 @@ static void extract_edituv_lines_iter_subdiv_mesh(const DRWSubdivCache *subdiv_c
|
|||
}
|
||||
else {
|
||||
mp_hidden = (mr->hide_poly) ? mr->hide_poly[coarse_poly_index] : false;
|
||||
mp_select = mr->selection_poly && mr->selection_poly[coarse_poly_index];
|
||||
mp_select = mr->select_poly && mr->select_poly[coarse_poly_index];
|
||||
}
|
||||
|
||||
uint start_loop_idx = subdiv_quad_index * 4;
|
||||
|
|
|
@ -52,7 +52,7 @@ static void extract_lines_paint_mask_iter_poly_mesh(const MeshRenderData *mr,
|
|||
|
||||
const int ml_index_last = mp->totloop + mp->loopstart - 1;
|
||||
const int ml_index_other = (ml_index == ml_index_last) ? mp->loopstart : (ml_index + 1);
|
||||
if (mr->selection_poly && mr->selection_poly[mp_index]) {
|
||||
if (mr->select_poly && mr->select_poly[mp_index]) {
|
||||
if (BLI_BITMAP_TEST_AND_SET_ATOMIC(data->select_map, e_index)) {
|
||||
/* Hide edge as it has more than 2 selected loop. */
|
||||
GPU_indexbuf_set_line_restart(&data->elb, e_index);
|
||||
|
@ -126,7 +126,7 @@ static void extract_lines_paint_mask_iter_subdiv_mesh(const DRWSubdivCache *subd
|
|||
((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 :
|
||||
loop_idx + 1;
|
||||
if (mr->selection_poly && mr->selection_poly[coarse_quad_index]) {
|
||||
if (mr->select_poly && mr->select_poly[coarse_quad_index]) {
|
||||
if (BLI_BITMAP_TEST_AND_SET_ATOMIC(data->select_map, coarse_edge_index)) {
|
||||
/* Hide edge as it has more than 2 selected loop. */
|
||||
GPU_indexbuf_set_line_restart(&data->elb, subdiv_edge_index);
|
||||
|
|
|
@ -86,7 +86,7 @@ static void extract_lnor_iter_poly_mesh(const MeshRenderData *mr,
|
|||
(mr->edit_bmesh && (mr->v_origindex) && mr->v_origindex[ml->v] == ORIGINDEX_NONE)) {
|
||||
lnor_data->w = -1;
|
||||
}
|
||||
else if (mr->selection_poly && mr->selection_poly[mp_index]) {
|
||||
else if (mr->select_poly && mr->select_poly[mp_index]) {
|
||||
lnor_data->w = 1;
|
||||
}
|
||||
else {
|
||||
|
@ -211,7 +211,7 @@ static void extract_lnor_hq_iter_poly_mesh(const MeshRenderData *mr,
|
|||
(mr->edit_bmesh && (mr->v_origindex) && mr->v_origindex[ml->v] == ORIGINDEX_NONE)) {
|
||||
lnor_data->w = -1;
|
||||
}
|
||||
else if (mr->selection_poly && mr->selection_poly[mp_index]) {
|
||||
else if (mr->select_poly && mr->select_poly[mp_index]) {
|
||||
lnor_data->w = 1;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -104,7 +104,7 @@ static void extract_pos_nor_iter_poly_mesh(const MeshRenderData *mr,
|
|||
((mr->v_origindex) && (mr->v_origindex[ml->v] == ORIGINDEX_NONE))) {
|
||||
vert->nor.w = -1;
|
||||
}
|
||||
else if (mr->selection_vert && mr->selection_vert[ml->v]) {
|
||||
else if (mr->select_vert && mr->select_vert[ml->v]) {
|
||||
vert->nor.w = 1;
|
||||
}
|
||||
else {
|
||||
|
@ -451,7 +451,7 @@ static void extract_pos_nor_hq_iter_poly_mesh(const MeshRenderData *mr,
|
|||
((mr->v_origindex) && (mr->v_origindex[ml->v] == ORIGINDEX_NONE))) {
|
||||
vert->nor[3] = -1;
|
||||
}
|
||||
else if (mr->selection_vert && mr->selection_vert[ml->v]) {
|
||||
else if (mr->select_vert && mr->select_vert[ml->v]) {
|
||||
vert->nor[3] = 1;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -203,13 +203,13 @@ static void envelope_bone_weighting(Object *ob,
|
|||
use_mask = true;
|
||||
}
|
||||
|
||||
const bool *selection_vert = (const bool *)CustomData_get_layer_named(
|
||||
&mesh->vdata, CD_PROP_BOOL, ".selection_vert");
|
||||
const bool *select_vert = (const bool *)CustomData_get_layer_named(
|
||||
&mesh->vdata, CD_PROP_BOOL, ".select_vert");
|
||||
|
||||
/* for each vertex in the mesh */
|
||||
for (int i = 0; i < mesh->totvert; i++) {
|
||||
|
||||
if (use_mask && !(selection_vert && selection_vert[i])) {
|
||||
if (use_mask && !(select_vert && select_vert[i])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -669,22 +669,22 @@ void heat_bone_weighting(Object *ob,
|
|||
|
||||
/* (added selectedVerts content for vertex mask, they used to just equal 1) */
|
||||
if (use_vert_sel) {
|
||||
const bool *selection_vert = (const bool *)CustomData_get_layer_named(
|
||||
&me->vdata, CD_PROP_BOOL, ".selection_vert");
|
||||
if (selection_vert) {
|
||||
const bool *select_vert = (const bool *)CustomData_get_layer_named(
|
||||
&me->vdata, CD_PROP_BOOL, ".select_vert");
|
||||
if (select_vert) {
|
||||
for (a = 0, mp = polys; a < me->totpoly; mp++, a++) {
|
||||
for (j = 0, ml = loops + mp->loopstart; j < mp->totloop; j++, ml++) {
|
||||
mask[ml->v] = selection_vert[ml->v];
|
||||
mask[ml->v] = select_vert[ml->v];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (use_face_sel) {
|
||||
const bool *selection_poly = (const bool *)CustomData_get_layer_named(
|
||||
&me->pdata, CD_PROP_BOOL, ".selection_poly");
|
||||
if (selection_poly) {
|
||||
const bool *select_poly = (const bool *)CustomData_get_layer_named(
|
||||
&me->pdata, CD_PROP_BOOL, ".select_poly");
|
||||
if (select_poly) {
|
||||
for (a = 0, mp = polys; a < me->totpoly; mp++, a++) {
|
||||
if (selection_poly[a]) {
|
||||
if (select_poly[a]) {
|
||||
for (j = 0, ml = loops + mp->loopstart; j < mp->totloop; j++, ml++) {
|
||||
mask[ml->v] = 1;
|
||||
}
|
||||
|
|
|
@ -85,13 +85,13 @@ void paintface_flush_flags(bContext *C,
|
|||
hide_poly_orig.finish();
|
||||
}
|
||||
if (flush_selection) {
|
||||
const VArray<bool> selection_poly_me = attributes_me.lookup_or_default<bool>(
|
||||
".selection_poly", ATTR_DOMAIN_FACE, false);
|
||||
bke::SpanAttributeWriter<bool> selection_poly_orig =
|
||||
attributes_orig.lookup_or_add_for_write_only_span<bool>(".selection_poly",
|
||||
const VArray<bool> select_poly_me = attributes_me.lookup_or_default<bool>(
|
||||
".select_poly", ATTR_DOMAIN_FACE, false);
|
||||
bke::SpanAttributeWriter<bool> select_poly_orig =
|
||||
attributes_orig.lookup_or_add_for_write_only_span<bool>(".select_poly",
|
||||
ATTR_DOMAIN_FACE);
|
||||
selection_poly_me.materialize(selection_poly_orig.span);
|
||||
selection_poly_orig.finish();
|
||||
select_poly_me.materialize(select_poly_orig.span);
|
||||
select_poly_orig.finish();
|
||||
}
|
||||
|
||||
/* Mesh polys => Final derived polys */
|
||||
|
@ -111,18 +111,18 @@ void paintface_flush_flags(bContext *C,
|
|||
hide_poly_eval.finish();
|
||||
}
|
||||
if (flush_selection) {
|
||||
const VArray<bool> selection_poly_orig = attributes_orig.lookup_or_default<bool>(
|
||||
".selection_poly", ATTR_DOMAIN_FACE, false);
|
||||
bke::SpanAttributeWriter<bool> selection_poly_eval =
|
||||
attributes_eval.lookup_or_add_for_write_only_span<bool>(".selection_poly",
|
||||
const VArray<bool> select_poly_orig = attributes_orig.lookup_or_default<bool>(
|
||||
".select_poly", ATTR_DOMAIN_FACE, false);
|
||||
bke::SpanAttributeWriter<bool> select_poly_eval =
|
||||
attributes_eval.lookup_or_add_for_write_only_span<bool>(".select_poly",
|
||||
ATTR_DOMAIN_FACE);
|
||||
for (const int i : IndexRange(me_eval->totpoly)) {
|
||||
const int orig_poly_index = index_array[i];
|
||||
if (orig_poly_index != ORIGINDEX_NONE) {
|
||||
selection_poly_eval.span[i] = selection_poly_orig[orig_poly_index];
|
||||
select_poly_eval.span[i] = select_poly_orig[orig_poly_index];
|
||||
}
|
||||
}
|
||||
selection_poly_eval.finish();
|
||||
select_poly_eval.finish();
|
||||
}
|
||||
|
||||
updated = true;
|
||||
|
@ -157,23 +157,23 @@ void paintface_hide(bContext *C, Object *ob, const bool unselected)
|
|||
bke::MutableAttributeAccessor attributes = me->attributes_for_write();
|
||||
bke::SpanAttributeWriter<bool> hide_poly = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".hide_poly", ATTR_DOMAIN_FACE);
|
||||
bke::SpanAttributeWriter<bool> selection_poly = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".selection_poly", ATTR_DOMAIN_FACE);
|
||||
bke::SpanAttributeWriter<bool> select_poly = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".select_poly", ATTR_DOMAIN_FACE);
|
||||
|
||||
for (int i = 0; i < me->totpoly; i++) {
|
||||
if (!hide_poly.span[i]) {
|
||||
if (!selection_poly.span[i] == unselected) {
|
||||
if (!select_poly.span[i] == unselected) {
|
||||
hide_poly.span[i] = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (hide_poly.span[i]) {
|
||||
selection_poly.span[i] = false;
|
||||
select_poly.span[i] = false;
|
||||
}
|
||||
}
|
||||
|
||||
hide_poly.finish();
|
||||
selection_poly.finish();
|
||||
select_poly.finish();
|
||||
|
||||
BKE_mesh_flush_hidden_from_polys(me);
|
||||
|
||||
|
@ -193,14 +193,14 @@ void paintface_reveal(bContext *C, Object *ob, const bool select)
|
|||
if (select) {
|
||||
const VArray<bool> hide_poly = attributes.lookup_or_default<bool>(
|
||||
".hide_poly", ATTR_DOMAIN_FACE, false);
|
||||
bke::SpanAttributeWriter<bool> selection_poly = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".selection_poly", ATTR_DOMAIN_FACE);
|
||||
bke::SpanAttributeWriter<bool> select_poly = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".select_poly", ATTR_DOMAIN_FACE);
|
||||
for (const int i : hide_poly.index_range()) {
|
||||
if (hide_poly[i]) {
|
||||
selection_poly.span[i] = true;
|
||||
select_poly.span[i] = true;
|
||||
}
|
||||
}
|
||||
selection_poly.finish();
|
||||
select_poly.finish();
|
||||
}
|
||||
|
||||
attributes.remove(".hide_poly");
|
||||
|
@ -227,8 +227,8 @@ static void select_linked_tfaces_with_seams(Mesh *me, const uint index, const bo
|
|||
bke::MutableAttributeAccessor attributes = me->attributes_for_write();
|
||||
const VArray<bool> hide_poly = attributes.lookup_or_default<bool>(
|
||||
".hide_poly", ATTR_DOMAIN_FACE, false);
|
||||
bke::SpanAttributeWriter<bool> selection_poly = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".selection_poly", ATTR_DOMAIN_FACE);
|
||||
bke::SpanAttributeWriter<bool> select_poly = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".select_poly", ATTR_DOMAIN_FACE);
|
||||
|
||||
if (index != (uint)-1) {
|
||||
/* only put face under cursor in array */
|
||||
|
@ -242,7 +242,7 @@ static void select_linked_tfaces_with_seams(Mesh *me, const uint index, const bo
|
|||
if (hide_poly[i]) {
|
||||
/* pass */
|
||||
}
|
||||
else if (selection_poly.span[i]) {
|
||||
else if (select_poly.span[i]) {
|
||||
const MPoly &poly = polys[i];
|
||||
BKE_mesh_poly_edgebitmap_insert(edge_tag, &poly, &loops[poly.loopstart]);
|
||||
BLI_BITMAP_ENABLE(poly_tag, i);
|
||||
|
@ -286,7 +286,7 @@ static void select_linked_tfaces_with_seams(Mesh *me, const uint index, const bo
|
|||
|
||||
for (int i = 0; i < me->totpoly; i++) {
|
||||
if (BLI_BITMAP_TEST(poly_tag, i)) {
|
||||
selection_poly.span[i] = select;
|
||||
select_poly.span[i] = select;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -324,14 +324,14 @@ bool paintface_deselect_all_visible(bContext *C, Object *ob, int action, bool fl
|
|||
bke::MutableAttributeAccessor attributes = me->attributes_for_write();
|
||||
const VArray<bool> hide_poly = attributes.lookup_or_default<bool>(
|
||||
".hide_poly", ATTR_DOMAIN_FACE, false);
|
||||
bke::SpanAttributeWriter<bool> selection_poly = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".selection_poly", ATTR_DOMAIN_FACE);
|
||||
bke::SpanAttributeWriter<bool> select_poly = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".select_poly", ATTR_DOMAIN_FACE);
|
||||
|
||||
if (action == SEL_TOGGLE) {
|
||||
action = SEL_SELECT;
|
||||
|
||||
for (int i = 0; i < me->totpoly; i++) {
|
||||
if (!hide_poly[i] && selection_poly.span[i]) {
|
||||
if (!hide_poly[i] && select_poly.span[i]) {
|
||||
action = SEL_DESELECT;
|
||||
break;
|
||||
}
|
||||
|
@ -344,25 +344,25 @@ bool paintface_deselect_all_visible(bContext *C, Object *ob, int action, bool fl
|
|||
if (hide_poly[i]) {
|
||||
continue;
|
||||
}
|
||||
const bool old_selection = selection_poly.span[i];
|
||||
const bool old_selection = select_poly.span[i];
|
||||
switch (action) {
|
||||
case SEL_SELECT:
|
||||
selection_poly.span[i] = true;
|
||||
select_poly.span[i] = true;
|
||||
break;
|
||||
case SEL_DESELECT:
|
||||
selection_poly.span[i] = false;
|
||||
select_poly.span[i] = false;
|
||||
break;
|
||||
case SEL_INVERT:
|
||||
selection_poly.span[i] = !selection_poly.span[i];
|
||||
select_poly.span[i] = !select_poly.span[i];
|
||||
changed = true;
|
||||
break;
|
||||
}
|
||||
if (old_selection != selection_poly.span[i]) {
|
||||
if (old_selection != select_poly.span[i]) {
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
selection_poly.finish();
|
||||
select_poly.finish();
|
||||
|
||||
if (changed) {
|
||||
if (flush_flags) {
|
||||
|
@ -391,11 +391,11 @@ bool paintface_minmax(Object *ob, float r_min[3], float r_max[3])
|
|||
bke::AttributeAccessor attributes = me->attributes();
|
||||
const VArray<bool> hide_poly = attributes.lookup_or_default<bool>(
|
||||
".hide_poly", ATTR_DOMAIN_FACE, false);
|
||||
const VArray<bool> selection_poly = attributes.lookup_or_default<bool>(
|
||||
".selection_poly", ATTR_DOMAIN_FACE, false);
|
||||
const VArray<bool> select_poly = attributes.lookup_or_default<bool>(
|
||||
".select_poly", ATTR_DOMAIN_FACE, false);
|
||||
|
||||
for (int i = 0; i < me->totpoly; i++) {
|
||||
if (hide_poly[i] || !selection_poly[i]) {
|
||||
if (hide_poly[i] || !select_poly[i]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -429,8 +429,8 @@ bool paintface_mouse_select(bContext *C,
|
|||
bke::MutableAttributeAccessor attributes = me->attributes_for_write();
|
||||
const VArray<bool> hide_poly = attributes.lookup_or_default<bool>(
|
||||
".hide_poly", ATTR_DOMAIN_FACE, false);
|
||||
bke::AttributeWriter<bool> selection_poly = attributes.lookup_or_add_for_write<bool>(
|
||||
".selection_poly", ATTR_DOMAIN_FACE);
|
||||
bke::AttributeWriter<bool> select_poly = attributes.lookup_or_add_for_write<bool>(
|
||||
".select_poly", ATTR_DOMAIN_FACE);
|
||||
|
||||
if (ED_mesh_pick_face(C, ob, mval, ED_MESH_PICK_DEFAULT_FACE_DIST, &index)) {
|
||||
if (index < me->totpoly) {
|
||||
|
@ -441,7 +441,7 @@ bool paintface_mouse_select(bContext *C,
|
|||
}
|
||||
|
||||
if (params->sel_op == SEL_OP_SET) {
|
||||
if ((found && params->select_passthrough) && selection_poly.varray[index]) {
|
||||
if ((found && params->select_passthrough) && select_poly.varray[index]) {
|
||||
found = false;
|
||||
}
|
||||
else if (found || params->deselect_all) {
|
||||
|
@ -456,13 +456,13 @@ bool paintface_mouse_select(bContext *C,
|
|||
switch (params->sel_op) {
|
||||
case SEL_OP_SET:
|
||||
case SEL_OP_ADD:
|
||||
selection_poly.varray.set(index, true);
|
||||
select_poly.varray.set(index, true);
|
||||
break;
|
||||
case SEL_OP_SUB:
|
||||
selection_poly.varray.set(index, false);
|
||||
select_poly.varray.set(index, false);
|
||||
break;
|
||||
case SEL_OP_XOR:
|
||||
selection_poly.varray.set(index, !selection_poly.varray[index]);
|
||||
select_poly.varray.set(index, !select_poly.varray[index]);
|
||||
break;
|
||||
case SEL_OP_AND:
|
||||
BLI_assert_unreachable(); /* Doesn't make sense for picking. */
|
||||
|
@ -517,22 +517,21 @@ void paintvert_flush_flags(Object *ob)
|
|||
}
|
||||
hide_vert_eval.finish();
|
||||
|
||||
const VArray<bool> selection_vert_orig = attributes_orig.lookup_or_default<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT, false);
|
||||
bke::SpanAttributeWriter<bool> selection_vert_eval =
|
||||
attributes_eval.lookup_or_add_for_write_only_span<bool>(".selection_vert",
|
||||
ATTR_DOMAIN_POINT);
|
||||
const VArray<bool> select_vert_orig = attributes_orig.lookup_or_default<bool>(
|
||||
".select_vert", ATTR_DOMAIN_POINT, false);
|
||||
bke::SpanAttributeWriter<bool> select_vert_eval =
|
||||
attributes_eval.lookup_or_add_for_write_only_span<bool>(".select_vert", ATTR_DOMAIN_POINT);
|
||||
if (orig_indices) {
|
||||
for (const int i : selection_vert_eval.span.index_range()) {
|
||||
for (const int i : select_vert_eval.span.index_range()) {
|
||||
if (orig_indices[i] != ORIGINDEX_NONE) {
|
||||
selection_vert_eval.span[i] = selection_vert_orig[orig_indices[i]];
|
||||
select_vert_eval.span[i] = select_vert_orig[orig_indices[i]];
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
selection_vert_orig.materialize(selection_vert_eval.span);
|
||||
select_vert_orig.materialize(select_vert_eval.span);
|
||||
}
|
||||
selection_vert_eval.finish();
|
||||
select_vert_eval.finish();
|
||||
|
||||
BKE_mesh_batch_cache_dirty_tag(me, BKE_MESH_BATCH_DIRTY_ALL);
|
||||
}
|
||||
|
@ -554,14 +553,14 @@ bool paintvert_deselect_all_visible(Object *ob, int action, bool flush_flags)
|
|||
bke::MutableAttributeAccessor attributes = me->attributes_for_write();
|
||||
const VArray<bool> hide_vert = attributes.lookup_or_default<bool>(
|
||||
".hide_vert", ATTR_DOMAIN_POINT, false);
|
||||
bke::SpanAttributeWriter<bool> selection_vert = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT);
|
||||
bke::SpanAttributeWriter<bool> select_vert = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".select_vert", ATTR_DOMAIN_POINT);
|
||||
|
||||
if (action == SEL_TOGGLE) {
|
||||
action = SEL_SELECT;
|
||||
|
||||
for (int i = 0; i < me->totvert; i++) {
|
||||
if (!hide_vert[i] && selection_vert.span[i]) {
|
||||
if (!hide_vert[i] && select_vert.span[i]) {
|
||||
action = SEL_DESELECT;
|
||||
break;
|
||||
}
|
||||
|
@ -573,24 +572,24 @@ bool paintvert_deselect_all_visible(Object *ob, int action, bool flush_flags)
|
|||
if (hide_vert[i]) {
|
||||
continue;
|
||||
}
|
||||
const bool old_selection = selection_vert.span[i];
|
||||
const bool old_selection = select_vert.span[i];
|
||||
switch (action) {
|
||||
case SEL_SELECT:
|
||||
selection_vert.span[i] = true;
|
||||
select_vert.span[i] = true;
|
||||
break;
|
||||
case SEL_DESELECT:
|
||||
selection_vert.span[i] = false;
|
||||
select_vert.span[i] = false;
|
||||
break;
|
||||
case SEL_INVERT:
|
||||
selection_vert.span[i] = !selection_vert.span[i];
|
||||
select_vert.span[i] = !select_vert.span[i];
|
||||
break;
|
||||
}
|
||||
if (old_selection != selection_vert.span[i]) {
|
||||
if (old_selection != select_vert.span[i]) {
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
selection_vert.finish();
|
||||
select_vert.finish();
|
||||
|
||||
if (changed) {
|
||||
/* handle mselect */
|
||||
|
@ -630,19 +629,19 @@ void paintvert_select_ungrouped(Object *ob, bool extend, bool flush_flags)
|
|||
bke::MutableAttributeAccessor attributes = me->attributes_for_write();
|
||||
const VArray<bool> hide_vert = attributes.lookup_or_default<bool>(
|
||||
".hide_vert", ATTR_DOMAIN_POINT, false);
|
||||
bke::SpanAttributeWriter<bool> selection_vert = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT);
|
||||
bke::SpanAttributeWriter<bool> select_vert = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".select_vert", ATTR_DOMAIN_POINT);
|
||||
|
||||
for (const int i : selection_vert.span.index_range()) {
|
||||
for (const int i : select_vert.span.index_range()) {
|
||||
if (!hide_vert[i]) {
|
||||
if (dverts[i].dw == nullptr) {
|
||||
/* if null weight then not grouped */
|
||||
selection_vert.span[i] = true;
|
||||
select_vert.span[i] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
selection_vert.finish();
|
||||
select_vert.finish();
|
||||
|
||||
if (flush_flags) {
|
||||
paintvert_flush_flags(ob);
|
||||
|
@ -660,22 +659,22 @@ void paintvert_hide(bContext *C, Object *ob, const bool unselected)
|
|||
bke::MutableAttributeAccessor attributes = me->attributes_for_write();
|
||||
bke::SpanAttributeWriter<bool> hide_vert = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".hide_vert", ATTR_DOMAIN_POINT);
|
||||
bke::SpanAttributeWriter<bool> selection_vert = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT);
|
||||
bke::SpanAttributeWriter<bool> select_vert = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".select_vert", ATTR_DOMAIN_POINT);
|
||||
|
||||
for (const int i : hide_vert.span.index_range()) {
|
||||
if (!hide_vert.span[i]) {
|
||||
if (!selection_vert.span[i] == unselected) {
|
||||
if (!select_vert.span[i] == unselected) {
|
||||
hide_vert.span[i] = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (hide_vert.span[i]) {
|
||||
selection_vert.span[i] = false;
|
||||
select_vert.span[i] = false;
|
||||
}
|
||||
}
|
||||
hide_vert.finish();
|
||||
selection_vert.finish();
|
||||
select_vert.finish();
|
||||
|
||||
BKE_mesh_flush_hidden_from_verts(me);
|
||||
|
||||
|
@ -694,16 +693,16 @@ void paintvert_reveal(bContext *C, Object *ob, const bool select)
|
|||
bke::MutableAttributeAccessor attributes = me->attributes_for_write();
|
||||
const VArray<bool> hide_vert = attributes.lookup_or_default<bool>(
|
||||
".hide_vert", ATTR_DOMAIN_POINT, false);
|
||||
bke::SpanAttributeWriter<bool> selection_vert = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT);
|
||||
bke::SpanAttributeWriter<bool> select_vert = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".select_vert", ATTR_DOMAIN_POINT);
|
||||
|
||||
for (const int i : selection_vert.span.index_range()) {
|
||||
for (const int i : select_vert.span.index_range()) {
|
||||
if (hide_vert[i]) {
|
||||
selection_vert.span[i] = select;
|
||||
select_vert.span[i] = select;
|
||||
}
|
||||
}
|
||||
|
||||
selection_vert.finish();
|
||||
select_vert.finish();
|
||||
|
||||
/* Remove the hide attribute to reveal all vertices. */
|
||||
attributes.remove(".hide_vert");
|
||||
|
|
|
@ -1156,10 +1156,10 @@ static void mesh_add_verts(Mesh *mesh, int len)
|
|||
mesh->totvert = totvert;
|
||||
|
||||
bke::MutableAttributeAccessor attributes = mesh->attributes_for_write();
|
||||
bke::SpanAttributeWriter<bool> selection_vert = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT);
|
||||
selection_vert.span.take_back(len).fill(true);
|
||||
selection_vert.finish();
|
||||
bke::SpanAttributeWriter<bool> select_vert = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".select_vert", ATTR_DOMAIN_POINT);
|
||||
select_vert.span.take_back(len).fill(true);
|
||||
select_vert.finish();
|
||||
}
|
||||
|
||||
static void mesh_add_edges(Mesh *mesh, int len)
|
||||
|
@ -1195,10 +1195,10 @@ static void mesh_add_edges(Mesh *mesh, int len)
|
|||
}
|
||||
|
||||
bke::MutableAttributeAccessor attributes = mesh->attributes_for_write();
|
||||
bke::SpanAttributeWriter<bool> selection_edge = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".selection_edge", ATTR_DOMAIN_EDGE);
|
||||
selection_edge.span.take_back(len).fill(true);
|
||||
selection_edge.finish();
|
||||
bke::SpanAttributeWriter<bool> select_edge = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".select_edge", ATTR_DOMAIN_EDGE);
|
||||
select_edge.span.take_back(len).fill(true);
|
||||
select_edge.finish();
|
||||
}
|
||||
|
||||
static void mesh_add_loops(Mesh *mesh, int len)
|
||||
|
@ -1256,10 +1256,10 @@ static void mesh_add_polys(Mesh *mesh, int len)
|
|||
mesh->totpoly = totpoly;
|
||||
|
||||
bke::MutableAttributeAccessor attributes = mesh->attributes_for_write();
|
||||
bke::SpanAttributeWriter<bool> selection_poly = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".selection_poly", ATTR_DOMAIN_FACE);
|
||||
selection_poly.span.take_back(len).fill(true);
|
||||
selection_poly.finish();
|
||||
bke::SpanAttributeWriter<bool> select_poly = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".select_poly", ATTR_DOMAIN_FACE);
|
||||
select_poly.span.take_back(len).fill(true);
|
||||
select_poly.finish();
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
|
|
@ -601,8 +601,8 @@ bool ED_object_modifier_convert_psys_to_mesh(ReportList *UNUSED(reports),
|
|||
MEdge *medge = edges.data();
|
||||
|
||||
bke::MutableAttributeAccessor attributes = me->attributes_for_write();
|
||||
bke::SpanAttributeWriter<bool> selection_vert = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT);
|
||||
bke::SpanAttributeWriter<bool> select_vert = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".select_vert", ATTR_DOMAIN_POINT);
|
||||
|
||||
/* copy coordinates */
|
||||
int vert_index = 0;
|
||||
|
@ -620,7 +620,7 @@ bool ED_object_modifier_convert_psys_to_mesh(ReportList *UNUSED(reports),
|
|||
}
|
||||
else {
|
||||
/* cheap trick to select the roots */
|
||||
selection_vert.span[vert_index] = true;
|
||||
select_vert.span[vert_index] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -639,12 +639,12 @@ bool ED_object_modifier_convert_psys_to_mesh(ReportList *UNUSED(reports),
|
|||
}
|
||||
else {
|
||||
/* cheap trick to select the roots */
|
||||
selection_vert.span[vert_index] = true;
|
||||
select_vert.span[vert_index] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
selection_vert.finish();
|
||||
select_vert.finish();
|
||||
|
||||
DEG_relations_tag_update(bmain);
|
||||
|
||||
|
|
|
@ -210,11 +210,11 @@ bool ED_vgroup_parray_alloc(ID *id,
|
|||
|
||||
if (use_vert_sel) {
|
||||
const bke::AttributeAccessor attributes = me->attributes();
|
||||
const VArray<bool> selection_vert = attributes.lookup_or_default<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT, false);
|
||||
const VArray<bool> select_vert = attributes.lookup_or_default<bool>(
|
||||
".select_vert", ATTR_DOMAIN_POINT, false);
|
||||
|
||||
for (int i = 0; i < me->totvert; i++) {
|
||||
(*dvert_arr)[i] = selection_vert[i] ? &dverts[i] : nullptr;
|
||||
(*dvert_arr)[i] = select_vert[i] ? &dverts[i] : nullptr;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -670,8 +670,8 @@ static void vgroup_copy_active_to_sel(Object *ob, eVGroupSelect subset_type)
|
|||
}
|
||||
else {
|
||||
const bke::AttributeAccessor attributes = me->attributes();
|
||||
const VArray<bool> selection_vert = attributes.lookup_or_default<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT, false);
|
||||
const VArray<bool> select_vert = attributes.lookup_or_default<bool>(
|
||||
".select_vert", ATTR_DOMAIN_POINT, false);
|
||||
|
||||
int v_act;
|
||||
|
||||
|
@ -679,7 +679,7 @@ static void vgroup_copy_active_to_sel(Object *ob, eVGroupSelect subset_type)
|
|||
if (dvert_act) {
|
||||
MutableSpan<MDeformVert> dverts = me->deform_verts_for_write();
|
||||
for (i = 0; i < me->totvert; i++) {
|
||||
if (selection_vert[i] && &dverts[i] != dvert_act) {
|
||||
if (select_vert[i] && &dverts[i] != dvert_act) {
|
||||
BKE_defvert_copy_subset(&dverts[i], dvert_act, vgroup_validmap, vgroup_tot);
|
||||
if (me->symmetry & ME_SYMMETRY_X) {
|
||||
ED_mesh_defvert_mirror_update_ob(ob, -1, i);
|
||||
|
@ -1064,19 +1064,18 @@ static void vgroup_select_verts(Object *ob, int select)
|
|||
bke::MutableAttributeAccessor attributes = me->attributes_for_write();
|
||||
const VArray<bool> hide_vert = attributes.lookup_or_default<bool>(
|
||||
".hide_vert", ATTR_DOMAIN_POINT, false);
|
||||
bke::SpanAttributeWriter<bool> selection_vert =
|
||||
attributes.lookup_or_add_for_write_only_span<bool>(".selection_vert",
|
||||
ATTR_DOMAIN_POINT);
|
||||
bke::SpanAttributeWriter<bool> select_vert =
|
||||
attributes.lookup_or_add_for_write_only_span<bool>(".select_vert", ATTR_DOMAIN_POINT);
|
||||
|
||||
for (const int i : selection_vert.span.index_range()) {
|
||||
for (const int i : select_vert.span.index_range()) {
|
||||
if (!hide_vert[i]) {
|
||||
if (BKE_defvert_find_index(&dverts[i], def_nr)) {
|
||||
selection_vert.span[i] = select;
|
||||
select_vert.span[i] = select;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
selection_vert.finish();
|
||||
select_vert.finish();
|
||||
paintvert_flush_flags(ob);
|
||||
}
|
||||
}
|
||||
|
@ -1537,10 +1536,10 @@ static void vgroup_fix(
|
|||
return;
|
||||
}
|
||||
const bke::AttributeAccessor attributes = me->attributes();
|
||||
const VArray<bool> selection_vert = attributes.lookup_or_default<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT, false);
|
||||
const VArray<bool> select_vert = attributes.lookup_or_default<bool>(
|
||||
".select_vert", ATTR_DOMAIN_POINT, false);
|
||||
for (i = 0; i < me->totvert && mvert; i++, mvert++) {
|
||||
if (selection_vert[i]) {
|
||||
if (select_vert[i]) {
|
||||
blender::Vector<int> verts = getSurroundingVerts(me, i);
|
||||
const int count = verts.size();
|
||||
if (!verts.is_empty()) {
|
||||
|
@ -1924,8 +1923,8 @@ static void vgroup_smooth_subset(Object *ob,
|
|||
Mesh *me = em ? nullptr : static_cast<Mesh *>(ob->data);
|
||||
|
||||
const bke::AttributeAccessor attributes = me->attributes();
|
||||
const VArray<bool> selection_vert = attributes.lookup_or_default<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT, false);
|
||||
const VArray<bool> select_vert = attributes.lookup_or_default<bool>(
|
||||
".select_vert", ATTR_DOMAIN_POINT, false);
|
||||
|
||||
MeshElemMap *emap;
|
||||
int *emap_mem;
|
||||
|
@ -1970,7 +1969,7 @@ static void vgroup_smooth_subset(Object *ob,
|
|||
nullptr;
|
||||
|
||||
#define IS_ME_VERT_READ(v) (use_hide ? !(hide_vert && hide_vert[v]) : true)
|
||||
#define IS_ME_VERT_WRITE(v) (use_select ? selection_vert[v] : true)
|
||||
#define IS_ME_VERT_WRITE(v) (use_select ? select_vert[v] : true)
|
||||
|
||||
/* initialize used verts */
|
||||
if (bm) {
|
||||
|
@ -2486,8 +2485,8 @@ void ED_vgroup_mirror(Object *ob,
|
|||
BLI_bitmap *vert_tag = BLI_BITMAP_NEW(me->totvert, __func__);
|
||||
MutableSpan<MDeformVert> dverts = me->deform_verts_for_write();
|
||||
const bke::AttributeAccessor attributes = me->attributes();
|
||||
const VArray<bool> selection_vert = attributes.lookup_or_default<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT, false);
|
||||
const VArray<bool> select_vert = attributes.lookup_or_default<bool>(
|
||||
".select_vert", ATTR_DOMAIN_POINT, false);
|
||||
|
||||
for (vidx = 0; vidx < me->totvert; vidx++) {
|
||||
if (!BLI_BITMAP_TEST(vert_tag, vidx)) {
|
||||
|
@ -2496,8 +2495,8 @@ void ED_vgroup_mirror(Object *ob,
|
|||
if (!BLI_BITMAP_TEST(vert_tag, vidx_mirr)) {
|
||||
|
||||
if (use_vert_sel) {
|
||||
sel = selection_vert[vidx];
|
||||
sel_mirr = selection_vert[vidx_mirr];
|
||||
sel = select_vert[vidx];
|
||||
sel_mirr = select_vert[vidx_mirr];
|
||||
}
|
||||
|
||||
if (sel || sel_mirr) {
|
||||
|
@ -2641,13 +2640,13 @@ static void vgroup_assign_verts(Object *ob, const float weight)
|
|||
}
|
||||
else {
|
||||
const bke::AttributeAccessor attributes = me->attributes();
|
||||
const VArray<bool> selection_vert = attributes.lookup_or_default<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT, false);
|
||||
const VArray<bool> select_vert = attributes.lookup_or_default<bool>(
|
||||
".select_vert", ATTR_DOMAIN_POINT, false);
|
||||
|
||||
MutableSpan<MDeformVert> dverts = me->deform_verts_for_write();
|
||||
|
||||
for (int i = 0; i < me->totvert; i++) {
|
||||
if (selection_vert[i]) {
|
||||
if (select_vert[i]) {
|
||||
MDeformWeight *dw;
|
||||
dw = BKE_defvert_ensure_index(&dverts[i], def_nr);
|
||||
if (dw) {
|
||||
|
@ -4374,11 +4373,11 @@ static void vgroup_copy_active_to_sel_single(Object *ob, const int def_nr)
|
|||
|
||||
MutableSpan<MDeformVert> dverts = me->deform_verts_for_write();
|
||||
const bke::AttributeAccessor attributes = me->attributes();
|
||||
const VArray<bool> selection_vert = attributes.lookup_or_default<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT, false);
|
||||
const VArray<bool> select_vert = attributes.lookup_or_default<bool>(
|
||||
".select_vert", ATTR_DOMAIN_POINT, false);
|
||||
|
||||
for (i = 0; i < me->totvert; i++) {
|
||||
if (selection_vert[i] && (&dverts[i] != dvert_act)) {
|
||||
if (select_vert[i] && (&dverts[i] != dvert_act)) {
|
||||
BKE_defvert_copy_index(&dverts[i], def_nr, dvert_act, def_nr);
|
||||
|
||||
if (me->symmetry & ME_SYMMETRY_X) {
|
||||
|
|
|
@ -415,7 +415,7 @@ typedef struct ProjPaintState {
|
|||
const float (*vert_normals)[3];
|
||||
const MEdge *medge_eval;
|
||||
const MPoly *mpoly_eval;
|
||||
const bool *selection_poly_eval;
|
||||
const bool *select_poly_eval;
|
||||
const int *material_indices;
|
||||
const MLoop *mloop_eval;
|
||||
const MLoopTri *mlooptri_eval;
|
||||
|
@ -4063,8 +4063,8 @@ static bool proj_paint_state_mesh_eval_init(const bContext *C, ProjPaintState *p
|
|||
}
|
||||
ps->mloop_eval = BKE_mesh_loops(ps->me_eval);
|
||||
ps->mpoly_eval = BKE_mesh_polys(ps->me_eval);
|
||||
ps->selection_poly_eval = (const bool *)CustomData_get_layer_named(
|
||||
&ps->me_eval->pdata, CD_PROP_BOOL, ".selection_poly");
|
||||
ps->select_poly_eval = (const bool *)CustomData_get_layer_named(
|
||||
&ps->me_eval->pdata, CD_PROP_BOOL, ".select_poly");
|
||||
ps->material_indices = (const int *)CustomData_get_layer_named(
|
||||
&ps->me_eval->pdata, CD_PROP_INT32, "material_index");
|
||||
|
||||
|
@ -4148,7 +4148,7 @@ static bool project_paint_clone_face_skip(ProjPaintState *ps,
|
|||
}
|
||||
|
||||
typedef struct {
|
||||
const bool *selection_poly_orig;
|
||||
const bool *select_poly_orig;
|
||||
|
||||
const int *index_mp_to_orig;
|
||||
} ProjPaintFaceLookup;
|
||||
|
@ -4159,8 +4159,8 @@ static void proj_paint_face_lookup_init(const ProjPaintState *ps, ProjPaintFaceL
|
|||
if (ps->do_face_sel) {
|
||||
Mesh *orig_mesh = (Mesh *)ps->ob->data;
|
||||
face_lookup->index_mp_to_orig = CustomData_get_layer(&ps->me_eval->pdata, CD_ORIGINDEX);
|
||||
face_lookup->selection_poly_orig = CustomData_get_layer_named(
|
||||
&orig_mesh->pdata, CD_PROP_BOOL, ".selection_poly");
|
||||
face_lookup->select_poly_orig = CustomData_get_layer_named(
|
||||
&orig_mesh->pdata, CD_PROP_BOOL, ".select_poly");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4174,9 +4174,9 @@ static bool project_paint_check_face_sel(const ProjPaintState *ps,
|
|||
|
||||
if ((face_lookup->index_mp_to_orig != NULL) &&
|
||||
(((orig_index = (face_lookup->index_mp_to_orig[lt->poly]))) != ORIGINDEX_NONE)) {
|
||||
return face_lookup->selection_poly_orig && face_lookup->selection_poly_orig[orig_index];
|
||||
return face_lookup->select_poly_orig && face_lookup->select_poly_orig[orig_index];
|
||||
}
|
||||
return ps->selection_poly_eval && ps->selection_poly_eval[lt->poly];
|
||||
return ps->select_poly_eval && ps->select_poly_eval[lt->poly];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1960,8 +1960,8 @@ static void do_wpaint_brush_blur_task_cb_ex(void *__restrict userdata,
|
|||
ss, data->brush->falloff_shape);
|
||||
|
||||
const blender::bke::AttributeAccessor attributes = data->me->attributes();
|
||||
const blender::VArray<bool> selection_vert = attributes.lookup_or_default<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT, false);
|
||||
const blender::VArray<bool> select_vert = attributes.lookup_or_default<bool>(
|
||||
".select_vert", ATTR_DOMAIN_POINT, false);
|
||||
|
||||
/* For each vertex */
|
||||
PBVHVertexIter vd;
|
||||
|
@ -1973,7 +1973,7 @@ static void do_wpaint_brush_blur_task_cb_ex(void *__restrict userdata,
|
|||
const int v_index = has_grids ? ss->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i];
|
||||
const float grid_alpha = has_grids ? 1.0f / vd.gridsize : 1.0f;
|
||||
/* If the vertex is selected */
|
||||
if (!(use_face_sel || use_vert_sel) || selection_vert[v_index]) {
|
||||
if (!(use_face_sel || use_vert_sel) || select_vert[v_index]) {
|
||||
/* Get the average poly weight */
|
||||
int total_hit_loops = 0;
|
||||
float weight_final = 0.0f;
|
||||
|
@ -2050,8 +2050,8 @@ static void do_wpaint_brush_smear_task_cb_ex(void *__restrict userdata,
|
|||
project_plane_v3_v3v3(brush_dir, brush_dir, cache->view_normal);
|
||||
|
||||
const blender::bke::AttributeAccessor attributes = data->me->attributes();
|
||||
const blender::VArray<bool> selection_vert = attributes.lookup_or_default<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT, false);
|
||||
const blender::VArray<bool> select_vert = attributes.lookup_or_default<bool>(
|
||||
".select_vert", ATTR_DOMAIN_POINT, false);
|
||||
|
||||
if (cache->is_last_valid && (normalize_v3(brush_dir) != 0.0f)) {
|
||||
|
||||
|
@ -2073,7 +2073,7 @@ static void do_wpaint_brush_smear_task_cb_ex(void *__restrict userdata,
|
|||
const MVert *mv_curr = &ss->mvert[v_index];
|
||||
|
||||
/* If the vertex is selected */
|
||||
if (!(use_face_sel || use_vert_sel) || selection_vert[v_index]) {
|
||||
if (!(use_face_sel || use_vert_sel) || select_vert[v_index]) {
|
||||
float brush_strength = cache->bstrength;
|
||||
const float angle_cos = (use_normal && vd.no) ?
|
||||
dot_v3v3(sculpt_normal_frontface, vd.no) :
|
||||
|
@ -2167,8 +2167,8 @@ static void do_wpaint_brush_draw_task_cb_ex(void *__restrict userdata,
|
|||
ss, data->brush->falloff_shape);
|
||||
|
||||
const blender::bke::AttributeAccessor attributes = data->me->attributes();
|
||||
const blender::VArray<bool> selection_vert = attributes.lookup_or_default<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT, false);
|
||||
const blender::VArray<bool> select_vert = attributes.lookup_or_default<bool>(
|
||||
".select_vert", ATTR_DOMAIN_POINT, false);
|
||||
|
||||
/* For each vertex */
|
||||
PBVHVertexIter vd;
|
||||
|
@ -2182,7 +2182,7 @@ static void do_wpaint_brush_draw_task_cb_ex(void *__restrict userdata,
|
|||
const float grid_alpha = has_grids ? 1.0f / vd.gridsize : 1.0f;
|
||||
|
||||
/* If the vertex is selected */
|
||||
if (!(use_face_sel || use_vert_sel) || selection_vert[v_index]) {
|
||||
if (!(use_face_sel || use_vert_sel) || select_vert[v_index]) {
|
||||
float brush_strength = cache->bstrength;
|
||||
const float angle_cos = (use_normal && vd.no) ? dot_v3v3(sculpt_normal_frontface, vd.no) :
|
||||
1.0f;
|
||||
|
@ -2236,8 +2236,8 @@ static void do_wpaint_brush_calc_average_weight_cb_ex(
|
|||
ss, data->brush->falloff_shape);
|
||||
|
||||
const blender::bke::AttributeAccessor attributes = data->me->attributes();
|
||||
const blender::VArray<bool> selection_vert = attributes.lookup_or_default<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT, false);
|
||||
const blender::VArray<bool> select_vert = attributes.lookup_or_default<bool>(
|
||||
".select_vert", ATTR_DOMAIN_POINT, false);
|
||||
|
||||
/* For each vertex */
|
||||
PBVHVertexIter vd;
|
||||
|
@ -2251,7 +2251,7 @@ static void do_wpaint_brush_calc_average_weight_cb_ex(
|
|||
const int v_index = has_grids ? ss->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i];
|
||||
|
||||
/* If the vertex is selected. */
|
||||
if (!(use_face_sel || use_vert_sel) || selection_vert[v_index]) {
|
||||
if (!(use_face_sel || use_vert_sel) || select_vert[v_index]) {
|
||||
const MDeformVert *dv = &data->wpi->dvert[v_index];
|
||||
accum->len += 1;
|
||||
accum->value += wpaint_get_active_weight(dv, data->wpi);
|
||||
|
@ -2970,10 +2970,10 @@ static void do_vpaint_brush_blur_loops(bContext *C,
|
|||
|
||||
Color *previous_color = static_cast<Color *>(ss->cache->prev_colors_vpaint);
|
||||
|
||||
const blender::VArray<bool> selection_vert = me->attributes().lookup_or_default<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT, false);
|
||||
const blender::VArray<bool> selection_poly = me->attributes().lookup_or_default<bool>(
|
||||
".selection_poly", ATTR_DOMAIN_FACE, false);
|
||||
const blender::VArray<bool> select_vert = me->attributes().lookup_or_default<bool>(
|
||||
".select_vert", ATTR_DOMAIN_POINT, false);
|
||||
const blender::VArray<bool> select_poly = me->attributes().lookup_or_default<bool>(
|
||||
".select_poly", ATTR_DOMAIN_FACE, false);
|
||||
|
||||
blender::threading::parallel_for(IndexRange(totnode), 1LL, [&](IndexRange range) {
|
||||
for (int n : range) {
|
||||
|
@ -3008,7 +3008,7 @@ static void do_vpaint_brush_blur_loops(bContext *C,
|
|||
const float grid_alpha = has_grids ? 1.0f / vd.gridsize : 1.0f;
|
||||
|
||||
/* If the vertex is selected for painting. */
|
||||
if (!use_vert_sel || selection_vert[v_index]) {
|
||||
if (!use_vert_sel || select_vert[v_index]) {
|
||||
float brush_strength = cache->bstrength;
|
||||
const float angle_cos = (use_normal && vd.no) ?
|
||||
dot_v3v3(sculpt_normal_frontface, vd.no) :
|
||||
|
@ -3029,7 +3029,7 @@ static void do_vpaint_brush_blur_loops(bContext *C,
|
|||
for (int j = 0; j < gmap->vert_to_poly[v_index].count; j++) {
|
||||
int p_index = gmap->vert_to_poly[v_index].indices[j];
|
||||
const MPoly *mp = &ss->mpoly[p_index];
|
||||
if (!use_face_sel || selection_poly[p_index]) {
|
||||
if (!use_face_sel || select_poly[p_index]) {
|
||||
total_hit_loops += mp->totloop;
|
||||
for (int k = 0; k < mp->totloop; k++) {
|
||||
const uint l_index = mp->loopstart + k;
|
||||
|
@ -3063,7 +3063,7 @@ static void do_vpaint_brush_blur_loops(bContext *C,
|
|||
const int p_index = gmap->vert_to_poly[v_index].indices[j];
|
||||
const int l_index = gmap->vert_to_loop[v_index].indices[j];
|
||||
BLI_assert(ss->mloop[l_index].v == v_index);
|
||||
if (!use_face_sel || selection_poly[p_index]) {
|
||||
if (!use_face_sel || select_poly[p_index]) {
|
||||
Color color_orig(0, 0, 0, 0); /* unused when array is nullptr */
|
||||
|
||||
if (previous_color != nullptr) {
|
||||
|
@ -3115,10 +3115,10 @@ static void do_vpaint_brush_blur_verts(bContext *C,
|
|||
|
||||
Color *previous_color = static_cast<Color *>(ss->cache->prev_colors_vpaint);
|
||||
|
||||
const blender::VArray<bool> selection_vert = me->attributes().lookup_or_default<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT, false);
|
||||
const blender::VArray<bool> selection_poly = me->attributes().lookup_or_default<bool>(
|
||||
".selection_poly", ATTR_DOMAIN_FACE, false);
|
||||
const blender::VArray<bool> select_vert = me->attributes().lookup_or_default<bool>(
|
||||
".select_vert", ATTR_DOMAIN_POINT, false);
|
||||
const blender::VArray<bool> select_poly = me->attributes().lookup_or_default<bool>(
|
||||
".select_poly", ATTR_DOMAIN_FACE, false);
|
||||
|
||||
blender::threading::parallel_for(IndexRange(totnode), 1LL, [&](IndexRange range) {
|
||||
for (int n : range) {
|
||||
|
@ -3153,7 +3153,7 @@ static void do_vpaint_brush_blur_verts(bContext *C,
|
|||
const float grid_alpha = has_grids ? 1.0f / vd.gridsize : 1.0f;
|
||||
|
||||
/* If the vertex is selected for painting. */
|
||||
if (!use_vert_sel || selection_vert[v_index]) {
|
||||
if (!use_vert_sel || select_vert[v_index]) {
|
||||
float brush_strength = cache->bstrength;
|
||||
const float angle_cos = (use_normal && vd.no) ?
|
||||
dot_v3v3(sculpt_normal_frontface, vd.no) :
|
||||
|
@ -3174,7 +3174,7 @@ static void do_vpaint_brush_blur_verts(bContext *C,
|
|||
for (int j = 0; j < gmap->vert_to_poly[v_index].count; j++) {
|
||||
int p_index = gmap->vert_to_poly[v_index].indices[j];
|
||||
const MPoly *mp = &ss->mpoly[p_index];
|
||||
if (!use_face_sel || selection_poly[p_index]) {
|
||||
if (!use_face_sel || select_poly[p_index]) {
|
||||
total_hit_loops += mp->totloop;
|
||||
for (int k = 0; k < mp->totloop; k++) {
|
||||
const uint l_index = mp->loopstart + k;
|
||||
|
@ -3211,7 +3211,7 @@ static void do_vpaint_brush_blur_verts(bContext *C,
|
|||
|
||||
BLI_assert(ss->mloop[gmap->vert_to_loop[v_index].indices[j]].v == v_index);
|
||||
|
||||
if (!use_face_sel || selection_poly[p_index]) {
|
||||
if (!use_face_sel || select_poly[p_index]) {
|
||||
Color color_orig(0, 0, 0, 0); /* unused when array is nullptr */
|
||||
|
||||
if (previous_color != nullptr) {
|
||||
|
@ -3267,10 +3267,10 @@ static void do_vpaint_brush_smear(bContext *C,
|
|||
Color *color_prev_smear = static_cast<Color *>(vpd->smear.color_prev);
|
||||
Color *color_prev = reinterpret_cast<Color *>(ss->cache->prev_colors_vpaint);
|
||||
|
||||
const blender::VArray<bool> selection_vert = me->attributes().lookup_or_default<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT, false);
|
||||
const blender::VArray<bool> selection_poly = me->attributes().lookup_or_default<bool>(
|
||||
".selection_poly", ATTR_DOMAIN_FACE, false);
|
||||
const blender::VArray<bool> select_vert = me->attributes().lookup_or_default<bool>(
|
||||
".select_vert", ATTR_DOMAIN_POINT, false);
|
||||
const blender::VArray<bool> select_poly = me->attributes().lookup_or_default<bool>(
|
||||
".select_poly", ATTR_DOMAIN_FACE, false);
|
||||
|
||||
blender::threading::parallel_for(IndexRange(totnode), 1LL, [&](IndexRange range) {
|
||||
for (int n : range) {
|
||||
|
@ -3308,7 +3308,7 @@ static void do_vpaint_brush_smear(bContext *C,
|
|||
const MVert *mv_curr = &ss->mvert[v_index];
|
||||
|
||||
/* if the vertex is selected for painting. */
|
||||
if (!use_vert_sel || selection_vert[v_index]) {
|
||||
if (!use_vert_sel || select_vert[v_index]) {
|
||||
/* Calc the dot prod. between ray norm on surf and current vert
|
||||
* (ie splash prevention factor), and only paint front facing verts. */
|
||||
float brush_strength = cache->bstrength;
|
||||
|
@ -3337,7 +3337,7 @@ static void do_vpaint_brush_smear(bContext *C,
|
|||
BLI_assert(ss->mloop[l_index].v == v_index);
|
||||
UNUSED_VARS_NDEBUG(l_index);
|
||||
const MPoly *mp = &ss->mpoly[p_index];
|
||||
if (!use_face_sel || selection_poly[p_index]) {
|
||||
if (!use_face_sel || select_poly[p_index]) {
|
||||
const MLoop *ml_other = &ss->mloop[mp->loopstart];
|
||||
for (int k = 0; k < mp->totloop; k++, ml_other++) {
|
||||
const uint v_other_index = ml_other->v;
|
||||
|
@ -3391,7 +3391,7 @@ static void do_vpaint_brush_smear(bContext *C,
|
|||
BLI_assert(ss->mloop[l_index].v == v_index);
|
||||
}
|
||||
|
||||
if (!use_face_sel || selection_poly[p_index]) {
|
||||
if (!use_face_sel || select_poly[p_index]) {
|
||||
/* Get the previous element color */
|
||||
Color color_orig(0, 0, 0, 0); /* unused when array is nullptr */
|
||||
|
||||
|
@ -3437,8 +3437,8 @@ static void calculate_average_color(VPaintData<Color, Traits, domain> *vpd,
|
|||
{
|
||||
using Blend = typename Traits::BlendType;
|
||||
|
||||
const blender::VArray<bool> selection_vert = me->attributes().lookup_or_default<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT, false);
|
||||
const blender::VArray<bool> select_vert = me->attributes().lookup_or_default<bool>(
|
||||
".select_vert", ATTR_DOMAIN_POINT, false);
|
||||
|
||||
VPaintAverageAccum<Blend> *accum = (VPaintAverageAccum<Blend> *)MEM_mallocN(
|
||||
sizeof(*accum) * totnode, __func__);
|
||||
|
@ -3470,7 +3470,7 @@ static void calculate_average_color(VPaintData<Color, Traits, domain> *vpd,
|
|||
vd.vert_indices[vd.i];
|
||||
if (BKE_brush_curve_strength(brush, 0.0, cache->radius) > 0.0) {
|
||||
/* If the vertex is selected for painting. */
|
||||
if (!use_vert_sel || selection_vert[v_index]) {
|
||||
if (!use_vert_sel || select_vert[v_index]) {
|
||||
accum2->len += gmap->vert_to_loop[v_index].count;
|
||||
/* if a vertex is within the brush region, then add its color to the blend. */
|
||||
for (int j = 0; j < gmap->vert_to_loop[v_index].count; j++) {
|
||||
|
@ -3555,10 +3555,10 @@ static void vpaint_do_draw(bContext *C,
|
|||
|
||||
Color *previous_color = static_cast<Color *>(ss->cache->prev_colors_vpaint);
|
||||
|
||||
const blender::VArray<bool> selection_vert = me->attributes().lookup_or_default<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT, false);
|
||||
const blender::VArray<bool> selection_poly = me->attributes().lookup_or_default<bool>(
|
||||
".selection_poly", ATTR_DOMAIN_FACE, false);
|
||||
const blender::VArray<bool> select_vert = me->attributes().lookup_or_default<bool>(
|
||||
".select_vert", ATTR_DOMAIN_POINT, false);
|
||||
const blender::VArray<bool> select_poly = me->attributes().lookup_or_default<bool>(
|
||||
".select_poly", ATTR_DOMAIN_FACE, false);
|
||||
|
||||
blender::threading::parallel_for(IndexRange(totnode), 1LL, [&](IndexRange range) {
|
||||
for (int n : range) {
|
||||
|
@ -3595,7 +3595,7 @@ static void vpaint_do_draw(bContext *C,
|
|||
const float grid_alpha = has_grids ? 1.0f / vd.gridsize : 1.0f;
|
||||
|
||||
/* If the vertex is selected for painting. */
|
||||
if (!use_vert_sel || selection_vert[v_index]) {
|
||||
if (!use_vert_sel || select_vert[v_index]) {
|
||||
/* Calc the dot prod. between ray norm on surf and current vert
|
||||
* (ie splash prevention factor), and only paint front facing verts. */
|
||||
float brush_strength = cache->bstrength;
|
||||
|
@ -3647,7 +3647,7 @@ static void vpaint_do_draw(bContext *C,
|
|||
const int p_index = gmap->vert_to_poly[v_index].indices[j];
|
||||
const int l_index = gmap->vert_to_loop[v_index].indices[j];
|
||||
BLI_assert(ss->mloop[l_index].v == v_index);
|
||||
if (!use_face_sel || selection_poly[p_index]) {
|
||||
if (!use_face_sel || select_poly[p_index]) {
|
||||
Color color_orig = Color(0, 0, 0, 0); /* unused when array is nullptr */
|
||||
|
||||
if (previous_color != nullptr) {
|
||||
|
@ -4074,10 +4074,10 @@ static bool vertex_color_set(Object *ob, ColorPaint4f paintcol_in, CustomDataLay
|
|||
return false;
|
||||
}
|
||||
|
||||
const blender::VArray<bool> selection_vert = me->attributes().lookup_or_default<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT, false);
|
||||
const blender::VArray<bool> selection_poly = me->attributes().lookup_or_default<bool>(
|
||||
".selection_poly", ATTR_DOMAIN_FACE, false);
|
||||
const blender::VArray<bool> select_vert = me->attributes().lookup_or_default<bool>(
|
||||
".select_vert", ATTR_DOMAIN_POINT, false);
|
||||
const blender::VArray<bool> select_poly = me->attributes().lookup_or_default<bool>(
|
||||
".select_poly", ATTR_DOMAIN_FACE, false);
|
||||
|
||||
Color paintcol = fromFloat<Color>(paintcol_in);
|
||||
|
||||
|
@ -4126,7 +4126,7 @@ static bool vertex_color_set(Object *ob, ColorPaint4f paintcol_in, CustomDataLay
|
|||
const Span<MLoop> loops = me->loops();
|
||||
|
||||
for (const int i : polys.index_range()) {
|
||||
if (use_face_sel && !selection_poly[i]) {
|
||||
if (use_face_sel && !select_poly[i]) {
|
||||
continue;
|
||||
}
|
||||
const MPoly &poly = polys[i];
|
||||
|
@ -4135,7 +4135,7 @@ static bool vertex_color_set(Object *ob, ColorPaint4f paintcol_in, CustomDataLay
|
|||
do {
|
||||
uint vidx = loops[poly.loopstart + j].v;
|
||||
|
||||
if (!(use_vert_sel && !(selection_vert[vidx]))) {
|
||||
if (!(use_vert_sel && !(select_vert[vidx]))) {
|
||||
if constexpr (domain == ATTR_DOMAIN_CORNER) {
|
||||
color_layer[poly.loopstart + j] = paintcol;
|
||||
}
|
||||
|
|
|
@ -163,13 +163,13 @@ static IndexMask get_selected_indices(const Mesh &mesh,
|
|||
|
||||
if (mesh.editflag & ME_EDIT_PAINT_FACE_SEL) {
|
||||
const VArray<bool> selection = attributes.lookup_or_default<bool>(
|
||||
".selection_poly", ATTR_DOMAIN_FACE, false);
|
||||
".select_poly", ATTR_DOMAIN_FACE, false);
|
||||
return index_mask_ops::find_indices_from_virtual_array(
|
||||
selection.index_range(), selection, 4096, indices);
|
||||
}
|
||||
if (mesh.editflag & ME_EDIT_PAINT_VERT_SEL) {
|
||||
const VArray<bool> selection = attributes.lookup_or_default<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT, false);
|
||||
".select_vert", ATTR_DOMAIN_POINT, false);
|
||||
return index_mask_ops::find_indices_from_virtual_array(
|
||||
selection.index_range(), selection, 4096, indices);
|
||||
}
|
||||
|
|
|
@ -463,15 +463,15 @@ static bool weight_paint_set(Object *ob, float paintweight)
|
|||
struct WPaintPrev wpp;
|
||||
wpaint_prev_create(&wpp, dvert, me->totvert);
|
||||
|
||||
const bool *selection_vert = (const bool *)CustomData_get_layer_named(
|
||||
&me->vdata, CD_PROP_BOOL, ".selection_vert");
|
||||
const bool *selection_poly = (const bool *)CustomData_get_layer_named(
|
||||
&me->pdata, CD_PROP_BOOL, ".selection_poly");
|
||||
const bool *select_vert = (const bool *)CustomData_get_layer_named(
|
||||
&me->vdata, CD_PROP_BOOL, ".select_vert");
|
||||
const bool *select_poly = (const bool *)CustomData_get_layer_named(
|
||||
&me->pdata, CD_PROP_BOOL, ".select_poly");
|
||||
|
||||
for (index = 0, mp = polys; index < me->totpoly; index++, mp++) {
|
||||
uint fidx = mp->totloop - 1;
|
||||
|
||||
if ((paint_selmode == SCE_SELECT_FACE) && !(selection_poly && selection_poly[index])) {
|
||||
if ((paint_selmode == SCE_SELECT_FACE) && !(select_poly && select_poly[index])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -479,7 +479,7 @@ static bool weight_paint_set(Object *ob, float paintweight)
|
|||
uint vidx = loops[mp->loopstart + fidx].v;
|
||||
|
||||
if (!dvert[vidx].flag) {
|
||||
if ((paint_selmode == SCE_SELECT_VERTEX) && !(selection_vert && selection_vert[vidx])) {
|
||||
if ((paint_selmode == SCE_SELECT_VERTEX) && !(select_vert && select_vert[vidx])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -344,23 +344,23 @@ static bool edbm_backbuf_check_and_select_verts_obmode(Mesh *me,
|
|||
const BLI_bitmap *select_bitmap = esel->select_bitmap;
|
||||
|
||||
bke::MutableAttributeAccessor attributes = me->attributes_for_write();
|
||||
bke::SpanAttributeWriter<bool> selection_vert = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT);
|
||||
bke::SpanAttributeWriter<bool> select_vert = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".select_vert", ATTR_DOMAIN_POINT);
|
||||
const VArray<bool> hide_vert = attributes.lookup_or_default<bool>(
|
||||
".hide_vert", ATTR_DOMAIN_POINT, false);
|
||||
|
||||
for (int index = 0; index < me->totvert; index++) {
|
||||
if (!hide_vert[index]) {
|
||||
const bool is_select = selection_vert.span[index];
|
||||
const bool is_select = select_vert.span[index];
|
||||
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);
|
||||
if (sel_op_result != -1) {
|
||||
selection_vert.span[index] = sel_op_result == 1;
|
||||
select_vert.span[index] = sel_op_result == 1;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
selection_vert.finish();
|
||||
select_vert.finish();
|
||||
return changed;
|
||||
}
|
||||
|
||||
|
@ -375,23 +375,23 @@ static bool edbm_backbuf_check_and_select_faces_obmode(Mesh *me,
|
|||
const BLI_bitmap *select_bitmap = esel->select_bitmap;
|
||||
|
||||
bke::MutableAttributeAccessor attributes = me->attributes_for_write();
|
||||
bke::SpanAttributeWriter<bool> selection_poly = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".selection_poly", ATTR_DOMAIN_FACE);
|
||||
bke::SpanAttributeWriter<bool> select_poly = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".select_poly", ATTR_DOMAIN_FACE);
|
||||
const VArray<bool> hide_poly = attributes.lookup_or_default<bool>(
|
||||
".hide_poly", ATTR_DOMAIN_FACE, false);
|
||||
|
||||
for (int index = 0; index < me->totpoly; index++) {
|
||||
if (!hide_poly[index]) {
|
||||
const bool is_select = selection_poly.span[index];
|
||||
const bool is_select = select_poly.span[index];
|
||||
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);
|
||||
if (sel_op_result != -1) {
|
||||
selection_poly.span[index] = sel_op_result == 1;
|
||||
select_poly.span[index] = sel_op_result == 1;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
selection_poly.finish();
|
||||
select_poly.finish();
|
||||
return changed;
|
||||
}
|
||||
|
||||
|
@ -1160,7 +1160,7 @@ static bool do_lasso_select_meta(ViewContext *vc,
|
|||
|
||||
struct LassoSelectUserData_ForMeshVert {
|
||||
LassoSelectUserData lasso_data;
|
||||
blender::MutableSpan<bool> selection_vert;
|
||||
blender::MutableSpan<bool> select_vert;
|
||||
};
|
||||
static void do_lasso_select_meshobject__doSelectVert(void *userData,
|
||||
MVert * /*mv*/,
|
||||
|
@ -1171,14 +1171,14 @@ static void do_lasso_select_meshobject__doSelectVert(void *userData,
|
|||
LassoSelectUserData_ForMeshVert *mesh_data = static_cast<LassoSelectUserData_ForMeshVert *>(
|
||||
userData);
|
||||
LassoSelectUserData *data = &mesh_data->lasso_data;
|
||||
const bool is_select = mesh_data->selection_vert[index];
|
||||
const bool is_select = mesh_data->select_vert[index];
|
||||
const bool is_inside =
|
||||
(BLI_rctf_isect_pt_v(data->rect_fl, screen_co) &&
|
||||
BLI_lasso_is_point_inside(
|
||||
data->mcoords, data->mcoords_len, screen_co[0], screen_co[1], IS_CLIPPED));
|
||||
const int sel_op_result = ED_select_op_action_deselected(data->sel_op, is_select, is_inside);
|
||||
if (sel_op_result != -1) {
|
||||
mesh_data->selection_vert[index] = sel_op_result == 1;
|
||||
mesh_data->select_vert[index] = sel_op_result == 1;
|
||||
data->is_changed = true;
|
||||
}
|
||||
}
|
||||
|
@ -1223,11 +1223,11 @@ static bool do_lasso_select_paintvert(ViewContext *vc,
|
|||
}
|
||||
else {
|
||||
bke::MutableAttributeAccessor attributes = me->attributes_for_write();
|
||||
bke::SpanAttributeWriter<bool> selection_vert = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT);
|
||||
bke::SpanAttributeWriter<bool> select_vert = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".select_vert", ATTR_DOMAIN_POINT);
|
||||
|
||||
LassoSelectUserData_ForMeshVert data;
|
||||
data.selection_vert = selection_vert.span;
|
||||
data.select_vert = select_vert.span;
|
||||
|
||||
view3d_userdata_lassoselect_init(&data.lasso_data, vc, &rect, mcoords, mcoords_len, sel_op);
|
||||
|
||||
|
@ -1237,7 +1237,7 @@ static bool do_lasso_select_paintvert(ViewContext *vc,
|
|||
vc, do_lasso_select_meshobject__doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
|
||||
|
||||
changed |= data.lasso_data.is_changed;
|
||||
selection_vert.finish();
|
||||
select_vert.finish();
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
|
@ -2854,11 +2854,11 @@ static bool ed_wpaint_vertex_select_pick(bContext *C,
|
|||
bool found = ED_mesh_pick_vert(C, obact, mval, ED_MESH_PICK_DEFAULT_VERT_DIST, use_zbuf, &index);
|
||||
|
||||
bke::MutableAttributeAccessor attributes = me->attributes_for_write();
|
||||
bke::AttributeWriter<bool> selection_vert = attributes.lookup_or_add_for_write<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT);
|
||||
bke::AttributeWriter<bool> select_vert = attributes.lookup_or_add_for_write<bool>(
|
||||
".select_vert", ATTR_DOMAIN_POINT);
|
||||
|
||||
if (params->sel_op == SEL_OP_SET) {
|
||||
if ((found && params->select_passthrough) && selection_vert.varray[index]) {
|
||||
if ((found && params->select_passthrough) && select_vert.varray[index]) {
|
||||
found = false;
|
||||
}
|
||||
else if (found || params->deselect_all) {
|
||||
|
@ -2870,20 +2870,20 @@ static bool ed_wpaint_vertex_select_pick(bContext *C,
|
|||
if (found) {
|
||||
switch (params->sel_op) {
|
||||
case SEL_OP_ADD: {
|
||||
selection_vert.varray.set(index, true);
|
||||
select_vert.varray.set(index, true);
|
||||
break;
|
||||
}
|
||||
case SEL_OP_SUB: {
|
||||
selection_vert.varray.set(index, false);
|
||||
select_vert.varray.set(index, false);
|
||||
break;
|
||||
}
|
||||
case SEL_OP_XOR: {
|
||||
selection_vert.varray.set(index, !selection_vert.varray[index]);
|
||||
select_vert.varray.set(index, !select_vert.varray[index]);
|
||||
break;
|
||||
}
|
||||
case SEL_OP_SET: {
|
||||
paintvert_deselect_all_visible(obact, SEL_DESELECT, false);
|
||||
selection_vert.varray.set(index, true);
|
||||
select_vert.varray.set(index, true);
|
||||
break;
|
||||
}
|
||||
case SEL_OP_AND: {
|
||||
|
@ -2893,14 +2893,14 @@ static bool ed_wpaint_vertex_select_pick(bContext *C,
|
|||
}
|
||||
|
||||
/* update mselect */
|
||||
if (selection_vert.varray[index]) {
|
||||
if (select_vert.varray[index]) {
|
||||
BKE_mesh_mselect_active_set(me, index, ME_VSEL);
|
||||
}
|
||||
else {
|
||||
BKE_mesh_mselect_validate(me);
|
||||
}
|
||||
|
||||
selection_vert.finish();
|
||||
select_vert.finish();
|
||||
|
||||
paintvert_flush_flags(obact);
|
||||
|
||||
|
@ -3140,7 +3140,7 @@ bool edge_inside_circle(const float cent[2],
|
|||
|
||||
struct BoxSelectUserData_ForMeshVert {
|
||||
BoxSelectUserData box_data;
|
||||
blender::MutableSpan<bool> selection_vert;
|
||||
blender::MutableSpan<bool> select_vert;
|
||||
};
|
||||
static void do_paintvert_box_select__doSelectVert(void *userData,
|
||||
MVert * /*mv*/,
|
||||
|
@ -3150,11 +3150,11 @@ static void do_paintvert_box_select__doSelectVert(void *userData,
|
|||
BoxSelectUserData_ForMeshVert *mesh_data = static_cast<BoxSelectUserData_ForMeshVert *>(
|
||||
userData);
|
||||
BoxSelectUserData *data = &mesh_data->box_data;
|
||||
const bool is_select = mesh_data->selection_vert[index];
|
||||
const bool is_select = mesh_data->select_vert[index];
|
||||
const bool is_inside = BLI_rctf_isect_pt_v(data->rect_fl, screen_co);
|
||||
const int sel_op_result = ED_select_op_action_deselected(data->sel_op, is_select, is_inside);
|
||||
if (sel_op_result != -1) {
|
||||
mesh_data->selection_vert[index] = sel_op_result == 1;
|
||||
mesh_data->select_vert[index] = sel_op_result == 1;
|
||||
data->is_changed = true;
|
||||
}
|
||||
}
|
||||
|
@ -3193,11 +3193,11 @@ static bool do_paintvert_box_select(ViewContext *vc,
|
|||
}
|
||||
else {
|
||||
bke::MutableAttributeAccessor attributes = me->attributes_for_write();
|
||||
bke::SpanAttributeWriter<bool> selection_vert = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT);
|
||||
bke::SpanAttributeWriter<bool> select_vert = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".select_vert", ATTR_DOMAIN_POINT);
|
||||
|
||||
BoxSelectUserData_ForMeshVert data;
|
||||
data.selection_vert = selection_vert.span;
|
||||
data.select_vert = select_vert.span;
|
||||
|
||||
view3d_userdata_boxselect_init(&data.box_data, vc, rect, sel_op);
|
||||
|
||||
|
@ -3206,7 +3206,7 @@ static bool do_paintvert_box_select(ViewContext *vc,
|
|||
meshobject_foreachScreenVert(
|
||||
vc, do_paintvert_box_select__doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
|
||||
changed |= data.box_data.is_changed;
|
||||
selection_vert.finish();
|
||||
select_vert.finish();
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
|
@ -3484,7 +3484,8 @@ static bool do_mesh_box_select(ViewContext *vc,
|
|||
}
|
||||
if (ts->selectmode & SCE_SELECT_EDGE) {
|
||||
/* Does both use_zbuf and non-use_zbuf versions (need screen cos for both) */
|
||||
struct BoxSelectUserData_ForMeshEdge cb_data {};
|
||||
struct BoxSelectUserData_ForMeshEdge cb_data {
|
||||
};
|
||||
cb_data.data = &data;
|
||||
cb_data.esel = use_zbuf ? esel : nullptr;
|
||||
cb_data.backbuf_offset = use_zbuf ? DRW_select_buffer_context_offset_for_object_elem(
|
||||
|
@ -4159,7 +4160,7 @@ static bool paint_facesel_circle_select(ViewContext *vc,
|
|||
|
||||
struct CircleSelectUserData_ForMeshVert {
|
||||
CircleSelectUserData circle_data;
|
||||
blender::MutableSpan<bool> selection_vert;
|
||||
blender::MutableSpan<bool> select_vert;
|
||||
};
|
||||
static void paint_vertsel_circle_select_doSelectVert(void *userData,
|
||||
MVert * /*mv*/,
|
||||
|
@ -4171,7 +4172,7 @@ static void paint_vertsel_circle_select_doSelectVert(void *userData,
|
|||
CircleSelectUserData *data = &mesh_data->circle_data;
|
||||
|
||||
if (len_squared_v2v2(data->mval_fl, screen_co) <= data->radius_squared) {
|
||||
mesh_data->selection_vert[index] = data->select;
|
||||
mesh_data->select_vert[index] = data->select;
|
||||
data->is_changed = true;
|
||||
}
|
||||
}
|
||||
|
@ -4214,11 +4215,11 @@ static bool paint_vertsel_circle_select(ViewContext *vc,
|
|||
}
|
||||
else {
|
||||
bke::MutableAttributeAccessor attributes = me->attributes_for_write();
|
||||
bke::SpanAttributeWriter<bool> selection_vert = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT);
|
||||
bke::SpanAttributeWriter<bool> select_vert = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".select_vert", ATTR_DOMAIN_POINT);
|
||||
|
||||
CircleSelectUserData_ForMeshVert data;
|
||||
data.selection_vert = selection_vert.span;
|
||||
data.select_vert = select_vert.span;
|
||||
|
||||
ED_view3d_init_mats_rv3d(vc->obact, vc->rv3d); /* for foreach's screen/vert projection */
|
||||
|
||||
|
@ -4226,7 +4227,7 @@ static bool paint_vertsel_circle_select(ViewContext *vc,
|
|||
meshobject_foreachScreenVert(
|
||||
vc, paint_vertsel_circle_select_doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
|
||||
changed |= data.circle_data.is_changed;
|
||||
selection_vert.finish();
|
||||
select_vert.finish();
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
|
|
|
@ -29,7 +29,7 @@ typedef struct MVert {
|
|||
* Deprecated flag for storing hide status and selection, which are now stored in separate
|
||||
* generic attributes. Kept for file read and write.
|
||||
*/
|
||||
char flag DNA_DEPRECATED;
|
||||
char flag_legacy;
|
||||
/**
|
||||
* Deprecated bevel weight storage, now located in #CD_BWEIGHT, except for file read and write.
|
||||
*/
|
||||
|
@ -41,7 +41,7 @@ typedef struct MVert {
|
|||
|
||||
#ifdef DNA_DEPRECATED_ALLOW
|
||||
enum {
|
||||
/** Deprecated selection status. Now stored in ".selection_vert" attribute. */
|
||||
/** Deprecated selection status. Now stored in ".select_vert" attribute. */
|
||||
/* SELECT = (1 << 0), */
|
||||
/** Deprecated hide status. Now stored in ".hide_vert" attribute. */
|
||||
ME_HIDE = (1 << 4),
|
||||
|
@ -67,7 +67,7 @@ typedef struct MEdge {
|
|||
|
||||
/** #MEdge.flag */
|
||||
enum {
|
||||
/** Deprecated selection status. Now stored in ".selection_edge" attribute. */
|
||||
/** Deprecated selection status. Now stored in ".select_edge" attribute. */
|
||||
/* SELECT = (1 << 0), */
|
||||
ME_EDGEDRAW = (1 << 1),
|
||||
ME_SEAM = (1 << 2),
|
||||
|
@ -98,7 +98,7 @@ typedef struct MPoly {
|
|||
enum {
|
||||
ME_SMOOTH = (1 << 0),
|
||||
#ifdef DNA_DEPRECATED_ALLOW
|
||||
/** Deprecated selection status. Now stored in ".selection_poly" attribute. */
|
||||
/** Deprecated selection status. Now stored in ".select_poly" attribute. */
|
||||
ME_FACE_SEL = (1 << 1),
|
||||
#endif
|
||||
/** Deprecated hide status. Now stored in ".hide_poly" attribute. */
|
||||
|
|
|
@ -449,27 +449,27 @@ static void rna_MeshVertex_hide_set(PointerRNA *ptr, bool value)
|
|||
static bool rna_MeshVertex_select_get(PointerRNA *ptr)
|
||||
{
|
||||
const Mesh *mesh = rna_mesh(ptr);
|
||||
const bool *selection_vert = (const bool *)CustomData_get_layer_named(
|
||||
&mesh->vdata, CD_PROP_BOOL, ".selection_vert");
|
||||
const bool *select_vert = (const bool *)CustomData_get_layer_named(
|
||||
&mesh->vdata, CD_PROP_BOOL, ".select_vert");
|
||||
const int index = rna_MeshVertex_index_get(ptr);
|
||||
return selection_vert == NULL ? false : selection_vert[index];
|
||||
return select_vert == NULL ? false : select_vert[index];
|
||||
}
|
||||
|
||||
static void rna_MeshVertex_select_set(PointerRNA *ptr, bool value)
|
||||
{
|
||||
Mesh *mesh = rna_mesh(ptr);
|
||||
bool *selection_vert = (bool *)CustomData_duplicate_referenced_layer_named(
|
||||
&mesh->vdata, CD_PROP_BOOL, ".selection_vert", mesh->totvert);
|
||||
if (!selection_vert) {
|
||||
bool *select_vert = (bool *)CustomData_duplicate_referenced_layer_named(
|
||||
&mesh->vdata, CD_PROP_BOOL, ".select_vert", mesh->totvert);
|
||||
if (!select_vert) {
|
||||
if (!value) {
|
||||
/* Skip adding layer if it doesn't exist already anyway and we're not hiding an element. */
|
||||
return;
|
||||
}
|
||||
selection_vert = (bool *)CustomData_add_layer_named(
|
||||
&mesh->vdata, CD_PROP_BOOL, CD_SET_DEFAULT, NULL, mesh->totvert, ".selection_vert");
|
||||
select_vert = (bool *)CustomData_add_layer_named(
|
||||
&mesh->vdata, CD_PROP_BOOL, CD_SET_DEFAULT, NULL, mesh->totvert, ".select_vert");
|
||||
}
|
||||
const int index = rna_MeshVertex_index_get(ptr);
|
||||
selection_vert[index] = value;
|
||||
select_vert[index] = value;
|
||||
}
|
||||
|
||||
static float rna_MeshVertex_bevel_weight_get(PointerRNA *ptr)
|
||||
|
@ -625,27 +625,27 @@ static void rna_MeshPolygon_hide_set(PointerRNA *ptr, bool value)
|
|||
static bool rna_MeshPolygon_select_get(PointerRNA *ptr)
|
||||
{
|
||||
const Mesh *mesh = rna_mesh(ptr);
|
||||
const bool *selection_poly = (const bool *)CustomData_get_layer_named(
|
||||
&mesh->pdata, CD_PROP_BOOL, ".selection_poly");
|
||||
const bool *select_poly = (const bool *)CustomData_get_layer_named(
|
||||
&mesh->pdata, CD_PROP_BOOL, ".select_poly");
|
||||
const int index = rna_MeshPolygon_index_get(ptr);
|
||||
return selection_poly == NULL ? false : selection_poly[index];
|
||||
return select_poly == NULL ? false : select_poly[index];
|
||||
}
|
||||
|
||||
static void rna_MeshPolygon_select_set(PointerRNA *ptr, bool value)
|
||||
{
|
||||
Mesh *mesh = rna_mesh(ptr);
|
||||
bool *selection_poly = (bool *)CustomData_duplicate_referenced_layer_named(
|
||||
&mesh->pdata, CD_PROP_BOOL, ".selection_poly", mesh->totpoly);
|
||||
if (!selection_poly) {
|
||||
bool *select_poly = (bool *)CustomData_duplicate_referenced_layer_named(
|
||||
&mesh->pdata, CD_PROP_BOOL, ".select_poly", mesh->totpoly);
|
||||
if (!select_poly) {
|
||||
if (!value) {
|
||||
/* Skip adding layer if it doesn't exist already anyway and we're not hiding an element. */
|
||||
return;
|
||||
}
|
||||
selection_poly = (bool *)CustomData_add_layer_named(
|
||||
&mesh->pdata, CD_PROP_BOOL, CD_SET_DEFAULT, NULL, mesh->totpoly, ".selection_poly");
|
||||
select_poly = (bool *)CustomData_add_layer_named(
|
||||
&mesh->pdata, CD_PROP_BOOL, CD_SET_DEFAULT, NULL, mesh->totpoly, ".select_poly");
|
||||
}
|
||||
const int index = rna_MeshPolygon_index_get(ptr);
|
||||
selection_poly[index] = value;
|
||||
select_poly[index] = value;
|
||||
}
|
||||
|
||||
static int rna_MeshPolygon_material_index_get(PointerRNA *ptr)
|
||||
|
@ -1436,27 +1436,27 @@ static void rna_MeshEdge_hide_set(PointerRNA *ptr, bool value)
|
|||
static bool rna_MeshEdge_select_get(PointerRNA *ptr)
|
||||
{
|
||||
const Mesh *mesh = rna_mesh(ptr);
|
||||
const bool *selection_edge = (const bool *)CustomData_get_layer_named(
|
||||
&mesh->edata, CD_PROP_BOOL, ".selection_edge");
|
||||
const bool *select_edge = (const bool *)CustomData_get_layer_named(
|
||||
&mesh->edata, CD_PROP_BOOL, ".select_edge");
|
||||
const int index = rna_MeshEdge_index_get(ptr);
|
||||
return selection_edge == NULL ? false : selection_edge[index];
|
||||
return select_edge == NULL ? false : select_edge[index];
|
||||
}
|
||||
|
||||
static void rna_MeshEdge_select_set(PointerRNA *ptr, bool value)
|
||||
{
|
||||
Mesh *mesh = rna_mesh(ptr);
|
||||
bool *selection_edge = (bool *)CustomData_duplicate_referenced_layer_named(
|
||||
&mesh->edata, CD_PROP_BOOL, ".selection_edge", mesh->totedge);
|
||||
if (!selection_edge) {
|
||||
bool *select_edge = (bool *)CustomData_duplicate_referenced_layer_named(
|
||||
&mesh->edata, CD_PROP_BOOL, ".select_edge", mesh->totedge);
|
||||
if (!select_edge) {
|
||||
if (!value) {
|
||||
/* Skip adding layer if it doesn't exist already anyway and we're not hiding an element. */
|
||||
return;
|
||||
}
|
||||
selection_edge = (bool *)CustomData_add_layer_named(
|
||||
&mesh->edata, CD_PROP_BOOL, CD_SET_DEFAULT, NULL, mesh->totedge, ".selection_edge");
|
||||
select_edge = (bool *)CustomData_add_layer_named(
|
||||
&mesh->edata, CD_PROP_BOOL, CD_SET_DEFAULT, NULL, mesh->totedge, ".select_edge");
|
||||
}
|
||||
const int index = rna_MeshEdge_index_get(ptr);
|
||||
selection_edge[index] = value;
|
||||
select_edge[index] = value;
|
||||
}
|
||||
|
||||
static int rna_MeshLoopTriangle_material_index_get(PointerRNA *ptr)
|
||||
|
|
|
@ -396,13 +396,12 @@ class MeshTest(ABC):
|
|||
selected_expected_verts = [
|
||||
v.index for v in expected_mesh.vertices if v.select]
|
||||
|
||||
# TODO(@HooglyBoogly): Reenable when mesh tests are updated.
|
||||
# if selected_evaluated_verts == selected_expected_verts:
|
||||
# result_selection = "Same"
|
||||
# result_codes['Selection Comparison'] = (True, result_selection)
|
||||
# else:
|
||||
# result_selection = "Selection doesn't match."
|
||||
# result_codes['Selection Comparison'] = (False, result_selection)
|
||||
if selected_evaluated_verts == selected_expected_verts:
|
||||
result_selection = "Same"
|
||||
result_codes['Selection Comparison'] = (True, result_selection)
|
||||
else:
|
||||
result_selection = "Selection doesn't match."
|
||||
result_codes['Selection Comparison'] = (False, result_selection)
|
||||
|
||||
# Validation check.
|
||||
result_validation = evaluated_test_mesh.validate(verbose=True)
|
||||
|
|
Loading…
Reference in New Issue