Merge branch 'blender-v2.91-release'

This commit is contained in:
Pablo Dobarro
2020-11-05 23:42:11 +01:00
4 changed files with 34 additions and 8 deletions

View File

@@ -42,6 +42,7 @@
#include "BKE_brush.h"
#include "BKE_ccg.h"
#include "BKE_context.h"
#include "BKE_lib_id.h"
#include "BKE_mesh.h"
#include "BKE_multires.h"
#include "BKE_paint.h"
@@ -993,7 +994,7 @@ static void sculpt_gesture_trim_normals_update(SculptGestureContext *sgcontext)
}),
trim_mesh);
BM_mesh_free(bm);
BKE_mesh_free(trim_mesh);
BKE_id_free(NULL, trim_mesh);
trim_operation->mesh = result;
}
@@ -1207,7 +1208,7 @@ static void sculpt_gesture_trim_geometry_generate(SculptGestureContext *sgcontex
static void sculpt_gesture_trim_geometry_free(SculptGestureContext *sgcontext)
{
SculptGestureTrimOperation *trim_operation = (SculptGestureTrimOperation *)sgcontext->operation;
BKE_mesh_free(trim_operation->mesh);
BKE_id_free(NULL, trim_operation->mesh);
MEM_freeN(trim_operation->true_mesh_co);
}
@@ -1218,7 +1219,6 @@ static int bm_face_isect_pair(BMFace *f, void *UNUSED(user_data))
static void sculpt_gesture_apply_trim(SculptGestureContext *sgcontext)
{
SculptGestureTrimOperation *trim_operation = (SculptGestureTrimOperation *)sgcontext->operation;
Mesh *sculpt_mesh = BKE_mesh_from_object(sgcontext->vc.obact);
Mesh *trim_mesh = trim_operation->mesh;
@@ -1296,12 +1296,17 @@ static void sculpt_gesture_apply_trim(SculptGestureContext *sgcontext)
BM_mesh_boolean(bm, looptris, tottri, bm_face_isect_pair, NULL, 2, true, boolean_mode);
}
Mesh *result = BKE_mesh_from_bmesh_for_eval_nomain(bm, NULL, sculpt_mesh);
MEM_freeN(looptris);
Mesh *result = BKE_mesh_from_bmesh_nomain(bm,
(&(struct BMeshToMeshParams){
.calc_object_remap = false,
}),
sculpt_mesh);
BM_mesh_free(bm);
result->runtime.cd_dirty_vert |= CD_MASK_NORMAL;
BKE_mesh_nomain_to_mesh(result, sculpt_mesh, sgcontext->vc.obact, &CD_MASK_MESH, true);
BKE_mesh_free(result);
BKE_mesh_nomain_to_mesh(
result, sgcontext->vc.obact->data, sgcontext->vc.obact, &CD_MASK_MESH, true);
}
static void sculpt_gesture_trim_begin(bContext *C, SculptGestureContext *sgcontext)

View File

@@ -298,6 +298,21 @@ void SCULPT_active_vertex_normal_get(SculptSession *ss, float normal[3])
SCULPT_vertex_normal_get(ss, SCULPT_active_vertex_get(ss), normal);
}
MVert *SCULPT_mesh_deformed_mverts_get(SculptSession *ss)
{
switch (BKE_pbvh_type(ss->pbvh)) {
case PBVH_FACES:
if (ss->shapekey_active || ss->deform_modifiers_active) {
return BKE_pbvh_get_verts(ss->pbvh);
}
return ss->mvert;
case PBVH_BMESH:
case PBVH_GRIDS:
return NULL;
}
return NULL;
}
float *SCULPT_brush_deform_target_vertex_co_get(SculptSession *ss,
const int deform_target,
PBVHVertexIter *iter)

View File

@@ -132,6 +132,8 @@ static void do_draw_face_sets_brush_task_cb_ex(void *__restrict userdata,
ss, &test, data->brush->falloff_shape);
const int thread_id = BLI_task_parallel_thread_id(tls);
MVert *mvert = SCULPT_mesh_deformed_mverts_get(ss);
BKE_pbvh_vertex_iter_begin(ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE)
{
if (BKE_pbvh_type(ss->pbvh) == PBVH_FACES) {
@@ -140,7 +142,7 @@ static void do_draw_face_sets_brush_task_cb_ex(void *__restrict userdata,
const MPoly *p = &ss->mpoly[vert_map->indices[j]];
float poly_center[3];
BKE_mesh_calc_poly_center(p, &ss->mloop[p->loopstart], ss->mvert, poly_center);
BKE_mesh_calc_poly_center(p, &ss->mloop[p->loopstart], mvert, poly_center);
if (sculpt_brush_test_sq_fn(&test, poly_center)) {
const float fade = bstrength * SCULPT_brush_strength_factor(ss,

View File

@@ -170,6 +170,10 @@ int SCULPT_active_vertex_get(SculptSession *ss);
const float *SCULPT_active_vertex_co_get(SculptSession *ss);
void SCULPT_active_vertex_normal_get(SculptSession *ss, float normal[3]);
/* Returns PBVH deformed vertices array if shape keys or deform modifiers are used, otherwise
* returns mesh original vertices array. */
struct MVert *SCULPT_mesh_deformed_mverts_get(SculptSession *ss);
/* Fake Neighbors */
#define FAKE_NEIGHBOR_NONE -1