[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23980] trunk/blender/source/blender/ editors/transform/transform_snap.c: Some cleanup for particle edit snap.

Martin Poirier theeth at yahoo.com
Mon Oct 19 20:49:04 CEST 2009


Revision: 23980
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23980
Author:   theeth
Date:     2009-10-19 20:49:04 +0200 (Mon, 19 Oct 2009)

Log Message:
-----------
Some cleanup for particle edit snap.

Update comment to point at the root of the problem.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/transform/transform_snap.c

Modified: trunk/blender/source/blender/editors/transform/transform_snap.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform_snap.c	2009-10-19 18:44:09 UTC (rev 23979)
+++ trunk/blender/source/blender/editors/transform/transform_snap.c	2009-10-19 18:49:04 UTC (rev 23980)
@@ -344,6 +344,7 @@
 {
 	ToolSettings *ts = t->settings;
 	Object *obedit = t->obedit;
+	Scene *scene = t->scene;
 	int snapping = 0;
 	short snap_mode = t->settings->snap_target;
 	
@@ -407,6 +408,15 @@
 				t->tsnap.mode = SNAP_ALL;
 			}
 		}
+		/* Particles edit mode*/
+		else if (t->tsnap.applySnap != NULL && // A snapping function actually exist
+			(snapping) && // Only if the snap flag is on
+			(obedit == NULL && BASACT->object && BASACT->object->mode & OB_MODE_PARTICLE_EDIT ))
+		{
+			t->tsnap.status |= SNAP_ON;
+			t->tsnap.modePoint = SNAP_GEO;
+			t->tsnap.mode = SNAP_ALL;
+		}
 		/* Object mode */
 		else if (t->tsnap.applySnap != NULL && // A snapping function actually exist
 			(snapping) && // Only if the snap flag is on
@@ -1457,13 +1467,14 @@
 		retval |= snapObject(scene, ar, ob, 1, ob->obmat, ray_start, ray_normal, mval, loc, no, dist, &depth);
 	}
 
-	/* This isn't so great, particles only need to snap with the mesh object
-	 * that emits them, but this doesnt fit into a current snap mode
+	/* Need an exception for particle edit because the base is flagged with BA_HAS_RECALC_DATA
+	 * which makes the loop skip it, even the derived mesh will never change
+	 *
+	 * To solve that problem, we do it first as an exception. 
 	 * */
 	if(BASACT->object && BASACT->object->mode & OB_MODE_PARTICLE_EDIT)
 	{
 		Object *ob = BASACT->object;
-
 		retval |= snapObject(scene, ar, ob, 0, ob->obmat, ray_start, ray_normal, mval, loc, no, dist, &depth);
 	}
 	





More information about the Bf-blender-cvs mailing list