Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2009-01-02 17:11:18 +0300
committerTon Roosendaal <ton@blender.org>2009-01-02 17:11:18 +0300
commit70fe6664568b95ce98507d2d5e23a8c800e66f25 (patch)
tree5a614567d682c5fbeeb7d6264e2e673c198d8e01 /source/blender/windowmanager/intern/wm_gesture.c
parenta371f5513a749dcebe789f2e00870083f26725b4 (diff)
2.5
- Lasso select back (CTRL+LMB), object centers only, and for editmesh. See template in wm_operators.c - Circle select for editmode back. Currently it still uses Ckey, and is only a temporary mode, not persistant. Persistant circle select can be added later with tweak gesture keymap? We'll see. :) The old circle select was actually annoying that it was so sticky.
Diffstat (limited to 'source/blender/windowmanager/intern/wm_gesture.c')
-rw-r--r--source/blender/windowmanager/intern/wm_gesture.c40
1 files changed, 34 insertions, 6 deletions
diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c
index a8dd6f41e47..17addfe1b4b 100644
--- a/source/blender/windowmanager/intern/wm_gesture.c
+++ b/source/blender/windowmanager/intern/wm_gesture.c
@@ -43,6 +43,7 @@
#include "WM_api.h"
#include "WM_types.h"
+#include "wm.h"
#include "wm_event_system.h"
#include "wm_subwindow.h"
@@ -81,6 +82,13 @@ wmGesture *WM_gesture_new(bContext *C, wmEvent *event, int type)
rect->ymax= event->y - sy;
}
}
+ else if (type==WM_GESTURE_LASSO) {
+ short *lasso;
+ gesture->customdata= lasso= MEM_callocN(2*sizeof(short)*WM_LASSO_MAX_POINTS, "lasso points");
+ lasso[0] = event->x - sx;
+ lasso[1] = event->y - sy;
+ gesture->points= 1;
+ }
return gesture;
}
@@ -92,12 +100,6 @@ void WM_gesture_end(bContext *C, wmGesture *gesture)
MEM_freeN(gesture);
}
-/* for line, lasso, ... */
-void wm_gesture_point_add(bContext *C, wmGesture *gesture)
-{
-
-}
-
/* tweak and line gestures */
#define TWEAK_THRESHOLD 10
int wm_gesture_evaluate(bContext *C, wmGesture *gesture)
@@ -187,6 +189,30 @@ static void wm_gesture_draw_circle(wmWindow *win, wmGesture *gt)
}
+static void wm_gesture_draw_lasso(wmWindow *win, wmGesture *gt)
+{
+ short *lasso= (short *)gt->customdata;
+ int i;
+
+ glEnable(GL_LINE_STIPPLE);
+ glColor3ub(0, 0, 0);
+ glLineStipple(1, 0xAAAA);
+ glBegin(GL_LINE_STRIP);
+ for(i=0; i<gt->points; i++, lasso+=2)
+ glVertex2sv(lasso);
+ glEnd();
+
+ glColor3ub(255, 255, 255);
+ glLineStipple(1, 0x5555);
+ glBegin(GL_LINE_STRIP);
+ lasso= (short *)gt->customdata;
+ for(i=0; i<gt->points; i++, lasso+=2)
+ glVertex2sv(lasso);
+ glEnd();
+
+ glDisable(GL_LINE_STIPPLE);
+
+}
static void wm_gesture_draw_cross(wmWindow *win, wmGesture *gt)
{
@@ -226,6 +252,8 @@ void wm_gesture_draw(wmWindow *win)
else
wm_gesture_draw_cross(win, gt);
}
+ else if(gt->type==WM_GESTURE_LASSO)
+ wm_gesture_draw_lasso(win, gt);
}
}