Merge branch 'blender-v2.83-release'

This commit is contained in:
Pablo Dobarro 2020-04-20 02:19:42 +02:00
commit 9776b8a05e
8 changed files with 40 additions and 10 deletions

@ -1 +1 @@
Subproject commit ab7daecbb2dfe5fe8b0110bb92cd195d98c29649
Subproject commit f12430cae606db8aeeb72f99fe15ebbd71d4a92c

View File

@ -294,10 +294,15 @@ typedef struct SculptSession {
struct MultiresModifierData *modifier;
int level;
} multires;
/* These are always assigned to base mesh data when using PBVH_FACES and PBVH_GRIDS. */
struct MVert *mvert;
struct MPoly *mpoly;
struct MLoop *mloop;
/* These contain the vertex and poly counts of the final mesh. */
int totvert, totpoly;
struct KeyBlock *shapekey_active;
float *vmask;
@ -306,6 +311,7 @@ typedef struct SculptSession {
int *pmap_mem;
/* Mesh Face Sets */
/* Total number of polys of the base mesh. */
int totfaces;
int *face_sets;

View File

@ -1514,9 +1514,12 @@ static void sculpt_update_object(
ss->totvert = me_eval->totvert;
ss->totpoly = me_eval->totpoly;
ss->totfaces = me->totpoly;
ss->mvert = NULL;
ss->mpoly = NULL;
ss->mloop = NULL;
/* These are assigned to the base mesh in Multires. This is needed because Face Sets operators
* and tools use the Face Sets data from the base mesh when Multires is active. */
ss->mvert = me->mvert;
ss->mpoly = me->mpoly;
ss->mloop = me->mloop;
}
else {
ss->totvert = me->totvert;
@ -1851,7 +1854,7 @@ static PBVH *build_pbvh_from_ccg(Object *ob, SubdivCCG *subdiv_ccg)
subdiv_ccg->grid_flag_mats,
subdiv_ccg->grid_hidden);
pbvh_show_mask_set(pbvh, ob->sculpt->show_mask);
pbvh_show_face_sets_set(pbvh, false);
pbvh_show_face_sets_set(pbvh, ob->sculpt->show_face_sets);
return pbvh;
}

View File

@ -2958,7 +2958,7 @@ bool pbvh_has_face_sets(PBVH *bvh)
{
switch (bvh->type) {
case PBVH_GRIDS:
return false;
return (bvh->pdata && CustomData_get_layer(bvh->pdata, CD_SCULPT_FACE_SETS));
case PBVH_FACES:
return (bvh->pdata && CustomData_get_layer(bvh->pdata, CD_SCULPT_FACE_SETS));
case PBVH_BMESH:

View File

@ -223,7 +223,16 @@ static void mesh_filter_task_cb(void *__restrict userdata,
if (ss->filter_cache->active_face_set != SCULPT_FACE_SET_NONE) {
if (!SCULPT_vertex_has_face_set(ss, vd.index, ss->filter_cache->active_face_set)) {
continue;
/* Surface Smooth can't skip the loop for this vertex as it needs to calculate its
* laplacian_disp. This value is accessed from the vertex neighbors when deforming the
* vertices, so it is needed for all vertices even if they are not going to be displaced.
*/
if (filter_type == MESH_FILTER_SURFACE_SMOOTH) {
fade = 0.0f;
}
else {
continue;
}
}
/* Skip the edges of the face set when relaxing or smoothing.
* There is a relax face set option to relax the boundaries independently. */
@ -429,6 +438,13 @@ static void mesh_filter_surface_smooth_displace_task_cb(
if (fade == 0.0f) {
continue;
}
if (ss->filter_cache->active_face_set != SCULPT_FACE_SET_NONE) {
if (!SCULPT_vertex_has_face_set(ss, vd.index, ss->filter_cache->active_face_set)) {
continue;
}
}
SCULPT_surface_smooth_displace_step(ss,
vd.co,
ss->filter_cache->surface_smooth_laplacian_disp,

View File

@ -315,7 +315,7 @@ static void do_smooth_brush_bmesh_task_cb_ex(void *__restrict userdata,
vd.index,
tls->thread_id);
if (smooth_mask) {
float val = SCULPT_neighbor_mask_average(ss, vd.vert_indices[vd.i]) - *vd.mask;
float val = SCULPT_neighbor_mask_average(ss, vd.index) - *vd.mask;
val *= fade * bstrength;
*vd.mask += val;
CLAMP(*vd.mask, 0.0f, 1.0f);
@ -533,6 +533,9 @@ static void SCULPT_do_surface_smooth_brush_laplacian_task_cb_ex(
orig_data.co,
alpha);
madd_v3_v3fl(vd.co, disp, clamp_f(fade, 0.0f, 1.0f));
if (vd.mvert) {
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
}
}
BKE_pbvh_vertex_iter_end;
}

View File

@ -691,6 +691,8 @@ void GPU_pbvh_grid_buffers_update(GPU_PBVH_Buffers *buffers,
{
const bool show_mask = (update_flags & GPU_PBVH_BUFFERS_SHOW_MASK) != 0;
const bool show_vcol = (update_flags & GPU_PBVH_BUFFERS_SHOW_VCOL) != 0;
const bool show_face_sets = sculpt_face_sets &&
(update_flags & GPU_PBVH_BUFFERS_SHOW_SCULPT_FACE_SETS) != 0;
bool empty_mask = true;
bool default_face_set = true;
@ -738,7 +740,7 @@ void GPU_pbvh_grid_buffers_update(GPU_PBVH_Buffers *buffers,
uchar face_set_color[4] = {UCHAR_MAX, UCHAR_MAX, UCHAR_MAX, UCHAR_MAX};
if (subdiv_ccg && sculpt_face_sets) {
if (show_face_sets && subdiv_ccg && sculpt_face_sets) {
const int face_index = BKE_subdiv_cgg_grid_to_face_index(subdiv_ccg, grid_index);
const int fset = abs(sculpt_face_sets[face_index]);

@ -1 +1 @@
Subproject commit 35dd27ded664b1068e773c27988ee221f3ce39d9
Subproject commit 8a36c2833db48ed78c436ee19534ce5cf3b2eeee