Commit: 36607080bd84509372d7b49ba5586b9e006fa943
Author: Antony Riakiotakis
Date:   Thu Sep 25 18:00:00 2014 +0200
Branches: terrible_consequencer
https://developer.blender.org/rB36607080bd84509372d7b49ba5586b9e006fa943

Gooseberry request, hide the extensions except when trimming.

===================================================================

M       source/blender/editors/space_sequencer/sequencer_draw.c
M       source/blender/editors/space_sequencer/sequencer_edit.c
M       source/blender/editors/space_sequencer/sequencer_intern.h

===================================================================

diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c 
b/source/blender/editors/space_sequencer/sequencer_draw.c
index 396f5c9..117e47f 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -86,9 +86,8 @@
 
 /* Note, Don't use SEQ_BEGIN/SEQ_END while drawing!
  * it messes up transform, - Campbell */
-static void draw_shadedstrip(Sequence *seq, unsigned char col[3], float x1, 
float y1, float x2, float y2);
 
-static void get_seq_color3ubv(Scene *curscene, Sequence *seq, unsigned char 
col[3])
+void get_seq_color3ubv(Scene *curscene, Sequence *seq, unsigned char col[3])
 {
        unsigned char blendcol[3];
        SolidColorVars *colvars = (SolidColorVars *)seq->effectdata;
@@ -427,112 +426,6 @@ static void draw_seq_handle(View2D *v2d, Sequence *seq, 
const float handsize_cla
        }
 }
 
