Progress
This commit is contained in:
parent
f0e4307792
commit
70116c39b6
|
@ -93,6 +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 struct MLoop *mloop,
|
||||
const struct MLoopUV *mloopuv,
|
||||
unsigned int totpoly,
|
||||
|
|
|
@ -30,6 +30,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 MLoop *mloop,
|
||||
const MLoopUV *mloopuv,
|
||||
uint totpoly,
|
||||
|
@ -52,7 +53,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]) && (mp->flag & ME_FACE_SEL))) {
|
||||
if (!selected || (!(hide_poly && hide_poly[a]) && (selection_poly && selection_poly[a]))) {
|
||||
totuv += mp->totloop;
|
||||
}
|
||||
}
|
||||
|
@ -75,7 +76,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]) && (mp->flag & ME_FACE_SEL))) {
|
||||
if (!selected || (!(hide_poly && hide_poly[a]) && (selection_poly && selection_poly[a]))) {
|
||||
float(*tf_uv)[2] = NULL;
|
||||
|
||||
if (use_winding) {
|
||||
|
|
|
@ -207,6 +207,7 @@ static void precalc_uv_layer(const OpenSubdiv_Converter *converter, const int la
|
|||
UvVertMap *uv_vert_map = BKE_mesh_uv_vert_map_create(
|
||||
mpoly,
|
||||
(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"),
|
||||
mloop,
|
||||
mloopuv,
|
||||
num_poly,
|
||||
|
|
|
@ -285,7 +285,7 @@ static int ss_sync_from_uv(CCGSubSurf *ss,
|
|||
* Also, initially intention is to treat merged vertices from mirror modifier as seams.
|
||||
* This fixes a very old regression (2.49 was correct here) */
|
||||
vmap = BKE_mesh_uv_vert_map_create(
|
||||
mpoly, NULL, mloop, mloopuv, totface, totvert, limit, false, true);
|
||||
mpoly, NULL, NULL, mloop, mloopuv, totface, totvert, limit, false, true);
|
||||
if (!vmap) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -879,7 +879,7 @@ static void ccgDM_getFinalVertNo(DerivedMesh *dm, int vertNum, float r_no[3])
|
|||
BLI_INLINE void ccgDM_to_MVert(MVert *mv, const CCGKey *key, CCGElem *elem)
|
||||
{
|
||||
copy_v3_v3(mv->co, CCG_elem_co(key, elem));
|
||||
mv->flag = mv->bweight = 0;
|
||||
mv->bweight = 0;
|
||||
}
|
||||
|
||||
static void ccgDM_copyFinalVertArray(DerivedMesh *dm, MVert *mvert)
|
||||
|
|
|
@ -585,6 +585,13 @@ MeshRenderData *mesh_render_data_create(Object *object,
|
|||
CustomData_get_layer_named(&me->edata, CD_PROP_BOOL, ".hide_edge"));
|
||||
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"));
|
||||
}
|
||||
else {
|
||||
/* #BMesh */
|
||||
|
|
|
@ -86,6 +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;
|
||||
float (*loop_normals)[3];
|
||||
int *lverts, *ledges;
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ static void extract_edituv_tris_iter_looptri_mesh(const MeshRenderData *mr,
|
|||
const MPoly *mp = &mr->mpoly[mlt->poly];
|
||||
edituv_tri_add(data,
|
||||
mr->hide_poly && mr->hide_poly[mlt->poly],
|
||||
(mp->flag & ME_FACE_SEL) != 0,
|
||||
mr->selection_poly && mr->selection_poly[mlt->poly],
|
||||
mlt->tri[0],
|
||||
mlt->tri[1],
|
||||
mlt->tri[2]);
|
||||
|
@ -125,13 +125,23 @@ static void extract_edituv_tris_iter_subdiv_mesh(const DRWSubdivCache *UNUSED(su
|
|||
MeshExtract_EditUvElem_Data *data = static_cast<MeshExtract_EditUvElem_Data *>(_data);
|
||||
const uint loop_idx = subdiv_quad_index * 4;
|
||||
|
||||
const bool hidden = mr->hide_poly && mr->hide_poly[coarse_quad - mr->mpoly];
|
||||
const int coarse_quad_index = coarse_quad - mr->mpoly;
|
||||
|
||||
edituv_tri_add(
|
||||
data, hidden, (coarse_quad->flag & ME_FACE_SEL) != 0, loop_idx, loop_idx + 1, loop_idx + 2);
|
||||
const bool hidden = mr->hide_poly && mr->hide_poly[coarse_quad_index];
|
||||
|
||||
edituv_tri_add(
|
||||
data, hidden, (coarse_quad->flag & ME_FACE_SEL) != 0, loop_idx, loop_idx + 2, loop_idx + 3);
|
||||
edituv_tri_add(data,
|
||||
hidden,
|
||||
mr->selection_poly && mr->selection_poly[coarse_quad_index],
|
||||
loop_idx,
|
||||
loop_idx + 1,
|
||||
loop_idx + 2);
|
||||
|
||||
edituv_tri_add(data,
|
||||
hidden,
|
||||
mr->selection_poly && mr->selection_poly[coarse_quad_index],
|
||||
loop_idx,
|
||||
loop_idx + 2,
|
||||
loop_idx + 3);
|
||||
}
|
||||
|
||||
static void extract_edituv_tris_finish_subdiv(const struct DRWSubdivCache *UNUSED(subdiv_cache),
|
||||
|
@ -208,7 +218,7 @@ static void extract_edituv_lines_iter_poly_bm(const MeshRenderData *UNUSED(mr),
|
|||
|
||||
static void extract_edituv_lines_iter_poly_mesh(const MeshRenderData *mr,
|
||||
const MPoly *mp,
|
||||
const int UNUSED(mp_index),
|
||||
const int mp_index,
|
||||
void *_data)
|
||||
{
|
||||
MeshExtract_EditUvElem_Data *data = static_cast<MeshExtract_EditUvElem_Data *>(_data);
|
||||
|
@ -223,8 +233,11 @@ static void extract_edituv_lines_iter_poly_mesh(const MeshRenderData *mr,
|
|||
const int ml_index_next = (ml_index == ml_index_last) ? mp->loopstart : (ml_index + 1);
|
||||
const bool real_edge = (mr->e_origindex == nullptr ||
|
||||
mr->e_origindex[ml->e] != ORIGINDEX_NONE);
|
||||
edituv_edge_add(
|
||||
data, hidden || !real_edge, (mp->flag & ME_FACE_SEL) != 0, ml_index, ml_index_next);
|
||||
edituv_edge_add(data,
|
||||
hidden || !real_edge,
|
||||
mr->selection_poly && mr->selection_poly[mp_index],
|
||||
ml_index,
|
||||
ml_index_next);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -281,7 +294,8 @@ static void extract_edituv_lines_iter_subdiv_mesh(const DRWSubdivCache *subdiv_c
|
|||
const MPoly *coarse_poly)
|
||||
{
|
||||
MeshExtract_EditUvElem_Data *data = static_cast<MeshExtract_EditUvElem_Data *>(_data);
|
||||
const bool hidden = mr->hide_poly && mr->hide_poly[coarse_poly - mr->mpoly];
|
||||
const int coarse_quad_index = coarse_poly - mr->mpoly;
|
||||
const bool hidden = mr->hide_poly && mr->hide_poly[coarse_quad_index];
|
||||
|
||||
int *subdiv_loop_edge_index = (int *)GPU_vertbuf_get_data(subdiv_cache->edges_orig_index);
|
||||
|
||||
|
@ -294,7 +308,7 @@ static void extract_edituv_lines_iter_subdiv_mesh(const DRWSubdivCache *subdiv_c
|
|||
mr->e_origindex[edge_origindex] != ORIGINDEX_NONE));
|
||||
edituv_edge_add(data,
|
||||
hidden || !real_edge,
|
||||
(coarse_poly->flag & ME_FACE_SEL) != 0,
|
||||
mr->selection_poly && mr->selection_poly[coarse_quad_index],
|
||||
loop_idx,
|
||||
(loop_idx + 1 == end_loop_idx) ? start_loop_idx : (loop_idx + 1));
|
||||
}
|
||||
|
@ -373,7 +387,7 @@ static void extract_edituv_points_iter_poly_bm(const MeshRenderData *UNUSED(mr),
|
|||
|
||||
static void extract_edituv_points_iter_poly_mesh(const MeshRenderData *mr,
|
||||
const MPoly *mp,
|
||||
const int UNUSED(mp_index),
|
||||
const int mp_index,
|
||||
void *_data)
|
||||
{
|
||||
MeshExtract_EditUvElem_Data *data = static_cast<MeshExtract_EditUvElem_Data *>(_data);
|
||||
|
@ -385,7 +399,8 @@ static void extract_edituv_points_iter_poly_mesh(const MeshRenderData *mr,
|
|||
const MLoop *ml = &mloop[ml_index];
|
||||
|
||||
const bool real_vert = !mr->v_origindex || mr->v_origindex[ml->v] != ORIGINDEX_NONE;
|
||||
edituv_point_add(data, hidden || !real_vert, (mp->flag & ME_FACE_SEL) != 0, ml_index);
|
||||
edituv_point_add(
|
||||
data, hidden || !real_vert, mr->selection_poly && mr->selection_poly[mp_index], ml_index);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -438,7 +453,8 @@ static void extract_edituv_points_iter_subdiv_mesh(const DRWSubdivCache *subdiv_
|
|||
const MPoly *coarse_quad)
|
||||
{
|
||||
MeshExtract_EditUvElem_Data *data = static_cast<MeshExtract_EditUvElem_Data *>(_data);
|
||||
const bool hidden = mr->hide_poly && mr->hide_poly[coarse_quad - mr->mpoly];
|
||||
const int coarse_quad_index = coarse_quad - mr->mpoly;
|
||||
const bool hidden = mr->hide_poly && mr->hide_poly[coarse_quad_index];
|
||||
int *subdiv_loop_vert_index = (int *)GPU_vertbuf_get_data(subdiv_cache->verts_orig_index);
|
||||
|
||||
uint start_loop_idx = subdiv_quad_index * 4;
|
||||
|
@ -447,7 +463,10 @@ static void extract_edituv_points_iter_subdiv_mesh(const DRWSubdivCache *subdiv_
|
|||
const int vert_origindex = subdiv_loop_vert_index[i];
|
||||
const bool real_vert = !mr->v_origindex || (vert_origindex != -1 &&
|
||||
mr->v_origindex[vert_origindex] != ORIGINDEX_NONE);
|
||||
edituv_point_add(data, hidden || !real_vert, (coarse_quad->flag & ME_FACE_SEL) != 0, i);
|
||||
edituv_point_add(data,
|
||||
hidden || !real_vert,
|
||||
mr->selection_poly && mr->selection_poly[coarse_quad_index],
|
||||
i);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -527,7 +546,7 @@ static void extract_edituv_fdots_iter_poly_mesh(const MeshRenderData *mr,
|
|||
void *_data)
|
||||
{
|
||||
MeshExtract_EditUvElem_Data *data = static_cast<MeshExtract_EditUvElem_Data *>(_data);
|
||||
const bool hidden = mr->hide_poly && mr->hide_poly[mp - mr->mpoly];
|
||||
const bool hidden = mr->hide_poly && mr->hide_poly[mp_index];
|
||||
|
||||
if (mr->use_subsurf_fdots) {
|
||||
const BLI_bitmap *facedot_tags = mr->me->runtime.subsurf_face_dot_tags;
|
||||
|
@ -539,13 +558,16 @@ static void extract_edituv_fdots_iter_poly_mesh(const MeshRenderData *mr,
|
|||
|
||||
const bool real_fdot = !mr->p_origindex || (mr->p_origindex[mp_index] != ORIGINDEX_NONE);
|
||||
const bool subd_fdot = BLI_BITMAP_TEST(facedot_tags, ml->v);
|
||||
edituv_facedot_add(
|
||||
data, hidden || !real_fdot || !subd_fdot, (mp->flag & ME_FACE_SEL) != 0, mp_index);
|
||||
edituv_facedot_add(data,
|
||||
hidden || !real_fdot || !subd_fdot,
|
||||
mr->selection_poly && mr->selection_poly[mp_index],
|
||||
mp_index);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const bool real_fdot = !mr->p_origindex || (mr->p_origindex[mp_index] != ORIGINDEX_NONE);
|
||||
edituv_facedot_add(data, hidden || !real_fdot, (mp->flag & ME_FACE_SEL) != 0, mp_index);
|
||||
edituv_facedot_add(
|
||||
data, hidden || !real_fdot, mr->selection_poly && mr->selection_poly[mp_index], mp_index);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ static void extract_lines_paint_mask_init(const MeshRenderData *mr,
|
|||
|
||||
static void extract_lines_paint_mask_iter_poly_mesh(const MeshRenderData *mr,
|
||||
const MPoly *mp,
|
||||
const int UNUSED(mp_index),
|
||||
const int mp_index,
|
||||
void *_data)
|
||||
{
|
||||
MeshExtract_LinePaintMask_Data *data = static_cast<MeshExtract_LinePaintMask_Data *>(_data);
|
||||
|
@ -53,7 +53,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 (mp->flag & ME_FACE_SEL) {
|
||||
if (mr->selection_poly && mr->selection_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);
|
||||
|
@ -111,6 +111,8 @@ static void extract_lines_paint_mask_iter_subdiv_mesh(const DRWSubdivCache *subd
|
|||
int *subdiv_loop_edge_index = (int *)GPU_vertbuf_get_data(subdiv_cache->edges_orig_index);
|
||||
int *subdiv_loop_subdiv_edge_index = subdiv_cache->subdiv_loop_subdiv_edge_index;
|
||||
|
||||
const int coarse_quad_index = coarse_quad - mr->mpoly;
|
||||
|
||||
uint start_loop_idx = subdiv_quad_index * 4;
|
||||
uint end_loop_idx = (subdiv_quad_index + 1) * 4;
|
||||
for (uint loop_idx = start_loop_idx; loop_idx < end_loop_idx; loop_idx++) {
|
||||
|
@ -126,7 +128,7 @@ static void extract_lines_paint_mask_iter_subdiv_mesh(const DRWSubdivCache *subd
|
|||
(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 (coarse_quad->flag & ME_FACE_SEL) {
|
||||
if (mr->selection_poly && mr->selection_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->v_origindex[ml->v] == ORIGINDEX_NONE)) {
|
||||
lnor_data->w = -1;
|
||||
}
|
||||
else if (mp->flag & ME_FACE_SEL) {
|
||||
else if (mr->selection_poly && mr->selection_poly[mp_index]) {
|
||||
lnor_data->w = 1;
|
||||
}
|
||||
else {
|
||||
|
@ -211,7 +211,7 @@ static void extract_lnor_hq_iter_poly_mesh(const MeshRenderData *mr,
|
|||
mr->v_origindex[ml->v] == ORIGINDEX_NONE)) {
|
||||
lnor_data->w = -1;
|
||||
}
|
||||
else if (mp->flag & ME_FACE_SEL) {
|
||||
else if (mr->selection_poly && mr->selection_poly[mp_index]) {
|
||||
lnor_data->w = 1;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -667,17 +667,25 @@ void heat_bone_weighting(Object *ob,
|
|||
|
||||
/* (added selectedVerts content for vertex mask, they used to just equal 1) */
|
||||
if (use_vert_sel) {
|
||||
for (a = 0, mp = me->mpoly; a < me->totpoly; mp++, a++) {
|
||||
for (j = 0, ml = me->mloop + mp->loopstart; j < mp->totloop; j++, ml++) {
|
||||
mask[ml->v] = (mvert[ml->v].flag & SELECT) != 0;
|
||||
const bool *selection_vert = (const bool *)CustomData_get_layer_named(
|
||||
&me->vdata, CD_PROP_BOOL, ".selection_vert");
|
||||
if (selection_vert) {
|
||||
for (a = 0, mp = me->mpoly; a < me->totpoly; mp++, a++) {
|
||||
for (j = 0, ml = me->mloop + mp->loopstart; j < mp->totloop; j++, ml++) {
|
||||
mask[ml->v] = selection_vert[ml->v];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (use_face_sel) {
|
||||
for (a = 0, mp = me->mpoly; a < me->totpoly; mp++, a++) {
|
||||
if (mp->flag & ME_FACE_SEL) {
|
||||
for (j = 0, ml = me->mloop + mp->loopstart; j < mp->totloop; j++, ml++) {
|
||||
mask[ml->v] = 1;
|
||||
const bool *selection_poly = (const bool *)CustomData_get_layer_named(
|
||||
&me->pdata, CD_PROP_BOOL, ".selection_poly");
|
||||
if (selection_poly) {
|
||||
for (a = 0, mp = me->mpoly; a < me->totpoly; mp++, a++) {
|
||||
if (selection_poly[a]) {
|
||||
for (j = 0, ml = me->mloop + mp->loopstart; j < mp->totloop; j++, ml++) {
|
||||
mask[ml->v] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "BLI_math.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BKE_attribute.h"
|
||||
#include "BKE_attribute.hh"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_customdata.h"
|
||||
#include "BKE_editmesh.h"
|
||||
|
@ -888,16 +888,13 @@ static void mesh_add_verts(Mesh *mesh, int len)
|
|||
|
||||
BKE_mesh_runtime_clear_cache(mesh);
|
||||
|
||||
/* scan the input list and insert the new vertices */
|
||||
|
||||
/* set default flags */
|
||||
MVert *mvert = &mesh->mvert[mesh->totvert];
|
||||
for (int i = 0; i < len; i++, mvert++) {
|
||||
mvert->flag |= SELECT;
|
||||
}
|
||||
|
||||
/* set final vertex list size */
|
||||
mesh->totvert = totvert;
|
||||
|
||||
const bke::MutableAttributeAccessor attributes = bke::mesh_attributes_for_write(*mesh);
|
||||
const 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();
|
||||
}
|
||||
|
||||
static void mesh_add_edges(Mesh *mesh, int len)
|
||||
|
@ -929,10 +926,16 @@ static void mesh_add_edges(Mesh *mesh, int len)
|
|||
/* set default flags */
|
||||
medge = &mesh->medge[mesh->totedge];
|
||||
for (i = 0; i < len; i++, medge++) {
|
||||
medge->flag = ME_EDGEDRAW | ME_EDGERENDER | SELECT;
|
||||
medge->flag = ME_EDGEDRAW | ME_EDGERENDER;
|
||||
}
|
||||
|
||||
mesh->totedge = totedge;
|
||||
|
||||
const bke::MutableAttributeAccessor attributes = bke::mesh_attributes_for_write(*mesh);
|
||||
const 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();
|
||||
}
|
||||
|
||||
static void mesh_add_loops(Mesh *mesh, int len)
|
||||
|
@ -965,6 +968,7 @@ static void mesh_add_loops(Mesh *mesh, int len)
|
|||
|
||||
static void mesh_add_polys(Mesh *mesh, int len)
|
||||
{
|
||||
using namespace blender;
|
||||
CustomData pdata;
|
||||
MPoly *mpoly;
|
||||
int i, totpoly;
|
||||
|
@ -989,13 +993,14 @@ static void mesh_add_polys(Mesh *mesh, int len)
|
|||
|
||||
BKE_mesh_runtime_clear_cache(mesh);
|
||||
|
||||
/* set default flags */
|
||||
mpoly = &mesh->mpoly[mesh->totpoly];
|
||||
for (i = 0; i < len; i++, mpoly++) {
|
||||
mpoly->flag = ME_FACE_SEL;
|
||||
}
|
||||
|
||||
mesh->totpoly = totpoly;
|
||||
|
||||
/* TODO: Make selection optional. */
|
||||
const bke::MutableAttributeAccessor attributes = bke::mesh_attributes_for_write(*mesh);
|
||||
const 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();
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "RNA_prototypes.h"
|
||||
|
||||
#include "BKE_attribute.h"
|
||||
#include "BKE_attribute.hh"
|
||||
#include "BKE_brush.h"
|
||||
#include "BKE_colortools.h"
|
||||
#include "BKE_context.h"
|
||||
|
@ -1954,6 +1955,10 @@ static void do_wpaint_brush_blur_task_cb_ex(void *__restrict userdata,
|
|||
const float *sculpt_normal_frontface = SCULPT_brush_frontface_normal_from_falloff_shape(
|
||||
ss, data->brush->falloff_shape);
|
||||
|
||||
const blender::bke::AttributeAccessor attributes = blender::bke::mesh_attributes(*data->me);
|
||||
const blender::VArray<bool> selection_vert = attributes.lookup_or_default<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT, false);
|
||||
|
||||
/* For each vertex */
|
||||
PBVHVertexIter vd;
|
||||
BKE_pbvh_vertex_iter_begin (ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) {
|
||||
|
@ -1964,9 +1969,8 @@ static void do_wpaint_brush_blur_task_cb_ex(void *__restrict userdata,
|
|||
const int v_index = has_grids ? data->me->mloop[vd.grid_indices[vd.g]].v :
|
||||
vd.vert_indices[vd.i];
|
||||
const float grid_alpha = has_grids ? 1.0f / vd.gridsize : 1.0f;
|
||||
const char v_flag = data->me->mvert[v_index].flag;
|
||||
/* If the vertex is selected */
|
||||
if (!(use_face_sel || use_vert_sel) || v_flag & SELECT) {
|
||||
if (!(use_face_sel || use_vert_sel) || selection_vert[v_index]) {
|
||||
/* Get the average poly weight */
|
||||
int total_hit_loops = 0;
|
||||
float weight_final = 0.0f;
|
||||
|
@ -2042,6 +2046,10 @@ static void do_wpaint_brush_smear_task_cb_ex(void *__restrict userdata,
|
|||
sub_v3_v3v3(brush_dir, cache->location, cache->last_location);
|
||||
project_plane_v3_v3v3(brush_dir, brush_dir, cache->view_normal);
|
||||
|
||||
const blender::bke::AttributeAccessor attributes = blender::bke::mesh_attributes(*data->me);
|
||||
const blender::VArray<bool> selection_vert = attributes.lookup_or_default<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT, false);
|
||||
|
||||
if (cache->is_last_valid && (normalize_v3(brush_dir) != 0.0f)) {
|
||||
|
||||
SculptBrushTest test;
|
||||
|
@ -2063,7 +2071,7 @@ static void do_wpaint_brush_smear_task_cb_ex(void *__restrict userdata,
|
|||
const MVert *mv_curr = &data->me->mvert[v_index];
|
||||
|
||||
/* If the vertex is selected */
|
||||
if (!(use_face_sel || use_vert_sel) || mv_curr->flag & SELECT) {
|
||||
if (!(use_face_sel || use_vert_sel) || selection_vert[v_index]) {
|
||||
float brush_strength = cache->bstrength;
|
||||
const float angle_cos = (use_normal && vd.no) ?
|
||||
dot_v3v3(sculpt_normal_frontface, vd.no) :
|
||||
|
@ -2156,6 +2164,10 @@ static void do_wpaint_brush_draw_task_cb_ex(void *__restrict userdata,
|
|||
const float *sculpt_normal_frontface = SCULPT_brush_frontface_normal_from_falloff_shape(
|
||||
ss, data->brush->falloff_shape);
|
||||
|
||||
const blender::bke::AttributeAccessor attributes = blender::bke::mesh_attributes(*data->me);
|
||||
const blender::VArray<bool> selection_vert = attributes.lookup_or_default<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT, false);
|
||||
|
||||
/* For each vertex */
|
||||
PBVHVertexIter vd;
|
||||
BKE_pbvh_vertex_iter_begin (ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) {
|
||||
|
@ -2168,9 +2180,8 @@ static void do_wpaint_brush_draw_task_cb_ex(void *__restrict userdata,
|
|||
vd.vert_indices[vd.i];
|
||||
const float grid_alpha = has_grids ? 1.0f / vd.gridsize : 1.0f;
|
||||
|
||||
const char v_flag = data->me->mvert[v_index].flag;
|
||||
/* If the vertex is selected */
|
||||
if (!(use_face_sel || use_vert_sel) || v_flag & SELECT) {
|
||||
if (!(use_face_sel || use_vert_sel) || selection_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;
|
||||
|
@ -2223,6 +2234,10 @@ static void do_wpaint_brush_calc_average_weight_cb_ex(
|
|||
const float *sculpt_normal_frontface = SCULPT_brush_frontface_normal_from_falloff_shape(
|
||||
ss, data->brush->falloff_shape);
|
||||
|
||||
const blender::bke::AttributeAccessor attributes = blender::bke::mesh_attributes(*data->me);
|
||||
const blender::VArray<bool> selection_vert = attributes.lookup_or_default<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT, false);
|
||||
|
||||
/* For each vertex */
|
||||
PBVHVertexIter vd;
|
||||
BKE_pbvh_vertex_iter_begin (ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) {
|
||||
|
@ -2234,10 +2249,9 @@ static void do_wpaint_brush_calc_average_weight_cb_ex(
|
|||
BKE_brush_curve_strength(data->brush, sqrtf(test.dist), cache->radius) > 0.0) {
|
||||
const int v_index = has_grids ? data->me->mloop[vd.grid_indices[vd.g]].v :
|
||||
vd.vert_indices[vd.i];
|
||||
const char v_flag = data->me->mvert[v_index].flag;
|
||||
|
||||
/* If the vertex is selected. */
|
||||
if (!(use_face_sel || use_vert_sel) || v_flag & SELECT) {
|
||||
if (!(use_face_sel || use_vert_sel) || selection_vert[v_index]) {
|
||||
const MDeformVert *dv = &data->me->dvert[v_index];
|
||||
accum->len += 1;
|
||||
accum->value += wpaint_get_active_weight(dv, data->wpi);
|
||||
|
@ -2952,6 +2966,11 @@ 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 = bke::mesh_attributes(*me).lookup_or_default<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT, false);
|
||||
const blender::VArray<bool> selection_poly = bke::mesh_attributes(*me).lookup_or_default<bool>(
|
||||
".selection_poly", ATTR_DOMAIN_FACE, false);
|
||||
|
||||
blender::threading::parallel_for(IndexRange(totnode), 1LL, [&](IndexRange range) {
|
||||
for (int n : range) {
|
||||
const PBVHType pbvh_type = BKE_pbvh_type(ss->pbvh);
|
||||
|
@ -2983,10 +3002,9 @@ static void do_vpaint_brush_blur_loops(bContext *C,
|
|||
const int v_index = has_grids ? me->mloop[vd.grid_indices[vd.g]].v :
|
||||
vd.vert_indices[vd.i];
|
||||
const float grid_alpha = has_grids ? 1.0f / vd.gridsize : 1.0f;
|
||||
const MVert *mv = &me->mvert[v_index];
|
||||
|
||||
/* If the vertex is selected for painting. */
|
||||
if (!use_vert_sel || mv->flag & SELECT) {
|
||||
if (!use_vert_sel || selection_vert[v_index]) {
|
||||
float brush_strength = cache->bstrength;
|
||||
const float angle_cos = (use_normal && vd.no) ?
|
||||
dot_v3v3(sculpt_normal_frontface, vd.no) :
|
||||
|
@ -3007,7 +3025,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 = &me->mpoly[p_index];
|
||||
if (!use_face_sel || mp->flag & ME_FACE_SEL) {
|
||||
if (!use_face_sel || selection_poly[p_index]) {
|
||||
total_hit_loops += mp->totloop;
|
||||
for (int k = 0; k < mp->totloop; k++) {
|
||||
const uint l_index = mp->loopstart + k;
|
||||
|
@ -3042,7 +3060,7 @@ static void do_vpaint_brush_blur_loops(bContext *C,
|
|||
const int l_index = gmap->vert_to_loop[v_index].indices[j];
|
||||
BLI_assert(me->mloop[l_index].v == v_index);
|
||||
const MPoly *mp = &me->mpoly[p_index];
|
||||
if (!use_face_sel || mp->flag & ME_FACE_SEL) {
|
||||
if (!use_face_sel || selection_poly[p_index]) {
|
||||
Color color_orig(0, 0, 0, 0); /* unused when array is nullptr */
|
||||
|
||||
if (previous_color != nullptr) {
|
||||
|
@ -3094,6 +3112,11 @@ 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 = bke::mesh_attributes(*me).lookup_or_default<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT, false);
|
||||
const blender::VArray<bool> selection_poly = bke::mesh_attributes(*me).lookup_or_default<bool>(
|
||||
".selection_poly", ATTR_DOMAIN_FACE, false);
|
||||
|
||||
blender::threading::parallel_for(IndexRange(totnode), 1LL, [&](IndexRange range) {
|
||||
for (int n : range) {
|
||||
const PBVHType pbvh_type = BKE_pbvh_type(ss->pbvh);
|
||||
|
@ -3125,10 +3148,9 @@ static void do_vpaint_brush_blur_verts(bContext *C,
|
|||
const int v_index = has_grids ? me->mloop[vd.grid_indices[vd.g]].v :
|
||||
vd.vert_indices[vd.i];
|
||||
const float grid_alpha = has_grids ? 1.0f / vd.gridsize : 1.0f;
|
||||
const MVert *mv = &me->mvert[v_index];
|
||||
|
||||
/* If the vertex is selected for painting. */
|
||||
if (!use_vert_sel || mv->flag & SELECT) {
|
||||
if (!use_vert_sel || selection_vert[v_index]) {
|
||||
float brush_strength = cache->bstrength;
|
||||
const float angle_cos = (use_normal && vd.no) ?
|
||||
dot_v3v3(sculpt_normal_frontface, vd.no) :
|
||||
|
@ -3149,7 +3171,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 = &me->mpoly[p_index];
|
||||
if (!use_face_sel || mp->flag & ME_FACE_SEL) {
|
||||
if (!use_face_sel || selection_poly[p_index]) {
|
||||
total_hit_loops += mp->totloop;
|
||||
for (int k = 0; k < mp->totloop; k++) {
|
||||
const uint l_index = mp->loopstart + k;
|
||||
|
@ -3187,7 +3209,7 @@ static void do_vpaint_brush_blur_verts(bContext *C,
|
|||
BLI_assert(me->mloop[gmap->vert_to_loop[v_index].indices[j]].v == v_index);
|
||||
|
||||
const MPoly *mp = &me->mpoly[p_index];
|
||||
if (!use_face_sel || mp->flag & ME_FACE_SEL) {
|
||||
if (!use_face_sel || selection_poly[p_index]) {
|
||||
Color color_orig(0, 0, 0, 0); /* unused when array is nullptr */
|
||||
|
||||
if (previous_color != nullptr) {
|
||||
|
@ -3243,6 +3265,11 @@ 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 = bke::mesh_attributes(*me).lookup_or_default<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT, false);
|
||||
const blender::VArray<bool> selection_poly = bke::mesh_attributes(*me).lookup_or_default<bool>(
|
||||
".selection_poly", ATTR_DOMAIN_FACE, false);
|
||||
|
||||
blender::threading::parallel_for(IndexRange(totnode), 1LL, [&](IndexRange range) {
|
||||
for (int n : range) {
|
||||
float brush_size_pressure, brush_alpha_value, brush_alpha_pressure;
|
||||
|
@ -3279,7 +3306,7 @@ static void do_vpaint_brush_smear(bContext *C,
|
|||
const MVert *mv_curr = &me->mvert[v_index];
|
||||
|
||||
/* if the vertex is selected for painting. */
|
||||
if (!use_vert_sel || mv_curr->flag & SELECT) {
|
||||
if (!use_vert_sel || selection_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;
|
||||
|
@ -3308,7 +3335,7 @@ static void do_vpaint_brush_smear(bContext *C,
|
|||
BLI_assert(me->mloop[l_index].v == v_index);
|
||||
UNUSED_VARS_NDEBUG(l_index);
|
||||
const MPoly *mp = &me->mpoly[p_index];
|
||||
if (!use_face_sel || mp->flag & ME_FACE_SEL) {
|
||||
if (!use_face_sel || selection_poly[p_index]) {
|
||||
const MLoop *ml_other = &me->mloop[mp->loopstart];
|
||||
for (int k = 0; k < mp->totloop; k++, ml_other++) {
|
||||
const uint v_other_index = ml_other->v;
|
||||
|
@ -3363,7 +3390,7 @@ static void do_vpaint_brush_smear(bContext *C,
|
|||
}
|
||||
|
||||
const MPoly *mp = &me->mpoly[p_index];
|
||||
if (!use_face_sel || mp->flag & ME_FACE_SEL) {
|
||||
if (!use_face_sel || selection_poly[p_index]) {
|
||||
/* Get the previous element color */
|
||||
Color color_orig(0, 0, 0, 0); /* unused when array is nullptr */
|
||||
|
||||
|
@ -3409,6 +3436,9 @@ static void calculate_average_color(VPaintData<Color, Traits, domain> *vpd,
|
|||
{
|
||||
using Blend = typename Traits::BlendType;
|
||||
|
||||
const blender::VArray<bool> selection_vert = bke::mesh_attributes(*me).lookup_or_default<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT, false);
|
||||
|
||||
VPaintAverageAccum<Blend> *accum = (VPaintAverageAccum<Blend> *)MEM_mallocN(
|
||||
sizeof(*accum) * totnode, __func__);
|
||||
blender::threading::parallel_for(IndexRange(totnode), 1LL, [&](IndexRange range) {
|
||||
|
@ -3439,8 +3469,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. */
|
||||
const MVert *mv = &me->mvert[v_index];
|
||||
if (!use_vert_sel || mv->flag & SELECT) {
|
||||
if (!use_vert_sel || selection_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++) {
|
||||
|
@ -3525,6 +3554,11 @@ static void vpaint_do_draw(bContext *C,
|
|||
|
||||
Color *previous_color = static_cast<Color *>(ss->cache->prev_colors_vpaint);
|
||||
|
||||
const blender::VArray<bool> selection_vert = bke::mesh_attributes(*me).lookup_or_default<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT, false);
|
||||
const blender::VArray<bool> selection_poly = bke::mesh_attributes(*me).lookup_or_default<bool>(
|
||||
".selection_poly", ATTR_DOMAIN_FACE, false);
|
||||
|
||||
blender::threading::parallel_for(IndexRange(totnode), 1LL, [&](IndexRange range) {
|
||||
for (int n : range) {
|
||||
const bool has_grids = (pbvh_type == PBVH_GRIDS);
|
||||
|
@ -3558,10 +3592,9 @@ static void vpaint_do_draw(bContext *C,
|
|||
const int v_index = has_grids ? me->mloop[vd.grid_indices[vd.g]].v :
|
||||
vd.vert_indices[vd.i];
|
||||
const float grid_alpha = has_grids ? 1.0f / vd.gridsize : 1.0f;
|
||||
const MVert *mv = &me->mvert[v_index];
|
||||
|
||||
/* If the vertex is selected for painting. */
|
||||
if (!use_vert_sel || mv->flag & SELECT) {
|
||||
if (!use_vert_sel || selection_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;
|
||||
|
@ -3614,7 +3647,7 @@ static void vpaint_do_draw(bContext *C,
|
|||
const int l_index = gmap->vert_to_loop[v_index].indices[j];
|
||||
BLI_assert(me->mloop[l_index].v == v_index);
|
||||
const MPoly *mp = &me->mpoly[p_index];
|
||||
if (!use_face_sel || mp->flag & ME_FACE_SEL) {
|
||||
if (!use_face_sel || selection_poly[p_index]) {
|
||||
Color color_orig = Color(0, 0, 0, 0); /* unused when array is nullptr */
|
||||
|
||||
if (previous_color != nullptr) {
|
||||
|
@ -4041,6 +4074,11 @@ static bool vertex_color_set(Object *ob, ColorPaint4f paintcol_in, CustomDataLay
|
|||
return false;
|
||||
}
|
||||
|
||||
const blender::VArray<bool> selection_vert = bke::mesh_attributes(*me).lookup_or_default<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT, false);
|
||||
const blender::VArray<bool> selection_poly = bke::mesh_attributes(*me).lookup_or_default<bool>(
|
||||
".selection_poly", ATTR_DOMAIN_FACE, false);
|
||||
|
||||
Color paintcol = fromFloat<Color>(paintcol_in);
|
||||
|
||||
const bool use_face_sel = (me->editflag & ME_EDIT_PAINT_FACE_SEL) != 0;
|
||||
|
@ -4087,7 +4125,7 @@ static bool vertex_color_set(Object *ob, ColorPaint4f paintcol_in, CustomDataLay
|
|||
|
||||
const MPoly *mp = me->mpoly;
|
||||
for (int i = 0; i < me->totpoly; i++, mp++) {
|
||||
if (use_face_sel && !(mp->flag & ME_FACE_SEL)) {
|
||||
if (use_face_sel && !selection_poly[i]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -4095,7 +4133,7 @@ static bool vertex_color_set(Object *ob, ColorPaint4f paintcol_in, CustomDataLay
|
|||
do {
|
||||
uint vidx = me->mloop[mp->loopstart + j].v;
|
||||
|
||||
if (!(use_vert_sel && !(me->mvert[vidx].flag & SELECT))) {
|
||||
if (!(use_vert_sel && !(selection_vert[vidx]))) {
|
||||
if constexpr (domain == ATTR_DOMAIN_CORNER) {
|
||||
color_layer[mp->loopstart + j] = paintcol;
|
||||
}
|
||||
|
|
|
@ -165,23 +165,16 @@ static IndexMask get_selected_indices(const Mesh &mesh,
|
|||
bke::AttributeAccessor attributes = bke::mesh_attributes(mesh);
|
||||
|
||||
if (mesh.editflag & ME_EDIT_PAINT_FACE_SEL) {
|
||||
const VArray<bool> selection = attributes.adapt_domain(
|
||||
VArray<bool>::ForFunc(faces.size(),
|
||||
[&](const int i) { return faces[i].flag & ME_FACE_SEL; }),
|
||||
ATTR_DOMAIN_FACE,
|
||||
domain);
|
||||
|
||||
const VArray<bool> selection = attributes.lookup_or_default<bool>(
|
||||
".selection_poly", ATTR_DOMAIN_FACE, false);
|
||||
return index_mask_ops::find_indices_from_virtual_array(
|
||||
IndexMask(attributes.domain_size(domain)), selection, 4096, indices);
|
||||
selection.index_range(), selection, 4096, indices);
|
||||
}
|
||||
if (mesh.editflag & ME_EDIT_PAINT_VERT_SEL) {
|
||||
const VArray<bool> selection = attributes.adapt_domain(
|
||||
VArray<bool>::ForFunc(verts.size(), [&](const int i) { return verts[i].flag & SELECT; }),
|
||||
ATTR_DOMAIN_POINT,
|
||||
domain);
|
||||
|
||||
const VArray<bool> selection = attributes.lookup_or_default<bool>(
|
||||
".selection_vert", ATTR_DOMAIN_POINT, false);
|
||||
return index_mask_ops::find_indices_from_virtual_array(
|
||||
IndexMask(attributes.domain_size(domain)), selection, 4096, indices);
|
||||
selection.index_range(), selection, 4096, indices);
|
||||
}
|
||||
return IndexMask(attributes.domain_size(domain));
|
||||
}
|
||||
|
|
|
@ -455,10 +455,15 @@ static bool weight_paint_set(Object *ob, float paintweight)
|
|||
struct WPaintPrev wpp;
|
||||
wpaint_prev_create(&wpp, me->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");
|
||||
|
||||
for (index = 0, mp = me->mpoly; index < me->totpoly; index++, mp++) {
|
||||
uint fidx = mp->totloop - 1;
|
||||
|
||||
if ((paint_selmode == SCE_SELECT_FACE) && !(mp->flag & ME_FACE_SEL)) {
|
||||
if ((paint_selmode == SCE_SELECT_FACE) && !(selection_poly && selection_poly[index])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -466,7 +471,7 @@ static bool weight_paint_set(Object *ob, float paintweight)
|
|||
uint vidx = me->mloop[mp->loopstart + fidx].v;
|
||||
|
||||
if (!me->dvert[vidx].flag) {
|
||||
if ((paint_selmode == SCE_SELECT_VERTEX) && !(me->mvert[vidx].flag & SELECT)) {
|
||||
if ((paint_selmode == SCE_SELECT_VERTEX) && !(selection_vert && selection_vert[vidx])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -574,6 +579,7 @@ typedef struct WPGradient_userData {
|
|||
struct ARegion *region;
|
||||
Scene *scene;
|
||||
Mesh *me;
|
||||
const bool *selection_vert;
|
||||
Brush *brush;
|
||||
const float *sco_start; /* [2] */
|
||||
const float *sco_end; /* [2] */
|
||||
|
@ -672,7 +678,7 @@ static void gradientVertInit__mapFunc(void *userData,
|
|||
Mesh *me = grad_data->me;
|
||||
WPGradient_vertStore *vs = &grad_data->vert_cache->elem[index];
|
||||
|
||||
if (grad_data->use_select && !(me->mvert[index].flag & SELECT)) {
|
||||
if (grad_data->use_select && !(grad_data->selection_vert && grad_data->selection_vert[index])) {
|
||||
copy_v2_fl(vs->sco, FLT_MAX);
|
||||
return;
|
||||
}
|
||||
|
@ -797,6 +803,8 @@ static int paint_weight_gradient_exec(bContext *C, wmOperator *op)
|
|||
data.region = region;
|
||||
data.scene = scene;
|
||||
data.me = ob->data;
|
||||
data.selection_vert = (const bool *)CustomData_get_layer_named(
|
||||
&me->vdata, CD_PROP_BOOL, ".selection_vert");
|
||||
data.sco_start = sco_start;
|
||||
data.sco_end = sco_end;
|
||||
data.sco_line_div = 1.0f / len_v2v2(sco_start, sco_end);
|
||||
|
|
|
@ -296,7 +296,7 @@ void OBJMesh::store_uv_coords_and_indices()
|
|||
const float limit[2] = {STD_UV_CONNECT_LIMIT, STD_UV_CONNECT_LIMIT};
|
||||
|
||||
UvVertMap *uv_vert_map = BKE_mesh_uv_vert_map_create(
|
||||
mpoly, nullptr, mloop, mloopuv, totpoly, totvert, limit, false, false);
|
||||
mpoly, nullptr, nullptr, mloop, mloopuv, totpoly, totvert, limit, false, false);
|
||||
|
||||
uv_indices_.resize(totpoly);
|
||||
/* At least total vertices of a mesh will be present in its texture map. So
|
||||
|
|
Loading…
Reference in New Issue