[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48571] branches/soc-2011-tomato/source/ blender/windowmanager/intern/wm_playanim.c: add support for scrubbing with the mouse
Campbell Barton
ideasman42 at gmail.com
Wed Jul 4 00:58:43 CEST 2012
Revision: 48571
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48571
Author: campbellbarton
Date: 2012-07-03 22:58:43 +0000 (Tue, 03 Jul 2012)
Log Message:
-----------
add support for scrubbing with the mouse
Modified Paths:
--------------
branches/soc-2011-tomato/source/blender/windowmanager/intern/wm_playanim.c
Modified: branches/soc-2011-tomato/source/blender/windowmanager/intern/wm_playanim.c
===================================================================
--- branches/soc-2011-tomato/source/blender/windowmanager/intern/wm_playanim.c 2012-07-03 22:44:25 UTC (rev 48570)
+++ branches/soc-2011-tomato/source/blender/windowmanager/intern/wm_playanim.c 2012-07-03 22:58:43 UTC (rev 48571)
@@ -239,17 +239,23 @@
pupdate_time();
if (picture && (qualN & (SHIFT | LMOUSE)) && (fontid != -1)) {
+ int sizex, sizey;
+ float fsizex_inv, fsizey_inv;
char str[32 + FILE_MAX];
cpack(-1);
// glRasterPos2f(0.02f, 0.03f);
BLI_snprintf(str, sizeof(str), "%s | %.2f frames/s", picture->name, fstep / swaptime);
// BMF_DrawString(font, str);
+ playanim_window_get_size(&sizex, &sizey);
+ fsizex_inv = 1.0f / sizex;
+ fsizey_inv = 1.0f / sizey;
+
BLF_enable(fontid, BLF_ASPECT);
- BLF_aspect(fontid, 1.0f / ibuf->x, 1.0f / ibuf->y, 1.0f);
- BLF_position(fontid, 0.02f, 0.03f, 0.0f);
+ BLF_aspect(fontid, fsizex_inv, fsizey_inv, 1.0f);
+ BLF_position(fontid, 10.0f * fsizex_inv, 10.0f * fsizey_inv, 0.0f);
BLF_draw(fontid, str, 256); // XXX
- printf("Drawing text '%s'\n", str);
+ // printf("Drawing text '%s'\n", str);
}
GHOST_SwapWindowBuffers(g_window);
@@ -279,7 +285,7 @@
picture->anim = anim;
picture->frame = pic;
picture->IB_flags = IB_rect;
- BLI_snprintf(str, sizeof(str), "%s : %d", first, pic + 1);
+ BLI_snprintf(str, sizeof(str), "%s : %4.d", first, pic + 1);
picture->name = strdup(str);
BLI_addtail(picsbase, picture);
}
@@ -515,31 +521,6 @@
}
}
break;
-#if 0
- case LEFTMOUSE:
- case MOUSEX:
- if (qualN & LMOUSE) {
- int sizex, sizey;
- int i;
- playanim_window_get_size(&sizex, &sizey);
- ps->picture = picsbase->first;
- i = 0;
- while (ps->picture) {
- i++;
- ps->picture = ps->picture->next;
- }
- i = (i * val) / sizex;
- ps->picture = picsbase->first;
- for (; i > 0; i--) {
- if (ps->picture->next == NULL) break;
- ps->picture = ps->picture->next;
- }
- ps->sstep = TRUE;
- ps->wait2 = FALSE;
- ps->next = 0;
- }
- break;
-#endif
case GHOST_kKeyEqual:
if (val) {
if (qualN & SHIFT) {
@@ -622,6 +603,37 @@
}
break;
}
+ case GHOST_kEventCursorMove:
+ {
+ if (qualN & LMOUSE) {
+ int sizex, sizey;
+ int i;
+
+ GHOST_TEventCursorData *cd = GHOST_GetEventData(evt);
+ int cx, cy;
+
+ GHOST_ScreenToClient(g_window, cd->x, cd->y, &cx, &cy);
+
+ playanim_window_get_size(&sizex, &sizey);
+ ps->picture = picsbase->first;
+ /* TODO - store in ps direct? */
+ i = 0;
+ while (ps->picture) {
+ i++;
+ ps->picture = ps->picture->next;
+ }
+ i = (i * cx) / sizex;
+ ps->picture = picsbase->first;
+ for (; i > 0; i--) {
+ if (ps->picture->next == NULL) break;
+ ps->picture = ps->picture->next;
+ }
+ ps->sstep = TRUE;
+ ps->wait2 = FALSE;
+ ps->next = 0;
+ }
+ break;
+ }
case GHOST_kEventWindowSize:
case GHOST_kEventWindowMove:
{
@@ -988,6 +1000,11 @@
}
}
+ /* XXX25 - we should not have to do this, but it makes scrubbing functional! */
+ if (qualN & LMOUSE) {
+ ps.next = 0;
+ }
+
ps.wait2 = ps.sstep;
if (ps.wait2 == 0 && ps.stopped == 0) {
More information about the Bf-blender-cvs
mailing list