[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17105] branches/etch-a-ton/source/blender /src: Alt-C and Del/X for convert and delete (no confirmation, no undo, LIVE ON THE EDGE!)

Martin Poirier theeth at yahoo.com
Sun Oct 19 02:35:00 CEST 2008


Revision: 17105
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17105
Author:   theeth
Date:     2008-10-19 02:35:00 +0200 (Sun, 19 Oct 2008)

Log Message:
-----------
Alt-C and Del/X for convert and delete (no confirmation, no undo, LIVE ON THE EDGE!)

Fix bug with mouse selection (would selected last stroke when clicking in empty space).

Modified Paths:
--------------
    branches/etch-a-ton/source/blender/src/edit.c
    branches/etch-a-ton/source/blender/src/editarmature_sketch.c
    branches/etch-a-ton/source/blender/src/space.c

Modified: branches/etch-a-ton/source/blender/src/edit.c
===================================================================
--- branches/etch-a-ton/source/blender/src/edit.c	2008-10-18 23:54:09 UTC (rev 17104)
+++ branches/etch-a-ton/source/blender/src/edit.c	2008-10-19 00:35:00 UTC (rev 17105)
@@ -99,6 +99,7 @@
 #include "BIF_space.h"
 #include "BIF_screen.h"
 #include "BIF_toolbox.h"
+#include "BIF_sketch.h"
 
 #ifdef WITH_VERSE
 #include "BIF_verse.h"
