[Bf-blender-cvs] [c44a203aa73] blender2.8: Texture Paint: fix fast selection update to also work without modifiers.

Alexander Gavrilov noreply at git.blender.org
Sun Dec 2 18:06:50 CET 2018


Commit: c44a203aa7379b8da73ef6a4ac9aa05198e22fa1
Author: Alexander Gavrilov
Date:   Sun Dec 2 19:59:57 2018 +0300
Branches: blender2.8
https://developer.blender.org/rBc44a203aa7379b8da73ef6a4ac9aa05198e22fa1

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.

===================================================================

M	source/blender/editors/mesh/editface.c

===================================================================

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;



More information about the Bf-blender-cvs mailing list