From c11fce1a9fcad3c1e8e80a01c4f3b25afb35dc0e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 20 Jan 2008 20:09:06 +0000 Subject: [PATCH] draw muted strips faded. hkey added alt+hkey to mute and un-mute strips, Mkey is used for metastrips. would be nice to make this similar to object mode restrict render option. --- source/blender/include/BIF_editseq.h | 1 + source/blender/src/drawseq.c | 50 +++++++++++++++++++++++++++- source/blender/src/editseq.c | 17 ++++++++++ source/blender/src/space.c | 7 ++++ 4 files changed, 74 insertions(+), 1 deletion(-) diff --git a/source/blender/include/BIF_editseq.h b/source/blender/include/BIF_editseq.h index cd1b80dfc65..2874cade043 100644 --- a/source/blender/include/BIF_editseq.h +++ b/source/blender/include/BIF_editseq.h @@ -62,6 +62,7 @@ void mouse_select_seq(void); void no_gaps(void); void seq_snap(short event); void seq_snap_menu(void); +void seq_mute_sel( int mute ); void set_filter_seq(void); void swap_select_seq(void); void touch_seq_files(void); diff --git a/source/blender/src/drawseq.c b/source/blender/src/drawseq.c index 75c32524654..abf0f24e892 100644 --- a/source/blender/src/drawseq.c +++ b/source/blender/src/drawseq.c @@ -92,6 +92,24 @@ #define SEQ_STRIP_OFSBOTTOM 0.2 #define SEQ_STRIP_OFSTOP 0.8 +static GLubyte halftone[] = { + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55, + 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55}; + /* Note, Dont use WHILE_SEQ while drawing! - it messes up transform, - Campbell */ int no_rightbox=0, no_leftbox= 0; @@ -220,6 +238,14 @@ static void drawmeta_contents(Sequence *seqm, float x1, float y1, float x2, floa dx= (x2-x1)/nr; + if (seqm->flag & SEQ_MUTE) { + glEnable(GL_POLYGON_STIPPLE); + glPolygonStipple(halftone); + + glEnable(GL_LINE_STIPPLE); + glLineStipple(1, 0x8888); + } + for (seq= seqm->seqbase.first; seq; seq= seq->next) { get_seq_color3ubv(seq, col); @@ -234,6 +260,11 @@ static void drawmeta_contents(Sequence *seqm, float x1, float y1, float x2, floa x1+= dx; } + + if (seqm->flag & SEQ_MUTE) { + glDisable(GL_POLYGON_STIPPLE); + glDisable(GL_LINE_STIPPLE); + } } static void drawseqwave(Sequence *seq, float x1, float y1, float x2, float y2, int winx) @@ -603,6 +634,11 @@ static void draw_shadedstrip(Sequence *seq, char *col, float x1, float y1, float { float ymid1, ymid2; + if (seq->flag & SEQ_MUTE) { + glEnable(GL_POLYGON_STIPPLE); + glPolygonStipple(halftone); + } + ymid1 = (y2-y1)*0.25 + y1; ymid2 = (y2-y1)*0.65 + y1; @@ -644,6 +680,9 @@ static void draw_shadedstrip(Sequence *seq, char *col, float x1, float y1, float glEnd(); + if (seq->flag & SEQ_MUTE) { + glDisable(GL_POLYGON_STIPPLE); + } } /* @@ -701,8 +740,17 @@ static void draw_seq_strip(Sequence *seq, ScrArea *sa, SpaceSeq *sseq, int outli BIF_GetColorPtrBlendShade3ubv(col, col, col, 0.0, outline_tint); glColor3ubv((GLubyte *)col); + + if (seq->flag & SEQ_MUTE) { + glEnable(GL_LINE_STIPPLE); + glLineStipple(1, 0x8888); + } + gl_round_box_shade(GL_LINE_LOOP, x1, y1, x2, y2, 0.0, 0.1, 0.0); - + + if (seq->flag & SEQ_MUTE) { + glDisable(GL_LINE_STIPPLE); + } /* calculate if seq is long enough to print a name */ x1= seq->startdisp+seq->handsize; diff --git a/source/blender/src/editseq.c b/source/blender/src/editseq.c index e0774fcae44..d07d733ce90 100644 --- a/source/blender/src/editseq.c +++ b/source/blender/src/editseq.c @@ -3685,6 +3685,23 @@ void seq_snap(short event) allqueue(REDRAWSEQ, 0); } +void seq_mute_sel(int mute) { + Editing *ed; + Sequence *seq; + + ed= G.scene->ed; + if(!ed) return NULL; + + for(seq= ed->seqbasep->first; seq; seq= seq->next) { + if ((seq->flag & SELECT) && (seq->flag & SEQ_LOCK)==0) { + if (mute) seq->flag |= SEQ_MUTE; + else seq->flag &= ~SEQ_MUTE; + } + } + BIF_undo_push(mute?"Mute Strips, Sequencer":"UnMute Strips, Sequencer"); + allqueue(REDRAWSEQ, 0); +} + void borderselect_seq(void) { Sequence *seq; diff --git a/source/blender/src/space.c b/source/blender/src/space.c index beed318b0d3..1e764d98e9e 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -4798,6 +4798,13 @@ static void winqreadseqspace(ScrArea *sa, void *spacedata, BWinEvent *evt) doredraw= 1; } break; + case HKEY: /* hide==mute? - not that nice but MKey us used for meta :/ */ + if((G.qual==0)) { + seq_mute_sel(1); + } else if((G.qual==LR_ALTKEY)) { + seq_mute_sel(0); + } + break; case XKEY: case DELKEY: if(G.qual==0) {