Texture Paint: avoid rebuilding evaluated mesh on first stroke.

Ensure all relevant CustomDataMask bits are set during normal evaluation.
This commit is contained in:
Alexander Gavrilov 2018-12-01 12:12:18 +03:00
parent 32d46f7de6
commit bfcd25b313
1 changed files with 8 additions and 3 deletions

View File

@ -2007,6 +2007,11 @@ static void mesh_build_data(
BKE_object_free_derived_caches(ob);
BKE_object_sculpt_modifiers_changed(ob);
if (need_mapping) {
/* Also add the flag so that it is recorded in lastDataMask. */
dataMask |= CD_MASK_ORIGINDEX;
}
mesh_calc_modifiers(
depsgraph, scene, ob, NULL, 1, need_mapping, dataMask, -1, true, build_shapekey_layers,
&ob->runtime.mesh_deform_eval, &ob->runtime.mesh_eval);
@ -2078,7 +2083,7 @@ static CustomDataMask object_get_datamask(const Depsgraph *depsgraph, Object *ob
}
if (DEG_get_original_object(ob) == actob) {
bool editing = BKE_paint_select_face_test(ob);
bool editing = BKE_paint_select_face_test(actob);
/* weight paint and face select need original indices because of selection buffer drawing */
if (r_need_mapping) {
@ -2087,7 +2092,7 @@ static CustomDataMask object_get_datamask(const Depsgraph *depsgraph, Object *ob
/* check if we need tfaces & mcols due to face select or texture paint */
if ((ob->mode & OB_MODE_TEXTURE_PAINT) || editing) {
mask |= CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL;
mask |= CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL | CD_MASK_MTFACE;
}
/* check if we need mcols due to vertex paint or weightpaint */
@ -2156,7 +2161,7 @@ Mesh *mesh_get_eval_final(
if (!ob->runtime.mesh_eval ||
((dataMask & ob->lastDataMask) != dataMask) ||
(need_mapping != ob->lastNeedMapping))
(need_mapping && !ob->lastNeedMapping))
{
mesh_build_data(depsgraph, scene, ob, dataMask, false, need_mapping);
}