@@ -1838,7 +1839,11 @@
 
 void delete_context_selected(void) 
 {
-	if(G.obedit) {
+	if(BIF_validSketchMode())
+	{
+		BIF_deleteSketch();
+	}
+	else if(G.obedit) {
 		if(G.obedit->type==OB_MESH) delete_mesh();
 		else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) delNurb();
 		else if(G.obedit->type==OB_MBALL) delete_mball();

Modified: branches/etch-a-ton/source/blender/src/editarmature_sketch.c
===================================================================
--- branches/etch-a-ton/source/blender/src/editarmature_sketch.c	2008-10-18 23:54:09 UTC (rev 17104)
+++ branches/etch-a-ton/source/blender/src/editarmature_sketch.c	2008-10-19 00:35:00 UTC (rev 17105)
@@ -1679,9 +1679,9 @@
 			/* loop and get best hit */
 		}
 		
-		if (besthitresult != -1)
+		if (besthitresult > 0)
 		{
-			SK_Stroke *selected_stk = BLI_findlink(&sketch->strokes, besthitresult);
+			SK_Stroke *selected_stk = BLI_findlink(&sketch->strokes, besthitresult - 1);
 			
 			if ((G.qual & LR_SHIFTKEY) == 0)
 			{
@@ -1724,10 +1724,12 @@
 	if (with_names)
 	{
 		int id;
-		for (id = 0, stk = sketch->strokes.first; stk; id++, stk = stk->next)
+		for (id = 1, stk = sketch->strokes.first; stk; id++, stk = stk->next)
 		{
 			sk_drawStroke(stk, id, NULL);
 		}
+		
+		glLoadName(-1);
 	}
 	else
 	{
@@ -1738,59 +1740,59 @@
 		{
 			sk_drawStroke(stk, -1, (stk->selected==1?selected_rgb:unselected_rgb));
 		}
-	}
 	
-	/* only draw gesture in active area */
-	if (sketch->gesture != NULL && area_is_active_area(G.vd->area))
-	{
-		float gesture_rgb[3] = {0, 0.5, 1};
-		sk_drawStroke(sketch->gesture, -1, gesture_rgb);
-	}
-	
-	if (sketch->active_stroke != NULL)
-	{
-		SK_Point *last = sk_lastStrokePoint(sketch->active_stroke);
+		/* only draw gesture in active area */
+		if (sketch->gesture != NULL && area_is_active_area(G.vd->area))
+		{
+			float gesture_rgb[3] = {0, 0.5, 1};
+			sk_drawStroke(sketch->gesture, -1, gesture_rgb);
+		}
 		
-		if (last != NULL)
+		if (sketch->active_stroke != NULL)
 		{
-			/* update point if in active area */
-			if (area_is_active_area(G.vd->area))
+			SK_Point *last = sk_lastStrokePoint(sketch->active_stroke);
+			
+			if (last != NULL)
 			{
-				SK_DrawData dd;
+				/* update point if in active area */
+				if (area_is_active_area(G.vd->area))
+				{
+					SK_DrawData dd;
+					
+					sk_initDrawData(&dd);
+					sk_getStrokePoint(&sketch->next_point, sketch, sketch->active_stroke, &dd, G.qual);
+				}
 				
-				sk_initDrawData(&dd);
-				sk_getStrokePoint(&sketch->next_point, sketch, sketch->active_stroke, &dd, G.qual);
+				glEnable(GL_LINE_STIPPLE);
+				glColor3f(1, 0.5, 0);
+				glBegin(GL_LINE_STRIP);
+				
+					glVertex3fv(last->p);
+					glVertex3fv(sketch->next_point.p);
+				
+				glEnd();
+				
+				glDisable(GL_LINE_STIPPLE);
+	
+				switch (sketch->next_point.mode)
+				{
+					case PT_SNAP:
+						glColor3f(0, 0.5, 1);
+						break;
+					case PT_EMBED:
+						glColor3f(0, 1, 0);
+						break;
+					case PT_PROJECT:
+						glColor3f(0, 0, 0);
+						break;
+				}
+				
+				glBegin(GL_POINTS);
+				
+					glVertex3fv(sketch->next_point.p);
+				
+				glEnd();
 			}
-			
-			glEnable(GL_LINE_STIPPLE);
-			glColor3f(1, 0.5, 0);
-			glBegin(GL_LINE_STRIP);
-			
-				glVertex3fv(last->p);
-				glVertex3fv(sketch->next_point.p);
-			
-			glEnd();
-			
-			glDisable(GL_LINE_STIPPLE);
-
-			switch (sketch->next_point.mode)
-			{
-				case PT_SNAP:
-					glColor3f(0, 0.5, 1);
-					break;
-				case PT_EMBED:
-					glColor3f(0, 1, 0);
-					break;
-				case PT_PROJECT:
-					glColor3f(0, 0, 0);
-					break;
-			}
-			
-			glBegin(GL_POINTS);
-			
-				glVertex3fv(sketch->next_point.p);
-			
-			glEnd();
 		}
 	}
 	
@@ -1957,6 +1959,7 @@
 		if (GLOBAL_sketch != NULL)
 		{
 			sk_deleteStrokes(GLOBAL_sketch);
+			allqueue(REDRAWVIEW3D, 0);
 		}
 	}
 }
@@ -1968,6 +1971,8 @@
 		if (GLOBAL_sketch != NULL)
 		{
 			sk_convert(GLOBAL_sketch);
+			allqueue(REDRAWVIEW3D, 0);
+			allqueue(REDRAWBUTSEDIT, 0);
 		}
 	}
 }

Modified: branches/etch-a-ton/source/blender/src/space.c
===================================================================
--- branches/etch-a-ton/source/blender/src/space.c	2008-10-18 23:54:09 UTC (rev 17104)
+++ branches/etch-a-ton/source/blender/src/space.c	2008-10-19 00:35:00 UTC (rev 17105)
@@ -1976,6 +1976,10 @@
 				else if(G.qual==LR_ALTKEY) {
 					if(ob && (ob->flag & OB_POSEMODE))
 						pose_clear_constraints();	/* poseobject.c */
+					else if (BIF_validSketchMode())
+					{
+						BIF_convertSketch();
+					}
 					else
 						convertmenu();	/* editobject.c */
 				}
@@ -2783,7 +2787,7 @@
 			case DELKEY:
 				if(G.qual==0 || G.qual==LR_SHIFTKEY)
 					delete_context_selected();
-				if(G.qual==LR_ALTKEY)
+				else if(G.qual==LR_ALTKEY)
 					gpencil_delete_menu();
 				break;
 			case YKEY:





More information about the Bf-blender-cvs mailing list