[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34847] trunk/blender/source/blender/ editors/sculpt_paint/sculpt.c: Previous commit to small optimization of sculpting broke smooth and layer

Sergey Sharybin g.ulairi at gmail.com
Mon Feb 14 17:54:52 CET 2011


Revision: 34847
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=34847
Author:   nazgul
Date:     2011-02-14 16:54:52 +0000 (Mon, 14 Feb 2011)
Log Message:
-----------
Previous commit to small optimization of sculpting broke smooth and layer
brushes. They aren't using proxies, so deformation wouldn't be propagated
in sculpt_combine_proxies().

So, maye idea of getting rid of "extra" memory allocaiton/disposing was not
such cool due to it lead to such exception ways?

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	2011-02-14 16:06:15 UTC (rev 34846)
+++ trunk/blender/source/blender/editors/sculpt_paint/sculpt.c	2011-02-14 16:54:52 UTC (rev 34847)
@@ -2446,12 +2446,35 @@
 }
 
 /* flush displacement from deformed PBVH to original layer */
-static void sculpt_flush_stroke_deform(SculptSession *ss)
+static void sculpt_flush_stroke_deform(Sculpt *sd, SculptSession *ss)
 {
 	if(!ss->kb) {
 		Object *ob= ss->ob;
 		Mesh *me= (Mesh*)ob->data;
+		Brush *brush= paint_brush(&sd->paint);
 
+		if(ELEM(brush->sculpt_tool, SCULPT_TOOL_SMOOTH, SCULPT_TOOL_LAYER)) {
+			/* this brushes aren't using proxies, so sculpt_combine_proxies() wouldn't
+			   propagate needed deformation to original base */
+
+			int n, totnode;
+			PBVHNode** nodes;
+			PBVHVertexIter vd;
+
+			BLI_pbvh_search_gather(ss->pbvh, NULL, NULL, &nodes, &totnode);
+
+			#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
+			for (n= 0; n < totnode; n++) {
+
+				BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
+					sculpt_flush_pbvhvert_deform(ss, &vd);
+				}
+				BLI_pbvh_vertex_iter_end;
+			}
+
+			MEM_freeN(nodes);
+		}
+
 		/* Modifiers could depend on mesh normals, so we should update them/
 		   Note, then if sculpting happens on locked key, normals should be re-calculated
 		   after applying coords from keyblock on base mesh */
@@ -2568,7 +2591,7 @@
 	sculpt_fix_noise_tear(sd, ss);
 
 	if (ss->modifiers_active)
-		sculpt_flush_stroke_deform(ss);
+		sculpt_flush_stroke_deform(sd, ss);
 
 	cache->first_time= 0;
 }




More information about the Bf-blender-cvs mailing list