65
68
#include "sequencer_intern.h"
67
#define SEQ_LEFTHANDLE 1
68
#define SEQ_RIGHTHANDLE 2
71
/* Note, Dont use WHILE_SEQ while drawing! - it messes up transform, - Campbell */
73
int no_rightbox=0, no_leftbox= 0;
74
static void draw_shadedstrip(Sequence *seq, char *col, float x1, float y1, float x2, float y2);
76
static void get_seq_color3ubv(Scene *curscene, Sequence *seq, char *col)
71
#define SEQ_LEFTHANDLE 1
72
#define SEQ_RIGHTHANDLE 2
75
/* Note, Don't use SEQ_BEGIN/SEQ_END while drawing!
76
* it messes up transform, - Campbell */
77
static void draw_shadedstrip(Sequence *seq, unsigned char col[3], float x1, float y1, float x2, float y2);
79
static void get_seq_color3ubv(Scene *curscene, Sequence *seq, unsigned char col[3])
81
unsigned char blendcol[3];
80
82
SolidColorVars *colvars = (SolidColorVars *)seq->effectdata;
84
UI_GetThemeColor3ubv(TH_SEQ_IMAGE, col);
87
UI_GetThemeColor3ubv(TH_SEQ_META, col);
90
UI_GetThemeColor3ubv(TH_SEQ_MOVIE, col);
93
UI_GetThemeColor3ubv(TH_SEQ_SCENE, col);
95
if(seq->scene==curscene) {
96
UI_GetColorPtrBlendShade3ubv(col, col, col, 1.0, 20);
104
/* slightly offset hue to distinguish different effects */
105
UI_GetThemeColor3ubv(TH_SEQ_TRANSITION, col);
107
rgb[0] = col[0]/255.0; rgb[1] = col[1]/255.0; rgb[2] = col[2]/255.0;
108
rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
110
if (seq->type == SEQ_CROSS) hsv[0]+= 0.04;
111
if (seq->type == SEQ_GAMCROSS) hsv[0]+= 0.08;
112
if (seq->type == SEQ_WIPE) hsv[0]+= 0.12;
114
if(hsv[0]>1.0) hsv[0]-=1.0; else if(hsv[0]<0.0) hsv[0]+= 1.0;
115
hsv_to_rgb(hsv[0], hsv[1], hsv[2], rgb, rgb+1, rgb+2);
116
col[0] = (char)(rgb[0]*255); col[1] = (char)(rgb[1]*255); col[2] = (char)(rgb[2]*255);
130
/* slightly offset hue to distinguish different effects */
131
UI_GetThemeColor3ubv(TH_SEQ_EFFECT, col);
133
rgb[0] = col[0]/255.0; rgb[1] = col[1]/255.0; rgb[2] = col[2]/255.0;
134
rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
136
if (seq->type == SEQ_ADD) hsv[0]+= 0.04;
137
if (seq->type == SEQ_SUB) hsv[0]+= 0.08;
138
if (seq->type == SEQ_MUL) hsv[0]+= 0.12;
139
if (seq->type == SEQ_ALPHAOVER) hsv[0]+= 0.16;
140
if (seq->type == SEQ_ALPHAUNDER) hsv[0]+= 0.20;
141
if (seq->type == SEQ_OVERDROP) hsv[0]+= 0.24;
142
if (seq->type == SEQ_GLOW) hsv[0]+= 0.28;
143
if (seq->type == SEQ_TRANSFORM) hsv[0]+= 0.36;
145
if(hsv[0]>1.0) hsv[0]-=1.0; else if(hsv[0]<0.0) hsv[0]+= 1.0;
146
hsv_to_rgb(hsv[0], hsv[1], hsv[2], rgb, rgb+1, rgb+2);
147
col[0] = (char)(rgb[0]*255); col[1] = (char)(rgb[1]*255); col[2] = (char)(rgb[2]*255);
151
col[0]= (char)(colvars->col[0]*255);
152
col[1]= (char)(colvars->col[1]*255);
153
col[2]= (char)(colvars->col[2]*255);
155
col[0] = col[1] = col[2] = 128;
159
UI_GetThemeColor3ubv(TH_SEQ_PLUGIN, col);
162
UI_GetThemeColor3ubv(TH_SEQ_AUDIO, col);
163
blendcol[0] = blendcol[1] = blendcol[2] = 128;
164
if(seq->flag & SEQ_MUTE) UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.5, 20);
167
col[0] = 10; col[1] = 255; col[2] = 40;
86
UI_GetThemeColor3ubv(TH_SEQ_IMAGE, col);
90
UI_GetThemeColor3ubv(TH_SEQ_META, col);
94
UI_GetThemeColor3ubv(TH_SEQ_MOVIE, col);
98
UI_GetThemeColor3ubv(TH_SEQ_MOVIECLIP, col);
102
UI_GetThemeColor3ubv(TH_SEQ_SCENE, col);
104
if (seq->scene == curscene) {
105
UI_GetColorPtrShade3ubv(col, col, 20);
113
UI_GetThemeColor3ubv(TH_SEQ_TRANSITION, col);
115
/* slightly offset hue to distinguish different effects */
116
if (seq->type == SEQ_CROSS) rgb_byte_set_hue_float_offset(col, 0.04);
117
if (seq->type == SEQ_GAMCROSS) rgb_byte_set_hue_float_offset(col, 0.08);
118
if (seq->type == SEQ_WIPE) rgb_byte_set_hue_float_offset(col, 0.12);
133
UI_GetThemeColor3ubv(TH_SEQ_EFFECT, col);
135
/* slightly offset hue to distinguish different effects */
136
if (seq->type == SEQ_ADD) rgb_byte_set_hue_float_offset(col, 0.04);
137
else if (seq->type == SEQ_SUB) rgb_byte_set_hue_float_offset(col, 0.08);
138
else if (seq->type == SEQ_MUL) rgb_byte_set_hue_float_offset(col, 0.12);
139
else if (seq->type == SEQ_ALPHAOVER) rgb_byte_set_hue_float_offset(col, 0.16);
140
else if (seq->type == SEQ_ALPHAUNDER) rgb_byte_set_hue_float_offset(col, 0.20);
141
else if (seq->type == SEQ_OVERDROP) rgb_byte_set_hue_float_offset(col, 0.24);
142
else if (seq->type == SEQ_GLOW) rgb_byte_set_hue_float_offset(col, 0.28);
143
else if (seq->type == SEQ_TRANSFORM) rgb_byte_set_hue_float_offset(col, 0.36);
144
else if (seq->type == SEQ_MULTICAM) rgb_byte_set_hue_float_offset(col, 0.32);
145
else if (seq->type == SEQ_ADJUSTMENT) rgb_byte_set_hue_float_offset(col, 0.40);
150
rgb_float_to_uchar(col, colvars->col);
153
col[0] = col[1] = col[2] = 128;
158
UI_GetThemeColor3ubv(TH_SEQ_PLUGIN, col);
162
UI_GetThemeColor3ubv(TH_SEQ_AUDIO, col);
163
blendcol[0] = blendcol[1] = blendcol[2] = 128;
164
if (seq->flag & SEQ_MUTE) UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.5, 20);
168
col[0] = 10; col[1] = 255; col[2] = 40;
171
172
static void drawseqwave(Scene *scene, Sequence *seq, float x1, float y1, float x2, float y2, float stepsize)
174
x1 is the starting x value to draw the wave,
175
x2 the end x value, same for y1 and y2
176
stepsize is width of a pixel.
178
if(seq->sound->cache)
181
int length = floor((x2-x1)/stepsize)+1;
182
float ymid = (y1+y2)/2;
183
float yscale = (y2-y1)/2;
184
float* samples = MEM_mallocN(length * sizeof(float) * 2, "seqwave_samples");
187
if(sound_read_sound_buffer(seq->sound, samples, length,
188
(seq->startofs + seq->anim_startofs)/FPS,
189
(seq->startofs + seq->anim_startofs + seq->enddisp - seq->startdisp)/FPS) != length)
195
for(i = 0; i < length; i++)
197
glVertex2f(x1+i*stepsize, ymid + samples[i * 2] * yscale);
198
glVertex2f(x1+i*stepsize, ymid + samples[i * 2 + 1] * yscale);
175
* x1 is the starting x value to draw the wave,
176
* x2 the end x value, same for y1 and y2
177
* stepsize is width of a pixel.
179
if (seq->flag & SEQ_AUDIO_DRAW_WAVEFORM) {
181
int length = floor((x2 - x1) / stepsize) + 1;
182
float ymid = (y1 + y2) / 2;
183
float yscale = (y2 - y1) / 2;
185
float startsample, endsample;
188
SoundWaveform *waveform;
190
if (!seq->sound->waveform)
191
sound_read_waveform(seq->sound);
193
if (!seq->sound->waveform)
194
return; /* zero length sound */
196
waveform = seq->sound->waveform;
201
startsample = floor((seq->startofs + seq->anim_startofs) / FPS * SOUND_WAVE_SAMPLES_PER_SECOND);
202
endsample = ceil((seq->startofs + seq->anim_startofs + seq->enddisp - seq->startdisp) / FPS * SOUND_WAVE_SAMPLES_PER_SECOND);
203
samplestep = (endsample - startsample) * stepsize / (x2 - x1);
205
if (length > floor((waveform->length - startsample) / samplestep))
206
length = floor((waveform->length - startsample) / samplestep);
208
glBegin(GL_LINE_STRIP);
209
for (i = 0; i < length; i++)
211
pos = startsample + i * samplestep;
213
value = waveform->data[pos * 3];
215
for (j = pos + 1; (j < waveform->length) && (j < pos + samplestep); j++)
217
if (value > waveform->data[j * 3])
218
value = waveform->data[j * 3];
221
glVertex2f(x1 + i * stepsize, ymid + value * yscale);
225
glBegin(GL_LINE_STRIP);
226
for (i = 0; i < length; i++)
228
pos = startsample + i * samplestep;
230
value = waveform->data[pos * 3 + 1];
232
for (j = pos + 1; (j < waveform->length) && (j < pos + samplestep); j++)
234
if (value < waveform->data[j * 3 + 1])
235
value = waveform->data[j * 3 + 1];
238
glVertex2f(x1 + i * stepsize, ymid + value * yscale);
205
244
static void drawmeta_stipple(int value)
208
247
glEnable(GL_POLYGON_STIPPLE);
209
248
glPolygonStipple(stipple_halftone);
220
259
static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1, float x2, float y2)
222
/* Note, this used to use WHILE_SEQ, but it messes up the seq->depth value, (needed by transform when doing overlap checks)
223
* so for now, just use the meta's immediate children, could be fixed but its only drawing - Campbell */
261
/* note: this used to use SEQ_BEGIN/SEQ_END, but it messes up the
262
* seq->depth value, (needed by transform when doing overlap checks)
263
* so for now, just use the meta's immediate children, could be fixed but
264
* its only drawing - campbell */
266
unsigned char col[4];
227
int chan_min= MAXSEQ;
230
float draw_range= y2 - y1;
268
int chan_min = MAXSEQ;
271
float draw_range = y2 - y1;
231
272
float draw_height;
233
274
glEnable(GL_BLEND);
234
275
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
236
if(seqm->flag & SEQ_MUTE)
277
if (seqm->flag & SEQ_MUTE)
237
278
drawmeta_stipple(1);
239
for (seq= seqm->seqbase.first; seq; seq= seq->next) {
240
chan_min= MIN2(chan_min, seq->machine);
241
chan_max= MAX2(chan_max, seq->machine);
280
for (seq = seqm->seqbase.first; seq; seq = seq->next) {
281
chan_min = MIN2(chan_min, seq->machine);
282
chan_max = MAX2(chan_max, seq->machine);
244
chan_range= (chan_max - chan_min) + 1;
245
draw_height= draw_range / chan_range;
247
col[3]= 196; /* alpha, used for all meta children */
249
for (seq= seqm->seqbase.first; seq; seq= seq->next) {
250
if((seq->startdisp > x2 || seq->enddisp < x1) == 0) {
251
float y_chan= (seq->machine - chan_min) / (float)(chan_range) * draw_range;
252
float x1_chan= seq->startdisp;
253
float x2_chan= seq->enddisp;
285
chan_range = (chan_max - chan_min) + 1;
286
draw_height = draw_range / chan_range;
288
col[3] = 196; /* alpha, used for all meta children */
290
for (seq = seqm->seqbase.first; seq; seq = seq->next) {
291
if ((seq->startdisp > x2 || seq->enddisp < x1) == 0) {
292
float y_chan = (seq->machine - chan_min) / (float)(chan_range) * draw_range;
293
float x1_chan = seq->startdisp;
294
float x2_chan = seq->enddisp;
254
295
float y1_chan, y2_chan;
256
if((seqm->flag & SEQ_MUTE) == 0 && (seq->flag & SEQ_MUTE))
297
if ((seqm->flag & SEQ_MUTE) == 0 && (seq->flag & SEQ_MUTE))
257
298
drawmeta_stipple(1);
259
300
get_seq_color3ubv(scene, seq, col);
261
glColor4ubv((GLubyte *)col);
263
304
/* clamp within parent sequence strip bounds */
264
if(x1_chan < x1) x1_chan= x1;
265
if(x2_chan > x2) x2_chan= x2;
305
if (x1_chan < x1) x1_chan = x1;
306
if (x2_chan > x2) x2_chan = x2;
267
y1_chan= y1 + y_chan + (draw_height * SEQ_STRIP_OFSBOTTOM);
268
y2_chan= y1 + y_chan + (draw_height * SEQ_STRIP_OFSTOP);
308
y1_chan = y1 + y_chan + (draw_height * SEQ_STRIP_OFSBOTTOM);
309
y2_chan = y1 + y_chan + (draw_height * SEQ_STRIP_OFSTOP);
270
311
glRectf(x1_chan, y1_chan, x2_chan, y2_chan);
272
UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -30);
273
glColor4ubv((GLubyte *)col);
313
UI_GetColorPtrShade3ubv(col, col, -30);
274
315
fdrawbox(x1_chan, y1_chan, x2_chan, y2_chan);
276
if((seqm->flag & SEQ_MUTE) == 0 && (seq->flag & SEQ_MUTE))
317
if ((seqm->flag & SEQ_MUTE) == 0 && (seq->flag & SEQ_MUTE))
277
318
drawmeta_stipple(0);
287
328
/* draw a handle, for each end of a sequence strip */
288
329
static void draw_seq_handle(View2D *v2d, Sequence *seq, float pixelx, short direction)
290
float v1[2], v2[2], v3[2], rx1=0, rx2=0; //for triangles and rect
331
float v1[2], v2[2], v3[2], rx1 = 0, rx2 = 0; //for triangles and rect
291
332
float x1, x2, y1, y2;
293
334
float minhandle, maxhandle;
295
unsigned int whichsel=0;
300
y1= seq->machine+SEQ_STRIP_OFSBOTTOM;
301
y2= seq->machine+SEQ_STRIP_OFSTOP;
336
unsigned int whichsel = 0;
341
y1 = seq->machine + SEQ_STRIP_OFSBOTTOM;
342
y2 = seq->machine + SEQ_STRIP_OFSTOP;
303
344
/* clamp handles to defined size in pixel space */
304
345
handsize = seq->handsize;
307
CLAMP(handsize, minhandle*pixelx, maxhandle*pixelx);
348
CLAMP(handsize, minhandle * pixelx, maxhandle * pixelx);
309
350
/* set up co-ordinates/dimensions for either left or right handle */
310
351
if (direction == SEQ_LEFTHANDLE) {
312
rx2 = x1+handsize*0.75;
353
rx2 = x1 + handsize * 0.75f;
314
v1[0]= x1+handsize/4; v1[1]= y1+( ((y1+y2)/2.0 - y1)/2);
315
v2[0]= x1+handsize/4; v2[1]= y2-( ((y1+y2)/2.0 - y1)/2);
316
v3[0]= v2[0] + handsize/4; v3[1]= (y1+y2)/2.0;
355
v1[0] = x1 + handsize / 4; v1[1] = y1 + ( ((y1 + y2) / 2.0f - y1) / 2);
356
v2[0] = x1 + handsize / 4; v2[1] = y2 - ( ((y1 + y2) / 2.0f - y1) / 2);
357
v3[0] = v2[0] + handsize / 4; v3[1] = (y1 + y2) / 2.0f;
318
359
whichsel = SEQ_LEFTSEL;
319
} else if (direction == SEQ_RIGHTHANDLE) {
320
rx1 = x2-handsize*0.75;
361
else if (direction == SEQ_RIGHTHANDLE) {
362
rx1 = x2 - handsize * 0.75f;
323
v1[0]= x2-handsize/4; v1[1]= y1+( ((y1+y2)/2.0 - y1)/2);
324
v2[0]= x2-handsize/4; v2[1]= y2-( ((y1+y2)/2.0 - y1)/2);
325
v3[0]= v2[0] - handsize/4; v3[1]= (y1+y2)/2.0;
365
v1[0] = x2 - handsize / 4; v1[1] = y1 + ( ((y1 + y2) / 2.0f - y1) / 2);
366
v2[0] = x2 - handsize / 4; v2[1] = y2 - ( ((y1 + y2) / 2.0f - y1) / 2);
367
v3[0] = v2[0] - handsize / 4; v3[1] = (y1 + y2) / 2.0f;
327
369
whichsel = SEQ_RIGHTSEL;
331
if(seq->type < SEQ_EFFECT ||
332
get_sequence_effect_num_inputs(seq->type) == 0) {
333
glEnable( GL_BLEND );
373
if (seq->type < SEQ_EFFECT ||
374
get_sequence_effect_num_inputs(seq->type) == 0) {
335
377
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
337
if(seq->flag & whichsel) glColor4ub(0, 0, 0, 80);
379
if (seq->flag & whichsel) glColor4ub(0, 0, 0, 80);
338
380
else if (seq->flag & SELECT) glColor4ub(255, 255, 255, 30);
339
381
else glColor4ub(0, 0, 0, 22);
341
383
glRectf(rx1, y1, rx2, y2);
343
if(seq->flag & whichsel) glColor4ub(255, 255, 255, 200);
385
if (seq->flag & whichsel) glColor4ub(255, 255, 255, 200);
344
386
else glColor4ub(0, 0, 0, 50);
346
glEnable( GL_POLYGON_SMOOTH );
388
glEnable(GL_POLYGON_SMOOTH);
347
389
glBegin(GL_TRIANGLES);
348
390
glVertex2fv(v1); glVertex2fv(v2); glVertex2fv(v3);
351
glDisable( GL_POLYGON_SMOOTH );
352
glDisable( GL_BLEND );
393
glDisable(GL_POLYGON_SMOOTH);
355
if(G.moving || (seq->flag & whichsel)) {
397
if (G.moving || (seq->flag & whichsel)) {
398
const char col[4] = {255, 255, 255, 255};
357
399
if (direction == SEQ_LEFTHANDLE) {
358
sprintf(str, "%d", seq->startdisp);
362
sprintf(str, "%d", seq->enddisp - 1);
363
x1= x2 - handsize*0.75;
366
UI_view2d_text_cache_add(v2d, x1, y1, str);
400
BLI_snprintf(numstr, sizeof(numstr), "%d", seq->startdisp);
405
BLI_snprintf(numstr, sizeof(numstr), "%d", seq->enddisp - 1);
406
x1 = x2 - handsize * 0.75f;
409
UI_view2d_text_cache_add(v2d, x1, y1, numstr, col);
370
static void draw_seq_extensions(Scene *scene, ARegion *ar, SpaceSeq *sseq, Sequence *seq)
413
static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq)
372
415
float x1, x2, y1, y2, pixely, a;
373
char col[3], blendcol[3];
374
View2D *v2d= &ar->v2d;
376
if(seq->type >= SEQ_EFFECT) return;
381
y1= seq->machine+SEQ_STRIP_OFSBOTTOM;
382
y2= seq->machine+SEQ_STRIP_OFSTOP;
384
pixely = (v2d->cur.ymax - v2d->cur.ymin)/(v2d->mask.ymax - v2d->mask.ymin);
386
if(pixely <= 0) return; /* can happen when the view is split/resized */
416
unsigned char col[3], blendcol[3];
417
View2D *v2d = &ar->v2d;
419
if (seq->type >= SEQ_EFFECT) return;
424
y1 = seq->machine + SEQ_STRIP_OFSBOTTOM;
425
y2 = seq->machine + SEQ_STRIP_OFSTOP;
427
pixely = (v2d->cur.ymax - v2d->cur.ymin) / (v2d->mask.ymax - v2d->mask.ymin);
429
if (pixely <= 0) return; /* can happen when the view is split/resized */
388
431
blendcol[0] = blendcol[1] = blendcol[2] = 120;
391
glEnable( GL_BLEND );
392
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
394
get_seq_color3ubv(scene, seq, col);
396
if (seq->flag & SELECT) {
397
UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.3, -40);
398
glColor4ub(col[0], col[1], col[2], 170);
400
UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.6, 0);
401
glColor4ub(col[0], col[1], col[2], 110);
404
glRectf((float)(seq->start), y1-SEQ_STRIP_OFSBOTTOM, x1, y1);
406
if (seq->flag & SELECT) glColor4ub(col[0], col[1], col[2], 255);
407
else glColor4ub(col[0], col[1], col[2], 160);
409
fdrawbox((float)(seq->start), y1-SEQ_STRIP_OFSBOTTOM, x1, y1); //outline
411
glDisable( GL_BLEND );
414
glEnable( GL_BLEND );
415
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
417
get_seq_color3ubv(scene, seq, col);
419
if (seq->flag & SELECT) {
420
UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.3, -40);
421
glColor4ub(col[0], col[1], col[2], 170);
423
UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.6, 0);
424
glColor4ub(col[0], col[1], col[2], 110);
427
glRectf(x2, y2, (float)(seq->start+seq->len), y2+SEQ_STRIP_OFSBOTTOM);
429
if (seq->flag & SELECT) glColor4ub(col[0], col[1], col[2], 255);
430
else glColor4ub(col[0], col[1], col[2], 160);
432
fdrawbox(x2, y2, (float)(seq->start+seq->len), y2+SEQ_STRIP_OFSBOTTOM); //outline
434
glDisable( GL_BLEND );
436
if(seq->startstill) {
435
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
437
get_seq_color3ubv(scene, seq, col);
439
if (seq->flag & SELECT) {
440
UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.3, -40);
441
glColor4ub(col[0], col[1], col[2], 170);
444
UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.6, 0);
445
glColor4ub(col[0], col[1], col[2], 110);
448
glRectf((float)(seq->start), y1 - SEQ_STRIP_OFSBOTTOM, x1, y1);
450
if (seq->flag & SELECT) glColor4ub(col[0], col[1], col[2], 255);
451
else glColor4ub(col[0], col[1], col[2], 160);
453
fdrawbox((float)(seq->start), y1 - SEQ_STRIP_OFSBOTTOM, x1, y1); //outline
459
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
461
get_seq_color3ubv(scene, seq, col);
463
if (seq->flag & SELECT) {
464
UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.3, -40);
465
glColor4ub(col[0], col[1], col[2], 170);
468
UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.6, 0);
469
glColor4ub(col[0], col[1], col[2], 110);
472
glRectf(x2, y2, (float)(seq->start + seq->len), y2 + SEQ_STRIP_OFSBOTTOM);
474
if (seq->flag & SELECT) glColor4ub(col[0], col[1], col[2], 255);
475
else glColor4ub(col[0], col[1], col[2], 160);
477
fdrawbox(x2, y2, (float)(seq->start + seq->len), y2 + SEQ_STRIP_OFSBOTTOM); //outline
481
if (seq->startstill) {
437
482
get_seq_color3ubv(scene, seq, col);
438
483
UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.75, 40);
439
484
glColor3ubv((GLubyte *)col);
441
486
draw_shadedstrip(seq, col, x1, y1, (float)(seq->start), y2);
443
488
/* feint pinstripes, helps see exactly which is extended and which isn't,
444
* especially when the extension is very small */
489
* especially when the extension is very small */
445
490
if (seq->flag & SELECT) UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 24);
446
else UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -16);
491
else UI_GetColorPtrShade3ubv(col, col, -16);
448
493
glColor3ubv((GLubyte *)col);
450
for(a=y1; a< y2; a+= pixely*2.0 ) {
495
for (a = y1; a < y2; a += pixely * 2.0f) {
451
496
fdrawline(x1, a, (float)(seq->start), a);
455
500
get_seq_color3ubv(scene, seq, col);
456
501
UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.75, 40);
457
502
glColor3ubv((GLubyte *)col);
459
draw_shadedstrip(seq, col, (float)(seq->start+seq->len), y1, x2, y2);
504
draw_shadedstrip(seq, col, (float)(seq->start + seq->len), y1, x2, y2);
461
506
/* feint pinstripes, helps see exactly which is extended and which isn't,
462
* especially when the extension is very small */
463
if (seq->flag & SELECT) UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 24);
464
else UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -16);
507
* especially when the extension is very small */
508
if (seq->flag & SELECT) UI_GetColorPtrShade3ubv(col, col, 24);
509
else UI_GetColorPtrShade3ubv(col, col, -16);
466
511
glColor3ubv((GLubyte *)col);
468
for(a=y1; a< y2; a+= pixely*2.0 ) {
469
fdrawline((float)(seq->start+seq->len), a, x2, a);
513
for (a = y1; a < y2; a += pixely * 2.0f) {
514
fdrawline((float)(seq->start + seq->len), a, x2, a);
474
519
/* draw info text on a sequence strip */
475
static void draw_seq_text(View2D *v2d, Sequence *seq, float x1, float x2, float y1, float y2, char *background_col)
520
static void draw_seq_text(View2D *v2d, Sequence *seq, float x1, float x2, float y1, float y2, const unsigned char background_col[3])
478
char str[32 + FILE_MAXDIR+FILE_MAXFILE];
479
const char *name= seq->name+2;
482
name= give_seqname(seq);
484
if(seq->type == SEQ_META) {
485
sprintf(str, "%d | %s", seq->len, name);
487
else if(seq->type == SEQ_SCENE) {
489
if(seq->scene_camera) {
490
sprintf(str, "%d | %s: %s (%s)", seq->len, name, seq->scene->id.name+2, ((ID *)seq->scene_camera)->name+2);
492
sprintf(str, "%d | %s: %s", seq->len, name, seq->scene->id.name+2);
496
sprintf(str, "%d | %s", seq->len, name);
499
else if(seq->type == SEQ_MULTICAM) {
500
sprintf(str, "Cam: %d", seq->multicam_source);
502
else if(seq->type == SEQ_IMAGE) {
503
sprintf(str, "%d | %s%s", seq->len, seq->strip->dir, seq->strip->stripdata->name);
505
else if(seq->type & SEQ_EFFECT) {
506
int can_float = (seq->type != SEQ_PLUGIN)
507
|| (seq->plugin && seq->plugin->version >= 4);
509
if(seq->seq3!=seq->seq2 && seq->seq1!=seq->seq3)
510
sprintf(str, "%d | %s: %d>%d (use %d)%s", seq->len, name, seq->seq1->machine, seq->seq2->machine, seq->seq3->machine, can_float ? "" : " No float, upgrade plugin!");
511
else if (seq->seq1 && seq->seq2)
512
sprintf(str, "%d | %s: %d>%d%s", seq->len, name, seq->seq1->machine, seq->seq2->machine, can_float ? "" : " No float, upgrade plugin!");
514
sprintf(str, "%d | %s", seq->len, name);
523
char str[32 + FILE_MAX];
524
const char *name = seq->name + 2;
527
/* note, all strings should include 'name' */
529
name = give_seqname(seq);
531
if (seq->type == SEQ_META || seq->type == SEQ_ADJUSTMENT) {
532
BLI_snprintf(str, sizeof(str), "%d | %s", seq->len, name);
534
else if (seq->type == SEQ_SCENE) {
536
if (seq->scene_camera) {
537
BLI_snprintf(str, sizeof(str), "%d | %s: %s (%s)",
538
seq->len, name, seq->scene->id.name + 2, ((ID *)seq->scene_camera)->name + 2);
541
BLI_snprintf(str, sizeof(str), "%d | %s: %s",
542
seq->len, name, seq->scene->id.name + 2);
546
BLI_snprintf(str, sizeof(str), "%d | %s",
550
else if (seq->type == SEQ_MOVIECLIP) {
551
if (seq->clip && strcmp(name, seq->clip->id.name + 2) != 0) {
552
BLI_snprintf(str, sizeof(str), "%d | %s: %s",
553
seq->len, name, seq->clip->id.name + 2);
556
BLI_snprintf(str, sizeof(str), "%d | %s",
560
else if (seq->type == SEQ_MULTICAM) {
561
BLI_snprintf(str, sizeof(str), "Cam | %s: %d",
562
name, seq->multicam_source);
564
else if (seq->type == SEQ_IMAGE) {
565
BLI_snprintf(str, sizeof(str), "%d | %s: %s%s",
566
seq->len, name, seq->strip->dir, seq->strip->stripdata->name);
568
else if (seq->type & SEQ_EFFECT) {
569
int can_float = (seq->type != SEQ_PLUGIN) || (seq->plugin && seq->plugin->version >= 4);
571
if (seq->seq3 != seq->seq2 && seq->seq1 != seq->seq3) {
572
BLI_snprintf(str, sizeof(str), "%d | %s: %d>%d (use %d)%s",
573
seq->len, name, seq->seq1->machine, seq->seq2->machine, seq->seq3->machine,
574
can_float ? "" : " No float, upgrade plugin!");
576
else if (seq->seq1 && seq->seq2) {
577
BLI_snprintf(str, sizeof(str), "%d | %s: %d>%d%s",
578
seq->len, name, seq->seq1->machine, seq->seq2->machine,
579
can_float ? "" : " No float, upgrade plugin!");
582
BLI_snprintf(str, sizeof(str), "%d | %s",
516
586
else if (seq->type == SEQ_SOUND) {
517
sprintf(str, "%d | %s", seq->len, seq->sound->name);
588
BLI_snprintf(str, sizeof(str), "%d | %s: %s",
589
seq->len, name, seq->sound->name);
591
BLI_snprintf(str, sizeof(str), "%d | %s",
519
594
else if (seq->type == SEQ_MOVIE) {
520
sprintf(str, "%d | %s%s", seq->len, seq->strip->dir, seq->strip->stripdata->name);
523
if(seq->flag & SELECT){
525
}else if ((((int)background_col[0] + (int)background_col[1] + (int)background_col[2]) / 3) < 50){
526
cpack(0x505050); /* use lighter text colour for dark background */
535
UI_view2d_text_cache_rectf(v2d, &rect, str);
595
BLI_snprintf(str, sizeof(str), "%d | %s: %s%s",
596
seq->len, name, seq->strip->dir, seq->strip->stripdata->name);
599
if (seq->flag & SELECT) {
600
col[0] = col[1] = col[2] = 255;
602
else if ((((int)background_col[0] + (int)background_col[1] + (int)background_col[2]) / 3) < 50) {
603
col[0] = col[1] = col[2] = 80; /* use lighter text color for dark background */
606
col[0] = col[1] = col[2] = 0;
614
UI_view2d_text_cache_rectf(v2d, &rect, str, col);
538
617
/* draws a shaded strip, made from gradient + flat color + gradient */
539
static void draw_shadedstrip(Sequence *seq, char *col, float x1, float y1, float x2, float y2)
618
static void draw_shadedstrip(Sequence *seq, unsigned char col[3], float x1, float y1, float x2, float y2)
541
620
float ymid1, ymid2;
595
Draw a sequence strip, bounds check already made
596
ARegion is currently only used to get the windows width in pixels
597
so wave file sample drawing precision is zoom adjusted
599
static void draw_seq_strip(Scene *scene, ARegion *ar, SpaceSeq *sseq, Sequence *seq, int outline_tint, float pixelx)
676
* Draw a sequence strip, bounds check already made
677
* ARegion is currently only used to get the windows width in pixels
678
* so wave file sample drawing precision is zoom adjusted
680
static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline_tint, float pixelx)
602
extern void gl_round_box_shade(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadetop, float shadedown);
603
View2D *v2d= &ar->v2d;
682
View2D *v2d = &ar->v2d;
604
683
float x1, x2, y1, y2;
605
char col[3], background_col[3], is_single_image;
684
unsigned char col[3], background_col[3], is_single_image;
607
686
/* we need to know if this is a single image/color or not for drawing */
608
687
is_single_image = (char)seq_single_check(seq);
611
if(seq->startstill) x1= seq->start;
612
else x1= seq->startdisp;
613
y1= seq->machine+SEQ_STRIP_OFSBOTTOM;
614
if(seq->endstill) x2= seq->start+seq->len;
615
else x2= seq->enddisp;
616
y2= seq->machine+SEQ_STRIP_OFSTOP;
690
x1 = (seq->startstill) ? seq->start : seq->startdisp;
691
y1 = seq->machine + SEQ_STRIP_OFSBOTTOM;
692
x2 = (seq->endstill) ? (seq->start + seq->len) : seq->enddisp;
693
y2 = seq->machine + SEQ_STRIP_OFSTOP;
619
696
/* get the correct color per strip type*/
620
697
//get_seq_color3ubv(scene, seq, col);
621
698
get_seq_color3ubv(scene, seq, background_col);
623
700
/* draw the main strip body */
624
if (is_single_image) /* single image */
701
if (is_single_image) { /* single image */
625
702
draw_shadedstrip(seq, background_col, seq_tx_get_final_left(seq, 0), y1, seq_tx_get_final_right(seq, 0), y2);
626
else /* normal operation */
704
else { /* normal operation */
627
705
draw_shadedstrip(seq, background_col, x1, y1, x2, y2);
629
708
/* draw additional info and controls */
630
709
if (!is_single_image)
631
draw_seq_extensions(scene, ar, sseq, seq);
710
draw_seq_extensions(scene, ar, seq);
633
712
draw_seq_handle(v2d, seq, pixelx, SEQ_LEFTHANDLE);
634
713
draw_seq_handle(v2d, seq, pixelx, SEQ_RIGHTHANDLE);
636
715
/* draw the strip outline */
640
719
/* draw sound wave */
641
if(seq->type == SEQ_SOUND) drawseqwave(scene, seq, x1, y1, x2, y2, (ar->v2d.cur.xmax - ar->v2d.cur.xmin)/ar->winx);
720
if (seq->type == SEQ_SOUND) {
721
drawseqwave(scene, seq, x1, y1, x2, y2, (ar->v2d.cur.xmax - ar->v2d.cur.xmin) / ar->winx);
725
if (seq->flag & SEQ_LOCK) {
726
glEnable(GL_POLYGON_STIPPLE);
730
glColor4ub(255, 255, 255, 32);
731
glPolygonStipple(stipple_diag_stripes_pos);
732
glRectf(x1, y1, x2, y2);
735
glColor4ub(0, 0, 0, 32);
736
glPolygonStipple(stipple_diag_stripes_neg);
737
glRectf(x1, y1, x2, y2);
739
glDisable(GL_POLYGON_STIPPLE);
643
743
get_seq_color3ubv(scene, seq, col);
644
744
if (G.moving && (seq->flag & SELECT)) {
645
if(seq->flag & SEQ_OVERLAP) {
646
col[0]= 255; col[1]= col[2]= 40;
647
} else UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 120);
745
if (seq->flag & SEQ_OVERLAP) {
746
col[0] = 255; col[1] = col[2] = 40;
749
UI_GetColorPtrShade3ubv(col, col, 120 + outline_tint);
650
UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, outline_tint);
752
UI_GetColorPtrShade3ubv(col, col, outline_tint);
652
754
glColor3ubv((GLubyte *)col);
656
758
glLineStipple(1, 0x8888);
659
gl_round_box_shade(GL_LINE_LOOP, x1, y1, x2, y2, 0.0, 0.1, 0.0);
761
uiDrawBoxShade(GL_LINE_LOOP, x1, y1, x2, y2, 0.0, 0.1, 0.0);
661
763
if (seq->flag & SEQ_MUTE) {
662
764
glDisable(GL_LINE_STIPPLE);
665
if(seq->type==SEQ_META) drawmeta_contents(scene, seq, x1, y1, x2, y2);
767
if (seq->type == SEQ_META) {
768
drawmeta_contents(scene, seq, x1, y1, x2, y2);
667
771
/* calculate if seq is long enough to print a name */
668
x1= seq->startdisp+seq->handsize;
669
x2= seq->enddisp-seq->handsize;
772
x1 = seq->startdisp + seq->handsize;
773
x2 = seq->enddisp - seq->handsize;
671
775
/* info text on the strip */
672
if(x1<v2d->cur.xmin) x1= v2d->cur.xmin;
673
else if(x1>v2d->cur.xmax) x1= v2d->cur.xmax;
674
if(x2<v2d->cur.xmin) x2= v2d->cur.xmin;
675
else if(x2>v2d->cur.xmax) x2= v2d->cur.xmax;
776
if (x1 < v2d->cur.xmin) x1 = v2d->cur.xmin;
777
else if (x1 > v2d->cur.xmax) x1 = v2d->cur.xmax;
778
if (x2 < v2d->cur.xmin) x2 = v2d->cur.xmin;
779
else if (x2 > v2d->cur.xmax) x2 = v2d->cur.xmax;
677
781
/* nice text here would require changing the view matrix for texture text */
678
if( (x2-x1) / pixelx > 32) {
782
if ((x2 - x1) / pixelx > 32) {
679
783
draw_seq_text(v2d, seq, x1, x2, y1, y2, background_col);
683
static Sequence *special_seq_update= 0;
787
static Sequence *special_seq_update = NULL;
685
void set_special_seq_update(int val)
789
static void UNUSED_FUNCTION(set_special_seq_update) (int val)
689
793
/* if mouse over a sequence && LEFTMOUSE */
691
795
// XXX special_seq_update= find_nearest_seq(&x);
693
else special_seq_update= 0;
797
else special_seq_update = NULL;
696
void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq, int cfra, int frame_ofs)
800
void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq, int cfra, int frame_ofs)
698
extern void gl_round_box(int mode, float minx, float miny, float maxx, float maxy, float rad);
802
struct Main *bmain = CTX_data_main(C);
803
struct ImBuf *ibuf = NULL;
804
struct ImBuf *scope = NULL;
700
805
struct View2D *v2d = &ar->v2d;
701
806
int rectx, recty;
702
807
float viewrectx, viewrecty;
704
static int recursive= 0;
705
808
float render_size = 0.0;
706
809
float proxy_size = 100.0;
708
812
GLuint last_texid;
813
SeqRenderData context;
710
815
render_size = sseq->render_size;
711
816
if (render_size == 0) {
712
817
render_size = scene->r.size;
714
820
proxy_size = render_size;
716
822
if (render_size < 0) {
720
viewrectx = (render_size*(float)scene->r.xsch)/100.0f;
721
viewrecty = (render_size*(float)scene->r.ysch)/100.0f;
826
viewrectx = (render_size * (float)scene->r.xsch) / 100.0f;
827
viewrecty = (render_size * (float)scene->r.ysch) / 100.0f;
723
829
rectx = viewrectx + 0.5f;
724
830
recty = viewrecty + 0.5f;
726
832
if (sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
727
833
viewrectx *= scene->r.xasp / scene->r.yasp;
728
viewrectx /= proxy_size / 100.0;
729
viewrecty /= proxy_size / 100.0;
834
viewrectx /= proxy_size / 100.0f;
835
viewrecty /= proxy_size / 100.0f;
733
/* XXX TODO: take color from theme */
734
glClearColor(0.0, 0.0, 0.0, 0.0);
838
if (frame_ofs == 0) {
839
UI_GetThemeColor3fv(TH_SEQ_PREVIEW, col);
840
glClearColor(col[0], col[1], col[2], 0.0);
735
841
glClear(GL_COLOR_BUFFER_BIT);
741
847
UI_view2d_totRect_set(v2d, viewrectx + 0.5f, viewrecty + 0.5f);
742
848
UI_view2d_curRect_validate(v2d);
744
/* BIG PROBLEM: the give_ibuf_seq() can call a rendering, which in turn calls redraws...
745
this shouldn't belong in a window drawing....
746
So: solve this once event based.
747
Now we check for recursion, space type and active area again (ton) */
753
if (special_seq_update) {
754
ibuf= give_ibuf_seq_direct(scene, rectx, recty, cfra + frame_ofs, proxy_size, special_seq_update);
756
else if (!U.prefetchframes) { // XXX || (G.f & G_PLAYANIM) == 0) {
757
ibuf= (ImBuf *)give_ibuf_seq(scene, rectx, recty, cfra + frame_ofs, sseq->chanshown, proxy_size);
760
ibuf= (ImBuf *)give_ibuf_seq_threaded(scene, rectx, recty, cfra + frame_ofs, sseq->chanshown, proxy_size);
764
/* XXX HURMF! the give_ibuf_seq can call image display in this window */
765
// if(sa->spacetype!=SPACE_SEQ)
768
// areawinset(sa->win);
775
if(ibuf->rect==NULL && ibuf->rect_float == NULL)
778
switch(sseq->mainb) {
779
case SEQ_DRAW_IMG_IMBUF:
780
if (sseq->zebra != 0) {
781
ibuf = make_zebra_view_from_ibuf(ibuf, sseq->zebra);
785
case SEQ_DRAW_IMG_WAVEFORM:
786
if ((sseq->flag & SEQ_DRAW_COLOR_SEPERATED) != 0) {
787
ibuf = make_sep_waveform_view_from_ibuf(ibuf);
789
ibuf = make_waveform_view_from_ibuf(ibuf);
793
case SEQ_DRAW_IMG_VECTORSCOPE:
794
ibuf = make_vectorscope_view_from_ibuf(ibuf);
797
case SEQ_DRAW_IMG_HISTOGRAM:
798
ibuf = make_histogram_view_from_ibuf(ibuf);
803
if(ibuf->rect_float && ibuf->rect==NULL) {
850
/* only initialize the preview if a render is in progress */
854
context = seq_new_render_data(bmain, scene, rectx, recty, proxy_size);
856
if (special_seq_update)
857
ibuf = give_ibuf_seq_direct(context, cfra + frame_ofs, special_seq_update);
858
else if (!U.prefetchframes) // XXX || (G.f & G_PLAYANIM) == 0) {
859
ibuf = give_ibuf_seq(context, cfra + frame_ofs, sseq->chanshown);
861
ibuf = give_ibuf_seq_threaded(context, cfra + frame_ofs, sseq->chanshown);
866
if (ibuf->rect == NULL && ibuf->rect_float == NULL)
869
switch (sseq->mainb) {
870
case SEQ_DRAW_IMG_IMBUF:
871
if (sseq->zebra != 0) {
872
scope = make_zebra_view_from_ibuf(ibuf, sseq->zebra);
875
case SEQ_DRAW_IMG_WAVEFORM:
876
if ((sseq->flag & SEQ_DRAW_COLOR_SEPARATED) != 0) {
877
scope = make_sep_waveform_view_from_ibuf(ibuf);
880
scope = make_waveform_view_from_ibuf(ibuf);
883
case SEQ_DRAW_IMG_VECTORSCOPE:
884
scope = make_vectorscope_view_from_ibuf(ibuf);
886
case SEQ_DRAW_IMG_HISTOGRAM:
887
scope = make_histogram_view_from_ibuf(ibuf);
896
if (ibuf->rect_float && ibuf->rect == NULL) {
804
897
IMB_rect_from_float(ibuf);
807
900
/* setting up the view - actual drawing starts here */
808
UI_view2d_view_ortho(C, v2d);
901
UI_view2d_view_ortho(v2d);
810
last_texid= glaGetOneInteger(GL_TEXTURE_2D);
903
last_texid = glaGetOneInteger(GL_TEXTURE_2D);
811
904
glEnable(GL_TEXTURE_2D);
812
905
glGenTextures(1, (GLuint *)&texid);
819
912
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, ibuf->x, ibuf->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
820
913
glBegin(GL_QUADS);
824
tot_clip.xmin= v2d->tot.xmin + (ABS(v2d->tot.xmax - v2d->tot.xmin) * scene->ed->over_border.xmin);
825
tot_clip.ymin= v2d->tot.ymin + (ABS(v2d->tot.ymax - v2d->tot.ymin) * scene->ed->over_border.ymin);
826
tot_clip.xmax= v2d->tot.xmin + (ABS(v2d->tot.xmax - v2d->tot.xmin) * scene->ed->over_border.xmax);
827
tot_clip.ymax= v2d->tot.ymin + (ABS(v2d->tot.ymax - v2d->tot.ymin) * scene->ed->over_border.ymax);
917
tot_clip.xmin = v2d->tot.xmin + (ABS(v2d->tot.xmax - v2d->tot.xmin) * scene->ed->over_border.xmin);
918
tot_clip.ymin = v2d->tot.ymin + (ABS(v2d->tot.ymax - v2d->tot.ymin) * scene->ed->over_border.ymin);
919
tot_clip.xmax = v2d->tot.xmin + (ABS(v2d->tot.xmax - v2d->tot.xmin) * scene->ed->over_border.xmax);
920
tot_clip.ymax = v2d->tot.ymin + (ABS(v2d->tot.ymax - v2d->tot.ymin) * scene->ed->over_border.ymax);
829
glTexCoord2f(scene->ed->over_border.xmin, scene->ed->over_border.ymin);glVertex2f(tot_clip.xmin, tot_clip.ymin);
830
glTexCoord2f(scene->ed->over_border.xmin, scene->ed->over_border.ymax);glVertex2f(tot_clip.xmin, tot_clip.ymax);
831
glTexCoord2f(scene->ed->over_border.xmax, scene->ed->over_border.ymax);glVertex2f(tot_clip.xmax, tot_clip.ymax);
832
glTexCoord2f(scene->ed->over_border.xmax, scene->ed->over_border.ymin);glVertex2f(tot_clip.xmax, tot_clip.ymin);
922
glTexCoord2f(scene->ed->over_border.xmin, scene->ed->over_border.ymin); glVertex2f(tot_clip.xmin, tot_clip.ymin);
923
glTexCoord2f(scene->ed->over_border.xmin, scene->ed->over_border.ymax); glVertex2f(tot_clip.xmin, tot_clip.ymax);
924
glTexCoord2f(scene->ed->over_border.xmax, scene->ed->over_border.ymax); glVertex2f(tot_clip.xmax, tot_clip.ymax);
925
glTexCoord2f(scene->ed->over_border.xmax, scene->ed->over_border.ymin); glVertex2f(tot_clip.xmax, tot_clip.ymin);
835
glTexCoord2f(0.0f, 0.0f);glVertex2f(v2d->tot.xmin, v2d->tot.ymin);
836
glTexCoord2f(0.0f, 1.0f);glVertex2f(v2d->tot.xmin, v2d->tot.ymax);
837
glTexCoord2f(1.0f, 1.0f);glVertex2f(v2d->tot.xmax, v2d->tot.ymax);
838
glTexCoord2f(1.0f, 0.0f);glVertex2f(v2d->tot.xmax, v2d->tot.ymin);
928
glTexCoord2f(0.0f, 0.0f); glVertex2f(v2d->tot.xmin, v2d->tot.ymin);
929
glTexCoord2f(0.0f, 1.0f); glVertex2f(v2d->tot.xmin, v2d->tot.ymax);
930
glTexCoord2f(1.0f, 1.0f); glVertex2f(v2d->tot.xmax, v2d->tot.ymax);
931
glTexCoord2f(1.0f, 0.0f); glVertex2f(v2d->tot.xmax, v2d->tot.ymin);
841
934
glBindTexture(GL_TEXTURE_2D, last_texid);
842
935
glDisable(GL_TEXTURE_2D);
843
936
glDeleteTextures(1, &texid);
845
if(sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
938
if (sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
847
940
float x1 = v2d->tot.xmin;
848
941
float y1 = v2d->tot.ymin;
935
1029
glRectf(v2d->cur.xmin, -1.0, v2d->cur.xmax, 1.0);
937
1031
/* Alternating horizontal stripes */
938
i= MAX2(1, ((int)v2d->cur.ymin)-1);
1032
i = MAX2(1, ((int)v2d->cur.ymin) - 1);
940
1034
glBegin(GL_QUADS);
941
while (i<v2d->cur.ymax) {
943
UI_ThemeColorShade(TH_BACK, -15);
945
UI_ThemeColorShade(TH_BACK, -25);
947
glVertex2f(v2d->cur.xmax, i);
948
glVertex2f(v2d->cur.xmin, i);
949
glVertex2f(v2d->cur.xmin, i+1);
950
glVertex2f(v2d->cur.xmax, i+1);
1035
while (i < v2d->cur.ymax) {
1037
UI_ThemeColorShade(TH_BACK, -15);
1039
UI_ThemeColorShade(TH_BACK, -25);
1041
glVertex2f(v2d->cur.xmax, i);
1042
glVertex2f(v2d->cur.xmin, i);
1043
glVertex2f(v2d->cur.xmin, i + 1);
1044
glVertex2f(v2d->cur.xmax, i + 1);
956
1050
/* Darker lines separating the horizontal bands */
957
i= MAX2(1, ((int)v2d->cur.ymin)-1);
1051
i = MAX2(1, ((int)v2d->cur.ymin) - 1);
958
1052
UI_ThemeColor(TH_GRID);
960
1054
glBegin(GL_LINES);
961
while (i < v2d->cur.ymax) {
962
glVertex2f(v2d->cur.xmax, i);
963
glVertex2f(v2d->cur.xmin, i);
1055
while (i < v2d->cur.ymax) {
1056
glVertex2f(v2d->cur.xmax, i);
1057
glVertex2f(v2d->cur.xmin, i);
970
1064
/* draw the contents of the sequencer strips view */
971
1065
static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar)
973
Scene *scene= CTX_data_scene(C);
974
SpaceSeq *sseq= CTX_wm_space_seq(C);
975
View2D *v2d= &ar->v2d;
1067
Scene *scene = CTX_data_scene(C);
1068
View2D *v2d = &ar->v2d;
976
1069
Sequence *last_seq = seq_active_get(scene);
978
float pixelx = (v2d->cur.xmax - v2d->cur.xmin)/(v2d->mask.xmax - v2d->mask.xmin);
1071
float pixelx = (v2d->cur.xmax - v2d->cur.xmin) / (v2d->mask.xmax - v2d->mask.xmin);
980
1073
/* loop through twice, first unselected, then selected */
981
for (j=0; j<2; j++) {
1074
for (j = 0; j < 2; j++) {
983
int outline_tint= (j) ? -60 : -150; /* highlighting around strip edges indicating selection */
1076
int outline_tint = (j) ? -60 : -150; /* highlighting around strip edges indicating selection */
985
1078
/* loop through strips, checking for those that are visible */
986
for (seq= ed->seqbasep->first; seq; seq= seq->next) {
1079
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
987
1080
/* boundbox and selection tests for NOT drawing the strip... */
988
if ((seq->flag & SELECT) == sel) continue;
1081
if ((seq->flag & SELECT) != sel) continue;
989
1082
else if (seq == last_seq) continue;
990
1083
else if (MIN2(seq->startdisp, seq->start) > v2d->cur.xmax) continue;
991
else if (MAX2(seq->enddisp, seq->start+seq->len) < v2d->cur.xmin) continue;
992
else if (seq->machine+1.0 < v2d->cur.ymin) continue;
1084
else if (MAX2(seq->enddisp, seq->start + seq->len) < v2d->cur.xmin) continue;
1085
else if (seq->machine + 1.0f < v2d->cur.ymin) continue;
993
1086
else if (seq->machine > v2d->cur.ymax) continue;
995
1088
/* strip passed all tests unscathed... so draw it now */
996
draw_seq_strip(scene, ar, sseq, seq, outline_tint, pixelx);
1089
draw_seq_strip(scene, ar, seq, outline_tint, pixelx);
999
1092
/* draw selected next time round */
1003
1096
/* draw the last selected last (i.e. 'active' in other parts of Blender), removes some overlapping error */
1005
draw_seq_strip(scene, ar, sseq, last_seq, 120, pixelx);
1098
draw_seq_strip(scene, ar, last_seq, 120, pixelx);
1008
static void seq_draw_sfra_efra(const bContext *C, SpaceSeq *sseq, ARegion *ar)
1010
View2D *v2d= UI_view2d_fromcontext(C);
1011
Scene *scene= CTX_data_scene(C);
1101
static void seq_draw_sfra_efra(Scene *scene, View2D *v2d)
1013
1103
glEnable(GL_BLEND);
1015
1105
/* draw darkened area outside of active timeline