Fix T77763: Wrong highlight of active grab vertex

The "Grab Active Vertex" in sculpt mode highlights the vertex and
the neighbor vertices. This was working wrong in the case when mesh
has multires modifier at sculpt level 0 and has shape keys.

The issue was caused by the wrong crazy space calculation, which was
ignoring subdivision level. This is an oversight from the initial
implementation: the modifier has no effect if the subdivision level
is 0.
This commit is contained in:
Sergey Sharybin 2020-09-07 16:56:41 +02:00
parent 231d08cbb1
commit 179bd1ea7d
Notes: blender-bot 2023-02-14 08:33:26 +01:00
Referenced by issue #77763, Sculpt Mode brushes target wrong points on multires level 0 when using shapekeys
1 changed files with 9 additions and 1 deletions

View File

@ -296,7 +296,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
}
static void deformMatrices(ModifierData *md,
const ModifierEvalContext *UNUSED(ctx),
const ModifierEvalContext *ctx,
Mesh *mesh,
float (*vertex_cos)[3],
float (*deform_matrices)[3][3],
@ -312,11 +312,19 @@ static void deformMatrices(ModifierData *md,
(void)deform_matrices;
MultiresModifierData *mmd = (MultiresModifierData *)md;
SubdivSettings subdiv_settings;
BKE_multires_subdiv_settings_init(&subdiv_settings, mmd);
if (subdiv_settings.level == 0) {
return;
}
SubdivToCCGSettings ccg_settings;
multires_ccg_settings_init(&ccg_settings, mmd, ctx, mesh);
if (ccg_settings.resolution < 3) {
return;
}
BKE_subdiv_settings_validate_for_mesh(&subdiv_settings, mesh);
MultiresRuntimeData *runtime_data = multires_ensure_runtime(mmd);
Subdiv *subdiv = subdiv_descriptor_ensure(mmd, &subdiv_settings, mesh);