-static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq)
-{
-       float x1, x2, y1, y2, pixely, a;
-       unsigned char col[3], blendcol[3];
-       View2D *v2d = &ar->v2d;
-       
-       if (seq->type >= SEQ_TYPE_EFFECT) return;
-
-       x1 = seq->startdisp;
-       x2 = seq->enddisp;
-       
-       y1 = seq->machine + SEQ_STRIP_OFSBOTTOM;
-       y2 = seq->machine + SEQ_STRIP_OFSTOP;
-
-       pixely = BLI_rctf_size_y(&v2d->cur) / BLI_rcti_size_y(&v2d->mask);
-       
-       if (pixely <= 0) return;  /* can happen when the view is split/resized 
*/
-       
-       blendcol[0] = blendcol[1] = blendcol[2] = 120;
-
-       if (seq->startofs) {
-               glEnable(GL_BLEND);
-               glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-               
-               get_seq_color3ubv(scene, seq, col);
-               
-               if (seq->flag & SELECT) {
-                       UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.3, 
-40);
-                       glColor4ub(col[0], col[1], col[2], 170);
-               }
-               else {
-                       UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.6, 
0);
-                       glColor4ub(col[0], col[1], col[2], 110);
-               }
-               
-               glRectf((float)(seq->start), y1 - SEQ_STRIP_OFSBOTTOM, x1, y1);
-               
-               if (seq->flag & SELECT) glColor4ub(col[0], col[1], col[2], 255);
-               else glColor4ub(col[0], col[1], col[2], 160);
-
-               fdrawbox((float)(seq->start), y1 - SEQ_STRIP_OFSBOTTOM, x1, 
y1);  //outline
-               
-               glDisable(GL_BLEND);
-       }
-       if (seq->endofs) {
-               glEnable(GL_BLEND);
-               glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-               
-               get_seq_color3ubv(scene, seq, col);
-               
-               if (seq->flag & SELECT) {
-                       UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.3, 
-40);
-                       glColor4ub(col[0], col[1], col[2], 170);
-               }
-               else {
-                       UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.6, 
0);
-                       glColor4ub(col[0], col[1], col[2], 110);
-               }
-               
-               glRectf(x2, y2, (float)(seq->start + seq->len), y2 + 
SEQ_STRIP_OFSBOTTOM);
-               
-               if (seq->flag & SELECT) glColor4ub(col[0], col[1], col[2], 255);
-               else glColor4ub(col[0], col[1], col[2], 160);
-
-               fdrawbox(x2, y2, (float)(seq->start + seq->len), y2 + 
SEQ_STRIP_OFSBOTTOM); //outline
-               
-               glDisable(GL_BLEND);
-       }
-       if (seq->startstill) {
-               get_seq_color3ubv(scene, seq, col);
-               UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.75, 40);
-               glColor3ubv((GLubyte *)col);
-               
-               draw_shadedstrip(seq, col, x1, y1, (float)(seq->start), y2);
-               
-               /* feint pinstripes, helps see exactly which is extended and 
which isn't,
-                * especially when the extension is very small */ 
-               if (seq->flag & SELECT) UI_GetColorPtrBlendShade3ubv(col, col, 
col, 0.0, 24);
-               else UI_GetColorPtrShade3ubv(col, col, -16);
-               
-               glColor3ubv((GLubyte *)col);
-               
-               for (a = y1; a < y2; a += pixely * 2.0f) {
-                       fdrawline(x1,  a,  (float)(seq->start),  a);
-               }
-       }
-       if (seq->endstill) {
-               get_seq_color3ubv(scene, seq, col);
-               UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.75, 40);
-               glColor3ubv((GLubyte *)col);
-               
-               draw_shadedstrip(seq, col, (float)(seq->start + seq->len), y1, 
x2, y2);
-               
-               /* feint pinstripes, helps see exactly which is extended and 
which isn't,
-                * especially when the extension is very small */ 
-               if (seq->flag & SELECT) UI_GetColorPtrShade3ubv(col, col, 24);
-               else UI_GetColorPtrShade3ubv(col, col, -16);
-               
-               glColor3ubv((GLubyte *)col);
-               
-               for (a = y1; a < y2; a += pixely * 2.0f) {
-                       fdrawline((float)(seq->start + seq->len),  a,  x2,  a);
-               }
-       }
-}
-
 /* draw info text on a sequence strip */
 static void draw_seq_text(View2D *v2d, Sequence *seq, float x1, float x2, 
float y1, float y2, const unsigned char background_col[3])
 {
@@ -699,7 +592,7 @@ static void generate_strip_vertices(float x1, float y1, 
float x2, float y2, floa
 }
 
 /* draws a shaded strip, made from gradient + flat color + gradient */
-static void draw_shadedstrip(Sequence *seq, unsigned char col[3], float x1, 
float y1, float x2, float y2)
+void draw_shadedstrip(Sequence *seq, unsigned char col[3], float x1, float y1, 
float x2, float y2)
 {
        float ymid1, ymid2;
 
@@ -852,10 +745,6 @@ static void draw_seq_strip(const bContext *C, SpaceSeq 
*sseq, Scene *scene, AReg
                draw_shaded_cuddly_strip(seq, background_col);
        }
        
-       /* draw additional info and controls */
-       if (!is_single_image)
-               draw_seq_extensions(scene, ar, seq);
-       
        draw_seq_handle(v2d, seq, handsize_clamped, SEQ_LEFTHANDLE);
        draw_seq_handle(v2d, seq, handsize_clamped, SEQ_RIGHTHANDLE);
        
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c 
b/source/blender/editors/space_sequencer/sequencer_edit.c
index 383a5e9..b5e9810 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -62,8 +62,13 @@
 #include "ED_screen.h"
 #include "ED_transform.h"
 #include "ED_sequencer.h"
+#include "ED_space_api.h"
 
 #include "UI_view2d.h"
+#include "UI_resources.h"
+
+#include "GL/glew.h"
+#include "BIF_glutil.h"
 
 /* own include */
 #include "sequencer_intern.h"
@@ -1721,14 +1726,124 @@ typedef struct TrimData {
        TransSeq ts;
        bool slow;
        int slow_offset; /* offset at the point where offset was turned on */
+       Sequence *seq;
+       void *draw_handle;
 } TrimData;
 
+static void draw_trim_extensions(const bContext *C, ARegion *ar, void *data)
+{
+       Scene *scene = CTX_data_scene(C);
+       float x1, x2, y1, y2, pixely, a;
+       unsigned char col[3], blendcol[3];
+       View2D *v2d = &ar->v2d;
+       Sequence *seq = ((TrimData *)data)->seq;
+       
+       if (seq->type >= SEQ_TYPE_EFFECT) return;
+
+       x1 = seq->startdisp;
+       x2 = seq->enddisp;
+       
+       y1 = seq->machine + SEQ_STRIP_OFSBOTTOM;
+       y2 = seq->machine + SEQ_STRIP_OFSTOP;
+
+       pixely = BLI_rctf_size_y(&v2d->cur) / BLI_rcti_size_y(&v2d->mask);
+       
+       if (pixely <= 0) return;  /* can happen when the view is split/resized 
*/
+       
+       blendcol[0] = blendcol[1] = blendcol[2] = 120;
+
+       if (seq->startofs) {
+               glEnable(GL_BLEND);
+               glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+               
+               get_seq_color3ubv(scene, seq, col);
+               
+               if (seq->flag & SELECT) {
+                       UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.3, 
-40);
+                       glColor4ub(col[0], col[1], col[2], 170);
+               }
+               else {
+                       UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.6, 
0);
+                       glColor4ub(col[0], col[1], col[2], 110);
+               }
+               
+               glRectf((float)(seq->start), y1 - SEQ_STRIP_OFSBOTTOM, x1, y1);
+               
+               if (seq->flag & SELECT) glColor4ub(col[0], col[1], col[2], 255);
+               else glColor4ub(col[0], col[1], col[2], 160);
+
+               fdrawbox((float)(seq->start), y1 - SEQ_STRIP_OFSBOTTOM, x1, 
y1);  //outline
+               
+               glDisable(GL_BLEND);
+       }
+       if (seq->endofs) {
+               glEnable(GL_BLEND);
+               glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+               
+               get_seq_color3ubv(scene, seq, col);
+               
+               if (seq->flag & SELECT) {
+                       UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.3, 
-40);
+                       glColor4ub(col[0], col[1], col[2], 170);
+               }
+               else {
+                       UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.6, 
0);
+                       glColor4ub(col[0], col[1], col[2], 110);
+               }
+               
+               glRectf(x2, y2, (float)(seq->start + seq->len), y2 + 
SEQ_STRIP_OFSBOTTOM);
+               
+               if (seq->flag & SELECT) glColor4ub(col[0], col[1], col[2], 255);
+               else glColor4ub(col[0], col[1], col[2], 160);
+
+               fdrawbox(x2, y2, (float)(seq->start + seq->len), y2 + 
SEQ_STRIP_OFSBOTTOM); //outline
+               
+               glDisable(GL_BLEND);
+       }
+       if (seq->startstill) {
+               get_seq_color3ubv(scene, seq, col);
+               UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.75, 40);
+               glColor3ubv((GLubyte *)col);
+               
+               draw_shadedstrip(seq, col, x1, y1, (float)(seq->start), y2);
+               
+               /* feint pinstripes, helps see exactly which is extended and 
which isn't,
+                * especially when the extension is very small */ 
+               if (seq->flag & SELECT) UI_GetColorPtrBlendShade3ubv(col, col, 
col, 0.0, 24);
+               else UI_GetColorPtrShade3ubv(col, col, -16);
+               
+               glColor3ubv((GLubyte *)col);
+               
+               for (a = y1; a < y2; a += pixely * 2.0f) {
+                       fdrawline(x1,  a,  (float)(seq->start),  a);
+               }
+       }
+       if (seq->endstill) {
+               get_seq_color3ubv(scene, seq, col);
+               UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.75, 40);
+               glColor3ubv((GLubyte *)col);
+               
+               draw_shadedstrip(seq, col, (float)(seq->start + seq->len), y1, 
x2, y2);
+               
+               /* feint pinstripes, helps see exactly which is extended and 
which isn't,
+                * especially when the extension is very small */ 
+               if (seq->flag & SELECT) UI_GetColorPtrShade3ubv(col, col, 24);
+               else UI_GetColorPtrShade3ubv(col, col, -16);
+               
+               glColor3ubv((GLubyte *)col);
+               
+               for (a = y1; a < y2; a += pixely * 2.0f) {
+                       fdrawline((float)(seq->start + seq->len),  a,  x2,  a);
+               }
+       }
+}
 
 static int sequencer_trim_invoke(bContext *C, wmOperator *op, const wmEvent 
*event)
 {
        TrimData *data = op->customdata = MEM_mallocN(sizeof(TrimData), 
"trimdata");    
        Scene *scene = CTX_data_scene(C);
        Sequence *seq = BKE_sequencer_active_get(scene);
+       ARegion *ar = CTX_wm_region(C);
        float mouseloc[2];
        View2D *v2d = UI_view2d_fromcontext(C);
 
@@ -1744,7 +1859,10 @@ static int sequencer_trim_invoke(bContext *C, wmOperator 
*op, const wmEvent *eve
        data->ts.anim_startofs = seq->anim_startofs;
        data->ts.anim_endofs = seq->anim_endofs;
        data->ts.len = seq->len;
+       data->seq = seq;
 
+       data->draw_handle = ED_region_draw_cb_activate(ar->type, 
draw_trim_extensions, data, REGION_DRAW_POST_VIEW);
+       
        UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], 
&mouseloc[0], &mouseloc[1]);
        
        copy_v2_v2_int(data->init_mouse, event->mval);
@@ -1818,6 +1936,7 @@ static int sequencer_trim_modal(bContext *C, wmOperator 
*op, const wm

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to