[Bf-blender-cvs] [82238c3] master: Fix T37550: Crash while snaping to curve made from Susane (bug in recent addition)

Campbell Barton noreply at git.blender.org
Wed Nov 20 14:23:54 CET 2013


Commit: 82238c3e3679d11e38f0e127698afc9dee8521b4
Author: Campbell Barton
Date:   Thu Nov 21 00:21:31 2013 +1100
http://developer.blender.org/rB82238c3e3679d11e38f0e127698afc9dee8521b4

Fix T37550: Crash while snaping to curve made from Susane (bug in recent addition)

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

M	source/blender/editors/transform/transform_snap.c

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

diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 8283197..4cda560 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -1446,23 +1446,37 @@ static bool snapCurve(short snap_mode, ARegion *ar, Object *ob, Curve *cu, float
 				case SCE_SNAP_MODE_VERTEX:
 				{
 					if (ob->mode == OB_MODE_EDIT) {
-						/* don't snap to selected (moving) or hidden */
-						if (nu->bezt[u].f2 & SELECT || nu->bezt[u].hide != 0) {
-							break;
-						}
-						retval |= snapVertex(ar, nu->bezt[u].vec[1], NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist_px, r_depth);
-						/* don't snap if handle is selected (moving), or if it is aligning to a moving handle */
-						if (!(nu->bezt[u].f1 & SELECT) && !(nu->bezt[u].h1 & HD_ALIGN && nu->bezt[u].f3 & SELECT)) {
-							retval |= snapVertex(ar, nu->bezt[u].vec[0], NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist_px, r_depth);
+						if (nu->bezt) {
+							/* don't snap to selected (moving) or hidden */
+							if (nu->bezt[u].f2 & SELECT || nu->bezt[u].hide != 0) {
+								break;
+							}
+							retval |= snapVertex(ar, nu->bezt[u].vec[1], NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist_px, r_depth);
+							/* don't snap if handle is selected (moving), or if it is aligning to a moving handle */
+							if (!(nu->bezt[u].f1 & SELECT) && !(nu->bezt[u].h1 & HD_ALIGN && nu->bezt[u].f3 & SELECT)) {
+								retval |= snapVertex(ar, nu->bezt[u].vec[0], NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist_px, r_depth);
+							}
+							if (!(nu->bezt[u].f3 & SELECT) && !(nu->bezt[u].h2 & HD_ALIGN && nu->bezt[u].f1 & SELECT)) {
+								retval |= snapVertex(ar, nu->bezt[u].vec[2], NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist_px, r_depth);
+							}
 						}
-						if (!(nu->bezt[u].f3 & SELECT) && !(nu->bezt[u].h2 & HD_ALIGN && nu->bezt[u].f1 & SELECT)) {
-							retval |= snapVertex(ar, nu->bezt[u].vec[2], NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist_px, r_depth);
+						else {
+							/* don't snap to selected (moving) or hidden */
+							if (nu->bp[u].f1 & SELECT || nu->bp[u].hide != 0) {
+								break;
+							}
+							retval |= snapVertex(ar, nu->bp[u].vec, NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist_px, r_depth);
 						}
 					}
 					else {
 						/* curve is not visible outside editmode if nurb length less than two */
 						if (nu->pntsu > 1) {
-							retval |= snapVertex(ar, nu->bezt[u].vec[1], NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist_px, r_depth);
+							if (nu->bezt) {
+								retval |= snapVertex(ar, nu->bezt[u].vec[1], NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist_px, r_depth);
+							}
+							else {
+								retval |= snapVertex(ar, nu->bp[u].vec, NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist_px, r_depth);
+							}
 						}
 					}
 					break;




More information about the Bf-blender-cvs mailing list