[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [57311] trunk/blender/source/blender/ editors/sculpt_paint/sculpt.c: Fix #35638: Object disappears when rotating after using the simplify brush

Sergey Sharybin sergey.vfx at gmail.com
Sun Jun 9 14:53:18 CEST 2013


Revision: 57311
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=57311
Author:   nazgul
Date:     2013-06-09 12:53:17 +0000 (Sun, 09 Jun 2013)
Log Message:
-----------
Fix #35638: Object disappears when rotating after using the simplify brush

Modified Paths:
--------------
    trunk/blender/source/blender/editors/sculpt_paint/sculpt.c

Modified: trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/sculpt.c	2013-06-09 12:33:28 UTC (rev 57310)
+++ trunk/blender/source/blender/editors/sculpt_paint/sculpt.c	2013-06-09 12:53:17 UTC (rev 57311)
@@ -120,7 +120,7 @@
 
 void ED_sculpt_get_average_stroke(Object *ob, float stroke[3])
 {
-	if (ob->sculpt->last_stroke_valid) {
+	if (ob->sculpt->last_stroke_valid && ob->sculpt->average_stroke_counter > 0) {
 		float fac = 1.0f / ob->sculpt->average_stroke_counter;
 		mul_v3_v3fl(stroke, ob->sculpt->average_stroke_accum, fac);
 	}
@@ -2980,6 +2980,7 @@
 	/* Only act if some verts are inside the brush area */
 	if (totnode) {
 		PBVHTopologyUpdateMode mode = PBVH_Subdivide;
+		float location[3];
 
 		if ((sd->flags & SCULPT_DYNTOPO_COLLAPSE) ||
 			(brush->sculpt_tool == SCULPT_TOOL_SIMPLIFY))
@@ -3006,6 +3007,13 @@
 		}
 
 		MEM_freeN(nodes);
+
+		/* update average stroke position */
+		copy_v3_v3(location, ss->cache->true_location);
+		mul_m4_v3(ob->obmat, location);
+
+		add_v3_v3(ob->sculpt->average_stroke_accum, location);
+		ob->sculpt->average_stroke_counter++;
 	}
 }
 




More information about the Bf-blender-cvs mailing list