[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17422] branches/animsys2/source/blender: AnimSys2: Current frame number indicator
Joshua Leung
aligorith at gmail.com
Wed Nov 12 12:06:44 CET 2008
Revision: 17422
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17422
Author: aligorith
Date: 2008-11-12 12:06:44 +0100 (Wed, 12 Nov 2008)
Log Message:
-----------
AnimSys2: Current frame number indicator
Added an (optional) frame number indicator beside the current frame indicator (green line) in Action/NLA/IPO editors. This can be turned on/off from the View menu. It draws as a green box containing the current frame number, and is attached to the bottom indicator line.
Notes:
* The placement in the IPO Editor is still quite non-optimal
* The aim of this was to make it easier to see what frame is the current frame. However, this may be too obstructive for some people.
Modified Paths:
--------------
branches/animsys2/source/blender/include/BDR_drawaction.h
branches/animsys2/source/blender/makesdna/DNA_action_types.h
branches/animsys2/source/blender/makesdna/DNA_space_types.h
branches/animsys2/source/blender/src/drawaction.c
branches/animsys2/source/blender/src/drawipo.c
branches/animsys2/source/blender/src/header_action.c
branches/animsys2/source/blender/src/header_ipo.c
branches/animsys2/source/blender/src/header_nla.c
Modified: branches/animsys2/source/blender/include/BDR_drawaction.h
===================================================================
--- branches/animsys2/source/blender/include/BDR_drawaction.h 2008-11-12 08:46:08 UTC (rev 17421)
+++ branches/animsys2/source/blender/include/BDR_drawaction.h 2008-11-12 11:06:44 UTC (rev 17422)
@@ -75,6 +75,7 @@
/* ******************************* Methods ****************************** */
/* Action Generics */
+void draw_cfra_number(float cfra);
void draw_cfra_action(void);
/* Channel Drawing */
Modified: branches/animsys2/source/blender/makesdna/DNA_action_types.h
===================================================================
--- branches/animsys2/source/blender/makesdna/DNA_action_types.h 2008-11-12 08:46:08 UTC (rev 17421)
+++ branches/animsys2/source/blender/makesdna/DNA_action_types.h 2008-11-12 11:06:44 UTC (rev 17422)
@@ -277,7 +277,9 @@
/* hack for moving pose-markers (temp flag) */
SACTION_POSEMARKERS_MOVE = (1<<6),
/* don't draw action channels using group colours (where applicable) */
- SACTION_NODRAWGCOLORS = (1<<7)
+ SACTION_NODRAWGCOLORS = (1<<7),
+ /* don't draw current frame number beside frame indicator */
+ SACTION_NODRAWCFRANUM = (1<<8),
} SACTION_FLAG;
/* SpaceAction Mode Settings */
Modified: branches/animsys2/source/blender/makesdna/DNA_space_types.h
===================================================================
--- branches/animsys2/source/blender/makesdna/DNA_space_types.h 2008-11-12 08:46:08 UTC (rev 17421)
+++ branches/animsys2/source/blender/makesdna/DNA_space_types.h 2008-11-12 11:06:44 UTC (rev 17422)
@@ -544,6 +544,8 @@
#define SIPO_LOCK_VIEW (1<<0)
#define SIPO_NOTRANSKEYCULL (1<<1)
#define SIPO_NOHANDLES (1<<2)
+#define SIPO_NODRAWCFRANUM (1<<3)
+#define SIPO_DRAWTIME (1<<4)
/* SpaceText flags (moved from DNA_text_types.h) */
@@ -638,6 +640,7 @@
#define SNLA_ACTIVELAYERS 2
#define SNLA_DRAWTIME 4
#define SNLA_NOTRANSKEYCULL 8
+#define SNLA_NODRAWCFRANUM 16
/* time->flag */
/* show timing in frames instead of in seconds */
Modified: branches/animsys2/source/blender/src/drawaction.c
===================================================================
--- branches/animsys2/source/blender/src/drawaction.c 2008-11-12 08:46:08 UTC (rev 17421)
+++ branches/animsys2/source/blender/src/drawaction.c 2008-11-12 11:06:44 UTC (rev 17422)
@@ -79,6 +79,7 @@
#include "BIF_gl.h"
#include "BIF_glutil.h"
#include "BIF_keyframing.h"
+#include "BIF_language.h"
#include "BIF_resources.h"
#include "BIF_screen.h"
#include "BIF_mywindow.h"
@@ -93,6 +94,7 @@
#include "BSE_drawview.h"
#include "BSE_editaction_types.h"
#include "BSE_editipo.h"
+#include "BSE_headerbuttons.h"
#include "BSE_time.h"
#include "BSE_view.h"
@@ -389,6 +391,65 @@
/********************************** Current Frame **************************** */
+void draw_cfra_number(float cfra)
+{
+ float xscale, yscale, x, y;
+ short slen, time=0;
+ char str[32];
+
+ /* check if current spacetype allows drawing */
+ switch (curarea->spacetype) {
+ case SPACE_ACTION: /* action editor */
+ if (G.saction->flag & SACTION_NODRAWCFRANUM)
+ return;
+ else if (G.saction->flag & SACTION_DRAWTIME)
+ time= 1;
+ break;
+ case SPACE_NLA: /* nla editor */
+ if (G.snla->flag & SNLA_NODRAWCFRANUM)
+ return;
+ else if (G.snla->flag & SNLA_DRAWTIME)
+ time= 1;
+ break;
+ case SPACE_IPO: /* ipo editor */
+ if (G.sipo->flag & SIPO_NODRAWCFRANUM)
+ return;
+ else if (G.sipo->flag & SIPO_DRAWTIME)
+ time= 1;
+ break;
+
+ default: /* other spaces don't support this */
+ return;
+ }
+
+ /* because the frame number text is subject to the same scaling as the contents of the view */
+ view2d_getscale(G.v2d, &xscale, &yscale);
+ glScalef(1.0/xscale, 1.0/yscale, 1.0);
+
+ if (time)
+ sprintf(str, " %.2f", FRA2TIME(CFRA));
+ else
+ sprintf(str, " %d", CFRA);
+ slen= GetButStringLength(str);
+
+ /* get starting coordinates for drawing */
+ x= cfra * xscale;
+ y= G.v2d->cur.ymin;
+
+ /* draw green box around/behind text */
+ BIF_ThemeColor(TH_CFRAME);
+ BIF_ThemeColorShadeAlpha(TH_CFRAME, 0, -100);
+ glRectf(x, y, x+slen, y+20);
+
+ /* draw current frame number - black text */
+ BIF_ThemeColor(TH_TEXT);
+ ui_rasterpos_safe(x, y+3, 1.0);
+ BIF_DrawString(G.fonts, str, 0);
+
+ /* restore scaling */
+ glScalef(xscale, yscale, 1.0);
+}
+
void draw_cfra_action (void)
{
Object *ob;
@@ -423,6 +484,9 @@
}
glLineWidth(1.0);
+
+ /* Draw current frame number in a little box*/
+ draw_cfra_number(vec[0]);
}
/********************************** Left-Hand Panel + Generics **************************** */
Modified: branches/animsys2/source/blender/src/drawipo.c
===================================================================
--- branches/animsys2/source/blender/src/drawipo.c 2008-11-12 08:46:08 UTC (rev 17421)
+++ branches/animsys2/source/blender/src/drawipo.c 2008-11-12 11:06:44 UTC (rev 17422)
@@ -79,6 +79,8 @@
#include "BIF_editaction.h"
#include "BIF_language.h"
+#include "BDR_drawaction.h"
+
#include "BSE_drawipo.h"
#include "BSE_view.h"
#include "BSE_editipo.h"
@@ -1221,7 +1223,7 @@
qobj = gluNewQuadric();
gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
- gluDisk(qobj, 0.0, 0.8, 12, 1);
+ gluDisk(qobj, 0.07, 0.8, 12, 1);
gluDeleteQuadric(qobj);
glEndList();
@@ -1763,6 +1765,9 @@
}
glLineWidth(1.0);
+
+ /* Draw current frame number in a little box */
+ draw_cfra_number(vec[0]);
}
static void draw_ipokey(SpaceIpo *sipo)
@@ -2404,8 +2409,6 @@
calc_ipogrid();
draw_ipogrid();
- draw_cfra(sipo);
-
/* ipokeys */
if(sipo->showkey) {
//if(sipo->ipokey.first==0) make_ipokey();
@@ -2437,12 +2440,15 @@
if (NLA_IPO_SCALED)
actstrip_map_ipo_keys(OBACT, sipo->ipo, 1, 0);
- /* Draw 'curtains' for preview */
- draw_anim_preview_timespace();
+ /* draw current frame */
+ draw_cfra(sipo);
/* draw markers */
draw_markers_timespace(SCE_MARKERS, 0);
+ /* Draw 'curtains' for preview */
+ draw_anim_preview_timespace();
+
/* restore viewport */
mywinset(sa->win);
Modified: branches/animsys2/source/blender/src/header_action.c
===================================================================
--- branches/animsys2/source/blender/src/header_action.c 2008-11-12 08:46:08 UTC (rev 17421)
+++ branches/animsys2/source/blender/src/header_action.c 2008-11-12 11:06:44 UTC (rev 17422)
@@ -97,6 +97,7 @@
ACTMENU_VIEW_PREVKEYFRAME,
ACTMENU_VIEW_TIME,
ACTMENU_VIEW_NOHIDE,
+ ACTMENU_VIEW_FRANUM,
ACTMENU_VIEW_TRANSDELDUPS,
ACTMENU_VIEW_HORIZOPTIMISE,
ACTMENU_VIEW_GCOLORS,
@@ -358,6 +359,9 @@
case ACTMENU_VIEW_NOHIDE: /* Show hidden channels */
G.saction->flag ^= SACTION_NOHIDE;
break;
+ case ACTMENU_VIEW_FRANUM: /* Show current frame number beside indicator */
+ G.saction->flag ^= SACTION_NODRAWCFRANUM;
+ break;
case ACTMENU_VIEW_NEXTKEYFRAME: /* Jump to next keyframe */
nextprev_action_keyframe(1);
break;
@@ -408,12 +412,22 @@
"Show Frames|Ctrl T", 0, yco-=20,
menuwidth, 19, NULL, 0.0, 0.0, 1,
ACTMENU_VIEW_TIME, "");
+
+ uiDefIconTextBut(block, BUTM, 1, (G.saction->flag & SACTION_NODRAWCFRANUM)?ICON_CHECKBOX_DEHLT:ICON_CHECKBOX_HLT,
+ "Show Current Time Code|", 0, yco-=20,
+ menuwidth, 19, NULL, 0.0, 0.0, 1,
+ ACTMENU_VIEW_FRANUM, "");
}
else {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
"Show Seconds|Ctrl T", 0, yco-=20,
menuwidth, 19, NULL, 0.0, 0.0, 1,
ACTMENU_VIEW_TIME, "");
+
+ uiDefIconTextBut(block, BUTM, 1, (G.saction->flag & SACTION_NODRAWCFRANUM)?ICON_CHECKBOX_DEHLT:ICON_CHECKBOX_HLT,
+ "Show Current Frame Number|", 0, yco-=20,
+ menuwidth, 19, NULL, 0.0, 0.0, 1,
+ ACTMENU_VIEW_FRANUM, "");
}
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
Modified: branches/animsys2/source/blender/src/header_ipo.c
===================================================================
--- branches/animsys2/source/blender/src/header_ipo.c 2008-11-12 08:46:08 UTC (rev 17421)
+++ branches/animsys2/source/blender/src/header_ipo.c 2008-11-12 11:06:44 UTC (rev 17422)
@@ -729,6 +729,9 @@
case 16: /* Show/Hide handles */
G.sipo->flag ^= SIPO_NOHANDLES;
break;
+ case 17: /* Show current frame number beside indicator */
+ G.sipo->flag ^= SIPO_NODRAWCFRANUM;
+ break;
}
}
@@ -754,6 +757,8 @@
"AutoMerge Keyframes|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 15, "");
uiDefIconTextBut(block, BUTM, 1, (G.sipo->flag & SIPO_NOHANDLES)?ICON_CHECKBOX_DEHLT:ICON_CHECKBOX_HLT,
"Show Handles|Ctrl H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, "");
+ uiDefIconTextBut(block, BUTM, 1, (G.sipo->flag & SIPO_NODRAWCFRANUM)?ICON_CHECKBOX_DEHLT:ICON_CHECKBOX_HLT,
+ "Show Handles|Ctrl H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 17, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
Modified: branches/animsys2/source/blender/src/header_nla.c
===================================================================
--- branches/animsys2/source/blender/src/header_nla.c 2008-11-12 08:46:08 UTC (rev 17421)
+++ branches/animsys2/source/blender/src/header_nla.c 2008-11-12 11:06:44 UTC (rev 17422)
@@ -131,6 +131,9 @@
case 10: /* AutoMerge Keyframes */
G.snla->flag ^= SNLA_NOTRANSKEYCULL;
break;
+ case 11: /* Show current frame number beside indicator */
+ G.snla->flag ^= SNLA_NODRAWCFRANUM;
+ break;
}
}
@@ -145,11 +148,18 @@
uiDefIconTextBut(block, BUTM, 1, (G.snla->flag & SNLA_ALLKEYED)?ICON_CHECKBOX_DEHLT:ICON_CHECKBOX_HLT,
"Only Objects On Visible Layers|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
-
+
if (G.snla->flag & SNLA_DRAWTIME) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Frames|Ctrl T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
- } else {
+
+ uiDefIconTextBut(block, BUTM, 1, (G.snla->flag & SNLA_NODRAWCFRANUM)?ICON_CHECKBOX_DEHLT:ICON_CHECKBOX_HLT,
+ "Show Current Time Code|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 11, "");
+ }
+ else {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Seconds|Ctrl T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
+
+ uiDefIconTextBut(block, BUTM, 1, (G.snla->flag & SNLA_NODRAWCFRANUM)?ICON_CHECKBOX_DEHLT:ICON_CHECKBOX_HLT,
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list