[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55008] trunk/blender/source/blender/ editors/sculpt_paint/sculpt.c: fix [#34416] Sculpt with ALT-B affects unseen mesh parts

Campbell Barton ideasman42 at gmail.com
Mon Mar 4 08:11:43 CET 2013


Revision: 55008
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55008
Author:   campbellbarton
Date:     2013-03-04 07:11:42 +0000 (Mon, 04 Mar 2013)
Log Message:
-----------
fix [#34416] Sculpt with ALT-B affects unseen mesh parts

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-03-04 05:25:16 UTC (rev 55007)
+++ trunk/blender/source/blender/editors/sculpt_paint/sculpt.c	2013-03-04 07:11:42 UTC (rev 55008)
@@ -545,20 +545,42 @@
 	float radius_squared;
 	float location[3];
 	float dist;
+
+	/* View3d clipping - only set rv3d for clipping */
+	RegionView3D *clip_rv3d;
 } SculptBrushTest;
 
 static void sculpt_brush_test_init(SculptSession *ss, SculptBrushTest *test)
 {
+	RegionView3D *rv3d = ss->cache->vc->rv3d;
+
 	test->radius_squared = ss->cache->radius_squared;
 	copy_v3_v3(test->location, ss->cache->location);
 	test->dist = 0.0f;   /* just for initialize */
+
+
+	if (rv3d->rflag & RV3D_CLIPPING) {
+		test->clip_rv3d = rv3d;
+	}
+	else {
+		test->clip_rv3d = NULL;
+	}
 }
 
+BLI_INLINE bool sculpt_brush_test_clipping(SculptBrushTest *test, const float co[3])
+{
+	RegionView3D *rv3d = test->clip_rv3d;
+	return (rv3d && (ED_view3d_clipping_test(rv3d, co, true)));
+}
+
 static int sculpt_brush_test(SculptBrushTest *test, const float co[3])
 {
 	float distsq = len_squared_v3v3(co, test->location);
 
 	if (distsq <= test->radius_squared) {
+		if (sculpt_brush_test_clipping(test, co)) {
+			return 0;
+		}
 		test->dist = sqrt(distsq);
 		return 1;
 	}
@@ -572,6 +594,9 @@
 	float distsq = len_squared_v3v3(co, test->location);
 
 	if (distsq <= test->radius_squared) {
+		if (sculpt_brush_test_clipping(test, co)) {
+			return 0;
+		}
 		test->dist = distsq;
 		return 1;
 	}
@@ -582,6 +607,9 @@
 
 static int sculpt_brush_test_fast(SculptBrushTest *test, float co[3])
 {
+	if (sculpt_brush_test_clipping(test, co)) {
+		return 0;
+	}
 	return len_squared_v3v3(co, test->location) <= test->radius_squared;
 }
 
@@ -590,6 +618,10 @@
 	float side = M_SQRT1_2;
 	float local_co[3];
 
+	if (sculpt_brush_test_clipping(test, co)) {
+		return 0;
+	}
+
 	mul_v3_m4v3(local_co, local, co);
 
 	local_co[0] = fabs(local_co[0]);




More information about the Bf-blender-cvs mailing list