[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15797] trunk/blender/source/blender/src: Grease-Pencil:

Joshua Leung aligorith at gmail.com
Sun Jul 27 06:40:01 CEST 2008


Revision: 15797
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15797
Author:   aligorith
Date:     2008-07-27 06:39:55 +0200 (Sun, 27 Jul 2008)

Log Message:
-----------
Grease-Pencil:

* UI - added delete button for hidden layers
* Renamed the two hardcoded defines added for testing distances to their more formal nomenclature.

Modified Paths:
--------------
    trunk/blender/source/blender/src/drawgpencil.c
    trunk/blender/source/blender/src/gpencil.c

Modified: trunk/blender/source/blender/src/drawgpencil.c
===================================================================
--- trunk/blender/source/blender/src/drawgpencil.c	2008-07-27 04:19:56 UTC (rev 15796)
+++ trunk/blender/source/blender/src/drawgpencil.c	2008-07-27 04:39:55 UTC (rev 15797)
@@ -187,10 +187,15 @@
 			sprintf(name, "%s (Locked)", gpl->info);
 		uiDefBut(block, LABEL, 1, name,	*xco+35, *yco, 240, 20, NULL, 0.0, 0.0, 0, 0, "Short description of what this layer is for (optional)");
 			
+		/* delete button (only if hidden but not locked!) */
+		if ((gpl->flag & GP_LAYER_HIDE) & !(gpl->flag & GP_LAYER_LOCKED)) {
+			but= uiDefIconBut(block, BUT, B_REDR, ICON_X, *xco+(width-30), *yco, 19, 19, NULL, 0.0, 0.0, 0.0, 0.0, "Delete layer");
+			uiButSetFunc(but, gp_ui_dellayer_cb, gpd, NULL);
+		}	
 		uiBlockSetEmboss(block, UI_EMBOSS);
 	}
 	else {
-		height= 100;
+		height= 97;
 		
 		/* draw rest of header */
 		{

Modified: trunk/blender/source/blender/src/gpencil.c
===================================================================
--- trunk/blender/source/blender/src/gpencil.c	2008-07-27 04:19:56 UTC (rev 15796)
+++ trunk/blender/source/blender/src/gpencil.c	2008-07-27 04:39:55 UTC (rev 15797)
@@ -664,11 +664,12 @@
 /* maximum sizes of gp-session buffer */
 #define GP_STROKE_BUFFER_MAX	5000
 
-	/* 'Hardcoded' sensitivity thresholds... */
-/* minimum number of pixels mouse should move before new point created */
-#define MIN_MMOVE_PX		3	
-/* minimum length of new segment before new point can be added */
-#define MIN_MDIST_PX		20
+/* Hardcoded sensitivity thresholds... */
+// TODO: one day, these might be added to the UI if it is necessary
+	/* minimum number of pixels mouse should move before new point created */
+#define MIN_MANHATTEN_PX		3	
+	/* minimum length of new segment before new point can be added */
+#define MIN_EUCLIDEAN_PX		20
 
 /* ------ */
 
@@ -890,11 +891,11 @@
 	short dy= abs(mval[1] - pmval[1]);
 	
 	/* check if mouse moved at least certain distance on both axes (best case) */
-	if ((dx > MIN_MMOVE_PX) && (dy > MIN_MMOVE_PX))
+	if ((dx > MIN_MANHATTEN_PX) && (dy > MIN_MANHATTEN_PX))
 		return 1;
 	
 	/* check if the distance since the last point is significant enough */
-	else if (sqrt(dx*dx + dy*dy) > MIN_MDIST_PX)
+	else if (sqrt(dx*dx + dy*dy) > MIN_EUCLIDEAN_PX)
 		return 1;
 	
 	/* mouse 'didn't move' */





More information about the Bf-blender-cvs mailing list