[Bf-blender-cvs] [ad87d47] master: Fix T39978: Sculpting shapekeys - Using Smooth tool, turns shapekey into Basis.

Sergey Sharybin noreply at git.blender.org
Thu May 15 17:46:48 CEST 2014


Commit: ad87d47fdb7f394219848ea66d55ce71c616821f
Author: Sergey Sharybin
Date:   Thu May 15 17:45:35 2014 +0200
https://developer.blender.org/rBad87d47fdb7f394219848ea66d55ce71c616821f

Fix T39978: Sculpting shapekeys - Using Smooth tool, turns shapekey into Basis.

Smooth brush requires deformed coordinates array to present.

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

M	source/blender/blenkernel/intern/paint.c

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

diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index 1b8c4e0..24616d88 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -658,14 +658,28 @@ void BKE_sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob,
 		BKE_free_sculptsession_deformMats(ss);
 	}
 
-	/* if pbvh is deformed, key block is already applied to it */
-	if (ss->kb && !BKE_pbvh_isDeformed(ss->pbvh)) {
-		float (*vertCos)[3] = BKE_key_convert_to_vertcos(ob, ss->kb);
+	if (ss->kb != NULL && ss->deform_cos == NULL) {
+		ss->deform_cos = BKE_key_convert_to_vertcos(ob, ss->kb);
+	}
 
-		if (vertCos) {
-			/* apply shape keys coordinates to PBVH */
-			BKE_pbvh_apply_vertCos(ss->pbvh, vertCos);
-			MEM_freeN(vertCos);
+	/* if pbvh is deformed, key block is already applied to it */
+	if (ss->kb) {
+		bool pbvh_deformd = BKE_pbvh_isDeformed(ss->pbvh);
+		if (!pbvh_deformd || ss->deform_cos == NULL) {
+			float (*vertCos)[3] = BKE_key_convert_to_vertcos(ob, ss->kb);
+
+			if (vertCos) {
+				if (!pbvh_deformd) {
+					/* apply shape keys coordinates to PBVH */
+					BKE_pbvh_apply_vertCos(ss->pbvh, vertCos);
+				}
+				if (ss->deform_cos == NULL) {
+					ss->deform_cos = vertCos;
+				}
+				if (vertCos != ss->deform_cos) {
+					MEM_freeN(vertCos);
+				}
+			}
 		}
 	}
 }




More information about the Bf-blender-cvs mailing list