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>2005-05-05 21:19:21 +0400
committerTon Roosendaal <ton@blender.org>2005-05-05 21:19:21 +0400
commitf0a4ce98f904fa9577e80c9bcd2b80da6847e365 (patch)
tree289c594f3d43762a106be9f4b3a3e384dbcacc55 /source/blender/src/drawipo.c
parent22f65bce76b70a09467469c9a06c51d9acf76fa6 (diff)
Added the new Timeline Window, copied from Tuhopuu, coded by Matt Ebb.
Main change is that it's an own Space type now, not part of the Audio window... the audio window should restrict to own options. This way functionality is nicely separated. Since it's the first time I added a new space (since long!) I've made an extensive tutorial as well. You can find that here: http://www.blender3d.org/cms/Adding_new_Space_Window.557.0.html Notes for using timewindow; - Add time markers with MKey - CTRL+M gives option to name Marker - Markers cannot be moved yet... - Pageup-Pagedown keys moves current frame to next-prev Marker - Xkey removes Markers - If an object has Ipos or an Action, it draws key lines - CTRL+Pageup-Pagedown moves current frame to next-prev Key - Press S or E to set start/end frame for playback Notes about the implementation in Tuhopuu: - Add new Marker now selects new, deselects others - Selecting Marker didn't work like elsewhere in Blender, on click it should deselect all, except the indicated Marker. Not when holding SHIFT of course - Not exported functions are static now - Removed unused defines (MARKER_NONE NEXT_AVAIL) - Drawing order was confusing, doing too many matrix calls - Removed not needed scrollbar, added new function to draw time values. (Has advantage the MMB scroll works not confusing on a scrollbar) - Added proper support for 'frame mapping' - The string button (name Marker) had a bug (checked str[64] while str was only 64 long) - String button itself didn't allow "OK on enter" - Made frame buttons in header larger, the arrows overlapped - Removed support for negative frame values, that won't work so simple!
Diffstat (limited to 'source/blender/src/drawipo.c')
-rw-r--r--source/blender/src/drawipo.c67
1 files changed, 57 insertions, 10 deletions
diff --git a/source/blender/src/drawipo.c b/source/blender/src/drawipo.c
index c20722ad0cb..c5254487603 100644
--- a/source/blender/src/drawipo.c
+++ b/source/blender/src/drawipo.c
@@ -174,7 +174,7 @@ void calc_ipogrid()
ipogrid_dx= IPOSTEP*space/pixels;
step_to_grid(&ipogrid_dx, &ipomachtx);
- if ELEM(curarea->spacetype, SPACE_SEQ, SPACE_SOUND) {
+ if ELEM3(curarea->spacetype, SPACE_SEQ, SPACE_SOUND, SPACE_TIME) {
if(ipogrid_dx < 0.1) ipogrid_dx= 0.1;
ipomachtx-= 2;
if(ipomachtx<-2) ipomachtx= -2;
@@ -185,7 +185,7 @@ void calc_ipogrid()
ipogrid_dy= IPOSTEP*space/pixels;
step_to_grid(&ipogrid_dy, &ipomachty);
- if ELEM(curarea->spacetype, SPACE_SEQ, SPACE_SOUND) {
+ if ELEM3(curarea->spacetype, SPACE_SEQ, SPACE_SOUND, SPACE_TIME) {
if(ipogrid_dy < 1.0) ipogrid_dy= 1.0;
if(ipomachty<1) ipomachty= 1;
}
@@ -208,7 +208,7 @@ void draw_ipogrid(void)
step= (G.v2d->mask.xmax-G.v2d->mask.xmin+1)/IPOSTEP;
- if(curarea->spacetype==SPACE_SOUND) glColor3ub(0x70, 0x70, 0x60);
+ if ELEM(curarea->spacetype, SPACE_SOUND, SPACE_TIME) glColor3ub(0x70, 0x70, 0x60);
else BIF_ThemeColor(TH_GRID);
for(a=0; a<step; a++) {
@@ -220,7 +220,7 @@ void draw_ipogrid(void)
vec2[0]= vec1[0]-= 0.5*ipogrid_dx;
- if(curarea->spacetype==SPACE_SOUND) glColor3ub(0x80, 0x80, 0x70);
+ if ELEM(curarea->spacetype, SPACE_SOUND, SPACE_TIME) glColor3ub(0x80, 0x80, 0x70);
else BIF_ThemeColorShade(TH_GRID, 16);
step++;
@@ -231,7 +231,8 @@ void draw_ipogrid(void)
vec2[0]= vec1[0]-= ipogrid_dx;
}
- if(curarea->spacetype!=SPACE_SOUND && curarea->spacetype!=SPACE_ACTION && curarea->spacetype!=SPACE_NLA) {
+ if ELEM4(curarea->spacetype, SPACE_SOUND, SPACE_ACTION, SPACE_NLA, SPACE_TIME);
+ else {
vec1[0]= ipogrid_startx;
vec1[1]= vec2[1]= ipogrid_starty;
vec2[0]= G.v2d->cur.xmax;
@@ -654,6 +655,38 @@ static void draw_solution(SpaceIpo *sipo)
}
}
+/* used for drawing timeline */
+void draw_view2d_numbers_horiz(int drawframes)
+{
+ float fac, fac2, dfac, val;
+
+ /* the numbers: convert ipogrid_startx and -dx to scroll coordinates */
+ fac= (ipogrid_startx- G.v2d->cur.xmin)/(G.v2d->cur.xmax-G.v2d->cur.xmin);
+ fac= G.v2d->mask.xmin+fac*(G.v2d->mask.xmax-G.v2d->mask.xmin);
+
+ dfac= (ipogrid_dx)/(G.v2d->cur.xmax-G.v2d->cur.xmin);
+ dfac= dfac*(G.v2d->mask.xmax-G.v2d->mask.xmin);
+
+ BIF_ThemeColor(TH_TEXT);
+ val= ipogrid_startx;
+ while(fac < G.v2d->mask.xmax) {
+
+ if(drawframes) {
+ ipomachtx= 1;
+ scroll_prstr(fac, 2.0+(float)(G.v2d->mask.ymin), val, 'h', 0);
+ }
+ else {
+ fac2= val/(float)G.scene->r.frs_sec;
+ scroll_prstr(fac, 2.0+(float)(G.v2d->mask.ymin), fac2, 'h', 0);
+ }
+
+ fac+= dfac;
+ val+= ipogrid_dx;
+ }
+
+}
+
+
void drawscroll(int disptype)
{
rcti vert, hor;
@@ -709,7 +742,7 @@ void drawscroll(int disptype)
fac2= fac2-tim;
scroll_prstr(fac, 3.0+(float)(hor.ymin), tim+G.scene->r.frs_sec*fac2/100.0, 'h', disptype);
}
- else if(curarea->spacetype==SPACE_SOUND) {
+ else if (curarea->spacetype==SPACE_SOUND) {
SpaceSound *ssound= curarea->spacedata.first;
if(ssound->flag & SND_DRAWFRAMES) {
@@ -721,6 +754,18 @@ void drawscroll(int disptype)
scroll_prstr(fac, 3.0+(float)(hor.ymin), fac2, 'h', disptype);
}
}
+ else if (curarea->spacetype==SPACE_TIME) {
+ SpaceTime *stime= curarea->spacedata.first;
+
+ if(stime->flag & TIME_DRAWFRAMES) {
+ ipomachtx= 1;
+ scroll_prstr(fac, 3.0+(float)(hor.ymin), val, 'h', disptype);
+ }
+ else {
+ fac2= val/(float)G.scene->r.frs_sec;
+ scroll_prstr(fac, 3.0+(float)(hor.ymin), fac2, 'h', disptype);
+ }
+ }
else {
scroll_prstr(fac, 3.0+(float)(hor.ymin), val, 'h', disptype);
}
@@ -1868,7 +1913,9 @@ int view2dzoom(unsigned short event)
G.v2d->cur.xmin+= dx;
G.v2d->cur.xmax-= dx;
- if(curarea->spacetype!=SPACE_SEQ && curarea->spacetype!=SPACE_SOUND && curarea->spacetype!=SPACE_NLA && curarea->spacetype!=SPACE_ACTION) {
+
+ if ELEM5(curarea->spacetype, SPACE_SEQ, SPACE_SOUND, SPACE_ACTION, SPACE_NLA, SPACE_TIME);
+ else {
G.v2d->cur.ymin+= dy;
G.v2d->cur.ymax-= dy;
}
@@ -1946,7 +1993,7 @@ int view2dmove(unsigned short event)
/* test where mouse is */
getmouseco_areawin(mvalo);
- if ELEM6(curarea->spacetype, SPACE_IPO, SPACE_SEQ, SPACE_OOPS, SPACE_SOUND, SPACE_ACTION, SPACE_NLA)
+ if ELEM7(curarea->spacetype, SPACE_IPO, SPACE_SEQ, SPACE_OOPS, SPACE_SOUND, SPACE_ACTION, SPACE_NLA, SPACE_TIME)
{
if( BLI_in_rcti(&G.v2d->mask, (int)mvalo[0], (int)mvalo[1]) ) {
facx= (G.v2d->cur.xmax-G.v2d->cur.xmin)/(float)(G.v2d->mask.xmax-G.v2d->mask.xmin);
@@ -1979,8 +2026,8 @@ int view2dmove(unsigned short event)
/* no x move in outliner */
if(curarea->spacetype==SPACE_OOPS && G.v2d->scroll) facx= 0.0;
- /* no y move in audio */
- if(curarea->spacetype==SPACE_SOUND) facy= 0.0;
+ /* no y move in audio & time */
+ if ELEM(curarea->spacetype, SPACE_SOUND, SPACE_TIME) facy= 0.0;
if(get_mbut() & mousebut && leftret) return 0;
if(facx==0.0 && facy==0.0) return 1;