diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2018-12-02 19:59:57 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2018-12-02 20:05:53 +0300 |
commit | c44a203aa7379b8da73ef6a4ac9aa05198e22fa1 (patch) | |
tree | 430107bab51e719a48c3490b6c682b08bfa76dc0 | |
parent | 4ee29d3fdfffdefa670b28a4f909ab29e5f54b98 (diff) |
Texture Paint: fix fast selection update to also work without modifiers.
If there are no (non-deform) modifiers, the evaluated mesh simply
shares arrays with the base COW copy instead of having CD_ORIGINDEX.
-rw-r--r-- | source/blender/editors/mesh/editface.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index 8be0105463e..7cfd00d8d8c 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -89,13 +89,22 @@ void paintface_flush_flags(struct bContext *C, Object *ob, short flag) return; } + Mesh *me_orig = ob_eval->runtime.mesh_orig; Mesh *me_eval = ob_eval->runtime.mesh_eval; bool updated = false; - if (me_eval != NULL) { - /* Mesh polys => Final derived polys */ + if (me_orig != NULL && me_eval != NULL && me_orig->totpoly == me->totpoly) { + /* Update the COW copy of the mesh. */ + for (i = 0; i < me->totpoly; i++) { + me_orig->mpoly[i].flag = me->mpoly[i].flag; + } - if ((index_array = CustomData_get_layer(&me_eval->pdata, CD_ORIGINDEX))) { + /* If the mesh has only deform modifiers, the evaluated mesh shares arrays. */ + if (me_eval->mpoly == me_orig->mpoly) { + updated = true; + } + /* Mesh polys => Final derived polys */ + else if ((index_array = CustomData_get_layer(&me_eval->pdata, CD_ORIGINDEX))) { polys = me_eval->mpoly; totpoly = me_eval->totpoly; |