style cleanup: sequencer

This commit is contained in:
Campbell Barton
2012-03-29 22:26:11 +00:00
parent 7816eb7bd8
commit 863f7edad6
9 changed files with 2391 additions and 2359 deletions

View File

@@ -79,11 +79,11 @@
# include "AUD_C-API.h"
#endif
static ImBuf* seq_render_strip_stack(
SeqRenderData context, ListBase *seqbasep, float cfra, int chanshown);
static ImBuf *seq_render_strip_stack(
SeqRenderData context, ListBase *seqbasep, float cfra, int chanshown);
static ImBuf * seq_render_strip(
SeqRenderData context, Sequence * seq, float cfra);
static ImBuf *seq_render_strip(
SeqRenderData context, Sequence *seq, float cfra);
static void seq_free_animdata(Scene *scene, Sequence *seq);
@@ -92,29 +92,29 @@ static void seq_free_animdata(Scene *scene, Sequence *seq);
#define SELECT 1
ListBase seqbase_clipboard;
int seqbase_clipboard_frame;
SequencerDrawView sequencer_view3d_cb= NULL; /* NULL in background mode */
SequencerDrawView sequencer_view3d_cb = NULL; /* NULL in background mode */
void printf_strip(Sequence *seq)
{
fprintf(stderr, "name: '%s', len:%d, start:%d, (startofs:%d, endofs:%d), (startstill:%d, endstill:%d), machine:%d, (startdisp:%d, enddisp:%d)\n",
seq->name, seq->len, seq->start, seq->startofs, seq->endofs, seq->startstill, seq->endstill, seq->machine, seq->startdisp, seq->enddisp);
seq->name, seq->len, seq->start, seq->startofs, seq->endofs, seq->startstill, seq->endstill, seq->machine, seq->startdisp, seq->enddisp);
fprintf(stderr, "\tseq_tx_set_final_left: %d %d\n\n", seq_tx_get_final_left(seq, 0), seq_tx_get_final_right(seq, 0));
}
int seqbase_recursive_apply(ListBase *seqbase, int (*apply_func)(Sequence *seq, void *), void *arg)
{
Sequence *iseq;
for (iseq= seqbase->first; iseq; iseq= iseq->next) {
for (iseq = seqbase->first; iseq; iseq = iseq->next) {
if (seq_recursive_apply(iseq, apply_func, arg) == -1)
return -1; /* bail out */
return -1; /* bail out */
}
return 1;
}
int seq_recursive_apply(Sequence *seq, int (*apply_func)(Sequence *, void *), void *arg)
{
int ret= apply_func(seq, arg);
int ret = apply_func(seq, arg);
if (ret == -1)
return -1; /* bail out */
@@ -142,8 +142,8 @@ static void free_proxy_seq(Sequence *seq)
void seq_free_strip(Strip *strip)
{
strip->us--;
if (strip->us>0) return;
if (strip->us<0) {
if (strip->us > 0) return;
if (strip->us < 0) {
printf("error: negative users in strip\n");
return;
}
@@ -192,8 +192,8 @@ void seq_free_sequence(Scene *scene, Sequence *seq)
if (scene) {
Editing *ed = scene->ed;
if (ed->act_seq==seq)
ed->act_seq= NULL;
if (ed->act_seq == seq)
ed->act_seq = NULL;
if (seq->scene_sound && ELEM(seq->type, SEQ_SOUND, SEQ_SCENE))
sound_remove_scene_sound(scene, seq->scene_sound);
@@ -208,7 +208,7 @@ void seq_free_sequence_recurse(Scene *scene, Sequence *seq)
{
Sequence *iseq;
for (iseq= seq->seqbase.first; iseq; iseq= iseq->next) {
for (iseq = seq->seqbase.first; iseq; iseq = iseq->next) {
seq_free_sequence_recurse(scene, iseq);
}
@@ -221,8 +221,8 @@ Editing *seq_give_editing(Scene *scene, int alloc)
if (scene->ed == NULL && alloc) {
Editing *ed;
ed= scene->ed= MEM_callocN( sizeof(Editing), "addseq");
ed->seqbasep= &ed->seqbase;
ed = scene->ed = MEM_callocN(sizeof(Editing), "addseq");
ed->seqbasep = &ed->seqbase;
}
return scene->ed;
}
@@ -231,8 +231,8 @@ static void seq_free_clipboard_recursive(Sequence *seq_parent)
{
Sequence *seq, *nseq;
for (seq= seq_parent->seqbase.first; seq; seq= nseq) {
nseq= seq->next;
for (seq = seq_parent->seqbase.first; seq; seq = nseq) {
nseq = seq->next;
seq_free_clipboard_recursive(seq);
}
@@ -243,11 +243,11 @@ void seq_free_clipboard(void)
{
Sequence *seq, *nseq;
for (seq= seqbase_clipboard.first; seq; seq= nseq) {
nseq= seq->next;
for (seq = seqbase_clipboard.first; seq; seq = nseq) {
nseq = seq->next;
seq_free_clipboard_recursive(seq);
}
seqbase_clipboard.first= seqbase_clipboard.last= NULL;
seqbase_clipboard.first = seqbase_clipboard.last = NULL;
}
void seq_free_editing(Scene *scene)
@@ -256,15 +256,16 @@ void seq_free_editing(Scene *scene)
MetaStack *ms;
Sequence *seq;
if (ed==NULL)
if (ed == NULL)
return;
SEQ_BEGIN(ed, seq) {
SEQ_BEGIN(ed, seq)
{
seq_free_sequence(scene, seq);
}
SEQ_END
while ((ms= ed->metastack.first)) {
while ((ms = ed->metastack.first)) {
BLI_remlink(&ed->metastack, ms);
MEM_freeN(ms);
}
@@ -277,8 +278,8 @@ void seq_free_editing(Scene *scene)
* ********************************************************************** */
SeqRenderData seq_new_render_data(
struct Main * bmain, struct Scene * scene,
int rectx, int recty, int preview_render_size)
struct Main *bmain, struct Scene *scene,
int rectx, int recty, int preview_render_size)
{
SeqRenderData rval;
@@ -293,7 +294,7 @@ SeqRenderData seq_new_render_data(
return rval;
}
int seq_cmp_render_data(const SeqRenderData * a, const SeqRenderData * b)
int seq_cmp_render_data(const SeqRenderData *a, const SeqRenderData *b)
{
if (a->preview_render_size < b->preview_render_size) {
return -1;
@@ -347,7 +348,7 @@ int seq_cmp_render_data(const SeqRenderData * a, const SeqRenderData * b)
return 0;
}
unsigned int seq_hash_render_data(const SeqRenderData * a)
unsigned int seq_hash_render_data(const SeqRenderData *a)
{
unsigned int rval = a->rectx + a->recty;
@@ -371,7 +372,7 @@ static void seq_count(ListBase *seqbase, int *tot)
{
Sequence *seq;
for (seq=seqbase->first; seq; seq=seq->next) {
for (seq = seqbase->first; seq; seq = seq->next) {
(*tot)++;
if (seq->seqbase.first)
@@ -383,13 +384,13 @@ static void seq_build_array(ListBase *seqbase, Sequence ***array, int depth)
{
Sequence *seq;
for (seq=seqbase->first; seq; seq=seq->next) {
seq->depth= depth;
for (seq = seqbase->first; seq; seq = seq->next) {
seq->depth = depth;
if (seq->seqbase.first)
seq_build_array(&seq->seqbase, array, depth+1);
seq_build_array(&seq->seqbase, array, depth + 1);
**array= seq;
**array = seq;
(*array)++;
}
}
@@ -398,8 +399,8 @@ void seq_array(Editing *ed, Sequence ***seqarray, int *tot, int use_pointer)
{
Sequence **array;
*seqarray= NULL;
*tot= 0;
*seqarray = NULL;
*tot = 0;
if (ed == NULL)
return;
@@ -412,7 +413,7 @@ void seq_array(Editing *ed, Sequence ***seqarray, int *tot, int use_pointer)
if (*tot == 0)
return;
*seqarray= array= MEM_mallocN(sizeof(Sequence *)*(*tot), "SeqArray");
*seqarray = array = MEM_mallocN(sizeof(Sequence *) * (*tot), "SeqArray");
if (use_pointer)
seq_build_array(ed->seqbasep, &array, 0);
else
@@ -425,18 +426,18 @@ void seq_begin(Editing *ed, SeqIterator *iter, int use_pointer)
seq_array(ed, &iter->array, &iter->tot, use_pointer);
if (iter->tot) {
iter->cur= 0;
iter->seq= iter->array[iter->cur];
iter->valid= 1;
iter->cur = 0;
iter->seq = iter->array[iter->cur];
iter->valid = 1;
}
}
void seq_next(SeqIterator *iter)
{
if (++iter->cur < iter->tot)
iter->seq= iter->array[iter->cur];
iter->seq = iter->array[iter->cur];
else
iter->valid= 0;
iter->valid = 0;
}
void seq_end(SeqIterator *iter)
@@ -444,7 +445,7 @@ void seq_end(SeqIterator *iter)
if (iter->array)
MEM_freeN(iter->array);
iter->valid= 0;
iter->valid = 0;
}
/*
@@ -457,11 +458,11 @@ void seq_end(SeqIterator *iter)
*/
static void do_seq_count_cb(ListBase *seqbase, int *totseq,
int (*test_func)(Sequence * seq))
int (*test_func)(Sequence *seq))
{
Sequence *seq;
seq= seqbase->first;
seq = seqbase->first;
while (seq) {
int test = test_func(seq);
if (test & BUILD_SEQAR_COUNT_CURRENT) {
@@ -470,48 +471,48 @@ static void do_seq_count_cb(ListBase *seqbase, int *totseq,
if (seq->seqbase.first && (test & BUILD_SEQAR_COUNT_CHILDREN)) {
do_seq_count_cb(&seq->seqbase, totseq, test_func);
}
seq= seq->next;
seq = seq->next;
}
}
static void do_build_seqar_cb(ListBase *seqbase, Sequence ***seqar, int depth,
int (*test_func)(Sequence * seq))
int (*test_func)(Sequence *seq))
{
Sequence *seq;
seq= seqbase->first;
seq = seqbase->first;
while (seq) {
int test = test_func(seq);
seq->depth= depth;
seq->depth = depth;
if (seq->seqbase.first && (test & BUILD_SEQAR_COUNT_CHILDREN)) {
do_build_seqar_cb(&seq->seqbase, seqar, depth+1, test_func);
do_build_seqar_cb(&seq->seqbase, seqar, depth + 1, test_func);
}
if (test & BUILD_SEQAR_COUNT_CURRENT) {
**seqar= seq;
**seqar = seq;
(*seqar)++;
}
seq= seq->next;
seq = seq->next;
}
}
void build_seqar_cb(ListBase *seqbase, Sequence ***seqar, int *totseq,
int (*test_func)(Sequence * seq))
int (*test_func)(Sequence *seq))
{
Sequence **tseqar;
*totseq= 0;
*totseq = 0;
do_seq_count_cb(seqbase, totseq, test_func);
if (*totseq==0) {
*seqar= NULL;
if (*totseq == 0) {
*seqar = NULL;
return;
}
*seqar= MEM_mallocN(sizeof(void *)* *totseq, "seqar");
tseqar= *seqar;
*seqar = MEM_mallocN(sizeof(void *) * *totseq, "seqar");
tseqar = *seqar;
do_build_seqar_cb(seqbase, seqar, 0, test_func);
*seqar= tseqar;
*seqar = tseqar;
}
@@ -521,7 +522,7 @@ static void seq_update_sound_bounds_recursive(Scene *scene, Sequence *metaseq)
/* for sound we go over full meta tree to update bounds of the sound strips,
* since sound is played outside of evaluating the imbufs, */
for (seq=metaseq->seqbase.first; seq; seq=seq->next) {
for (seq = metaseq->seqbase.first; seq; seq = seq->next) {
if (seq->type == SEQ_META) {
seq_update_sound_bounds_recursive(scene, seq);
}
@@ -534,7 +535,7 @@ static void seq_update_sound_bounds_recursive(Scene *scene, Sequence *metaseq)
if (seq->start + seq->len - seq->endofs > metaseq->start + metaseq->len - metaseq->endofs)
endofs = seq->start + seq->len - metaseq->start - metaseq->len + metaseq->endofs;
sound_move_scene_sound(scene, seq->scene_sound, seq->start + startofs, seq->start+seq->len - endofs, startofs);
sound_move_scene_sound(scene, seq->scene_sound, seq->start + startofs, seq->start + seq->len - endofs, startofs);
}
}
}
@@ -542,18 +543,18 @@ static void seq_update_sound_bounds_recursive(Scene *scene, Sequence *metaseq)
void calc_sequence_disp(Scene *scene, Sequence *seq)
{
if (seq->startofs && seq->startstill) seq->startstill= 0;
if (seq->endofs && seq->endstill) seq->endstill= 0;
if (seq->startofs && seq->startstill) seq->startstill = 0;
if (seq->endofs && seq->endstill) seq->endstill = 0;
seq->startdisp= seq->start + seq->startofs - seq->startstill;
seq->enddisp= seq->start+seq->len - seq->endofs + seq->endstill;
seq->startdisp = seq->start + seq->startofs - seq->startstill;
seq->enddisp = seq->start + seq->len - seq->endofs + seq->endstill;
seq->handsize= 10.0; /* 10 frames */
if ( seq->enddisp-seq->startdisp < 10 ) {
seq->handsize= (float)(0.5*(seq->enddisp-seq->startdisp));
seq->handsize = 10.0; /* 10 frames */
if (seq->enddisp - seq->startdisp < 10) {
seq->handsize = (float)(0.5 * (seq->enddisp - seq->startdisp));
}
else if (seq->enddisp-seq->startdisp > 250) {
seq->handsize= (float)((seq->enddisp-seq->startdisp)/25);
else if (seq->enddisp - seq->startdisp > 250) {
seq->handsize = (float)((seq->enddisp - seq->startdisp) / 25);
}
if (ELEM(seq->type, SEQ_SOUND, SEQ_SCENE)) {
@@ -569,18 +570,18 @@ void calc_sequence(Scene *scene, Sequence *seq)
int min, max;
/* check all metas recursively */
seqm= seq->seqbase.first;
seqm = seq->seqbase.first;
while (seqm) {
if (seqm->seqbase.first) calc_sequence(scene, seqm);
seqm= seqm->next;
seqm = seqm->next;
}
/* effects and meta: automatic start and end */
if (seq->type & SEQ_EFFECT) {
/* pointers */
if (seq->seq2==NULL) seq->seq2= seq->seq1;
if (seq->seq3==NULL) seq->seq3= seq->seq1;
if (seq->seq2 == NULL) seq->seq2 = seq->seq1;
if (seq->seq3 == NULL) seq->seq3 = seq->seq1;
/* effecten go from seq1 -> seq2: test */
@@ -593,40 +594,40 @@ void calc_sequence(Scene *scene, Sequence *seq)
/* XXX These resets should not be necessary, but users used to be able to
* edit effect's length, leading to strange results. See #29190. */
seq->startofs = seq->endofs = seq->startstill = seq->endstill = 0;
seq->start= seq->startdisp= MAX3(seq->seq1->startdisp, seq->seq2->startdisp, seq->seq3->startdisp);
seq->enddisp= MIN3(seq->seq1->enddisp, seq->seq2->enddisp, seq->seq3->enddisp);
seq->start = seq->startdisp = MAX3(seq->seq1->startdisp, seq->seq2->startdisp, seq->seq3->startdisp);
seq->enddisp = MIN3(seq->seq1->enddisp, seq->seq2->enddisp, seq->seq3->enddisp);
/* we cant help if strips don't overlap, it wont give useful results.
* but at least ensure 'len' is never negative which causes bad bugs elsewhere. */
if (seq->enddisp < seq->startdisp) {
/* simple start/end swap */
seq->start= seq->enddisp;
seq->start = seq->enddisp;
seq->enddisp = seq->startdisp;
seq->startdisp= seq->start;
seq->startdisp = seq->start;
seq->flag |= SEQ_INVALID_EFFECT;
}
else {
seq->flag &= ~SEQ_INVALID_EFFECT;
}
seq->len= seq->enddisp - seq->startdisp;
seq->len = seq->enddisp - seq->startdisp;
}
else {
calc_sequence_disp(scene, seq);
}
}
else {
if (seq->type==SEQ_META) {
seqm= seq->seqbase.first;
if (seq->type == SEQ_META) {
seqm = seq->seqbase.first;
if (seqm) {
min= MAXFRAME * 2;
max= -MAXFRAME * 2;
min = MAXFRAME * 2;
max = -MAXFRAME * 2;
while (seqm) {
if (seqm->startdisp < min) min= seqm->startdisp;
if (seqm->enddisp > max) max= seqm->enddisp;
seqm= seqm->next;
if (seqm->startdisp < min) min = seqm->startdisp;
if (seqm->enddisp > max) max = seqm->enddisp;
seqm = seqm->next;
}
seq->start= min + seq->anim_startofs;
seq->len = max-min;
seq->start = min + seq->anim_startofs;
seq->len = max - min;
seq->len -= seq->anim_startofs;
seq->len -= seq->anim_endofs;
}
@@ -637,95 +638,95 @@ void calc_sequence(Scene *scene, Sequence *seq)
}
/* note: caller should run calc_sequence(scene, seq) after */
void reload_sequence_new_file(Scene *scene, Sequence * seq, int lock_range)
void reload_sequence_new_file(Scene *scene, Sequence *seq, int lock_range)
{
char str[FILE_MAX];
int prev_startdisp=0, prev_enddisp=0;
int prev_startdisp = 0, prev_enddisp = 0;
/* note: don't rename the strip, will break animation curves */
if (ELEM6(seq->type, SEQ_MOVIE, SEQ_IMAGE, SEQ_SOUND, SEQ_SCENE, SEQ_META, SEQ_MOVIECLIP)==0) {
if (ELEM6(seq->type, SEQ_MOVIE, SEQ_IMAGE, SEQ_SOUND, SEQ_SCENE, SEQ_META, SEQ_MOVIECLIP) == 0) {
return;
}
if (lock_range) {
/* keep so we don't have to move the actual start and end points (only the data) */
calc_sequence_disp(scene, seq);
prev_startdisp= seq->startdisp;
prev_enddisp= seq->enddisp;
prev_startdisp = seq->startdisp;
prev_enddisp = seq->enddisp;
}
switch(seq->type) {
case SEQ_IMAGE:
{
/* Hack? */
size_t olen = MEM_allocN_len(seq->strip->stripdata)/sizeof(struct StripElem);
switch (seq->type) {
case SEQ_IMAGE:
{
/* Hack? */
size_t olen = MEM_allocN_len(seq->strip->stripdata) / sizeof(struct StripElem);
seq->len = olen;
seq->len -= seq->anim_startofs;
seq->len -= seq->anim_endofs;
if (seq->len < 0) {
seq->len = 0;
seq->len = olen;
seq->len -= seq->anim_startofs;
seq->len -= seq->anim_endofs;
if (seq->len < 0) {
seq->len = 0;
}
break;
}
break;
}
case SEQ_MOVIE:
BLI_join_dirfile(str, sizeof(str), seq->strip->dir,
seq->strip->stripdata->name);
BLI_path_abs(str, G.main->name);
case SEQ_MOVIE:
BLI_join_dirfile(str, sizeof(str), seq->strip->dir,
seq->strip->stripdata->name);
BLI_path_abs(str, G.main->name);
if (seq->anim) IMB_free_anim(seq->anim);
seq->anim = openanim(str, IB_rect | ((seq->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0), seq->streamindex);
if (seq->anim) IMB_free_anim(seq->anim);
seq->anim = openanim(str, IB_rect | ((seq->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0), seq->streamindex);
if (!seq->anim) {
return;
}
if (!seq->anim) {
return;
}
seq->len = IMB_anim_get_duration(seq->anim,
seq->strip->proxy ?
seq->strip->proxy->tc :
IMB_TC_RECORD_RUN);
seq->len = IMB_anim_get_duration(seq->anim,
seq->strip->proxy ?
seq->strip->proxy->tc :
IMB_TC_RECORD_RUN);
seq->anim_preseek = IMB_anim_get_preseek(seq->anim);
seq->anim_preseek = IMB_anim_get_preseek(seq->anim);
seq->len -= seq->anim_startofs;
seq->len -= seq->anim_endofs;
if (seq->len < 0) {
seq->len = 0;
}
break;
case SEQ_MOVIECLIP:
seq->len = BKE_movieclip_get_duration(seq->clip);
seq->len -= seq->anim_startofs;
seq->len -= seq->anim_endofs;
if (seq->len < 0) {
seq->len = 0;
}
break;
case SEQ_MOVIECLIP:
seq->len = BKE_movieclip_get_duration(seq->clip);
seq->len -= seq->anim_startofs;
seq->len -= seq->anim_endofs;
if (seq->len < 0) {
seq->len = 0;
}
break;
case SEQ_SOUND:
seq->len -= seq->anim_startofs;
seq->len -= seq->anim_endofs;
if (seq->len < 0) {
seq->len = 0;
}
break;
case SEQ_SOUND:
#ifdef WITH_AUDASPACE
if (!seq->sound)
return;
seq->len = ceil(AUD_getInfo(seq->sound->playback_handle).length * FPS);
seq->len -= seq->anim_startofs;
seq->len -= seq->anim_endofs;
if (seq->len < 0) {
seq->len = 0;
}
if (!seq->sound)
return;
seq->len = ceil(AUD_getInfo(seq->sound->playback_handle).length * FPS);
seq->len -= seq->anim_startofs;
seq->len -= seq->anim_endofs;
if (seq->len < 0) {
seq->len = 0;
}
#else
return;
return;
#endif
break;
case SEQ_SCENE:
{
seq->len= (seq->scene)? seq->scene->r.efra - seq->scene->r.sfra + 1: 0;
seq->len -= seq->anim_startofs;
seq->len -= seq->anim_endofs;
if (seq->len < 0) {
seq->len = 0;
break;
case SEQ_SCENE:
{
seq->len = (seq->scene) ? seq->scene->r.efra - seq->scene->r.sfra + 1 : 0;
seq->len -= seq->anim_startofs;
seq->len -= seq->anim_endofs;
if (seq->len < 0) {
seq->len = 0;
}
break;
}
break;
}
}
free_proxy_seq(seq);
@@ -743,51 +744,51 @@ void sort_seq(Scene *scene)
{
/* all strips together per kind, and in order of y location ("machine") */
ListBase seqbase, effbase;
Editing *ed= seq_give_editing(scene, FALSE);
Editing *ed = seq_give_editing(scene, FALSE);
Sequence *seq, *seqt;
if (ed==NULL) return;
if (ed == NULL) return;
seqbase.first= seqbase.last= NULL;
effbase.first= effbase.last= NULL;
seqbase.first = seqbase.last = NULL;
effbase.first = effbase.last = NULL;
while ( (seq= ed->seqbasep->first) ) {
while ( (seq = ed->seqbasep->first) ) {
BLI_remlink(ed->seqbasep, seq);
if (seq->type & SEQ_EFFECT) {
seqt= effbase.first;
seqt = effbase.first;
while (seqt) {
if (seqt->machine>=seq->machine) {
if (seqt->machine >= seq->machine) {
BLI_insertlinkbefore(&effbase, seqt, seq);
break;
}
seqt= seqt->next;
seqt = seqt->next;
}
if (seqt==NULL) BLI_addtail(&effbase, seq);
if (seqt == NULL) BLI_addtail(&effbase, seq);
}
else {
seqt= seqbase.first;
seqt = seqbase.first;
while (seqt) {
if (seqt->machine>=seq->machine) {
if (seqt->machine >= seq->machine) {
BLI_insertlinkbefore(&seqbase, seqt, seq);
break;
}
seqt= seqt->next;
seqt = seqt->next;
}
if (seqt==NULL) BLI_addtail(&seqbase, seq);
if (seqt == NULL) BLI_addtail(&seqbase, seq);
}
}
BLI_movelisttolist(&seqbase, &effbase);
*(ed->seqbasep)= seqbase;
*(ed->seqbasep) = seqbase;
}
static int clear_scene_in_allseqs_cb(Sequence *seq, void *arg_pt)
{
if (seq->scene==(Scene *)arg_pt)
seq->scene= NULL;
if (seq->scene == (Scene *)arg_pt)
seq->scene = NULL;
return 1;
}
@@ -796,7 +797,7 @@ void clear_scene_in_allseqs(Main *bmain, Scene *scene)
Scene *scene_iter;
/* when a scene is deleted: test all seqs */
for (scene_iter= bmain->scene.first; scene_iter; scene_iter= scene_iter->id.next) {
for (scene_iter = bmain->scene.first; scene_iter; scene_iter = scene_iter->id.next) {
if (scene_iter != scene && scene_iter->ed) {
seqbase_recursive_apply(&scene_iter->ed->seqbase, clear_scene_in_allseqs_cb, scene);
}
@@ -811,20 +812,21 @@ typedef struct SeqUniqueInfo {
int match;
} SeqUniqueInfo;
/*
#if 0
static void seqbase_unique_name(ListBase *seqbasep, Sequence *seq)
{
BLI_uniquename(seqbasep, seq, "Sequence", '.', offsetof(Sequence, name), SEQ_NAME_MAXSTR);
}*/
}
#endif
static void seqbase_unique_name(ListBase *seqbasep, SeqUniqueInfo *sui)
{
Sequence *seq;
for (seq=seqbasep->first; seq; seq= seq->next) {
if (sui->seq != seq && strcmp(sui->name_dest, seq->name+2)==0) {
for (seq = seqbasep->first; seq; seq = seq->next) {
if (sui->seq != seq && strcmp(sui->name_dest, seq->name + 2) == 0) {
/* SEQ_NAME_MAXSTR - 2 for prefix, -1 for \0, -4 for the number */
BLI_snprintf(sui->name_dest, sizeof(sui->name_dest), "%.59s.%03d", sui->name_src, sui->count++);
sui->match= 1; /* be sure to re-scan */
sui->match = 1; /* be sure to re-scan */
}
}
}
@@ -840,57 +842,57 @@ void seqbase_unique_name_recursive(ListBase *seqbasep, struct Sequence *seq)
{
SeqUniqueInfo sui;
char *dot;
sui.seq= seq;
BLI_strncpy(sui.name_src, seq->name+2, sizeof(sui.name_src));
BLI_strncpy(sui.name_dest, seq->name+2, sizeof(sui.name_dest));
sui.seq = seq;
BLI_strncpy(sui.name_src, seq->name + 2, sizeof(sui.name_src));
BLI_strncpy(sui.name_dest, seq->name + 2, sizeof(sui.name_dest));
sui.count= 1;
sui.match= 1; /* assume the worst to start the loop */
sui.count = 1;
sui.match = 1; /* assume the worst to start the loop */
/* Strip off the suffix */
if ((dot=strrchr(sui.name_src, '.'))) {
*dot= '\0';
if ((dot = strrchr(sui.name_src, '.'))) {
*dot = '\0';
dot++;
if (*dot)
sui.count= atoi(dot) + 1;
sui.count = atoi(dot) + 1;
}
while (sui.match) {
sui.match= 0;
sui.match = 0;
seqbase_unique_name(seqbasep, &sui);
seqbase_recursive_apply(seqbasep, seqbase_unique_name_recursive_cb, &sui);
}
BLI_strncpy(seq->name+2, sui.name_dest, sizeof(seq->name)-2);
BLI_strncpy(seq->name + 2, sui.name_dest, sizeof(seq->name) - 2);
}
static const char *give_seqname_by_type(int type)
{
switch(type) {
case SEQ_META: return "Meta";
case SEQ_IMAGE: return "Image";
case SEQ_SCENE: return "Scene";
case SEQ_MOVIE: return "Movie";
case SEQ_MOVIECLIP: return "Clip";
case SEQ_SOUND: return "Audio";
case SEQ_CROSS: return "Cross";
case SEQ_GAMCROSS: return "Gamma Cross";
case SEQ_ADD: return "Add";
case SEQ_SUB: return "Sub";
case SEQ_MUL: return "Mul";
case SEQ_ALPHAOVER: return "Alpha Over";
case SEQ_ALPHAUNDER: return "Alpha Under";
case SEQ_OVERDROP: return "Over Drop";
case SEQ_WIPE: return "Wipe";
case SEQ_GLOW: return "Glow";
case SEQ_TRANSFORM: return "Transform";
case SEQ_COLOR: return "Color";
case SEQ_MULTICAM: return "Multicam";
case SEQ_ADJUSTMENT: return "Adjustment";
case SEQ_SPEED: return "Speed";
default:
return NULL;
switch (type) {
case SEQ_META: return "Meta";
case SEQ_IMAGE: return "Image";
case SEQ_SCENE: return "Scene";
case SEQ_MOVIE: return "Movie";
case SEQ_MOVIECLIP: return "Clip";
case SEQ_SOUND: return "Audio";
case SEQ_CROSS: return "Cross";
case SEQ_GAMCROSS: return "Gamma Cross";
case SEQ_ADD: return "Add";
case SEQ_SUB: return "Sub";
case SEQ_MUL: return "Mul";
case SEQ_ALPHAOVER: return "Alpha Over";
case SEQ_ALPHAUNDER: return "Alpha Under";
case SEQ_OVERDROP: return "Over Drop";
case SEQ_WIPE: return "Wipe";
case SEQ_GLOW: return "Glow";
case SEQ_TRANSFORM: return "Transform";
case SEQ_COLOR: return "Color";
case SEQ_MULTICAM: return "Multicam";
case SEQ_ADJUSTMENT: return "Adjustment";
case SEQ_SPEED: return "Speed";
default:
return NULL;
}
}
@@ -899,12 +901,13 @@ const char *give_seqname(Sequence *seq)
const char *name = give_seqname_by_type(seq->type);
if (!name) {
if (seq->type<SEQ_EFFECT) {
if (seq->type < SEQ_EFFECT) {
return seq->strip->dir;
}
else if (seq->type==SEQ_PLUGIN) {
else if (seq->type == SEQ_PLUGIN) {
if (!(seq->flag & SEQ_EFFECT_NOT_LOADED) &&
seq->plugin && seq->plugin->doit) {
seq->plugin && seq->plugin->doit)
{
return seq->plugin->pname;
}
else {
@@ -926,11 +929,11 @@ static void make_black_ibuf(ImBuf *ibuf)
float *rect_float;
int tot;
if (ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL)) return;
if (ibuf == NULL || (ibuf->rect == NULL && ibuf->rect_float == NULL)) return;
tot= ibuf->x*ibuf->y;
tot = ibuf->x * ibuf->y;
rect= ibuf->rect;
rect = ibuf->rect;
rect_float = ibuf->rect_float;
if (rect) {
@@ -949,28 +952,28 @@ static void multibuf(ImBuf *ibuf, float fmul)
int a, mul, icol;
mul= (int)(256.0f * fmul);
rt= (char *)ibuf->rect;
mul = (int)(256.0f * fmul);
rt = (char *)ibuf->rect;
rt_float = ibuf->rect_float;
if (rt) {
a= ibuf->x*ibuf->y;
a = ibuf->x * ibuf->y;
while (a--) {
icol= (mul*rt[0])>>8;
if (icol>254) rt[0]= 255; else rt[0]= icol;
icol= (mul*rt[1])>>8;
if (icol>254) rt[1]= 255; else rt[1]= icol;
icol= (mul*rt[2])>>8;
if (icol>254) rt[2]= 255; else rt[2]= icol;
icol= (mul*rt[3])>>8;
if (icol>254) rt[3]= 255; else rt[3]= icol;
icol = (mul * rt[0]) >> 8;
if (icol > 254) rt[0] = 255; else rt[0] = icol;
icol = (mul * rt[1]) >> 8;
if (icol > 254) rt[1] = 255; else rt[1] = icol;
icol = (mul * rt[2]) >> 8;
if (icol > 254) rt[2] = 255; else rt[2] = icol;
icol = (mul * rt[3]) >> 8;
if (icol > 254) rt[3] = 255; else rt[3] = icol;
rt+= 4;
rt += 4;
}
}
if (rt_float) {
a= ibuf->x*ibuf->y;
a = ibuf->x * ibuf->y;
while (a--) {
rt_float[0] *= fmul;
rt_float[1] *= fmul;
@@ -986,7 +989,7 @@ static float give_stripelem_index(Sequence *seq, float cfra)
{
float nr;
int sta = seq->start;
int end = seq->start+seq->len-1;
int end = seq->start + seq->len - 1;
if (seq->type & SEQ_EFFECT) {
end = seq->enddisp;
@@ -996,16 +999,16 @@ static float give_stripelem_index(Sequence *seq, float cfra)
return -1;
}
if (seq->flag&SEQ_REVERSE_FRAMES) {
if (seq->flag & SEQ_REVERSE_FRAMES) {
/*reverse frame in this sequence */
if (cfra <= sta) nr= end - sta;
else if (cfra >= end) nr= 0;
else nr= end - cfra;
if (cfra <= sta) nr = end - sta;
else if (cfra >= end) nr = 0;
else nr = end - cfra;
}
else {
if (cfra <= sta) nr= 0;
else if (cfra >= end) nr= end - sta;
else nr= cfra - sta;
if (cfra <= sta) nr = 0;
else if (cfra >= end) nr = end - sta;
else nr = cfra - sta;
}
if (seq->strobe < 1.0f) seq->strobe = 1.0f;
@@ -1019,13 +1022,13 @@ static float give_stripelem_index(Sequence *seq, float cfra)
StripElem *give_stripelem(Sequence *seq, int cfra)
{
StripElem *se= seq->strip->stripdata;
StripElem *se = seq->strip->stripdata;
if (seq->type == SEQ_IMAGE) { /* only
* IMAGE strips use the whole array,
* MOVIE strips use only
* the first element, all other strips
* don't use this... */
* IMAGE strips use the whole array,
* MOVIE strips use only
* the first element, all other strips
* don't use this... */
int nr = (int) give_stripelem_index(seq, cfra);
if (nr == -1 || se == NULL) return NULL;
@@ -1035,20 +1038,20 @@ StripElem *give_stripelem(Sequence *seq, int cfra)
return se;
}
static int evaluate_seq_frame_gen(Sequence ** seq_arr, ListBase *seqbase, int cfra)
static int evaluate_seq_frame_gen(Sequence **seq_arr, ListBase *seqbase, int cfra)
{
Sequence *seq;
int totseq=0;
int totseq = 0;
memset(seq_arr, 0, sizeof(Sequence*) * (MAXSEQ+1));
memset(seq_arr, 0, sizeof(Sequence *) * (MAXSEQ + 1));
seq= seqbase->first;
seq = seqbase->first;
while (seq) {
if (seq->startdisp <=cfra && seq->enddisp > cfra) {
seq_arr[seq->machine]= seq;
if (seq->startdisp <= cfra && seq->enddisp > cfra) {
seq_arr[seq->machine] = seq;
totseq++;
}
seq= seq->next;
seq = seq->next;
}
return totseq;
@@ -1056,21 +1059,21 @@ static int evaluate_seq_frame_gen(Sequence ** seq_arr, ListBase *seqbase, int cf
int evaluate_seq_frame(Scene *scene, int cfra)
{
Editing *ed= seq_give_editing(scene, FALSE);
Sequence *seq_arr[MAXSEQ+1];
Editing *ed = seq_give_editing(scene, FALSE);
Sequence *seq_arr[MAXSEQ + 1];
if (ed==NULL) return 0;
if (ed == NULL) return 0;
return evaluate_seq_frame_gen(seq_arr, ed->seqbasep, cfra);
}
static int video_seq_is_rendered(Sequence * seq)
static int video_seq_is_rendered(Sequence *seq)
{
return (seq && !(seq->flag & SEQ_MUTE) && seq->type != SEQ_SOUND);
}
static int get_shown_sequences( ListBase * seqbasep, int cfra, int chanshown, Sequence ** seq_arr_out)
static int get_shown_sequences(ListBase *seqbasep, int cfra, int chanshown, Sequence **seq_arr_out)
{
Sequence *seq_arr[MAXSEQ+1];
Sequence *seq_arr[MAXSEQ + 1];
int b = chanshown;
int cnt = 0;
@@ -1091,7 +1094,7 @@ static int get_shown_sequences( ListBase * seqbasep, int cfra, int chanshown, Se
chanshown = b;
for (;b > 0; b--) {
for (; b > 0; b--) {
if (video_seq_is_rendered(seq_arr[b])) {
if (seq_arr[b]->blend_mode == SEQ_BLEND_REPLACE) {
break;
@@ -1099,7 +1102,7 @@ static int get_shown_sequences( ListBase * seqbasep, int cfra, int chanshown, Se
}
}
for (;b <= chanshown && b >= 0; b++) {
for (; b <= chanshown && b >= 0; b++) {
if (video_seq_is_rendered(seq_arr[b])) {
seq_arr_out[cnt++] = seq_arr[b];
}
@@ -1125,7 +1128,7 @@ typedef struct SeqIndexBuildContext {
Sequence *seq, *orig_seq;
} SeqIndexBuildContext;
#define PROXY_MAXFILE (2*FILE_MAXDIR+FILE_MAXFILE)
#define PROXY_MAXFILE (2 * FILE_MAXDIR + FILE_MAXFILE)
static IMB_Proxy_Size seq_rendersize_to_proxysize(int size)
{
@@ -1158,10 +1161,10 @@ static double seq_rendersize_to_scale_factor(int size)
return 0.25;
}
static void seq_open_anim_file(Sequence * seq)
static void seq_open_anim_file(Sequence *seq)
{
char name[FILE_MAX];
StripProxy * proxy;
StripProxy *proxy;
if (seq->anim != NULL) {
return;
@@ -1173,7 +1176,7 @@ static void seq_open_anim_file(Sequence * seq)
seq->anim = openanim(name, IB_rect |
((seq->flag & SEQ_FILTERY) ?
IB_animdeinterlace : 0), seq->streamindex);
IB_animdeinterlace : 0), seq->streamindex);
if (seq->anim == NULL) {
return;
@@ -1191,7 +1194,7 @@ static void seq_open_anim_file(Sequence * seq)
}
static int seq_proxy_get_fname(Sequence * seq, int cfra, int render_size, char * name)
static int seq_proxy_get_fname(Sequence *seq, int cfra, int render_size, char *name)
{
int frameno;
char dir[PROXY_MAXFILE];
@@ -1208,7 +1211,7 @@ static int seq_proxy_get_fname(Sequence * seq, int cfra, int render_size, char *
* have both, a directory full of jpeg files and proxy avis, so
* sorry folks, please rebuild your proxies... */
if (seq->flag & (SEQ_USE_PROXY_CUSTOM_DIR|SEQ_USE_PROXY_CUSTOM_FILE)) {
if (seq->flag & (SEQ_USE_PROXY_CUSTOM_DIR | SEQ_USE_PROXY_CUSTOM_FILE)) {
BLI_strncpy(dir, seq->strip->proxy->dir, sizeof(dir));
}
else if (seq->type == SEQ_IMAGE) {
@@ -1248,11 +1251,10 @@ static int seq_proxy_get_fname(Sequence * seq, int cfra, int render_size, char *
return TRUE;
}
static struct ImBuf * seq_proxy_fetch(SeqRenderData context, Sequence * seq, int cfra)
static ImBuf *seq_proxy_fetch(SeqRenderData context, Sequence *seq, int cfra)
{
char name[PROXY_MAXFILE];
IMB_Proxy_Size psize = seq_rendersize_to_proxysize(
context.preview_render_size);
IMB_Proxy_Size psize = seq_rendersize_to_proxysize(context.preview_render_size);
int size_flags;
int render_size = context.preview_render_size;
@@ -1275,23 +1277,23 @@ static struct ImBuf * seq_proxy_fetch(SeqRenderData context, Sequence * seq, int
if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) {
int frameno = (int) give_stripelem_index(seq, cfra) + seq->anim_startofs;
if (seq->strip->proxy->anim == NULL) {
if (seq_proxy_get_fname(seq, cfra, render_size, name)==0) {
if (seq_proxy_get_fname(seq, cfra, render_size, name) == 0) {
return NULL;
}
seq->strip->proxy->anim = openanim(name, IB_rect, 0);
}
if (seq->strip->proxy->anim==NULL) {
if (seq->strip->proxy->anim == NULL) {
return NULL;
}
seq_open_anim_file(seq);
frameno = IMB_anim_index_get_frame_index(
seq->anim, seq->strip->proxy->tc, frameno);
frameno = IMB_anim_index_get_frame_index(seq->anim, seq->strip->proxy->tc,
frameno);
return IMB_anim_absolute(seq->strip->proxy->anim, frameno,
IMB_TC_NONE, IMB_PROXY_NONE);
IMB_TC_NONE, IMB_PROXY_NONE);
}
if (seq_proxy_get_fname(seq, cfra, render_size, name) == 0) {
@@ -1307,14 +1309,14 @@ static struct ImBuf * seq_proxy_fetch(SeqRenderData context, Sequence * seq, int
}
static void seq_proxy_build_frame(SeqRenderData context,
Sequence* seq, int cfra,
int proxy_render_size)
Sequence *seq, int cfra,
int proxy_render_size)
{
char name[PROXY_MAXFILE];
int quality;
int rectx, recty;
int ok;
struct ImBuf * ibuf;
ImBuf *ibuf;
if (!seq_proxy_get_fname(seq, cfra, proxy_render_size, name)) {
return;
@@ -1332,11 +1334,11 @@ static void seq_proxy_build_frame(SeqRenderData context,
/* depth = 32 is intentionally left in, otherwise ALPHA channels
* won't work... */
quality = seq->strip->proxy->quality;
ibuf->ftype= JPG | quality;
ibuf->ftype = JPG | quality;
/* unsupported feature only confuses other s/w */
if (ibuf->planes==32)
ibuf->planes= 24;
if (ibuf->planes == 32)
ibuf->planes = 24;
BLI_make_existing_file(name);
@@ -1348,8 +1350,7 @@ static void seq_proxy_build_frame(SeqRenderData context,
IMB_freeImBuf(ibuf);
}
struct SeqIndexBuildContext *seq_proxy_rebuild_context(Main *bmain, Scene *scene, Sequence *seq)
{
struct SeqIndexBuildContext *seq_proxy_rebuild_context(Main *bmain, Scene *scene, Sequence *seq){
SeqIndexBuildContext *context;
Sequence *nseq;
@@ -1379,7 +1380,7 @@ struct SeqIndexBuildContext *seq_proxy_rebuild_context(Main *bmain, Scene *scene
if (nseq->anim) {
context->index_context = IMB_anim_index_rebuild_context(nseq->anim,
context->tc_flags, context->size_flags, context->quality);
context->tc_flags, context->size_flags, context->quality);
}
}
@@ -1413,10 +1414,10 @@ void seq_proxy_rebuild(SeqIndexBuildContext *context, short *stop, short *do_upd
/* fail safe code */
render_context = seq_new_render_data(
context->bmain, context->scene,
(scene->r.size * (float) scene->r.xsch) / 100.0f + 0.5f,
(scene->r.size * (float) scene->r.ysch) / 100.0f + 0.5f,
100);
context->bmain, context->scene,
(scene->r.size * (float) scene->r.xsch) / 100.0f + 0.5f,
(scene->r.size * (float) scene->r.ysch) / 100.0f + 0.5f,
100);
for (cfra = seq->startdisp + seq->startstill;
cfra < seq->enddisp - seq->endstill; cfra++) {
@@ -1433,9 +1434,9 @@ void seq_proxy_rebuild(SeqIndexBuildContext *context, short *stop, short *do_upd
seq_proxy_build_frame(render_context, seq, cfra, 100);
}
*progress= (float)cfra/(seq->enddisp - seq->endstill
- seq->startdisp + seq->startstill);
*do_update= 1;
*progress = (float)cfra / (seq->enddisp - seq->endstill -
seq->startdisp + seq->startstill);
*do_update = 1;
if (*stop || G.afbreek)
break;
@@ -1459,7 +1460,7 @@ void seq_proxy_rebuild_finish(SeqIndexBuildContext *context, short stop)
* color balance
* ********************************************************************** */
static StripColorBalance calc_cb(StripColorBalance * cb_)
static StripColorBalance calc_cb(StripColorBalance *cb_)
{
StripColorBalance cb = *cb_;
int c;
@@ -1493,7 +1494,7 @@ static StripColorBalance calc_cb(StripColorBalance * cb_)
if (!(cb.flag & SEQ_COLOR_BALANCE_INVERSE_GAMMA)) {
for (c = 0; c < 3; c++) {
if (cb.gamma[c] != 0.0f) {
cb.gamma[c] = 1.0f/cb.gamma[c];
cb.gamma[c] = 1.0f / cb.gamma[c];
}
else {
cb.gamma[c] = 1000000; /* should be enough :) */
@@ -1507,7 +1508,7 @@ static StripColorBalance calc_cb(StripColorBalance * cb_)
/* note: lift is actually 2-lift */
MINLINE float color_balance_fl(float in, const float lift, const float gain, const float gamma, const float mul)
{
float x= (((in - 1.0f) * lift) + 1.0f) * gain;
float x = (((in - 1.0f) * lift) + 1.0f) * gain;
/* prevent NaN */
if (x < 0.f) x = 0.f;
@@ -1516,34 +1517,34 @@ MINLINE float color_balance_fl(float in, const float lift, const float gain, con
}
static void make_cb_table_byte(float lift, float gain, float gamma,
unsigned char * table, float mul)
unsigned char *table, float mul)
{
int y;
for (y = 0; y < 256; y++) {
float v= color_balance_fl((float)y * (1.0f / 255.0f), lift, gain, gamma, mul);
float v = color_balance_fl((float)y * (1.0f / 255.0f), lift, gain, gamma, mul);
CLAMP(v, 0.0f, 1.0f);
table[y] = v * 255;
}
}
static void make_cb_table_float(float lift, float gain, float gamma,
float * table, float mul)
float *table, float mul)
{
int y;
for (y = 0; y < 256; y++) {
float v= color_balance_fl((float)y * (1.0f / 255.0f), lift, gain, gamma, mul);
float v = color_balance_fl((float)y * (1.0f / 255.0f), lift, gain, gamma, mul);
table[y] = v;
}
}
static void color_balance_byte_byte(Sequence * seq, ImBuf* ibuf, float mul)
static void color_balance_byte_byte(Sequence *seq, ImBuf *ibuf, float mul)
{
unsigned char cb_tab[3][256];
int c;
unsigned char * p = (unsigned char*) ibuf->rect;
unsigned char * e = p + ibuf->x * 4 * ibuf->y;
unsigned char *p = (unsigned char *) ibuf->rect;
unsigned char *e = p + ibuf->x * 4 * ibuf->y;
StripColorBalance cb = calc_cb(seq->strip->color_balance);
@@ -1561,13 +1562,13 @@ static void color_balance_byte_byte(Sequence * seq, ImBuf* ibuf, float mul)
}
}
static void color_balance_byte_float(Sequence * seq, ImBuf* ibuf, float mul)
static void color_balance_byte_float(Sequence *seq, ImBuf *ibuf, float mul)
{
float cb_tab[4][256];
int c,i;
unsigned char * p = (unsigned char*) ibuf->rect;
unsigned char * e = p + ibuf->x * 4 * ibuf->y;
float * o;
int c, i;
unsigned char *p = (unsigned char *) ibuf->rect;
unsigned char *e = p + ibuf->x * 4 * ibuf->y;
float *o;
StripColorBalance cb;
imb_addrectfloatImBuf(ibuf);
@@ -1581,7 +1582,7 @@ static void color_balance_byte_float(Sequence * seq, ImBuf* ibuf, float mul)
}
for (i = 0; i < 256; i++) {
cb_tab[3][i] = ((float)i)*(1.0f/255.0f);
cb_tab[3][i] = ((float)i) * (1.0f / 255.0f);
}
while (p < e) {
@@ -1594,22 +1595,22 @@ static void color_balance_byte_float(Sequence * seq, ImBuf* ibuf, float mul)
}
}
static void color_balance_float_float(Sequence * seq, ImBuf* ibuf, float mul)
static void color_balance_float_float(Sequence *seq, ImBuf *ibuf, float mul)
{
float * p = ibuf->rect_float;
float * e = ibuf->rect_float + ibuf->x * 4* ibuf->y;
float *p = ibuf->rect_float;
float *e = ibuf->rect_float + ibuf->x * 4 * ibuf->y;
StripColorBalance cb = calc_cb(seq->strip->color_balance);
while (p < e) {
int c;
for (c = 0; c < 3; c++) {
p[c]= color_balance_fl(p[c], cb.lift[c], cb.gain[c], cb.gamma[c], mul);
p[c] = color_balance_fl(p[c], cb.lift[c], cb.gain[c], cb.gamma[c], mul);
}
p += 4;
}
}
static void color_balance(Sequence * seq, ImBuf* ibuf, float mul)
static void color_balance(Sequence *seq, ImBuf *ibuf, float mul)
{
if (ibuf->rect_float) {
color_balance_float_float(seq, ibuf, mul);
@@ -1641,12 +1642,12 @@ static void color_balance(Sequence * seq, ImBuf* ibuf, float mul)
*/
int input_have_to_preprocess(
SeqRenderData UNUSED(context), Sequence * seq, float UNUSED(cfra))
SeqRenderData UNUSED(context), Sequence *seq, float UNUSED(cfra))
{
float mul;
if (seq->flag & (SEQ_FILTERY|SEQ_USE_CROP|SEQ_USE_TRANSFORM|SEQ_FLIPX|
SEQ_FLIPY|SEQ_USE_COLOR_BALANCE|SEQ_MAKE_PREMUL)) {
if (seq->flag & (SEQ_FILTERY | SEQ_USE_CROP | SEQ_USE_TRANSFORM | SEQ_FLIPX |
SEQ_FLIPY | SEQ_USE_COLOR_BALANCE | SEQ_MAKE_PREMUL)) {
return TRUE;
}
@@ -1667,33 +1668,34 @@ int input_have_to_preprocess(
return FALSE;
}
static ImBuf * input_preprocess(
SeqRenderData context, Sequence *seq, float UNUSED(cfra), ImBuf * ibuf,
int is_proxy_image, int is_preprocessed)
static ImBuf *input_preprocess(
SeqRenderData context, Sequence *seq, float UNUSED(cfra), ImBuf *ibuf,
int is_proxy_image, int is_preprocessed)
{
float mul;
ibuf = IMB_makeSingleUser(ibuf);
if ((seq->flag & SEQ_FILTERY)
&& !ELEM(seq->type, SEQ_MOVIE, SEQ_MOVIECLIP)) {
if ((seq->flag & SEQ_FILTERY) &&
!ELEM(seq->type, SEQ_MOVIE, SEQ_MOVIECLIP))
{
IMB_filtery(ibuf);
}
if (seq->flag & (SEQ_USE_CROP|SEQ_USE_TRANSFORM)) {
StripCrop c= {0};
StripTransform t= {0};
int sx,sy,dx,dy;
if (seq->flag & (SEQ_USE_CROP | SEQ_USE_TRANSFORM)) {
StripCrop c = {0};
StripTransform t = {0};
int sx, sy, dx, dy;
double xscale = 1.0;
double yscale = 1.0;
if (is_proxy_image) {
double f = seq_rendersize_to_scale_factor(
context.preview_render_size);
context.preview_render_size);
if (f != 1.0) {
IMB_scalefastImBuf(
ibuf, ibuf->x / f, ibuf->y / f);
ibuf, ibuf->x / f, ibuf->y / f);
}
}
@@ -1705,11 +1707,11 @@ static ImBuf * input_preprocess(
}
xscale = context.scene->r.xsch ?
((double) context.rectx /
(double) context.scene->r.xsch) : 1.0;
((double) context.rectx /
(double) context.scene->r.xsch) : 1.0;
yscale = context.scene->r.ysch ?
((double) context.recty /
(double) context.scene->r.ysch) : 1.0;
((double) context.recty /
(double) context.scene->r.ysch) : 1.0;
c.left *= xscale; c.right *= xscale;
c.top *= yscale; c.bottom *= yscale;
@@ -1732,17 +1734,17 @@ static ImBuf * input_preprocess(
}
}
if (c.top+c.bottom >= ibuf->y || c.left+c.right >= ibuf->x ||
if (c.top + c.bottom >= ibuf->y || c.left + c.right >= ibuf->x ||
t.xofs >= dx || t.yofs >= dy) {
make_black_ibuf(ibuf);
}
else {
ImBuf * i = IMB_allocImBuf(
dx, dy, 32,
ibuf->rect_float ? IB_rectfloat : IB_rect);
ImBuf *i = IMB_allocImBuf(
dx, dy, 32,
ibuf->rect_float ? IB_rectfloat : IB_rect);
IMB_rectcpy(i, ibuf,
t.xofs, t.yofs, c.left, c.bottom, sx, sy);
t.xofs, t.yofs, c.left, c.bottom, sx, sy);
IMB_freeImBuf(ibuf);
@@ -1793,7 +1795,7 @@ static ImBuf * input_preprocess(
}
if (ibuf->x != context.rectx || ibuf->y != context.recty ) {
if (ibuf->x != context.rectx || ibuf->y != context.recty) {
if (context.scene->r.mode & R_OSA) {
IMB_scaleImBuf(ibuf, (short)context.rectx, (short)context.recty);
}
@@ -1804,21 +1806,21 @@ static ImBuf * input_preprocess(
return ibuf;
}
static ImBuf * copy_from_ibuf_still(SeqRenderData context, Sequence * seq,
float nr)
static ImBuf *copy_from_ibuf_still(SeqRenderData context, Sequence *seq,
float nr)
{
ImBuf * rval = NULL;
ImBuf * ibuf = NULL;
ImBuf *rval = NULL;
ImBuf *ibuf = NULL;
if (nr == 0) {
ibuf = seq_stripelem_cache_get(
context, seq, seq->start,
SEQ_STRIPELEM_IBUF_STARTSTILL);
context, seq, seq->start,
SEQ_STRIPELEM_IBUF_STARTSTILL);
}
else if (nr == seq->len - 1) {
ibuf = seq_stripelem_cache_get(
context, seq, seq->start,
SEQ_STRIPELEM_IBUF_ENDSTILL);
context, seq, seq->start,
SEQ_STRIPELEM_IBUF_ENDSTILL);
}
if (ibuf) {
@@ -1829,8 +1831,8 @@ static ImBuf * copy_from_ibuf_still(SeqRenderData context, Sequence * seq,
return rval;
}
static void copy_to_ibuf_still(SeqRenderData context, Sequence * seq, float nr,
ImBuf * ibuf)
static void copy_to_ibuf_still(SeqRenderData context, Sequence *seq, float nr,
ImBuf *ibuf)
{
if (nr == 0 || nr == seq->len - 1) {
/* we have to store a copy, since the passed ibuf
@@ -1840,14 +1842,14 @@ static void copy_to_ibuf_still(SeqRenderData context, Sequence * seq, float nr,
if (nr == 0) {
seq_stripelem_cache_put(
context, seq, seq->start,
SEQ_STRIPELEM_IBUF_STARTSTILL, ibuf);
context, seq, seq->start,
SEQ_STRIPELEM_IBUF_STARTSTILL, ibuf);
}
if (nr == seq->len - 1) {
seq_stripelem_cache_put(
context, seq, seq->start,
SEQ_STRIPELEM_IBUF_ENDSTILL, ibuf);
context, seq, seq->start,
SEQ_STRIPELEM_IBUF_ENDSTILL, ibuf);
}
IMB_freeImBuf(ibuf);
@@ -1858,24 +1860,24 @@ static void copy_to_ibuf_still(SeqRenderData context, Sequence * seq, float nr,
* strip rendering functions
* ********************************************************************** */
static ImBuf* seq_render_strip_stack(
SeqRenderData context, ListBase *seqbasep, float cfra, int chanshown);
static ImBuf *seq_render_strip_stack(
SeqRenderData context, ListBase *seqbasep, float cfra, int chanshown);
static ImBuf * seq_render_strip(
SeqRenderData context, Sequence * seq, float cfra);
static ImBuf *seq_render_strip(
SeqRenderData context, Sequence *seq, float cfra);
static ImBuf* seq_render_effect_strip_impl(
SeqRenderData context, Sequence *seq, float cfra)
static ImBuf *seq_render_effect_strip_impl(
SeqRenderData context, Sequence *seq, float cfra)
{
float fac, facf;
int early_out;
int i;
struct SeqEffectHandle sh = get_sequence_effect(seq);
FCurve *fcu= NULL;
ImBuf * ibuf[3];
FCurve *fcu = NULL;
ImBuf *ibuf[3];
Sequence *input[3];
ImBuf * out = NULL;
ImBuf *out = NULL;
ibuf[0] = ibuf[1] = ibuf[2] = NULL;
@@ -1883,21 +1885,21 @@ static ImBuf* seq_render_effect_strip_impl(
if (!sh.execute) { /* effect not supported in this version... */
out = IMB_allocImBuf((short)context.rectx,
(short)context.recty, 32, IB_rect);
(short)context.recty, 32, IB_rect);
return out;
}
if (seq->flag & SEQ_USE_EFFECT_DEFAULT_FADE) {
sh.get_default_fac(seq, cfra, &fac, &facf);
if ((context.scene->r.mode & R_FIELDS)==0)
facf= fac;
if ((context.scene->r.mode & R_FIELDS) == 0)
facf = fac;
}
else {
fcu = id_data_find_fcurve(&context.scene->id, seq, &RNA_Sequence, "effect_fader", 0, NULL);
if (fcu) {
fac = facf = evaluate_fcurve(fcu, cfra);
if ( context.scene->r.mode & R_FIELDS ) {
if (context.scene->r.mode & R_FIELDS) {
facf = evaluate_fcurve(fcu, cfra + 0.5f);
}
}
@@ -1909,50 +1911,50 @@ static ImBuf* seq_render_effect_strip_impl(
early_out = sh.early_out(seq, fac, facf);
switch (early_out) {
case EARLY_NO_INPUT:
out = sh.execute(context, seq, cfra, fac, facf,
NULL, NULL, NULL);
break;
case EARLY_DO_EFFECT:
for (i=0; i<3; i++) {
if (input[i])
ibuf[i] = seq_render_strip(
context, input[i], cfra);
}
if (ibuf[0] && ibuf[1]) {
case EARLY_NO_INPUT:
out = sh.execute(context, seq, cfra, fac, facf,
ibuf[0], ibuf[1], ibuf[2]);
}
break;
case EARLY_USE_INPUT_1:
if (input[0]) {
ibuf[0] = seq_render_strip(context, input[0], cfra);
}
if (ibuf[0]) {
if (input_have_to_preprocess(context, seq, cfra)) {
out = IMB_dupImBuf(ibuf[0]);
NULL, NULL, NULL);
break;
case EARLY_DO_EFFECT:
for (i = 0; i < 3; i++) {
if (input[i])
ibuf[i] = seq_render_strip(
context, input[i], cfra);
}
else {
out = ibuf[0];
IMB_refImBuf(out);
if (ibuf[0] && ibuf[1]) {
out = sh.execute(context, seq, cfra, fac, facf,
ibuf[0], ibuf[1], ibuf[2]);
}
}
break;
case EARLY_USE_INPUT_2:
if (input[1]) {
ibuf[1] = seq_render_strip(context, input[1], cfra);
}
if (ibuf[1]) {
if (input_have_to_preprocess(context, seq, cfra)) {
out = IMB_dupImBuf(ibuf[1]);
break;
case EARLY_USE_INPUT_1:
if (input[0]) {
ibuf[0] = seq_render_strip(context, input[0], cfra);
}
else {
out = ibuf[1];
IMB_refImBuf(out);
if (ibuf[0]) {
if (input_have_to_preprocess(context, seq, cfra)) {
out = IMB_dupImBuf(ibuf[0]);
}
else {
out = ibuf[0];
IMB_refImBuf(out);
}
}
}
break;
break;
case EARLY_USE_INPUT_2:
if (input[1]) {
ibuf[1] = seq_render_strip(context, input[1], cfra);
}
if (ibuf[1]) {
if (input_have_to_preprocess(context, seq, cfra)) {
out = IMB_dupImBuf(ibuf[1]);
}
else {
out = ibuf[1];
IMB_refImBuf(out);
}
}
break;
}
for (i = 0; i < 3; i++) {
@@ -1966,10 +1968,10 @@ static ImBuf* seq_render_effect_strip_impl(
return out;
}
static ImBuf * seq_render_movieclip_strip(
SeqRenderData context, Sequence * seq, float nr)
static ImBuf *seq_render_movieclip_strip(
SeqRenderData context, Sequence *seq, float nr)
{
ImBuf * ibuf = NULL;
ImBuf *ibuf = NULL;
MovieClipUser user;
float tloc[2], tscale, tangle;
@@ -1984,21 +1986,21 @@ static ImBuf * seq_render_movieclip_strip(
user.render_size = MCLIP_PROXY_RENDER_SIZE_FULL;
switch (seq_rendersize_to_proxysize(context.preview_render_size)) {
case IMB_PROXY_NONE:
user.render_size = MCLIP_PROXY_RENDER_SIZE_FULL;
break;
case IMB_PROXY_100:
user.render_size = MCLIP_PROXY_RENDER_SIZE_100;
break;
case IMB_PROXY_75:
user.render_size = MCLIP_PROXY_RENDER_SIZE_75;
break;
case IMB_PROXY_50:
user.render_size = MCLIP_PROXY_RENDER_SIZE_50;
break;
case IMB_PROXY_25:
user.render_size = MCLIP_PROXY_RENDER_SIZE_25;
break;
case IMB_PROXY_NONE:
user.render_size = MCLIP_PROXY_RENDER_SIZE_FULL;
break;
case IMB_PROXY_100:
user.render_size = MCLIP_PROXY_RENDER_SIZE_100;
break;
case IMB_PROXY_75:
user.render_size = MCLIP_PROXY_RENDER_SIZE_75;
break;
case IMB_PROXY_50:
user.render_size = MCLIP_PROXY_RENDER_SIZE_50;
break;
case IMB_PROXY_25:
user.render_size = MCLIP_PROXY_RENDER_SIZE_25;
break;
}
if (seq->clip_flag & SEQ_MOVIECLIP_RENDER_UNDISTORTED) {
@@ -2007,21 +2009,21 @@ static ImBuf * seq_render_movieclip_strip(
if (seq->clip_flag & SEQ_MOVIECLIP_RENDER_STABILIZED) {
ibuf = BKE_movieclip_get_stable_ibuf(
seq->clip, &user, tloc, &tscale, &tangle,
0);
seq->clip, &user, tloc, &tscale, &tangle,
0);
}
else {
ibuf = BKE_movieclip_get_ibuf_flag(
seq->clip, &user, 0, MOVIECLIP_CACHE_SKIP);
seq->clip, &user, 0, MOVIECLIP_CACHE_SKIP);
}
return ibuf;
}
static ImBuf * seq_render_scene_strip(
SeqRenderData context, Sequence * seq, float nr)
static ImBuf *seq_render_scene_strip(
SeqRenderData context, Sequence *seq, float nr)
{
ImBuf * ibuf = NULL;
ImBuf *ibuf = NULL;
float frame;
float oldcfra;
Object *camera;
@@ -2060,8 +2062,8 @@ static ImBuf * seq_render_scene_strip(
int rendering = G.rendering;
int doseq;
int doseq_gl= G.rendering ? /*(scene->r.seq_flag & R_SEQ_GL_REND)*/ 0 : /*(scene->r.seq_flag & R_SEQ_GL_PREV)*/ 1;
int have_seq= FALSE;
int doseq_gl = G.rendering ? /*(scene->r.seq_flag & R_SEQ_GL_REND)*/ 0 : /*(scene->r.seq_flag & R_SEQ_GL_PREV)*/ 1;
int have_seq = FALSE;
Scene *scene;
/* don't refer to seq->scene above this point!, it can be NULL */
@@ -2069,42 +2071,42 @@ static ImBuf * seq_render_scene_strip(
return NULL;
}
scene= seq->scene;
frame= scene->r.sfra + nr + seq->anim_startofs;
scene = seq->scene;
frame = scene->r.sfra + nr + seq->anim_startofs;
have_seq= (scene->r.scemode & R_DOSEQ) && scene->ed && scene->ed->seqbase.first;
have_seq = (scene->r.scemode & R_DOSEQ) && scene->ed && scene->ed->seqbase.first;
oldcfra= scene->r.cfra;
scene->r.cfra= frame;
oldcfra = scene->r.cfra;
scene->r.cfra = frame;
if (seq->scene_camera)
camera= seq->scene_camera;
camera = seq->scene_camera;
else {
scene_camera_switch_update(scene);
camera= scene->camera;
camera = scene->camera;
}
if (have_seq==FALSE && camera==NULL) {
scene->r.cfra= oldcfra;
if (have_seq == FALSE && camera == NULL) {
scene->r.cfra = oldcfra;
return NULL;
}
/* prevent eternal loop */
doseq= context.scene->r.scemode & R_DOSEQ;
doseq = context.scene->r.scemode & R_DOSEQ;
context.scene->r.scemode &= ~R_DOSEQ;
#ifdef DURIAN_CAMERA_SWITCH
/* stooping to new low's in hackyness :( */
oldmarkers= scene->markers;
scene->markers.first= scene->markers.last= NULL;
oldmarkers = scene->markers;
scene->markers.first = scene->markers.last = NULL;
#else
(void)oldmarkers;
#endif
if (sequencer_view3d_cb && BLI_thread_is_main() && doseq_gl && (scene == context.scene || have_seq==0) && camera) {
char err_out[256]= "unknown";
if (sequencer_view3d_cb && BLI_thread_is_main() && doseq_gl && (scene == context.scene || have_seq == 0) && camera) {
char err_out[256] = "unknown";
/* for old scened this can be uninitialized, should probably be added to do_versions at some point if the functionality stays */
if (context.scene->r.seq_prev_type==0)
if (context.scene->r.seq_prev_type == 0)
context.scene->r.seq_prev_type = 3 /* ==OB_SOLID */;
/* opengl offscreen render */
@@ -2121,8 +2123,8 @@ static ImBuf * seq_render_scene_strip(
/* XXX: this if can be removed when sequence preview rendering uses the job system */
if (rendering || context.scene != scene) {
if (re==NULL)
re= RE_NewRender(scene->id.name);
if (re == NULL)
re = RE_NewRender(scene->id.name);
RE_BlenderFrame(re, context.bmain, scene, NULL, camera, scene->lay, frame, FALSE);
@@ -2133,23 +2135,23 @@ static ImBuf * seq_render_scene_strip(
RE_AcquireResultImage(re, &rres);
if (rres.rectf) {
ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rectfloat);
memcpy(ibuf->rect_float, rres.rectf, 4*sizeof(float)*rres.rectx*rres.recty);
ibuf = IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rectfloat);
memcpy(ibuf->rect_float, rres.rectf, 4 * sizeof(float) * rres.rectx * rres.recty);
if (rres.rectz) {
addzbuffloatImBuf(ibuf);
memcpy(ibuf->zbuf_float, rres.rectz, sizeof(float)*rres.rectx*rres.recty);
memcpy(ibuf->zbuf_float, rres.rectz, sizeof(float) * rres.rectx * rres.recty);
}
/* float buffers in the sequencer are not linear */
if (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT)
ibuf->profile= IB_PROFILE_LINEAR_RGB;
ibuf->profile = IB_PROFILE_LINEAR_RGB;
else
ibuf->profile= IB_PROFILE_NONE;
ibuf->profile = IB_PROFILE_NONE;
IMB_convert_profile(ibuf, IB_PROFILE_SRGB);
}
else if (rres.rect32) {
ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rect);
memcpy(ibuf->rect, rres.rect32, 4*rres.rectx*rres.recty);
ibuf = IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rect);
memcpy(ibuf->rect, rres.rect32, 4 * rres.rectx * rres.recty);
}
RE_ReleaseResultImage(re);
@@ -2167,15 +2169,15 @@ static ImBuf * seq_render_scene_strip(
#ifdef DURIAN_CAMERA_SWITCH
/* stooping to new low's in hackyness :( */
scene->markers= oldmarkers;
scene->markers = oldmarkers;
#endif
return ibuf;
}
static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfra)
static ImBuf *seq_render_strip(SeqRenderData context, Sequence *seq, float cfra)
{
ImBuf * ibuf = NULL;
ImBuf *ibuf = NULL;
char name[FILE_MAX];
int use_preprocess = input_have_to_preprocess(context, seq, cfra);
int is_proxy_image = FALSE;
@@ -2187,7 +2189,7 @@ static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfr
ibuf = seq_stripelem_cache_get(context, seq, cfra, SEQ_STRIPELEM_IBUF);
/* currently, we cache preprocessed images in SEQ_STRIPELEM_IBUF,
* but not(!) on SEQ_STRIPELEM_IBUF_ENDSTILL and ..._STARTSTILL */
* but not(!) on SEQ_STRIPELEM_IBUF_ENDSTILL and ..._STARTSTILL */
if (ibuf)
use_preprocess = FALSE;
@@ -2200,139 +2202,139 @@ static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfr
is_proxy_image = (ibuf != NULL);
}
if (ibuf == NULL) switch(type) {
case SEQ_META:
{
ImBuf * meta_ibuf = NULL;
if (ibuf == NULL) switch (type) {
case SEQ_META:
{
ImBuf *meta_ibuf = NULL;
if (seq->seqbase.first)
meta_ibuf = seq_render_strip_stack(
context, &seq->seqbase,
seq->start + nr, 0);
if (seq->seqbase.first)
meta_ibuf = seq_render_strip_stack(
context, &seq->seqbase,
seq->start + nr, 0);
if (meta_ibuf) {
ibuf = meta_ibuf;
if (ibuf && use_preprocess) {
struct ImBuf * i = IMB_dupImBuf(ibuf);
if (meta_ibuf) {
ibuf = meta_ibuf;
if (ibuf && use_preprocess) {
ImBuf *i = IMB_dupImBuf(ibuf);
IMB_freeImBuf(ibuf);
IMB_freeImBuf(ibuf);
ibuf = i;
ibuf = i;
}
}
break;
}
case SEQ_SPEED:
{
ImBuf *child_ibuf = NULL;
break;
}
case SEQ_SPEED:
{
ImBuf * child_ibuf = NULL;
float f_cfra;
SpeedControlVars *s = (SpeedControlVars *)seq->effectdata;
float f_cfra;
SpeedControlVars * s = (SpeedControlVars *)seq->effectdata;
sequence_effect_speed_rebuild_map(context.scene, seq, 0);
sequence_effect_speed_rebuild_map(context.scene,seq, 0);
/* weeek! */
f_cfra = seq->start + s->frameMap[(int) nr];
/* weeek! */
f_cfra = seq->start + s->frameMap[(int) nr];
child_ibuf = seq_render_strip(context, seq->seq1, f_cfra);
child_ibuf = seq_render_strip(context,seq->seq1,f_cfra);
if (child_ibuf) {
ibuf = child_ibuf;
if (ibuf && use_preprocess) {
ImBuf *i = IMB_dupImBuf(ibuf);
if (child_ibuf) {
ibuf = child_ibuf;
if (ibuf && use_preprocess) {
struct ImBuf * i = IMB_dupImBuf(ibuf);
IMB_freeImBuf(ibuf);
IMB_freeImBuf(ibuf);
ibuf = i;
ibuf = i;
}
}
break;
}
break;
}
case SEQ_EFFECT:
{
ibuf = seq_render_effect_strip_impl(
context, seq, seq->start + nr);
break;
}
case SEQ_IMAGE:
{
StripElem * s_elem = give_stripelem(seq, cfra);
if (s_elem) {
BLI_join_dirfile(name, sizeof(name), seq->strip->dir, s_elem->name);
BLI_path_abs(name, G.main->name);
case SEQ_EFFECT:
{
ibuf = seq_render_effect_strip_impl(
context, seq, seq->start + nr);
break;
}
case SEQ_IMAGE:
{
StripElem *s_elem = give_stripelem(seq, cfra);
if (s_elem && (ibuf = IMB_loadiffname(name, IB_rect))) {
/* we don't need both (speed reasons)! */
if (ibuf->rect_float && ibuf->rect)
imb_freerectImBuf(ibuf);
if (s_elem) {
BLI_join_dirfile(name, sizeof(name), seq->strip->dir, s_elem->name);
BLI_path_abs(name, G.main->name);
}
/* all sequencer color is done in SRGB space, linear gives odd crossfades */
if (ibuf->profile == IB_PROFILE_LINEAR_RGB)
IMB_convert_profile(ibuf, IB_PROFILE_NONE);
if (s_elem && (ibuf = IMB_loadiffname(name, IB_rect))) {
/* we don't need both (speed reasons)! */
if (ibuf->rect_float && ibuf->rect)
imb_freerectImBuf(ibuf);
/* all sequencer color is done in SRGB space, linear gives odd crossfades */
if (ibuf->profile == IB_PROFILE_LINEAR_RGB)
IMB_convert_profile(ibuf, IB_PROFILE_NONE);
copy_to_ibuf_still(context, seq, nr, ibuf);
s_elem->orig_width = ibuf->x;
s_elem->orig_height = ibuf->y;
}
break;
}
case SEQ_MOVIE:
{
seq_open_anim_file(seq);
if (seq->anim) {
IMB_anim_set_preseek(seq->anim,
seq->anim_preseek);
ibuf = IMB_anim_absolute(
seq->anim, nr + seq->anim_startofs,
seq->strip->proxy ?
seq->strip->proxy->tc :
IMB_TC_RECORD_RUN,
seq_rendersize_to_proxysize(
context.preview_render_size));
/* we don't need both (speed reasons)! */
if (ibuf && ibuf->rect_float && ibuf->rect)
imb_freerectImBuf(ibuf);
if (ibuf) {
seq->strip->stripdata->orig_width = ibuf->x;
seq->strip->stripdata->orig_height = ibuf->y;
}
}
copy_to_ibuf_still(context, seq, nr, ibuf);
break;
}
case SEQ_SCENE:
{ // scene can be NULL after deletions
ibuf = seq_render_scene_strip(context, seq, nr);
/* Scene strips update all animation, so we need to restore original state.*/
BKE_animsys_evaluate_all_animation(context.bmain, context.scene, cfra);
copy_to_ibuf_still(context, seq, nr, ibuf);
s_elem->orig_width = ibuf->x;
s_elem->orig_height = ibuf->y;
break;
}
break;
}
case SEQ_MOVIE:
{
seq_open_anim_file(seq);
case SEQ_MOVIECLIP:
{
ibuf = seq_render_movieclip_strip(context, seq, nr);
if (seq->anim) {
IMB_anim_set_preseek(seq->anim,
seq->anim_preseek);
if (ibuf && use_preprocess) {
ImBuf *i = IMB_dupImBuf(ibuf);
ibuf = IMB_anim_absolute(
seq->anim, nr + seq->anim_startofs,
seq->strip->proxy ?
seq->strip->proxy->tc
: IMB_TC_RECORD_RUN,
seq_rendersize_to_proxysize(
context.preview_render_size));
IMB_freeImBuf(ibuf);
/* we don't need both (speed reasons)! */
if (ibuf && ibuf->rect_float && ibuf->rect)
imb_freerectImBuf(ibuf);
if (ibuf) {
seq->strip->stripdata->orig_width = ibuf->x;
seq->strip->stripdata->orig_height = ibuf->y;
ibuf = i;
}
copy_to_ibuf_still(context, seq, nr, ibuf);
break;
}
copy_to_ibuf_still(context, seq, nr, ibuf);
break;
}
case SEQ_SCENE:
{ // scene can be NULL after deletions
ibuf = seq_render_scene_strip(context, seq, nr);
/* Scene strips update all animation, so we need to restore original state.*/
BKE_animsys_evaluate_all_animation(context.bmain, context.scene, cfra);
copy_to_ibuf_still(context, seq, nr, ibuf);
break;
}
case SEQ_MOVIECLIP:
{
ibuf = seq_render_movieclip_strip(context, seq, nr);
if (ibuf && use_preprocess) {
struct ImBuf * i = IMB_dupImBuf(ibuf);
IMB_freeImBuf(ibuf);
ibuf = i;
}
copy_to_ibuf_still(context, seq, nr, ibuf);
break;
}
}
if (ibuf == NULL)
ibuf = IMB_allocImBuf((short)context.rectx, (short)context.recty, 32, IB_rect);
@@ -2342,7 +2344,7 @@ static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfr
if (use_preprocess)
ibuf = input_preprocess(context, seq, cfra, ibuf,
is_proxy_image, is_preprocessed);
is_proxy_image, is_preprocessed);
seq_stripelem_cache_put(context, seq, cfra, SEQ_STRIPELEM_IBUF, ibuf);
@@ -2353,7 +2355,7 @@ static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfr
* strip stack rendering functions
* ********************************************************************** */
static int seq_must_swap_input_in_blend_mode(Sequence * seq)
static int seq_must_swap_input_in_blend_mode(Sequence *seq)
{
int swap_input = FALSE;
@@ -2367,7 +2369,7 @@ static int seq_must_swap_input_in_blend_mode(Sequence * seq)
return swap_input;
}
static int seq_get_early_out_for_blend_mode(Sequence * seq)
static int seq_get_early_out_for_blend_mode(Sequence *seq)
{
struct SeqEffectHandle sh = get_sequence_blend(seq);
float facf = seq->blend_opacity / 100.0f;
@@ -2388,13 +2390,13 @@ static int seq_get_early_out_for_blend_mode(Sequence * seq)
return early_out;
}
static ImBuf* seq_render_strip_stack(
SeqRenderData context, ListBase *seqbasep, float cfra, int chanshown)
static ImBuf *seq_render_strip_stack(
SeqRenderData context, ListBase *seqbasep, float cfra, int chanshown)
{
Sequence* seq_arr[MAXSEQ+1];
Sequence *seq_arr[MAXSEQ + 1];
int count;
int i;
ImBuf* out = NULL;
ImBuf *out = NULL;
count = get_shown_sequences(seqbasep, cfra, chanshown, (Sequence **)&seq_arr);
@@ -2405,13 +2407,13 @@ static ImBuf* seq_render_strip_stack(
#if 0 /* commentind since this breaks keyframing, since it resets the value on draw */
if (scene->r.cfra != cfra) {
// XXX for prefetch and overlay offset!..., very bad!!!
AnimData *adt= BKE_animdata_from_id(&scene->id);
AnimData *adt = BKE_animdata_from_id(&scene->id);
BKE_animsys_evaluate_animdata(scene, &scene->id, adt, cfra, ADT_RECALC_ANIM);
}
#endif
out = seq_stripelem_cache_get(context, seq_arr[count - 1],
cfra, SEQ_STRIPELEM_IBUF_COMP);
cfra, SEQ_STRIPELEM_IBUF_COMP);
if (out) {
return out;
@@ -2420,7 +2422,7 @@ static ImBuf* seq_render_strip_stack(
if (count == 1) {
out = seq_render_strip(context, seq_arr[0], cfra);
seq_stripelem_cache_put(context, seq_arr[0], cfra,
SEQ_STRIPELEM_IBUF_COMP, out);
SEQ_STRIPELEM_IBUF_COMP, out);
return out;
}
@@ -2431,7 +2433,7 @@ static ImBuf* seq_render_strip_stack(
Sequence *seq = seq_arr[i];
out = seq_stripelem_cache_get(
context, seq, cfra, SEQ_STRIPELEM_IBUF_COMP);
context, seq, cfra, SEQ_STRIPELEM_IBUF_COMP);
if (out) {
break;
@@ -2444,21 +2446,21 @@ static ImBuf* seq_render_strip_stack(
early_out = seq_get_early_out_for_blend_mode(seq);
switch (early_out) {
case EARLY_NO_INPUT:
case EARLY_USE_INPUT_2:
out = seq_render_strip(context, seq, cfra);
break;
case EARLY_USE_INPUT_1:
if (i == 0) {
out = IMB_allocImBuf((short)context.rectx, (short)context.recty, 32, IB_rect);
}
break;
case EARLY_DO_EFFECT:
if (i == 0) {
case EARLY_NO_INPUT:
case EARLY_USE_INPUT_2:
out = seq_render_strip(context, seq, cfra);
}
break;
case EARLY_USE_INPUT_1:
if (i == 0) {
out = IMB_allocImBuf((short)context.rectx, (short)context.recty, 32, IB_rect);
}
break;
case EARLY_DO_EFFECT:
if (i == 0) {
out = seq_render_strip(context, seq, cfra);
}
break;
break;
}
if (out) {
break;
@@ -2466,31 +2468,31 @@ static ImBuf* seq_render_strip_stack(
}
seq_stripelem_cache_put(context, seq_arr[i], cfra,
SEQ_STRIPELEM_IBUF_COMP, out);
SEQ_STRIPELEM_IBUF_COMP, out);
i++;
for (; i < count; i++) {
Sequence * seq = seq_arr[i];
Sequence *seq = seq_arr[i];
if (seq_get_early_out_for_blend_mode(seq) == EARLY_DO_EFFECT) {
struct SeqEffectHandle sh = get_sequence_blend(seq);
ImBuf * ibuf1 = out;
ImBuf * ibuf2 = seq_render_strip(context, seq, cfra);
ImBuf *ibuf1 = out;
ImBuf *ibuf2 = seq_render_strip(context, seq, cfra);
float facf = seq->blend_opacity / 100.0f;
int swap_input = seq_must_swap_input_in_blend_mode(seq);
if (swap_input) {
out = sh.execute(context, seq, cfra,
facf, facf,
ibuf2, ibuf1, NULL);
facf, facf,
ibuf2, ibuf1, NULL);
}
else {
out = sh.execute(context, seq, cfra,
facf, facf,
ibuf1, ibuf2, NULL);
facf, facf,
ibuf1, ibuf2, NULL);
}
IMB_freeImBuf(ibuf1);
@@ -2498,7 +2500,7 @@ static ImBuf* seq_render_strip_stack(
}
seq_stripelem_cache_put(context, seq_arr[i], cfra,
SEQ_STRIPELEM_IBUF_COMP, out);
SEQ_STRIPELEM_IBUF_COMP, out);
}
return out;
@@ -2511,19 +2513,19 @@ static ImBuf* seq_render_strip_stack(
ImBuf *give_ibuf_seq(SeqRenderData context, float cfra, int chanshown)
{
Editing *ed= seq_give_editing(context.scene, FALSE);
Editing *ed = seq_give_editing(context.scene, FALSE);
int count;
ListBase *seqbasep;
if (ed==NULL) return NULL;
if (ed == NULL) return NULL;
count = BLI_countlist(&ed->metastack);
if ((chanshown < 0) && (count > 0)) {
count = MAX2(count + chanshown, 0);
seqbasep= ((MetaStack*)BLI_findlink(&ed->metastack, count))->oldbasep;
seqbasep = ((MetaStack *)BLI_findlink(&ed->metastack, count))->oldbasep;
}
else {
seqbasep= ed->seqbasep;
seqbasep = ed->seqbasep;
}
return seq_render_strip_stack(context, seqbasep, cfra, chanshown);
@@ -2561,13 +2563,13 @@ static ListBase prefetch_done;
static pthread_mutex_t queue_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t wakeup_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_cond_t wakeup_cond = PTHREAD_COND_INITIALIZER;
static pthread_cond_t wakeup_cond = PTHREAD_COND_INITIALIZER;
//static pthread_mutex_t prefetch_ready_lock = PTHREAD_MUTEX_INITIALIZER;
//static pthread_cond_t prefetch_ready_cond = PTHREAD_COND_INITIALIZER;
static pthread_mutex_t frame_done_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_cond_t frame_done_cond = PTHREAD_COND_INITIALIZER;
static pthread_cond_t frame_done_cond = PTHREAD_COND_INITIALIZER;
static volatile int seq_thread_shutdown = TRUE;
static volatile int seq_last_given_monoton_cfra = 0;
@@ -2594,13 +2596,13 @@ typedef struct PrefetchQueueElem {
int monoton_cfra;
struct ImBuf * ibuf;
ImBuf *ibuf;
} PrefetchQueueElem;
#if 0
static void *seq_prefetch_thread(void * This_)
static void *seq_prefetch_thread(void *This_)
{
PrefetchThread * This = This_;
PrefetchThread *This = This_;
while (!seq_thread_shutdown) {
PrefetchQueueElem *e;
@@ -2637,8 +2639,8 @@ static void *seq_prefetch_thread(void * This_)
if (e->cfra >= s_last) {
e->ibuf = give_ibuf_seq_impl(This->scene,
e->rectx, e->recty, e->cfra, e->chanshown,
e->preview_render_size);
e->rectx, e->recty, e->cfra, e->chanshown,
e->preview_render_size);
}
pthread_mutex_lock(&queue_lock);
@@ -2684,13 +2686,13 @@ static void seq_start_threads(Scene *scene)
(but we code, in the hope, that we can remove this restriction
soon...)
*/
*/
fprintf(stderr, "SEQ-THREAD: seq_start_threads\n");
for (i = 0; i < 1; i++) {
PrefetchThread *t = MEM_callocN(sizeof(PrefetchThread), "prefetch_thread");
t->scene= scene;
t->scene = scene;
t->running = TRUE;
BLI_addtail(&running_threads, t);
@@ -2720,7 +2722,7 @@ static void seq_stop_threads()
pthread_cond_broadcast(&wakeup_cond);
pthread_mutex_unlock(&wakeup_lock);
for (tslot = running_threads.first; tslot; tslot= tslot->next) {
for (tslot = running_threads.first; tslot; tslot = tslot->next) {
pthread_join(tslot->pthread, NULL);
}
@@ -2779,8 +2781,8 @@ static void seq_wait_for_prefetch_ready()
pthread_mutex_lock(&prefetch_ready_lock);
for (;;) {
for (tslot = running_threads.first; tslot; tslot= tslot->next) {
for (;; ) {
for (tslot = running_threads.first; tslot; tslot = tslot->next) {
if (tslot->running) {
break;
}
@@ -2812,10 +2814,11 @@ ImBuf *give_ibuf_seq_threaded(SeqRenderData context, float cfra, int chanshown)
for (e = prefetch_done.first; e; e = e->next) {
if (cfra == e->cfra &&
chanshown == e->chanshown &&
context.rectx == e->rectx &&
context.recty == e->recty &&
context.preview_render_size == e->preview_render_size) {
chanshown == e->chanshown &&
context.rectx == e->rectx &&
context.recty == e->recty &&
context.preview_render_size == e->preview_render_size)
{
success = TRUE;
found_something = TRUE;
break;
@@ -2825,10 +2828,11 @@ ImBuf *give_ibuf_seq_threaded(SeqRenderData context, float cfra, int chanshown)
if (!e) {
for (e = prefetch_wait.first; e; e = e->next) {
if (cfra == e->cfra &&
chanshown == e->chanshown &&
context.rectx == e->rectx &&
context.recty == e->recty &&
context.preview_render_size == e->preview_render_size) {
chanshown == e->chanshown &&
context.rectx == e->rectx &&
context.recty == e->recty &&
context.preview_render_size == e->preview_render_size)
{
found_something = TRUE;
break;
}
@@ -2840,14 +2844,14 @@ ImBuf *give_ibuf_seq_threaded(SeqRenderData context, float cfra, int chanshown)
for (tslot = running_threads.first;
tslot;
tslot= tslot->next)
tslot = tslot->next)
{
if (tslot->current &&
cfra == tslot->current->cfra &&
chanshown == tslot->current->chanshown &&
context.rectx == tslot->current->rectx &&
context.recty == tslot->current->recty &&
context.preview_render_size== tslot->current->preview_render_size)
context.preview_render_size == tslot->current->preview_render_size)
{
found_something = TRUE;
break;
@@ -2868,8 +2872,8 @@ ImBuf *give_ibuf_seq_threaded(SeqRenderData context, float cfra, int chanshown)
if (!found_something) {
fprintf(stderr,
"SEQ-THREAD: Requested frame "
"not in queue ???\n");
"SEQ-THREAD: Requested frame "
"not in queue ???\n");
break;
}
pthread_mutex_lock(&frame_done_lock);
@@ -2891,8 +2895,8 @@ static void free_anim_seq(Sequence *seq)
}
}
void free_imbuf_seq(Scene *scene, ListBase * seqbase, int check_mem_usage,
int keep_file_handles)
void free_imbuf_seq(Scene *scene, ListBase *seqbase, int check_mem_usage,
int keep_file_handles)
{
Sequence *seq;
@@ -2911,8 +2915,8 @@ void free_imbuf_seq(Scene *scene, ListBase * seqbase, int check_mem_usage,
uintptr_t mmap_in_use;
uintptr_t max;
mem_in_use= MEM_get_memory_in_use();
mmap_in_use= MEM_get_mapped_memory_in_use();
mem_in_use = MEM_get_memory_in_use();
mmap_in_use = MEM_get_mapped_memory_in_use();
max = MEM_CacheLimiter_get_maximum();
if (max == 0 || mem_in_use + mmap_in_use <= max) {
@@ -2922,18 +2926,18 @@ void free_imbuf_seq(Scene *scene, ListBase * seqbase, int check_mem_usage,
seq_stripelem_cache_cleanup();
for (seq= seqbase->first; seq; seq= seq->next) {
for (seq = seqbase->first; seq; seq = seq->next) {
if (seq->strip) {
if (seq->type==SEQ_MOVIE && !keep_file_handles)
if (seq->type == SEQ_MOVIE && !keep_file_handles)
free_anim_seq(seq);
if (seq->type==SEQ_SPEED) {
if (seq->type == SEQ_SPEED) {
sequence_effect_speed_rebuild_map(scene, seq, 1);
}
}
if (seq->type==SEQ_META) {
if (seq->type == SEQ_META) {
free_imbuf_seq(scene, &seq->seqbase, FALSE, keep_file_handles);
}
if (seq->type==SEQ_SCENE) {
if (seq->type == SEQ_SCENE) {
/* FIXME: recurs downwards,
but do recurs protection somehow! */
}
@@ -2954,7 +2958,7 @@ static int update_changed_seq_recurs(Scene *scene, Sequence *seq, Sequence *chan
if (seq == changed_seq)
free_imbuf = 1;
for (subseq=seq->seqbase.first; subseq; subseq=subseq->next)
for (subseq = seq->seqbase.first; subseq; subseq = subseq->next)
if (update_changed_seq_recurs(scene, subseq, changed_seq, len_change, ibuf_change))
free_imbuf = TRUE;
@@ -2986,12 +2990,12 @@ static int update_changed_seq_recurs(Scene *scene, Sequence *seq, Sequence *chan
void update_changed_seq_and_deps(Scene *scene, Sequence *changed_seq, int len_change, int ibuf_change)
{
Editing *ed= seq_give_editing(scene, FALSE);
Editing *ed = seq_give_editing(scene, FALSE);
Sequence *seq;
if (ed==NULL) return;
if (ed == NULL) return;
for (seq=ed->seqbase.first; seq; seq=seq->next)
for (seq = ed->seqbase.first; seq; seq = seq->next)
update_changed_seq_recurs(scene, seq, changed_seq, len_change, ibuf_change);
}
@@ -3007,14 +3011,14 @@ int seq_tx_get_start(Sequence *seq)
}
int seq_tx_get_end(Sequence *seq)
{
return seq->start+seq->len;
return seq->start + seq->len;
}
int seq_tx_get_final_left(Sequence *seq, int metaclip)
{
if (metaclip && seq->tmp) {
/* return the range clipped by the parents range */
return MAX2( seq_tx_get_final_left(seq, 0), seq_tx_get_final_left((Sequence *)seq->tmp, 1) );
return MAX2(seq_tx_get_final_left(seq, 0), seq_tx_get_final_left((Sequence *)seq->tmp, 1) );
}
else {
return (seq->start - seq->startstill) + seq->startofs;
@@ -3025,10 +3029,10 @@ int seq_tx_get_final_right(Sequence *seq, int metaclip)
{
if (metaclip && seq->tmp) {
/* return the range clipped by the parents range */
return MIN2( seq_tx_get_final_right(seq, 0), seq_tx_get_final_right((Sequence *)seq->tmp, 1) );
return MIN2(seq_tx_get_final_right(seq, 0), seq_tx_get_final_right((Sequence *)seq->tmp, 1) );
}
else {
return ((seq->start+seq->len) + seq->endstill) - seq->endofs;
return ((seq->start + seq->len) + seq->endstill) - seq->endofs;
}
}
@@ -3060,10 +3064,10 @@ void seq_tx_set_final_right(Sequence *seq, int val)
* since they work a bit differently to normal image seq's (during transform) */
int seq_single_check(Sequence *seq)
{
return (seq->len==1 && (
seq->type == SEQ_IMAGE
|| ((seq->type & SEQ_EFFECT) &&
get_sequence_effect_num_inputs(seq->type) == 0)));
return (seq->len == 1 && (
seq->type == SEQ_IMAGE
|| ((seq->type & SEQ_EFFECT) &&
get_sequence_effect_num_inputs(seq->type) == 0)));
}
/* check if the selected seq's reference unselected seq's */
@@ -3071,11 +3075,11 @@ int seqbase_isolated_sel_check(ListBase *seqbase)
{
Sequence *seq;
/* is there more than 1 select */
int ok= FALSE;
int ok = FALSE;
for (seq= seqbase->first; seq; seq= seq->next) {
for (seq = seqbase->first; seq; seq = seq->next) {
if (seq->flag & SELECT) {
ok= TRUE;
ok = TRUE;
break;
}
}
@@ -3084,20 +3088,20 @@ int seqbase_isolated_sel_check(ListBase *seqbase)
return FALSE;
/* test relationships */
for (seq= seqbase->first; seq; seq= seq->next) {
if ((seq->type & SEQ_EFFECT)==0)
for (seq = seqbase->first; seq; seq = seq->next) {
if ((seq->type & SEQ_EFFECT) == 0)
continue;
if (seq->flag & SELECT) {
if ( (seq->seq1 && (seq->seq1->flag & SELECT)==0) ||
(seq->seq2 && (seq->seq2->flag & SELECT)==0) ||
(seq->seq3 && (seq->seq3->flag & SELECT)==0) )
if ( (seq->seq1 && (seq->seq1->flag & SELECT) == 0) ||
(seq->seq2 && (seq->seq2->flag & SELECT) == 0) ||
(seq->seq3 && (seq->seq3->flag & SELECT) == 0) )
return FALSE;
}
else {
if ( (seq->seq1 && (seq->seq1->flag & SELECT)) ||
(seq->seq2 && (seq->seq2->flag & SELECT)) ||
(seq->seq3 && (seq->seq3->flag & SELECT)) )
(seq->seq2 && (seq->seq2->flag & SELECT)) ||
(seq->seq3 && (seq->seq3->flag & SELECT)) )
return FALSE;
}
}
@@ -3111,12 +3115,12 @@ void seq_tx_handle_xlimits(Sequence *seq, int leftflag, int rightflag)
{
if (leftflag) {
if (seq_tx_get_final_left(seq, 0) >= seq_tx_get_final_right(seq, 0)) {
seq_tx_set_final_left(seq, seq_tx_get_final_right(seq, 0)-1);
seq_tx_set_final_left(seq, seq_tx_get_final_right(seq, 0) - 1);
}
if (seq_single_check(seq)==0) {
if (seq_single_check(seq) == 0) {
if (seq_tx_get_final_left(seq, 0) >= seq_tx_get_end(seq)) {
seq_tx_set_final_left(seq, seq_tx_get_end(seq)-1);
seq_tx_set_final_left(seq, seq_tx_get_end(seq) - 1);
}
/* dosnt work now - TODO */
@@ -3125,7 +3129,7 @@ void seq_tx_handle_xlimits(Sequence *seq, int leftflag, int rightflag)
int ofs;
ofs = seq_tx_get_start(seq) - seq_tx_get_final_right(seq, 0);
seq->start -= ofs;
seq_tx_set_final_left(seq, seq_tx_get_final_left(seq, 0) + ofs );
seq_tx_set_final_left(seq, seq_tx_get_final_left(seq, 0) + ofs);
}
#endif
}
@@ -3133,20 +3137,20 @@ void seq_tx_handle_xlimits(Sequence *seq, int leftflag, int rightflag)
if (rightflag) {
if (seq_tx_get_final_right(seq, 0) <= seq_tx_get_final_left(seq, 0)) {
seq_tx_set_final_right(seq, seq_tx_get_final_left(seq, 0)+1);
seq_tx_set_final_right(seq, seq_tx_get_final_left(seq, 0) + 1);
}
if (seq_single_check(seq)==0) {
if (seq_single_check(seq) == 0) {
if (seq_tx_get_final_right(seq, 0) <= seq_tx_get_start(seq)) {
seq_tx_set_final_right(seq, seq_tx_get_start(seq)+1);
seq_tx_set_final_right(seq, seq_tx_get_start(seq) + 1);
}
}
}
/* sounds cannot be extended past their endpoints */
if (seq->type == SEQ_SOUND) {
seq->startstill= 0;
seq->endstill= 0;
seq->startstill = 0;
seq->endstill = 0;
}
}
@@ -3162,13 +3166,13 @@ void seq_single_fix(Sequence *seq)
start = seq->start;
if (start != left) {
offset = left - start;
seq_tx_set_final_left( seq, seq_tx_get_final_left(seq, 0) - offset );
seq_tx_set_final_right( seq, seq_tx_get_final_right(seq, 0) - offset );
seq_tx_set_final_left(seq, seq_tx_get_final_left(seq, 0) - offset);
seq_tx_set_final_right(seq, seq_tx_get_final_right(seq, 0) - offset);
seq->start += offset;
}
}
int seq_tx_test(Sequence * seq)
int seq_tx_test(Sequence *seq)
{
return (seq->type < SEQ_EFFECT) || (get_sequence_effect_num_inputs(seq->type) == 0);
}
@@ -3176,19 +3180,19 @@ int seq_tx_test(Sequence * seq)
static int seq_overlap(Sequence *seq1, Sequence *seq2)
{
return (seq1 != seq2 && seq1->machine == seq2->machine &&
((seq1->enddisp <= seq2->startdisp) || (seq1->startdisp >= seq2->enddisp))==0);
((seq1->enddisp <= seq2->startdisp) || (seq1->startdisp >= seq2->enddisp)) == 0);
}
int seq_test_overlap(ListBase * seqbasep, Sequence *test)
int seq_test_overlap(ListBase *seqbasep, Sequence *test)
{
Sequence *seq;
seq= seqbasep->first;
seq = seqbasep->first;
while (seq) {
if (seq_overlap(test, seq))
return 1;
seq= seq->next;
seq = seq->next;
}
return 0;
}
@@ -3199,9 +3203,9 @@ void seq_translate(Scene *evil_scene, Sequence *seq, int delta)
seq_offset_animdata(evil_scene, seq, delta);
seq->start += delta;
if (seq->type==SEQ_META) {
if (seq->type == SEQ_META) {
Sequence *seq_child;
for (seq_child= seq->seqbase.first; seq_child; seq_child= seq_child->next) {
for (seq_child = seq->seqbase.first; seq_child; seq_child = seq_child->next) {
seq_translate(evil_scene, seq_child, delta);
}
}
@@ -3211,9 +3215,9 @@ void seq_translate(Scene *evil_scene, Sequence *seq, int delta)
void seq_sound_init(Scene *scene, Sequence *seq)
{
if (seq->type==SEQ_META) {
if (seq->type == SEQ_META) {
Sequence *seq_child;
for (seq_child= seq->seqbase.first; seq_child; seq_child= seq_child->next) {
for (seq_child = seq->seqbase.first; seq_child; seq_child = seq_child->next) {
seq_sound_init(scene, seq_child);
}
}
@@ -3229,13 +3233,13 @@ void seq_sound_init(Scene *scene, Sequence *seq)
Sequence *seq_foreground_frame_get(Scene *scene, int frame)
{
Editing *ed= seq_give_editing(scene, FALSE);
Sequence *seq, *best_seq=NULL;
Editing *ed = seq_give_editing(scene, FALSE);
Sequence *seq, *best_seq = NULL;
int best_machine = -1;
if (!ed) return NULL;
for (seq=ed->seqbasep->first; seq; seq= seq->next) {
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
if (seq->flag & SEQ_MUTE || seq->startdisp > frame || seq->enddisp <= frame)
continue;
/* only use elements you can see - not */
@@ -3250,12 +3254,12 @@ Sequence *seq_foreground_frame_get(Scene *scene, int frame)
}
/* return 0 if there werent enough space */
int shuffle_seq(ListBase * seqbasep, Sequence *test, Scene *evil_scene)
int shuffle_seq(ListBase *seqbasep, Sequence *test, Scene *evil_scene)
{
int orig_machine= test->machine;
int orig_machine = test->machine;
test->machine++;
calc_sequence(evil_scene, test);
while ( seq_test_overlap(seqbasep, test) ) {
while (seq_test_overlap(seqbasep, test) ) {
if (test->machine >= MAXSEQ) {
break;
}
@@ -3269,15 +3273,15 @@ int shuffle_seq(ListBase * seqbasep, Sequence *test, Scene *evil_scene)
* nicer to move it to the end */
Sequence *seq;
int new_frame= test->enddisp;
int new_frame = test->enddisp;
for (seq= seqbasep->first; seq; seq= seq->next) {
for (seq = seqbasep->first; seq; seq = seq->next) {
if (seq->machine == orig_machine)
new_frame = MAX2(new_frame, seq->enddisp);
}
test->machine= orig_machine;
new_frame = new_frame + (test->start-test->startdisp); /* adjust by the startdisp */
test->machine = orig_machine;
new_frame = new_frame + (test->start - test->startdisp); /* adjust by the startdisp */
seq_translate(evil_scene, test, new_frame - test->start);
calc_sequence(evil_scene, test);
@@ -3288,20 +3292,20 @@ int shuffle_seq(ListBase * seqbasep, Sequence *test, Scene *evil_scene)
}
}
static int shuffle_seq_time_offset_test(ListBase * seqbasep, char dir)
static int shuffle_seq_time_offset_test(ListBase *seqbasep, char dir)
{
int offset= 0;
int offset = 0;
Sequence *seq, *seq_other;
for (seq= seqbasep->first; seq; seq= seq->next) {
for (seq = seqbasep->first; seq; seq = seq->next) {
if (seq->tmp) {
for (seq_other= seqbasep->first; seq_other; seq_other= seq_other->next) {
for (seq_other = seqbasep->first; seq_other; seq_other = seq_other->next) {
if (!seq_other->tmp && seq_overlap(seq, seq_other)) {
if (dir=='L') {
offset= MIN2(offset, seq_other->startdisp - seq->enddisp);
if (dir == 'L') {
offset = MIN2(offset, seq_other->startdisp - seq->enddisp);
}
else {
offset= MAX2(offset, seq_other->enddisp - seq->startdisp);
offset = MAX2(offset, seq_other->enddisp - seq->startdisp);
}
}
}
@@ -3310,32 +3314,32 @@ static int shuffle_seq_time_offset_test(ListBase * seqbasep, char dir)
return offset;
}
static int shuffle_seq_time_offset(Scene* scene, ListBase * seqbasep, char dir)
static int shuffle_seq_time_offset(Scene *scene, ListBase *seqbasep, char dir)
{
int ofs= 0;
int tot_ofs= 0;
int ofs = 0;
int tot_ofs = 0;
Sequence *seq;
while ( (ofs= shuffle_seq_time_offset_test(seqbasep, dir)) ) {
for (seq= seqbasep->first; seq; seq= seq->next) {
while ( (ofs = shuffle_seq_time_offset_test(seqbasep, dir)) ) {
for (seq = seqbasep->first; seq; seq = seq->next) {
if (seq->tmp) {
/* seq_test_overlap only tests display values */
seq->startdisp += ofs;
seq->enddisp += ofs;
seq->startdisp += ofs;
seq->enddisp += ofs;
}
}
tot_ofs+= ofs;
tot_ofs += ofs;
}
for (seq= seqbasep->first; seq; seq= seq->next) {
for (seq = seqbasep->first; seq; seq = seq->next) {
if (seq->tmp)
calc_sequence_disp(scene, seq); /* corrects dummy startdisp/enddisp values */
calc_sequence_disp(scene, seq); /* corrects dummy startdisp/enddisp values */
}
return tot_ofs;
}
int shuffle_seq_time(ListBase * seqbasep, Scene *evil_scene)
int shuffle_seq_time(ListBase *seqbasep, Scene *evil_scene)
{
/* note: seq->tmp is used to tag strips to move */
@@ -3343,10 +3347,10 @@ int shuffle_seq_time(ListBase * seqbasep, Scene *evil_scene)
int offset_l = shuffle_seq_time_offset(evil_scene, seqbasep, 'L');
int offset_r = shuffle_seq_time_offset(evil_scene, seqbasep, 'R');
int offset = (-offset_l < offset_r) ? offset_l:offset_r;
int offset = (-offset_l < offset_r) ? offset_l : offset_r;
if (offset) {
for (seq= seqbasep->first; seq; seq= seq->next) {
for (seq = seqbasep->first; seq; seq = seq->next) {
if (seq->tmp) {
seq_translate(evil_scene, seq, offset);
seq->flag &= ~SEQ_OVERLAP;
@@ -3354,7 +3358,7 @@ int shuffle_seq_time(ListBase * seqbasep, Scene *evil_scene)
}
}
return offset? 0:1;
return offset ? 0 : 1;
}
void seq_update_sound_bounds_all(Scene *scene)
@@ -3375,7 +3379,7 @@ void seq_update_sound_bounds_all(Scene *scene)
}
}
void seq_update_sound_bounds(Scene* scene, Sequence *seq)
void seq_update_sound_bounds(Scene *scene, Sequence *seq)
{
sound_move_scene_sound_defaults(scene, seq);
/* mute is set in seq_update_muting_recursive */
@@ -3387,15 +3391,15 @@ static void seq_update_muting_recursive(ListBase *seqbasep, Sequence *metaseq, i
int seqmute;
/* for sound we go over full meta tree to update muted state,
* since sound is played outside of evaluating the imbufs, */
for (seq=seqbasep->first; seq; seq=seq->next) {
seqmute= (mute || (seq->flag & SEQ_MUTE));
* since sound is played outside of evaluating the imbufs, */
for (seq = seqbasep->first; seq; seq = seq->next) {
seqmute = (mute || (seq->flag & SEQ_MUTE));
if (seq->type == SEQ_META) {
/* if this is the current meta sequence, unmute because
* all sequences above this were set to mute */
if (seq == metaseq)
seqmute= 0;
seqmute = 0;
seq_update_muting_recursive(&seq->seqbase, metaseq, seqmute);
}
@@ -3411,7 +3415,7 @@ void seq_update_muting(Editing *ed)
{
if (ed) {
/* mute all sounds up to current metastack list */
MetaStack *ms= ed->metastack.last;
MetaStack *ms = ed->metastack.last;
if (ms)
seq_update_muting_recursive(&ed->seqbase, ms->parseq, 1);
@@ -3424,7 +3428,7 @@ static void seq_update_sound_recursive(Scene *scene, ListBase *seqbasep, bSound
{
Sequence *seq;
for (seq=seqbasep->first; seq; seq=seq->next) {
for (seq = seqbasep->first; seq; seq = seq->next) {
if (seq->type == SEQ_META) {
seq_update_sound_recursive(scene, &seq->seqbase, sound);
}
@@ -3447,13 +3451,13 @@ void seq_update_sound(struct Scene *scene, struct bSound *sound)
ListBase *seq_seqbase(ListBase *seqbase, Sequence *seq)
{
Sequence *iseq;
ListBase *lb= NULL;
ListBase *lb = NULL;
for (iseq= seqbase->first; iseq; iseq= iseq->next) {
if (seq==iseq) {
for (iseq = seqbase->first; iseq; iseq = iseq->next) {
if (seq == iseq) {
return seqbase;
}
else if (iseq->seqbase.first && (lb= seq_seqbase(&iseq->seqbase, seq))) {
else if (iseq->seqbase.first && (lb = seq_seqbase(&iseq->seqbase, seq))) {
return lb;
}
}
@@ -3461,18 +3465,18 @@ ListBase *seq_seqbase(ListBase *seqbase, Sequence *seq)
return NULL;
}
Sequence *seq_metastrip(ListBase * seqbase, Sequence * meta, Sequence *seq)
Sequence *seq_metastrip(ListBase *seqbase, Sequence *meta, Sequence *seq)
{
Sequence * iseq;
Sequence *iseq;
for (iseq = seqbase->first; iseq; iseq = iseq->next) {
Sequence * rval;
Sequence *rval;
if (seq == iseq) {
return meta;
}
else if (iseq->seqbase.first &&
(rval = seq_metastrip(&iseq->seqbase, iseq, seq))) {
(rval = seq_metastrip(&iseq->seqbase, iseq, seq))) {
return rval;
}
}
@@ -3485,26 +3489,26 @@ int seq_swap(Sequence *seq_a, Sequence *seq_b, const char **error_str)
char name[sizeof(seq_a->name)];
if (seq_a->len != seq_b->len) {
*error_str= "Strips must be the same length";
*error_str = "Strips must be the same length";
return 0;
}
/* type checking, could be more advanced but disalow sound vs non-sound copy */
if (seq_a->type != seq_b->type) {
if (seq_a->type == SEQ_SOUND || seq_b->type == SEQ_SOUND) {
*error_str= "Strips were not compatible";
*error_str = "Strips were not compatible";
return 0;
}
/* disallow effects to swap with non-effects strips */
if ((seq_a->type & SEQ_EFFECT) != (seq_b->type & SEQ_EFFECT)) {
*error_str= "Strips were not compatible";
*error_str = "Strips were not compatible";
return 0;
}
if ((seq_a->type & SEQ_EFFECT) && (seq_b->type & SEQ_EFFECT)) {
if (get_sequence_effect_num_inputs(seq_a->type) != get_sequence_effect_num_inputs(seq_b->type)) {
*error_str= "Strips must have the same number of inputs";
*error_str = "Strips must have the same number of inputs";
return 0;
}
}
@@ -3513,9 +3517,9 @@ int seq_swap(Sequence *seq_a, Sequence *seq_b, const char **error_str)
SWAP(Sequence, *seq_a, *seq_b);
/* swap back names so animation fcurves don't get swapped */
BLI_strncpy(name, seq_a->name+2, sizeof(name));
BLI_strncpy(seq_a->name+2, seq_b->name+2, sizeof(seq_b->name)-2);
BLI_strncpy(seq_b->name+2, name, sizeof(seq_b->name)-2);
BLI_strncpy(name, seq_a->name + 2, sizeof(name));
BLI_strncpy(seq_a->name + 2, seq_b->name + 2, sizeof(seq_b->name) - 2);
BLI_strncpy(seq_b->name + 2, name, sizeof(seq_b->name) - 2);
/* swap back opacity, and overlay mode */
SWAP(int, seq_a->blend_mode, seq_b->blend_mode);
@@ -3539,19 +3543,19 @@ int seq_swap(Sequence *seq_a, Sequence *seq_b, const char **error_str)
/* XXX - hackish function needed for transforming strips! TODO - have some better solution */
void seq_offset_animdata(Scene *scene, Sequence *seq, int ofs)
{
char str[SEQ_NAME_MAXSTR+3];
char str[SEQ_NAME_MAXSTR + 3];
FCurve *fcu;
if (scene->adt==NULL || ofs==0 || scene->adt->action==NULL)
if (scene->adt == NULL || ofs == 0 || scene->adt->action == NULL)
return;
BLI_snprintf(str, sizeof(str), "[\"%s\"]", seq->name+2);
BLI_snprintf(str, sizeof(str), "[\"%s\"]", seq->name + 2);
for (fcu= scene->adt->action->curves.first; fcu; fcu= fcu->next) {
for (fcu = scene->adt->action->curves.first; fcu; fcu = fcu->next) {
if (strstr(fcu->rna_path, "sequence_editor.sequences_all[") && strstr(fcu->rna_path, str)) {
unsigned int i;
for (i = 0; i < fcu->totvert; i++) {
BezTriple *bezt= &fcu->bezt[i];
BezTriple *bezt = &fcu->bezt[i];
bezt->vec[0][0] += ofs;
bezt->vec[1][0] += ofs;
bezt->vec[2][0] += ofs;
@@ -3562,22 +3566,22 @@ void seq_offset_animdata(Scene *scene, Sequence *seq, int ofs)
void seq_dupe_animdata(Scene *scene, const char *name_src, const char *name_dst)
{
char str_from[SEQ_NAME_MAXSTR+3];
char str_from[SEQ_NAME_MAXSTR + 3];
FCurve *fcu;
FCurve *fcu_last;
FCurve *fcu_cpy;
ListBase lb= {NULL, NULL};
ListBase lb = {NULL, NULL};
if (scene->adt==NULL || scene->adt->action==NULL)
if (scene->adt == NULL || scene->adt->action == NULL)
return;
BLI_snprintf(str_from, sizeof(str_from), "[\"%s\"]", name_src);
fcu_last= scene->adt->action->curves.last;
fcu_last = scene->adt->action->curves.last;
for (fcu= scene->adt->action->curves.first; fcu && fcu->prev != fcu_last; fcu= fcu->next) {
for (fcu = scene->adt->action->curves.first; fcu && fcu->prev != fcu_last; fcu = fcu->next) {
if (strstr(fcu->rna_path, "sequence_editor.sequences_all[") && strstr(fcu->rna_path, str_from)) {
fcu_cpy= copy_fcurve(fcu);
fcu_cpy = copy_fcurve(fcu);
BLI_addtail(&lb, fcu_cpy);
}
}
@@ -3592,15 +3596,15 @@ void seq_dupe_animdata(Scene *scene, const char *name_src, const char *name_dst)
/* XXX - hackish function needed to remove all fcurves belonging to a sequencer strip */
static void seq_free_animdata(Scene *scene, Sequence *seq)
{
char str[SEQ_NAME_MAXSTR+3];
char str[SEQ_NAME_MAXSTR + 3];
FCurve *fcu;
if (scene->adt==NULL || scene->adt->action==NULL)
if (scene->adt == NULL || scene->adt->action == NULL)
return;
BLI_snprintf(str, sizeof(str), "[\"%s\"]", seq->name+2);
BLI_snprintf(str, sizeof(str), "[\"%s\"]", seq->name + 2);
fcu= scene->adt->action->curves.first;
fcu = scene->adt->action->curves.first;
while (fcu) {
if (strstr(fcu->rna_path, "sequence_editor.sequences_all[") && strstr(fcu->rna_path, str)) {
@@ -3620,13 +3624,13 @@ static void seq_free_animdata(Scene *scene, Sequence *seq)
Sequence *get_seq_by_name(ListBase *seqbase, const char *name, int recursive)
{
Sequence *iseq=NULL;
Sequence *rseq=NULL;
Sequence *iseq = NULL;
Sequence *rseq = NULL;
for (iseq=seqbase->first; iseq; iseq=iseq->next) {
if (strcmp(name, iseq->name+2) == 0)
for (iseq = seqbase->first; iseq; iseq = iseq->next) {
if (strcmp(name, iseq->name + 2) == 0)
return iseq;
else if (recursive && (iseq->seqbase.first) && (rseq=get_seq_by_name(&iseq->seqbase, name, 1))) {
else if (recursive && (iseq->seqbase.first) && (rseq = get_seq_by_name(&iseq->seqbase, name, 1))) {
return rseq;
}
}
@@ -3637,24 +3641,24 @@ Sequence *get_seq_by_name(ListBase *seqbase, const char *name, int recursive)
Sequence *seq_active_get(Scene *scene)
{
Editing *ed= seq_give_editing(scene, FALSE);
if (ed==NULL) return NULL;
Editing *ed = seq_give_editing(scene, FALSE);
if (ed == NULL) return NULL;
return ed->act_seq;
}
void seq_active_set(Scene *scene, Sequence *seq)
{
Editing *ed= seq_give_editing(scene, FALSE);
if (ed==NULL) return;
Editing *ed = seq_give_editing(scene, FALSE);
if (ed == NULL) return;
ed->act_seq= seq;
ed->act_seq = seq;
}
int seq_active_pair_get(Scene *scene, Sequence **seq_act, Sequence **seq_other)
{
Editing *ed= seq_give_editing(scene, FALSE);
Editing *ed = seq_give_editing(scene, FALSE);
*seq_act= seq_active_get(scene);
*seq_act = seq_active_get(scene);
if (*seq_act == NULL) {
return 0;
@@ -3662,15 +3666,15 @@ int seq_active_pair_get(Scene *scene, Sequence **seq_act, Sequence **seq_other)
else {
Sequence *seq;
*seq_other= NULL;
*seq_other = NULL;
for (seq= ed->seqbasep->first; seq; seq= seq->next) {
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
if (seq->flag & SELECT && (seq != (*seq_act))) {
if (*seq_other) {
return 0;
}
else {
*seq_other= seq;
*seq_other = seq;
}
}
}
@@ -3684,7 +3688,7 @@ int seq_active_pair_get(Scene *scene, Sequence **seq_act, Sequence **seq_other)
void seq_load_apply(Scene *scene, Sequence *seq, SeqLoadInfo *seq_load)
{
if (seq) {
BLI_strncpy(seq->name+2, seq_load->name, sizeof(seq->name)-2);
BLI_strncpy(seq->name + 2, seq_load->name, sizeof(seq->name) - 2);
seqbase_unique_name_recursive(&scene->ed->seqbase, seq);
if (seq_load->flag & SEQ_LOAD_FRAME_ADVANCE) {
@@ -3712,17 +3716,17 @@ Sequence *alloc_sequence(ListBase *lb, int cfra, int machine)
{
Sequence *seq;
seq= MEM_callocN( sizeof(Sequence), "addseq");
seq = MEM_callocN(sizeof(Sequence), "addseq");
BLI_addtail(lb, seq);
*( (short *)seq->name )= ID_SEQ;
seq->name[2]= 0;
*( (short *)seq->name) = ID_SEQ;
seq->name[2] = 0;
seq->flag= SELECT;
seq->start= cfra;
seq->machine= machine;
seq->sat= 1.0;
seq->mul= 1.0;
seq->flag = SELECT;
seq->start = cfra;
seq->machine = machine;
seq->sat = 1.0;
seq->mul = 1.0;
seq->blend_opacity = 100.0;
seq->volume = 1.0f;
seq->pitch = 1.0f;
@@ -3734,20 +3738,20 @@ Sequence *alloc_sequence(ListBase *lb, int cfra, int machine)
/* NOTE: this function doesn't fill in image names */
Sequence *sequencer_add_image_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo *seq_load)
{
Scene *scene= CTX_data_scene(C); /* only for active seq */
Scene *scene = CTX_data_scene(C); /* only for active seq */
Sequence *seq;
Strip *strip;
seq = alloc_sequence(seqbasep, seq_load->start_frame, seq_load->channel);
seq->type= SEQ_IMAGE;
seq->blend_mode= SEQ_CROSS; /* so alpha adjustment fade to the strip below */
seq->type = SEQ_IMAGE;
seq->blend_mode = SEQ_CROSS; /* so alpha adjustment fade to the strip below */
/* basic defaults */
seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
seq->strip = strip = MEM_callocN(sizeof(Strip), "strip");
seq->len = seq_load->len ? seq_load->len : 1;
strip->us= 1;
strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
strip->us = 1;
strip->stripdata = MEM_callocN(seq->len * sizeof(StripElem), "stripelem");
BLI_strncpy(strip->dir, seq_load->path, sizeof(strip->dir));
seq_load_apply(scene, seq, seq_load);
@@ -3758,12 +3762,12 @@ Sequence *sequencer_add_image_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
#ifdef WITH_AUDASPACE
Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo *seq_load)
{
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C); /* only for sound */
Editing *ed= seq_give_editing(scene, TRUE);
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C); /* only for sound */
Editing *ed = seq_give_editing(scene, TRUE);
bSound *sound;
Sequence *seq; /* generic strip vars */
Sequence *seq; /* generic strip vars */
Strip *strip;
StripElem *se;
@@ -3771,7 +3775,7 @@ Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
sound = sound_new_file(CTX_data_main(C), seq_load->path); /* handles relative paths */
if (sound==NULL || sound->playback_handle == NULL) {
if (sound == NULL || sound->playback_handle == NULL) {
//if(op)
// BKE_report(op->reports, RPT_ERROR, "Unsupported audio format");
return NULL;
@@ -3788,18 +3792,18 @@ Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
seq = alloc_sequence(seqbasep, seq_load->start_frame, seq_load->channel);
seq->type= SEQ_SOUND;
seq->sound= sound;
BLI_strncpy(seq->name+2, "Sound", SEQ_NAME_MAXSTR-2);
seq->type = SEQ_SOUND;
seq->sound = sound;
BLI_strncpy(seq->name + 2, "Sound", SEQ_NAME_MAXSTR - 2);
seqbase_unique_name_recursive(&scene->ed->seqbase, seq);
/* basic defaults */
seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
seq->strip = strip = MEM_callocN(sizeof(Strip), "strip");
seq->len = ceil(info.length * FPS);
strip->us= 1;
strip->us = 1;
/* we only need 1 element to store the filename */
strip->stripdata= se= MEM_callocN(sizeof(StripElem), "stripelem");
strip->stripdata = se = MEM_callocN(sizeof(StripElem), "stripelem");
BLI_split_dirfile(seq_load->path, strip->dir, se->name, sizeof(strip->dir), sizeof(se->name));
@@ -3826,10 +3830,10 @@ Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo *seq_load)
{
Scene *scene= CTX_data_scene(C); /* only for sound */
Scene *scene = CTX_data_scene(C); /* only for sound */
char path[sizeof(seq_load->path)];
Sequence *seq; /* generic strip vars */
Sequence *seq; /* generic strip vars */
Strip *strip;
StripElem *se;
@@ -3840,25 +3844,25 @@ Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
an = openanim(path, IB_rect, 0);
if (an==NULL)
if (an == NULL)
return NULL;
seq = alloc_sequence(seqbasep, seq_load->start_frame, seq_load->channel);
seq->type= SEQ_MOVIE;
seq->blend_mode= SEQ_CROSS; /* so alpha adjustment fade to the strip below */
seq->type = SEQ_MOVIE;
seq->blend_mode = SEQ_CROSS; /* so alpha adjustment fade to the strip below */
seq->anim= an;
seq->anim = an;
seq->anim_preseek = IMB_anim_get_preseek(an);
BLI_strncpy(seq->name+2, "Movie", SEQ_NAME_MAXSTR-2);
BLI_strncpy(seq->name + 2, "Movie", SEQ_NAME_MAXSTR - 2);
seqbase_unique_name_recursive(&scene->ed->seqbase, seq);
/* basic defaults */
seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
seq->strip = strip = MEM_callocN(sizeof(Strip), "strip");
seq->len = IMB_anim_get_duration(an, IMB_TC_RECORD_RUN);
strip->us= 1;
strip->us = 1;
/* we only need 1 element for MOVIE strips */
strip->stripdata= se= MEM_callocN(sizeof(StripElem), "stripelem");
strip->stripdata = se = MEM_callocN(sizeof(StripElem), "stripelem");
BLI_split_dirfile(seq_load->path, strip->dir, se->name, sizeof(strip->dir), sizeof(se->name));
@@ -3866,12 +3870,12 @@ Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
if (seq_load->flag & SEQ_LOAD_MOVIE_SOUND) {
int start_frame_back= seq_load->start_frame;
int start_frame_back = seq_load->start_frame;
seq_load->channel++;
sequencer_add_sound_strip(C, seqbasep, seq_load);
seq_load->start_frame= start_frame_back;
seq_load->start_frame = start_frame_back;
seq_load->channel--;
}
@@ -3887,11 +3891,11 @@ Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
static Sequence *seq_dupli(struct Scene *scene, struct Scene *scene_to, Sequence *seq, int dupe_flag)
{
Scene *sce_audio= scene_to ? scene_to : scene;
Scene *sce_audio = scene_to ? scene_to : scene;
Sequence *seqn = MEM_dupallocN(seq);
seq->tmp = seqn;
seqn->strip= MEM_dupallocN(seq->strip);
seqn->strip = MEM_dupallocN(seq->strip);
// XXX: add F-Curve duplication stuff?
@@ -3910,13 +3914,13 @@ static Sequence *seq_dupli(struct Scene *scene, struct Scene *scene_to, Sequence
if (seq->strip->color_balance) {
seqn->strip->color_balance
= MEM_dupallocN(seq->strip->color_balance);
= MEM_dupallocN(seq->strip->color_balance);
}
if (seq->type==SEQ_META) {
if (seq->type == SEQ_META) {
seqn->strip->stripdata = NULL;
seqn->seqbase.first= seqn->seqbase.last= NULL;
seqn->seqbase.first = seqn->seqbase.last = NULL;
/* WATCH OUT!!! - This metastrip is not recursively duplicated here - do this after!!! */
/* - seq_dupli_recursive(&seq->seqbase,&seqn->seqbase);*/
}
@@ -3927,12 +3931,12 @@ static Sequence *seq_dupli(struct Scene *scene, struct Scene *scene_to, Sequence
}
else if (seq->type == SEQ_MOVIE) {
seqn->strip->stripdata =
MEM_dupallocN(seq->strip->stripdata);
seqn->anim= NULL;
MEM_dupallocN(seq->strip->stripdata);
seqn->anim = NULL;
}
else if (seq->type == SEQ_SOUND) {
seqn->strip->stripdata =
MEM_dupallocN(seq->strip->stripdata);
MEM_dupallocN(seq->strip->stripdata);
if (seq->scene_sound)
seqn->scene_sound = sound_add_scene_sound_defaults(sce_audio, seqn);
@@ -3940,12 +3944,12 @@ static Sequence *seq_dupli(struct Scene *scene, struct Scene *scene_to, Sequence
}
else if (seq->type == SEQ_IMAGE) {
seqn->strip->stripdata =
MEM_dupallocN(seq->strip->stripdata);
MEM_dupallocN(seq->strip->stripdata);
}
else if (seq->type >= SEQ_EFFECT) {
if (seq->seq1 && seq->seq1->tmp) seqn->seq1= seq->seq1->tmp;
if (seq->seq2 && seq->seq2->tmp) seqn->seq2= seq->seq2->tmp;
if (seq->seq3 && seq->seq3->tmp) seqn->seq3= seq->seq3->tmp;
if (seq->seq1 && seq->seq1->tmp) seqn->seq1 = seq->seq1->tmp;
if (seq->seq2 && seq->seq2->tmp) seqn->seq2 = seq->seq2->tmp;
if (seq->seq3 && seq->seq3->tmp) seqn->seq3 = seq->seq3->tmp;
if (seq->type & SEQ_EFFECT) {
struct SeqEffectHandle sh;
@@ -3959,25 +3963,25 @@ static Sequence *seq_dupli(struct Scene *scene, struct Scene *scene_to, Sequence
}
else {
fprintf(stderr, "Aiiiiekkk! sequence type not "
"handled in duplicate!\nExpect a crash"
" now...\n");
"handled in duplicate!\nExpect a crash"
" now...\n");
}
if (dupe_flag & SEQ_DUPE_UNIQUE_NAME)
seqbase_unique_name_recursive(&scene->ed->seqbase, seqn);
if (dupe_flag & SEQ_DUPE_ANIM)
seq_dupe_animdata(scene, seq->name+2, seqn->name+2);
seq_dupe_animdata(scene, seq->name + 2, seqn->name + 2);
return seqn;
}
Sequence * seq_dupli_recursive(struct Scene *scene, struct Scene *scene_to, Sequence * seq, int dupe_flag)
Sequence *seq_dupli_recursive(struct Scene *scene, struct Scene *scene_to, Sequence *seq, int dupe_flag)
{
Sequence * seqn = seq_dupli(scene, scene_to, seq, dupe_flag);
Sequence *seqn = seq_dupli(scene, scene_to, seq, dupe_flag);
if (seq->type == SEQ_META) {
Sequence *s;
for (s= seq->seqbase.first; s; s = s->next) {
for (s = seq->seqbase.first; s; s = s->next) {
Sequence *n = seq_dupli_recursive(scene, scene_to, s, dupe_flag);
if (n) {
BLI_addtail(&seqn->seqbase, n);
@@ -3993,18 +3997,18 @@ void seqbase_dupli_recursive(Scene *scene, Scene *scene_to, ListBase *nseqbase,
Sequence *seqn = NULL;
Sequence *last_seq = seq_active_get(scene);
for (seq= seqbase->first; seq; seq= seq->next) {
seq->tmp= NULL;
for (seq = seqbase->first; seq; seq = seq->next) {
seq->tmp = NULL;
if ((seq->flag & SELECT) || (dupe_flag & SEQ_DUPE_ALL)) {
seqn = seq_dupli(scene, scene_to, seq, dupe_flag);
if (seqn) { /*should never fail */
if (dupe_flag & SEQ_DUPE_CONTEXT) {
seq->flag &= ~SEQ_ALLSEL;
seqn->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL+SEQ_LOCK);
seqn->flag &= ~(SEQ_LEFTSEL + SEQ_RIGHTSEL + SEQ_LOCK);
}
BLI_addtail(nseqbase, seqn);
if (seq->type==SEQ_META)
if (seq->type == SEQ_META)
seqbase_dupli_recursive(scene, scene_to, &seqn->seqbase, &seq->seqbase, dupe_flag);
if (dupe_flag & SEQ_DUPE_CONTEXT) {

View File

@@ -79,10 +79,10 @@
/* Generic functions, reused by add strip operators */
/* avoid passing multiple args and be more verbose */
#define SEQPROP_STARTFRAME (1<<0)
#define SEQPROP_ENDFRAME (1<<1)
#define SEQPROP_NOPATHS (1<<2)
#define SEQPROP_NOCHAN (1<<3)
#define SEQPROP_STARTFRAME (1 << 0)
#define SEQPROP_ENDFRAME (1 << 1)
#define SEQPROP_NOPATHS (1 << 2)
#define SEQPROP_NOCHAN (1 << 3)
#define SELECT 1
@@ -92,7 +92,7 @@ static void sequencer_generic_props__internal(wmOperatorType *ot, int flag)
RNA_def_int(ot->srna, "frame_start", 0, INT_MIN, INT_MAX, "Start Frame", "Start frame of the sequence strip", INT_MIN, INT_MAX);
if (flag & SEQPROP_ENDFRAME)
RNA_def_int(ot->srna, "frame_end", 0, INT_MIN, INT_MAX, "End Frame", "End frame for the color strip", INT_MIN, INT_MAX); /* not usual since most strips have a fixed length */
RNA_def_int(ot->srna, "frame_end", 0, INT_MIN, INT_MAX, "End Frame", "End frame for the color strip", INT_MIN, INT_MAX); /* not usual since most strips have a fixed length */
RNA_def_int(ot->srna, "channel", 1, 1, MAXSEQ, "Channel", "Channel to place this strip into", 1, MAXSEQ);
@@ -104,8 +104,8 @@ static void sequencer_generic_props__internal(wmOperatorType *ot, int flag)
static void sequencer_generic_invoke_path__internal(bContext *C, wmOperator *op, const char *identifier)
{
if (RNA_struct_find_property(op->ptr, identifier)) {
Scene *scene= CTX_data_scene(C);
Sequence *last_seq= seq_active_get(scene);
Scene *scene = CTX_data_scene(C);
Sequence *last_seq = seq_active_get(scene);
if (last_seq && last_seq->strip && SEQ_HAS_PATH(last_seq)) {
char path[sizeof(last_seq->strip->dir)];
BLI_strncpy(path, last_seq->strip->dir, sizeof(path));
@@ -117,7 +117,7 @@ static void sequencer_generic_invoke_path__internal(bContext *C, wmOperator *op,
static void sequencer_generic_invoke_xy__internal(bContext *C, wmOperator *op, wmEvent *event, int flag)
{
View2D *v2d= UI_view2d_fromcontext(C);
View2D *v2d = UI_view2d_fromcontext(C);
float mval_v2d[2];
@@ -125,13 +125,13 @@ static void sequencer_generic_invoke_xy__internal(bContext *C, wmOperator *op, w
/* effect strips don't need a channel initialized from the mouse */
if (!(flag & SEQPROP_NOCHAN)) {
RNA_int_set(op->ptr, "channel", (int)mval_v2d[1]+0.5f);
RNA_int_set(op->ptr, "channel", (int)mval_v2d[1] + 0.5f);
}
RNA_int_set(op->ptr, "frame_start", (int)mval_v2d[0]);
if ((flag & SEQPROP_ENDFRAME) && RNA_struct_property_is_set(op->ptr, "frame_end")==0)
RNA_int_set(op->ptr, "frame_end", (int)mval_v2d[0] + 25); // XXX arbitary but ok for now.
if ((flag & SEQPROP_ENDFRAME) && RNA_struct_property_is_set(op->ptr, "frame_end") == 0)
RNA_int_set(op->ptr, "frame_end", (int)mval_v2d[0] + 25); // XXX arbitary but ok for now.
if (!(flag & SEQPROP_NOPATHS)) {
sequencer_generic_invoke_path__internal(C, op, "filepath");
@@ -141,23 +141,23 @@ static void sequencer_generic_invoke_xy__internal(bContext *C, wmOperator *op, w
static void seq_load_operator_info(SeqLoadInfo *seq_load, wmOperator *op)
{
int relative= RNA_struct_find_property(op->ptr, "relative_path") && RNA_boolean_get(op->ptr, "relative_path");
int is_file= -1;
int relative = RNA_struct_find_property(op->ptr, "relative_path") && RNA_boolean_get(op->ptr, "relative_path");
int is_file = -1;
memset(seq_load, 0, sizeof(SeqLoadInfo));
seq_load->start_frame= RNA_int_get(op->ptr, "frame_start");
seq_load->end_frame= seq_load->start_frame; /* un-set */
seq_load->start_frame = RNA_int_get(op->ptr, "frame_start");
seq_load->end_frame = seq_load->start_frame; /* un-set */
seq_load->channel= RNA_int_get(op->ptr, "channel");
seq_load->len= 1; // images only, if endframe isn't set!
seq_load->channel = RNA_int_get(op->ptr, "channel");
seq_load->len = 1; // images only, if endframe isn't set!
if (RNA_struct_find_property(op->ptr, "filepath")) {
RNA_string_get(op->ptr, "filepath", seq_load->path); /* full path, file is set by the caller */
is_file= 1;
is_file = 1;
}
else if (RNA_struct_find_property(op->ptr, "directory")) {
RNA_string_get(op->ptr, "directory", seq_load->path); /* full path, file is set by the caller */
is_file= 0;
is_file = 0;
}
if ((is_file != -1) && relative)
@@ -181,14 +181,14 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, wmOperator *op)
seq_load->flag |= SEQ_LOAD_FRAME_ADVANCE;
if (is_file==1) {
if (is_file == 1) {
BLI_strncpy(seq_load->name, BLI_path_basename(seq_load->path), sizeof(seq_load->name));
}
else if (RNA_struct_find_property(op->ptr, "files")) {
/* used for image strip */
/* best guess, first images name */
RNA_BEGIN(op->ptr, itemptr, "files") {
char *name= RNA_string_get_alloc(&itemptr, "name", NULL, 0);
char *name = RNA_string_get_alloc(&itemptr, "name", NULL, 0);
BLI_strncpy(seq_load->name, name, sizeof(seq_load->name));
MEM_freeN(name);
break;
@@ -200,38 +200,38 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, wmOperator *op)
/* add scene operator */
static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, TRUE);
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, TRUE);
Scene *sce_seq;
Sequence *seq; /* generic strip vars */
Sequence *seq; /* generic strip vars */
Strip *strip;
int start_frame, channel; /* operator props */
start_frame= RNA_int_get(op->ptr, "frame_start");
channel= RNA_int_get(op->ptr, "channel");
start_frame = RNA_int_get(op->ptr, "frame_start");
channel = RNA_int_get(op->ptr, "channel");
sce_seq= BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "scene"));
sce_seq = BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "scene"));
if (sce_seq==NULL) {
if (sce_seq == NULL) {
BKE_report(op->reports, RPT_ERROR, "Scene not found");
return OPERATOR_CANCELLED;
}
seq = alloc_sequence(ed->seqbasep, start_frame, channel);
seq->type= SEQ_SCENE;
seq->blend_mode= SEQ_CROSS; /* so alpha adjustment fade to the strip below */
seq->type = SEQ_SCENE;
seq->blend_mode = SEQ_CROSS; /* so alpha adjustment fade to the strip below */
seq->scene= sce_seq;
seq->scene = sce_seq;
/* basic defaults */
seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
seq->strip = strip = MEM_callocN(sizeof(Strip), "strip");
seq->len = sce_seq->r.efra - sce_seq->r.sfra + 1;
strip->us= 1;
strip->us = 1;
BLI_strncpy(seq->name+2, sce_seq->id.name+2, sizeof(seq->name)-2);
BLI_strncpy(seq->name + 2, sce_seq->id.name + 2, sizeof(seq->name) - 2);
seqbase_unique_name_recursive(&ed->seqbase, seq);
seq->scene_sound = sound_scene_add_scene_sound(scene, seq, start_frame, start_frame + seq->len, 0);
@@ -249,7 +249,7 @@ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op)
if (seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene);
}
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@@ -288,10 +288,10 @@ void SEQUENCER_OT_scene_strip_add(struct wmOperatorType *ot)
ot->poll = ED_operator_scene_editable;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME);
prop= RNA_def_enum(ot->srna, "scene", DummyRNA_NULL_items, 0, "Scene", "");
prop = RNA_def_enum(ot->srna, "scene", DummyRNA_NULL_items, 0, "Scene", "");
RNA_def_enum_funcs(prop, RNA_scene_itemf);
ot->prop = prop;
}
@@ -299,20 +299,20 @@ void SEQUENCER_OT_scene_strip_add(struct wmOperatorType *ot)
/* add movieclip operator */
static int sequencer_add_movieclip_strip_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, TRUE);
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, TRUE);
MovieClip *clip;
Sequence *seq; /* generic strip vars */
Sequence *seq; /* generic strip vars */
Strip *strip;
int start_frame, channel; /* operator props */
start_frame= RNA_int_get(op->ptr, "frame_start");
channel= RNA_int_get(op->ptr, "channel");
start_frame = RNA_int_get(op->ptr, "frame_start");
channel = RNA_int_get(op->ptr, "channel");
clip= BLI_findlink(&CTX_data_main(C)->movieclip, RNA_enum_get(op->ptr, "clip"));
clip = BLI_findlink(&CTX_data_main(C)->movieclip, RNA_enum_get(op->ptr, "clip"));
if (clip == NULL) {
BKE_report(op->reports, RPT_ERROR, "MovieClip not found");
@@ -320,16 +320,16 @@ static int sequencer_add_movieclip_strip_exec(bContext *C, wmOperator *op)
}
seq = alloc_sequence(ed->seqbasep, start_frame, channel);
seq->type= SEQ_MOVIECLIP;
seq->blend_mode= SEQ_CROSS;
seq->type = SEQ_MOVIECLIP;
seq->blend_mode = SEQ_CROSS;
seq->clip = clip;
/* basic defaults */
seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
seq->strip = strip = MEM_callocN(sizeof(Strip), "strip");
seq->len = BKE_movieclip_get_duration(clip);
strip->us= 1;
strip->us = 1;
BLI_strncpy(seq->name+2, clip->id.name+2, sizeof(seq->name)-2);
BLI_strncpy(seq->name + 2, clip->id.name + 2, sizeof(seq->name) - 2);
seqbase_unique_name_recursive(&ed->seqbase, seq);
calc_sequence_disp(scene, seq);
@@ -345,7 +345,7 @@ static int sequencer_add_movieclip_strip_exec(bContext *C, wmOperator *op)
if (seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene);
}
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@@ -384,10 +384,10 @@ void SEQUENCER_OT_movieclip_strip_add(struct wmOperatorType *ot)
ot->poll = ED_operator_scene_editable;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME);
prop= RNA_def_enum(ot->srna, "clip", DummyRNA_NULL_items, 0, "Clip", "");
prop = RNA_def_enum(ot->srna, "clip", DummyRNA_NULL_items, 0, "Clip", "");
RNA_def_enum_funcs(prop, RNA_movieclip_itemf);
ot->prop = prop;
}
@@ -395,19 +395,19 @@ void SEQUENCER_OT_movieclip_strip_add(struct wmOperatorType *ot)
static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoadFunc seq_load_func)
{
Scene *scene= CTX_data_scene(C); /* only for sound */
Editing *ed= seq_give_editing(scene, TRUE);
Scene *scene = CTX_data_scene(C); /* only for sound */
Editing *ed = seq_give_editing(scene, TRUE);
SeqLoadInfo seq_load;
Sequence *seq;
int tot_files;
const short overlap= RNA_boolean_get(op->ptr, "overlap");
const short overlap = RNA_boolean_get(op->ptr, "overlap");
seq_load_operator_info(&seq_load, op);
if (seq_load.flag & SEQ_LOAD_REPLACE_SEL)
deselect_all_seq(scene);
tot_files= RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files"));
tot_files = RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files"));
if (tot_files) {
/* multiple files */
@@ -416,7 +416,8 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad
BLI_split_dir_part(seq_load.path, dir_only, sizeof(dir_only));
RNA_BEGIN(op->ptr, itemptr, "files") {
RNA_BEGIN(op->ptr, itemptr, "files")
{
RNA_string_get(&itemptr, "name", file_only);
BLI_join_dirfile(seq_load.path, sizeof(seq_load.path), dir_only, file_only);
@@ -439,7 +440,7 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad
}
}
if (seq_load.tot_success==0) {
if (seq_load.tot_success == 0) {
BKE_reportf(op->reports, RPT_ERROR, "File \"%s\" could not be loaded", seq_load.path);
return OPERATOR_CANCELLED;
}
@@ -447,7 +448,7 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad
sort_seq(scene);
seq_update_muting(ed);
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@@ -499,9 +500,9 @@ void SEQUENCER_OT_movie_strip_add(struct wmOperatorType *ot)
ot->poll = ED_operator_scene_editable;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
WM_operator_properties_filesel(ot, FOLDERFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH|WM_FILESEL_FILES, FILE_DEFAULTDISPLAY);
WM_operator_properties_filesel(ot, FOLDERFILE | MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH | WM_FILESEL_FILES, FILE_DEFAULTDISPLAY);
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME);
RNA_def_boolean(ot->srna, "sound", TRUE, "Sound", "Load sound with the movie");
}
@@ -523,7 +524,7 @@ static int sequencer_add_sound_strip_invoke(bContext *C, wmOperator *op, wmEvent
/* This is for drag and drop */
if ((RNA_struct_property_is_set(op->ptr, "files") && RNA_collection_length(op->ptr, "files")) ||
RNA_struct_property_is_set(op->ptr, "filepath"))
RNA_struct_property_is_set(op->ptr, "filepath"))
{
sequencer_generic_invoke_xy__internal(C, op, event, SEQPROP_NOPATHS);
return sequencer_add_sound_strip_exec(C, op);
@@ -553,9 +554,9 @@ void SEQUENCER_OT_sound_strip_add(struct wmOperatorType *ot)
ot->poll = ED_operator_scene_editable;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH|WM_FILESEL_FILES, FILE_DEFAULTDISPLAY);
WM_operator_properties_filesel(ot, FOLDERFILE | SOUNDFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH | WM_FILESEL_FILES, FILE_DEFAULTDISPLAY);
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME);
RNA_def_boolean(ot->srna, "cache", FALSE, "Cache", "Cache the sound in memory");
}
@@ -565,8 +566,8 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
{
/* cant use the generic function for this */
Scene *scene= CTX_data_scene(C); /* only for sound */
Editing *ed= seq_give_editing(scene, TRUE);
Scene *scene = CTX_data_scene(C); /* only for sound */
Editing *ed = seq_give_editing(scene, TRUE);
SeqLoadInfo seq_load;
Sequence *seq;
@@ -576,9 +577,9 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
seq_load_operator_info(&seq_load, op);
/* images are unique in how they handle this - 1 per strip elem */
seq_load.len= RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files"));
seq_load.len = RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files"));
if (seq_load.len==0)
if (seq_load.len == 0)
return OPERATOR_CANCELLED;
if (seq_load.flag & SEQ_LOAD_REPLACE_SEL)
@@ -586,12 +587,12 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
/* main adding function */
seq= sequencer_add_image_strip(C, ed->seqbasep, &seq_load);
strip= seq->strip;
se= strip->stripdata;
seq = sequencer_add_image_strip(C, ed->seqbasep, &seq_load);
strip = seq->strip;
se = strip->stripdata;
RNA_BEGIN(op->ptr, itemptr, "files") {
char *filename= RNA_string_get_alloc(&itemptr, "name", NULL, 0);
char *filename = RNA_string_get_alloc(&itemptr, "name", NULL, 0);
BLI_strncpy(se->name, filename, sizeof(se->name));
MEM_freeN(filename);
se++;
@@ -600,7 +601,7 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
if (seq_load.len == 1) {
if (seq_load.start_frame < seq_load.end_frame) {
seq->endstill= seq_load.end_frame - seq_load.start_frame;
seq->endstill = seq_load.end_frame - seq_load.start_frame;
}
}
@@ -609,13 +610,13 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
sort_seq(scene);
/* last active name */
strncpy(ed->act_imagedir, strip->dir, FILE_MAXDIR-1);
strncpy(ed->act_imagedir, strip->dir, FILE_MAXDIR - 1);
if (RNA_boolean_get(op->ptr, "overlap") == FALSE) {
if (seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene);
}
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@@ -631,7 +632,7 @@ static int sequencer_add_image_strip_invoke(bContext *C, wmOperator *op, wmEvent
/* drag drop has set the names */
if (RNA_struct_property_is_set(op->ptr, "files") && RNA_collection_length(op->ptr, "files")) {
sequencer_generic_invoke_xy__internal(C, op, event, SEQPROP_ENDFRAME|SEQPROP_NOPATHS);
sequencer_generic_invoke_xy__internal(C, op, event, SEQPROP_ENDFRAME | SEQPROP_NOPATHS);
return sequencer_add_image_strip_exec(C, op);
}
@@ -657,20 +658,20 @@ void SEQUENCER_OT_image_strip_add(struct wmOperatorType *ot)
ot->poll = ED_operator_scene_editable;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_DIRECTORY|WM_FILESEL_RELPATH|WM_FILESEL_FILES, FILE_DEFAULTDISPLAY);
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_ENDFRAME);
WM_operator_properties_filesel(ot, FOLDERFILE | IMAGEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_DIRECTORY | WM_FILESEL_RELPATH | WM_FILESEL_FILES, FILE_DEFAULTDISPLAY);
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME | SEQPROP_ENDFRAME);
}
/* add_effect_strip operator */
static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, TRUE);
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, TRUE);
Sequence *seq; /* generic strip vars */
Sequence *seq; /* generic strip vars */
Strip *strip;
struct SeqEffectHandle sh;
@@ -679,11 +680,11 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op)
Sequence *seq1, *seq2, *seq3;
const char *error_msg;
start_frame= RNA_int_get(op->ptr, "frame_start");
end_frame= RNA_int_get(op->ptr, "frame_end");
channel= RNA_int_get(op->ptr, "channel");
start_frame = RNA_int_get(op->ptr, "frame_start");
end_frame = RNA_int_get(op->ptr, "frame_end");
channel = RNA_int_get(op->ptr, "channel");
type= RNA_enum_get(op->ptr, "type");
type = RNA_enum_get(op->ptr, "type");
// XXX move to invoke
if (!seq_effect_find_selected(scene, NULL, type, &seq1, &seq2, &seq3, &error_msg)) {
@@ -693,27 +694,27 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op)
/* If seq1 is NULL and no error was raised it means the seq is standalone
* (like color strips) and we need to check its start and end frames are valid */
if (seq1==NULL && end_frame <= start_frame) {
if (seq1 == NULL && end_frame <= start_frame) {
BKE_report(op->reports, RPT_ERROR, "Start and end frame are not set");
return OPERATOR_CANCELLED;
}
seq = alloc_sequence(ed->seqbasep, start_frame, channel);
seq->type= type;
seq->type = type;
BLI_strncpy(seq->name+2, give_seqname(seq), sizeof(seq->name)-2);
BLI_strncpy(seq->name + 2, give_seqname(seq), sizeof(seq->name) - 2);
seqbase_unique_name_recursive(&ed->seqbase, seq);
sh = get_sequence_effect(seq);
seq->seq1= seq1;
seq->seq2= seq2;
seq->seq3= seq3;
seq->seq1 = seq1;
seq->seq2 = seq2;
seq->seq3 = seq3;
sh.init(seq);
if (!seq1) { /* effect has no deps */
seq->len= 1;
seq->len = 1;
seq_tx_set_final_right(seq, end_frame);
}
@@ -722,16 +723,16 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op)
calc_sequence(scene, seq);
/* basic defaults */
seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
strip->us= 1;
seq->strip = strip = MEM_callocN(sizeof(Strip), "strip");
strip->us = 1;
if (seq->type==SEQ_PLUGIN) {
if (seq->type == SEQ_PLUGIN) {
char path[FILE_MAX];
RNA_string_get(op->ptr, "filepath", path);
sh.init_plugin(seq, path);
if (seq->plugin==NULL) {
if (seq->plugin == NULL) {
BLI_remlink(ed->seqbasep, seq);
seq_free_sequence(scene, seq);
BKE_reportf(op->reports, RPT_ERROR, "Sequencer plugin \"%s\" could not load", path);
@@ -739,24 +740,24 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op)
}
}
else if (seq->type == SEQ_COLOR) {
SolidColorVars *colvars= (SolidColorVars *)seq->effectdata;
SolidColorVars *colvars = (SolidColorVars *)seq->effectdata;
RNA_float_get_array(op->ptr, "color", colvars->col);
seq->blend_mode= SEQ_CROSS; /* so alpha adjustment fade to the strip below */
seq->blend_mode = SEQ_CROSS; /* so alpha adjustment fade to the strip below */
}
else if (seq->type == SEQ_ADJUSTMENT) {
seq->blend_mode= SEQ_CROSS;
seq->blend_mode = SEQ_CROSS;
}
/* an unset channel is a special case where we automatically go above
* the other strips. */
if (!RNA_struct_property_is_set(op->ptr, "channel")) {
if (seq->seq1) {
int chan= MAX3( seq->seq1 ? seq->seq1->machine : 0,
seq->seq2 ? seq->seq2->machine : 0,
seq->seq3 ? seq->seq3->machine : 0);
int chan = MAX3(seq->seq1 ? seq->seq1->machine : 0,
seq->seq2 ? seq->seq2->machine : 0,
seq->seq3 ? seq->seq3->machine : 0);
if (chan < MAXSEQ)
seq->machine= chan;
seq->machine = chan;
}
}
@@ -777,7 +778,7 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op)
seq->flag |= SELECT;
}
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@@ -786,9 +787,9 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op)
/* add color */
static int sequencer_add_effect_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
short is_type_set= RNA_struct_property_is_set(op->ptr, "type");
int type= -1;
int prop_flag= SEQPROP_ENDFRAME;
short is_type_set = RNA_struct_property_is_set(op->ptr, "type");
int type = -1;
int prop_flag = SEQPROP_ENDFRAME;
if (!ED_operator_sequencer_active(C)) {
BKE_report(op->reports, RPT_ERROR, "Sequencer area not active");
@@ -796,7 +797,7 @@ static int sequencer_add_effect_strip_invoke(bContext *C, wmOperator *op, wmEven
}
if (is_type_set) {
type= RNA_enum_get(op->ptr, "type");
type = RNA_enum_get(op->ptr, "type");
/* when invoking an effect strip which uses inputs,
* skip initializing the channel from the mouse.
@@ -809,7 +810,7 @@ static int sequencer_add_effect_strip_invoke(bContext *C, wmOperator *op, wmEven
sequencer_generic_invoke_xy__internal(C, op, event, prop_flag);
if (is_type_set && type==SEQ_PLUGIN) {
if (is_type_set && type == SEQ_PLUGIN) {
/* only plugins need the file selector */
WM_event_add_fileselect(C, op);
return OPERATOR_RUNNING_MODAL;
@@ -833,10 +834,10 @@ void SEQUENCER_OT_effect_strip_add(struct wmOperatorType *ot)
ot->poll = ED_operator_scene_editable;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_ENDFRAME);
WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME | SEQPROP_ENDFRAME);
RNA_def_enum(ot->srna, "type", sequencer_prop_effect_types, SEQ_CROSS, "Type", "Sequencer effect type");
RNA_def_float_vector(ot->srna, "color", 3, NULL, 0.0f, 1.0f, "Color", "Initialize the strip with this color (only used when type='COLOR')", 0.0f, 1.0f);
}

View File

@@ -59,7 +59,7 @@ static void sequencer_panel_view_properties(const bContext *UNUSED(C), Panel *pa
{
uiBlock *block;
block= uiLayoutAbsoluteBlock(pa->layout);
block = uiLayoutAbsoluteBlock(pa->layout);
uiBlockSetHandleFunc(block, do_sequencer_panel_events, NULL);
}
@@ -69,7 +69,7 @@ static void sequencer_panel_properties(const bContext *UNUSED(C), Panel *pa)
{
uiBlock *block;
block= uiLayoutAbsoluteBlock(pa->layout);
block = uiLayoutAbsoluteBlock(pa->layout);
uiBlockSetHandleFunc(block, do_sequencer_panel_events, NULL);
}
@@ -78,16 +78,16 @@ void sequencer_buttons_register(ARegionType *art)
{
PanelType *pt;
pt= MEM_callocN(sizeof(PanelType), "spacetype sequencer strip properties");
pt = MEM_callocN(sizeof(PanelType), "spacetype sequencer strip properties");
strcpy(pt->idname, "SEQUENCER_PT_properties");
strcpy(pt->label, "Strip Properties");
pt->draw= sequencer_panel_properties;
pt->draw = sequencer_panel_properties;
BLI_addtail(&art->paneltypes, pt);
pt= MEM_callocN(sizeof(PanelType), "spacetype sequencer view properties");
pt = MEM_callocN(sizeof(PanelType), "spacetype sequencer view properties");
strcpy(pt->idname, "SEQUENCER_PT_view_properties");
strcpy(pt->label, "View Properties");
pt->draw= sequencer_panel_view_properties;
pt->draw = sequencer_panel_view_properties;
BLI_addtail(&art->paneltypes, pt);
}
@@ -96,8 +96,8 @@ void sequencer_buttons_register(ARegionType *art)
static int sequencer_properties(bContext *C, wmOperator *UNUSED(op))
{
ScrArea *sa= CTX_wm_area(C);
ARegion *ar= sequencer_has_buttons_region(sa);
ScrArea *sa = CTX_wm_area(C);
ARegion *ar = sequencer_has_buttons_region(sa);
if (ar)
ED_region_toggle_hidden(C, ar);

View File

@@ -68,8 +68,8 @@
#include "sequencer_intern.h"
#define SEQ_LEFTHANDLE 1
#define SEQ_RIGHTHANDLE 2
#define SEQ_LEFTHANDLE 1
#define SEQ_RIGHTHANDLE 2
/* Note, Don't use SEQ_BEGIN/SEQ_END while drawing!
@@ -81,91 +81,91 @@ static void get_seq_color3ubv(Scene *curscene, Sequence *seq, unsigned char col[
unsigned char blendcol[3];
SolidColorVars *colvars = (SolidColorVars *)seq->effectdata;
switch(seq->type) {
case SEQ_IMAGE:
UI_GetThemeColor3ubv(TH_SEQ_IMAGE, col);
break;
case SEQ_META:
UI_GetThemeColor3ubv(TH_SEQ_META, col);
break;
case SEQ_MOVIE:
UI_GetThemeColor3ubv(TH_SEQ_MOVIE, col);
break;
switch (seq->type) {
case SEQ_IMAGE:
UI_GetThemeColor3ubv(TH_SEQ_IMAGE, col);
break;
case SEQ_MOVIECLIP:
UI_GetThemeColor3ubv(TH_SEQ_MOVIECLIP, col);
break;
case SEQ_SCENE:
UI_GetThemeColor3ubv(TH_SEQ_SCENE, col);
if (seq->scene==curscene) {
UI_GetColorPtrShade3ubv(col, col, 20);
}
break;
/* transitions */
case SEQ_CROSS:
case SEQ_GAMCROSS:
case SEQ_WIPE:
UI_GetThemeColor3ubv(TH_SEQ_TRANSITION, col);
case SEQ_META:
UI_GetThemeColor3ubv(TH_SEQ_META, col);
break;
/* slightly offset hue to distinguish different effects */
if (seq->type == SEQ_CROSS) rgb_byte_set_hue_float_offset(col,0.04);
if (seq->type == SEQ_GAMCROSS) rgb_byte_set_hue_float_offset(col,0.08);
if (seq->type == SEQ_WIPE) rgb_byte_set_hue_float_offset(col,0.12);
break;
case SEQ_MOVIE:
UI_GetThemeColor3ubv(TH_SEQ_MOVIE, col);
break;
case SEQ_MOVIECLIP:
UI_GetThemeColor3ubv(TH_SEQ_MOVIECLIP, col);
break;
/* effects */
case SEQ_TRANSFORM:
case SEQ_SPEED:
case SEQ_ADD:
case SEQ_SUB:
case SEQ_MUL:
case SEQ_ALPHAOVER:
case SEQ_ALPHAUNDER:
case SEQ_OVERDROP:
case SEQ_GLOW:
case SEQ_MULTICAM:
case SEQ_ADJUSTMENT:
UI_GetThemeColor3ubv(TH_SEQ_EFFECT, col);
case SEQ_SCENE:
UI_GetThemeColor3ubv(TH_SEQ_SCENE, col);
/* slightly offset hue to distinguish different effects */
if (seq->type == SEQ_ADD) rgb_byte_set_hue_float_offset(col,0.04);
if (seq->type == SEQ_SUB) rgb_byte_set_hue_float_offset(col,0.08);
if (seq->type == SEQ_MUL) rgb_byte_set_hue_float_offset(col,0.12);
if (seq->type == SEQ_ALPHAOVER) rgb_byte_set_hue_float_offset(col,0.16);
if (seq->type == SEQ_ALPHAUNDER) rgb_byte_set_hue_float_offset(col,0.20);
if (seq->type == SEQ_OVERDROP) rgb_byte_set_hue_float_offset(col,0.24);
if (seq->type == SEQ_GLOW) rgb_byte_set_hue_float_offset(col,0.28);
if (seq->type == SEQ_TRANSFORM) rgb_byte_set_hue_float_offset(col,0.36);
if (seq->type == SEQ_MULTICAM) rgb_byte_set_hue_float_offset(col,0.32);
if (seq->type == SEQ_ADJUSTMENT) rgb_byte_set_hue_float_offset(col,0.40);
break;
if (seq->scene == curscene) {
UI_GetColorPtrShade3ubv(col, col, 20);
}
break;
case SEQ_COLOR:
if (colvars->col) {
rgb_float_to_uchar(col, colvars->col);
}
else {
col[0] = col[1] = col[2] = 128;
}
break;
/* transitions */
case SEQ_CROSS:
case SEQ_GAMCROSS:
case SEQ_WIPE:
UI_GetThemeColor3ubv(TH_SEQ_TRANSITION, col);
/* slightly offset hue to distinguish different effects */
if (seq->type == SEQ_CROSS) rgb_byte_set_hue_float_offset(col, 0.04);
if (seq->type == SEQ_GAMCROSS) rgb_byte_set_hue_float_offset(col, 0.08);
if (seq->type == SEQ_WIPE) rgb_byte_set_hue_float_offset(col, 0.12);
break;
/* effects */
case SEQ_TRANSFORM:
case SEQ_SPEED:
case SEQ_ADD:
case SEQ_SUB:
case SEQ_MUL:
case SEQ_ALPHAOVER:
case SEQ_ALPHAUNDER:
case SEQ_OVERDROP:
case SEQ_GLOW:
case SEQ_MULTICAM:
case SEQ_ADJUSTMENT:
UI_GetThemeColor3ubv(TH_SEQ_EFFECT, col);
/* slightly offset hue to distinguish different effects */
if (seq->type == SEQ_ADD) rgb_byte_set_hue_float_offset(col, 0.04);
else if (seq->type == SEQ_SUB) rgb_byte_set_hue_float_offset(col, 0.08);
else if (seq->type == SEQ_MUL) rgb_byte_set_hue_float_offset(col, 0.12);
else if (seq->type == SEQ_ALPHAOVER) rgb_byte_set_hue_float_offset(col, 0.16);
else if (seq->type == SEQ_ALPHAUNDER) rgb_byte_set_hue_float_offset(col, 0.20);
else if (seq->type == SEQ_OVERDROP) rgb_byte_set_hue_float_offset(col, 0.24);
else if (seq->type == SEQ_GLOW) rgb_byte_set_hue_float_offset(col, 0.28);
else if (seq->type == SEQ_TRANSFORM) rgb_byte_set_hue_float_offset(col, 0.36);
else if (seq->type == SEQ_MULTICAM) rgb_byte_set_hue_float_offset(col, 0.32);
else if (seq->type == SEQ_ADJUSTMENT) rgb_byte_set_hue_float_offset(col, 0.40);
break;
case SEQ_COLOR:
if (colvars->col) {
rgb_float_to_uchar(col, colvars->col);
}
else {
col[0] = col[1] = col[2] = 128;
}
break;
case SEQ_PLUGIN:
UI_GetThemeColor3ubv(TH_SEQ_PLUGIN, col);
break;
case SEQ_PLUGIN:
UI_GetThemeColor3ubv(TH_SEQ_PLUGIN, col);
break;
case SEQ_SOUND:
UI_GetThemeColor3ubv(TH_SEQ_AUDIO, col);
blendcol[0] = blendcol[1] = blendcol[2] = 128;
if (seq->flag & SEQ_MUTE) UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.5, 20);
break;
case SEQ_SOUND:
UI_GetThemeColor3ubv(TH_SEQ_AUDIO, col);
blendcol[0] = blendcol[1] = blendcol[2] = 128;
if (seq->flag & SEQ_MUTE) UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.5, 20);
break;
default:
col[0] = 10; col[1] = 255; col[2] = 40;
default:
col[0] = 10; col[1] = 255; col[2] = 40;
}
}
@@ -178,29 +178,29 @@ static void drawseqwave(Scene *scene, Sequence *seq, float x1, float y1, float x
*/
if (seq->flag & SEQ_AUDIO_DRAW_WAVEFORM) {
int i, j, pos;
int length = floor((x2-x1)/stepsize)+1;
float ymid = (y1+y2)/2;
float yscale = (y2-y1)/2;
int length = floor((x2 - x1) / stepsize) + 1;
float ymid = (y1 + y2) / 2;
float yscale = (y2 - y1) / 2;
float samplestep;
float startsample, endsample;
float value;
SoundWaveform* waveform;
SoundWaveform *waveform;
if (!seq->sound->waveform)
sound_read_waveform(seq->sound);
if (!seq->sound->waveform)
return; /* zero length sound */
return; /* zero length sound */
waveform = seq->sound->waveform;
if (!waveform)
return;
startsample = floor((seq->startofs + seq->anim_startofs)/FPS * SOUND_WAVE_SAMPLES_PER_SECOND);
endsample = ceil((seq->startofs + seq->anim_startofs + seq->enddisp - seq->startdisp)/FPS * SOUND_WAVE_SAMPLES_PER_SECOND);
samplestep = (endsample-startsample) * stepsize / (x2-x1);
startsample = floor((seq->startofs + seq->anim_startofs) / FPS * SOUND_WAVE_SAMPLES_PER_SECOND);
endsample = ceil((seq->startofs + seq->anim_startofs + seq->enddisp - seq->startdisp) / FPS * SOUND_WAVE_SAMPLES_PER_SECOND);
samplestep = (endsample - startsample) * stepsize / (x2 - x1);
if (length > floor((waveform->length - startsample) / samplestep))
length = floor((waveform->length - startsample) / samplestep);
@@ -212,13 +212,13 @@ static void drawseqwave(Scene *scene, Sequence *seq, float x1, float y1, float x
value = waveform->data[pos * 3];
for (j = pos+1; (j < waveform->length) && (j < pos + samplestep); j++)
for (j = pos + 1; (j < waveform->length) && (j < pos + samplestep); j++)
{
if (value > waveform->data[j * 3])
value = waveform->data[j * 3];
}
glVertex2f(x1+i*stepsize, ymid + value * yscale);
glVertex2f(x1 + i * stepsize, ymid + value * yscale);
}
glEnd();
@@ -229,13 +229,13 @@ static void drawseqwave(Scene *scene, Sequence *seq, float x1, float y1, float x
value = waveform->data[pos * 3 + 1];
for (j = pos+1; (j < waveform->length) && (j < pos + samplestep); j++)
for (j = pos + 1; (j < waveform->length) && (j < pos + samplestep); j++)
{
if (value < waveform->data[j * 3 + 1])
value = waveform->data[j * 3 + 1];
}
glVertex2f(x1+i*stepsize, ymid + value * yscale);
glVertex2f(x1 + i * stepsize, ymid + value * yscale);
}
glEnd();
}
@@ -265,10 +265,10 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1,
Sequence *seq;
unsigned char col[4];
int chan_min= MAXSEQ;
int chan_max= 0;
int chan_range= 0;
float draw_range= y2 - y1;
int chan_min = MAXSEQ;
int chan_max = 0;
int chan_range = 0;
float draw_range = y2 - y1;
float draw_height;
glEnable(GL_BLEND);
@@ -277,21 +277,21 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1,
if (seqm->flag & SEQ_MUTE)
drawmeta_stipple(1);
for (seq= seqm->seqbase.first; seq; seq= seq->next) {
chan_min= MIN2(chan_min, seq->machine);
chan_max= MAX2(chan_max, seq->machine);
for (seq = seqm->seqbase.first; seq; seq = seq->next) {
chan_min = MIN2(chan_min, seq->machine);
chan_max = MAX2(chan_max, seq->machine);
}
chan_range= (chan_max - chan_min) + 1;
draw_height= draw_range / chan_range;
chan_range = (chan_max - chan_min) + 1;
draw_height = draw_range / chan_range;
col[3]= 196; /* alpha, used for all meta children */
col[3] = 196; /* alpha, used for all meta children */
for (seq= seqm->seqbase.first; seq; seq= seq->next) {
for (seq = seqm->seqbase.first; seq; seq = seq->next) {
if ((seq->startdisp > x2 || seq->enddisp < x1) == 0) {
float y_chan= (seq->machine - chan_min) / (float)(chan_range) * draw_range;
float x1_chan= seq->startdisp;
float x2_chan= seq->enddisp;
float y_chan = (seq->machine - chan_min) / (float)(chan_range) * draw_range;
float x1_chan = seq->startdisp;
float x2_chan = seq->enddisp;
float y1_chan, y2_chan;
if ((seqm->flag & SEQ_MUTE) == 0 && (seq->flag & SEQ_MUTE))
@@ -302,11 +302,11 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1,
glColor4ubv(col);
/* clamp within parent sequence strip bounds */
if (x1_chan < x1) x1_chan= x1;
if (x2_chan > x2) x2_chan= x2;
if (x1_chan < x1) x1_chan = x1;
if (x2_chan > x2) x2_chan = x2;
y1_chan= y1 + y_chan + (draw_height * SEQ_STRIP_OFSBOTTOM);
y2_chan= y1 + y_chan + (draw_height * SEQ_STRIP_OFSTOP);
y1_chan = y1 + y_chan + (draw_height * SEQ_STRIP_OFSBOTTOM);
y2_chan = y1 + y_chan + (draw_height * SEQ_STRIP_OFSTOP);
glRectf(x1_chan, y1_chan, x2_chan, y2_chan);
@@ -328,51 +328,51 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1,
/* draw a handle, for each end of a sequence strip */
static void draw_seq_handle(View2D *v2d, Sequence *seq, float pixelx, short direction)
{
float v1[2], v2[2], v3[2], rx1=0, rx2=0; //for triangles and rect
float v1[2], v2[2], v3[2], rx1 = 0, rx2 = 0; //for triangles and rect
float x1, x2, y1, y2;
float handsize;
float minhandle, maxhandle;
char numstr[32];
unsigned int whichsel=0;
unsigned int whichsel = 0;
x1= seq->startdisp;
x2= seq->enddisp;
x1 = seq->startdisp;
x2 = seq->enddisp;
y1= seq->machine+SEQ_STRIP_OFSBOTTOM;
y2= seq->machine+SEQ_STRIP_OFSTOP;
y1 = seq->machine + SEQ_STRIP_OFSBOTTOM;
y2 = seq->machine + SEQ_STRIP_OFSTOP;
/* clamp handles to defined size in pixel space */
handsize = seq->handsize;
minhandle = 7;
maxhandle = 40;
CLAMP(handsize, minhandle*pixelx, maxhandle*pixelx);
CLAMP(handsize, minhandle * pixelx, maxhandle * pixelx);
/* set up co-ordinates/dimensions for either left or right handle */
if (direction == SEQ_LEFTHANDLE) {
rx1 = x1;
rx2 = x1+handsize * 0.75f;
rx2 = x1 + handsize * 0.75f;
v1[0]= x1+handsize/4; v1[1]= y1+( ((y1+y2)/2.0f - y1)/2);
v2[0]= x1+handsize/4; v2[1]= y2-( ((y1+y2)/2.0f - y1)/2);
v3[0]= v2[0] + handsize/4; v3[1]= (y1+y2)/2.0f;
v1[0] = x1 + handsize / 4; v1[1] = y1 + ( ((y1 + y2) / 2.0f - y1) / 2);
v2[0] = x1 + handsize / 4; v2[1] = y2 - ( ((y1 + y2) / 2.0f - y1) / 2);
v3[0] = v2[0] + handsize / 4; v3[1] = (y1 + y2) / 2.0f;
whichsel = SEQ_LEFTSEL;
}
else if (direction == SEQ_RIGHTHANDLE) {
rx1 = x2-handsize*0.75f;
rx1 = x2 - handsize * 0.75f;
rx2 = x2;
v1[0]= x2-handsize/4; v1[1]= y1+( ((y1+y2)/2.0f - y1)/2);
v2[0]= x2-handsize/4; v2[1]= y2-( ((y1+y2)/2.0f - y1)/2);
v3[0]= v2[0] - handsize/4; v3[1]= (y1+y2)/2.0f;
v1[0] = x2 - handsize / 4; v1[1] = y1 + ( ((y1 + y2) / 2.0f - y1) / 2);
v2[0] = x2 - handsize / 4; v2[1] = y2 - ( ((y1 + y2) / 2.0f - y1) / 2);
v3[0] = v2[0] - handsize / 4; v3[1] = (y1 + y2) / 2.0f;
whichsel = SEQ_RIGHTSEL;
}
/* draw! */
if (seq->type < SEQ_EFFECT ||
get_sequence_effect_num_inputs(seq->type) == 0) {
glEnable( GL_BLEND );
get_sequence_effect_num_inputs(seq->type) == 0) {
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -385,26 +385,26 @@ static void draw_seq_handle(View2D *v2d, Sequence *seq, float pixelx, short dire
if (seq->flag & whichsel) glColor4ub(255, 255, 255, 200);
else glColor4ub(0, 0, 0, 50);
glEnable( GL_POLYGON_SMOOTH );
glEnable(GL_POLYGON_SMOOTH);
glBegin(GL_TRIANGLES);
glVertex2fv(v1); glVertex2fv(v2); glVertex2fv(v3);
glEnd();
glDisable( GL_POLYGON_SMOOTH );
glDisable( GL_BLEND );
glDisable(GL_POLYGON_SMOOTH);
glDisable(GL_BLEND);
}
if (G.moving || (seq->flag & whichsel)) {
const char col[4]= {255, 255, 255, 255};
const char col[4] = {255, 255, 255, 255};
if (direction == SEQ_LEFTHANDLE) {
BLI_snprintf(numstr, sizeof(numstr),"%d", seq->startdisp);
x1= rx1;
BLI_snprintf(numstr, sizeof(numstr), "%d", seq->startdisp);
x1 = rx1;
y1 -= 0.45f;
}
else {
BLI_snprintf(numstr, sizeof(numstr), "%d", seq->enddisp - 1);
x1= x2 - handsize*0.75f;
y1= y2 + 0.05f;
x1 = x2 - handsize * 0.75f;
y1 = y2 + 0.05f;
}
UI_view2d_text_cache_add(v2d, x1, y1, numstr, col);
}
@@ -414,24 +414,24 @@ 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;
View2D *v2d = &ar->v2d;
if (seq->type >= SEQ_EFFECT) return;
x1= seq->startdisp;
x2= seq->enddisp;
x1 = seq->startdisp;
x2 = seq->enddisp;
y1= seq->machine+SEQ_STRIP_OFSBOTTOM;
y2= seq->machine+SEQ_STRIP_OFSTOP;
y1 = seq->machine + SEQ_STRIP_OFSBOTTOM;
y2 = seq->machine + SEQ_STRIP_OFSTOP;
pixely = (v2d->cur.ymax - v2d->cur.ymin)/(v2d->mask.ymax - v2d->mask.ymin);
pixely = (v2d->cur.ymax - v2d->cur.ymin) / (v2d->mask.ymax - v2d->mask.ymin);
if (pixely <= 0) return; /* can happen when the view is split/resized */
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 );
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
get_seq_color3ubv(scene, seq, col);
@@ -445,17 +445,17 @@ static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq)
glColor4ub(col[0], col[1], col[2], 110);
}
glRectf((float)(seq->start), y1-SEQ_STRIP_OFSBOTTOM, x1, y1);
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
fdrawbox((float)(seq->start), y1 - SEQ_STRIP_OFSBOTTOM, x1, y1); //outline
glDisable( GL_BLEND );
glDisable(GL_BLEND);
}
if (seq->endofs) {
glEnable( GL_BLEND );
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
get_seq_color3ubv(scene, seq, col);
@@ -469,14 +469,14 @@ static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq)
glColor4ub(col[0], col[1], col[2], 110);
}
glRectf(x2, y2, (float)(seq->start+seq->len), y2+SEQ_STRIP_OFSBOTTOM);
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
fdrawbox(x2, y2, (float)(seq->start + seq->len), y2 + SEQ_STRIP_OFSBOTTOM); //outline
glDisable( GL_BLEND );
glDisable(GL_BLEND);
}
if (seq->startstill) {
get_seq_color3ubv(scene, seq, col);
@@ -492,7 +492,7 @@ static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq)
glColor3ubv((GLubyte *)col);
for (a=y1; a< y2; a+= pixely * 2.0f) {
for (a = y1; a < y2; a += pixely * 2.0f) {
fdrawline(x1, a, (float)(seq->start), a);
}
}
@@ -501,7 +501,7 @@ static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq)
UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.75, 40);
glColor3ubv((GLubyte *)col);
draw_shadedstrip(seq, col, (float)(seq->start+seq->len), y1, x2, y2);
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 */
@@ -510,8 +510,8 @@ static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq)
glColor3ubv((GLubyte *)col);
for (a=y1; a< y2; a+= pixely * 2.0f) {
fdrawline((float)(seq->start+seq->len), a, x2, a);
for (a = y1; a < y2; a += pixely * 2.0f) {
fdrawline((float)(seq->start + seq->len), a, x2, a);
}
}
}
@@ -521,12 +521,12 @@ static void draw_seq_text(View2D *v2d, Sequence *seq, float x1, float x2, float
{
rctf rect;
char str[32 + FILE_MAX];
const char *name= seq->name+2;
const char *name = seq->name + 2;
char col[4];
/* note, all strings should include 'name' */
if (name[0]=='\0')
name= give_seqname(seq);
if (name[0] == '\0')
name = give_seqname(seq);
if (seq->type == SEQ_META || seq->type == SEQ_ADJUSTMENT) {
BLI_snprintf(str, sizeof(str), "%d | %s", seq->len, name);
@@ -534,61 +534,78 @@ static void draw_seq_text(View2D *v2d, Sequence *seq, float x1, float x2, float
else if (seq->type == SEQ_SCENE) {
if (seq->scene) {
if (seq->scene_camera) {
BLI_snprintf(str, sizeof(str), "%d | %s: %s (%s)", seq->len, name, seq->scene->id.name+2, ((ID *)seq->scene_camera)->name+2);
BLI_snprintf(str, sizeof(str), "%d | %s: %s (%s)",
seq->len, name, seq->scene->id.name + 2, ((ID *)seq->scene_camera)->name + 2);
}
else {
BLI_snprintf(str, sizeof(str), "%d | %s: %s", seq->len, name, seq->scene->id.name+2);
BLI_snprintf(str, sizeof(str), "%d | %s: %s",
seq->len, name, seq->scene->id.name + 2);
}
}
else {
BLI_snprintf(str, sizeof(str), "%d | %s", seq->len, name);
BLI_snprintf(str, sizeof(str), "%d | %s",
seq->len, name);
}
}
else if (seq->type == SEQ_MOVIECLIP) {
if (seq->clip && strcmp(name, seq->clip->id.name+2) != 0) {
BLI_snprintf(str, sizeof(str), "%d | %s: %s", seq->len, name, seq->clip->id.name+2);
if (seq->clip && strcmp(name, seq->clip->id.name + 2) != 0) {
BLI_snprintf(str, sizeof(str), "%d | %s: %s",
seq->len, name, seq->clip->id.name + 2);
}
else {
BLI_snprintf(str, sizeof(str), "%d | %s", seq->len, name);
BLI_snprintf(str, sizeof(str), "%d | %s",
seq->len, name);
}
}
else if (seq->type == SEQ_MULTICAM) {
BLI_snprintf(str, sizeof(str), "Cam | %s: %d", name, seq->multicam_source);
BLI_snprintf(str, sizeof(str), "Cam | %s: %d",
name, seq->multicam_source);
}
else if (seq->type == SEQ_IMAGE) {
BLI_snprintf(str, sizeof(str), "%d | %s: %s%s", seq->len, name, seq->strip->dir, seq->strip->stripdata->name);
BLI_snprintf(str, sizeof(str), "%d | %s: %s%s",
seq->len, name, seq->strip->dir, seq->strip->stripdata->name);
}
else if (seq->type & SEQ_EFFECT) {
int can_float = (seq->type != SEQ_PLUGIN)
|| (seq->plugin && seq->plugin->version >= 4);
int can_float = (seq->type != SEQ_PLUGIN) || (seq->plugin && seq->plugin->version >= 4);
if (seq->seq3!=seq->seq2 && seq->seq1!=seq->seq3)
BLI_snprintf(str, sizeof(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!");
else if (seq->seq1 && seq->seq2)
BLI_snprintf(str, sizeof(str), "%d | %s: %d>%d%s", seq->len, name, seq->seq1->machine, seq->seq2->machine, can_float ? "" : " No float, upgrade plugin!");
else
BLI_snprintf(str, sizeof(str), "%d | %s", seq->len, name);
if (seq->seq3 != seq->seq2 && seq->seq1 != seq->seq3) {
BLI_snprintf(str, sizeof(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!");
}
else if (seq->seq1 && seq->seq2) {
BLI_snprintf(str, sizeof(str), "%d | %s: %d>%d%s",
seq->len, name, seq->seq1->machine, seq->seq2->machine,
can_float ? "" : " No float, upgrade plugin!");
}
else {
BLI_snprintf(str, sizeof(str), "%d | %s",
seq->len, name);
}
}
else if (seq->type == SEQ_SOUND) {
if (seq->sound)
BLI_snprintf(str, sizeof(str), "%d | %s: %s", seq->len, name, seq->sound->name);
BLI_snprintf(str, sizeof(str), "%d | %s: %s",
seq->len, name, seq->sound->name);
else
BLI_snprintf(str, sizeof(str), "%d | %s", seq->len, name);
BLI_snprintf(str, sizeof(str), "%d | %s",
seq->len, name);
}
else if (seq->type == SEQ_MOVIE) {
BLI_snprintf(str, sizeof(str), "%d | %s: %s%s", seq->len, name, seq->strip->dir, seq->strip->stripdata->name);
BLI_snprintf(str, sizeof(str), "%d | %s: %s%s",
seq->len, name, seq->strip->dir, seq->strip->stripdata->name);
}
if (seq->flag & SELECT) {
col[0]= col[1]= col[2]= 255;
col[0] = col[1] = col[2] = 255;
}
else if ((((int)background_col[0] + (int)background_col[1] + (int)background_col[2]) / 3) < 50) {
col[0]= col[1]= col[2]= 80; /* use lighter text color for dark background */
col[0] = col[1] = col[2] = 80; /* use lighter text color for dark background */
}
else {
col[0]= col[1]= col[2]= 0;
col[0] = col[1] = col[2] = 0;
}
col[3]= 255;
col[3] = 255;
rect.xmin = x1;
rect.ymin = y1;
@@ -607,29 +624,29 @@ static void draw_shadedstrip(Sequence *seq, unsigned char col[3], float x1, floa
glPolygonStipple(stipple_halftone);
}
ymid1 = (y2-y1)*0.25f + y1;
ymid2 = (y2-y1)*0.65f + y1;
ymid1 = (y2 - y1) * 0.25f + y1;
ymid2 = (y2 - y1) * 0.65f + y1;
glShadeModel(GL_SMOOTH);
glBegin(GL_QUADS);
if (seq->flag & SEQ_INVALID_EFFECT) { col[0]= 255; col[1]= 0; col[2]= 255; }
if (seq->flag & SEQ_INVALID_EFFECT) { col[0] = 255; col[1] = 0; col[2] = 255; }
else if (seq->flag & SELECT) UI_GetColorPtrShade3ubv(col, col, -50);
/* else UI_GetColorPtrShade3ubv(col, col, 0); */ /* DO NOTHING */
glColor3ubv(col);
glVertex2f(x1,y1);
glVertex2f(x2,y1);
glVertex2f(x1, y1);
glVertex2f(x2, y1);
if (seq->flag & SEQ_INVALID_EFFECT) { col[0]= 255; col[1]= 0; col[2]= 255; }
if (seq->flag & SEQ_INVALID_EFFECT) { col[0] = 255; col[1] = 0; col[2] = 255; }
else if (seq->flag & SELECT) UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 5);
else UI_GetColorPtrShade3ubv(col, col, -5);
glColor3ubv((GLubyte *)col);
glVertex2f(x2,ymid1);
glVertex2f(x1,ymid1);
glVertex2f(x2, ymid1);
glVertex2f(x1, ymid1);
glEnd();
@@ -637,16 +654,16 @@ static void draw_shadedstrip(Sequence *seq, unsigned char col[3], float x1, floa
glBegin(GL_QUADS);
glVertex2f(x1,ymid2);
glVertex2f(x2,ymid2);
glVertex2f(x1, ymid2);
glVertex2f(x2, ymid2);
if (seq->flag & SELECT) UI_GetColorPtrShade3ubv(col, col, -15);
else UI_GetColorPtrShade3ubv(col, col, 25);
glColor3ubv((GLubyte *)col);
glVertex2f(x2,y2);
glVertex2f(x1,y2);
glVertex2f(x2, y2);
glVertex2f(x1, y2);
glEnd();
@@ -662,7 +679,7 @@ static void draw_shadedstrip(Sequence *seq, unsigned char col[3], float x1, floa
*/
static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline_tint, float pixelx)
{
View2D *v2d= &ar->v2d;
View2D *v2d = &ar->v2d;
float x1, x2, y1, y2;
unsigned char col[3], background_col[3], is_single_image;
@@ -670,23 +687,23 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline
is_single_image = (char)seq_single_check(seq);
/* body */
if (seq->startstill) x1= seq->start;
else x1= seq->startdisp;
y1= seq->machine+SEQ_STRIP_OFSBOTTOM;
if (seq->endstill) x2= seq->start+seq->len;
else x2= seq->enddisp;
y2= seq->machine+SEQ_STRIP_OFSTOP;
x1 = (seq->startstill) ? seq->start : seq->startdisp;
y1 = seq->machine + SEQ_STRIP_OFSBOTTOM;
x2 = (seq->endstill) ? (seq->start + seq->len) : seq->enddisp;
y2 = seq->machine + SEQ_STRIP_OFSTOP;
/* get the correct color per strip type*/
//get_seq_color3ubv(scene, seq, col);
get_seq_color3ubv(scene, seq, background_col);
/* draw the main strip body */
if (is_single_image) /* single image */
if (is_single_image) { /* single image */
draw_shadedstrip(seq, background_col, seq_tx_get_final_left(seq, 0), y1, seq_tx_get_final_right(seq, 0), y2);
else /* normal operation */
}
else { /* normal operation */
draw_shadedstrip(seq, background_col, x1, y1, x2, y2);
}
/* draw additional info and controls */
if (!is_single_image)
@@ -696,11 +713,13 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline
draw_seq_handle(v2d, seq, pixelx, SEQ_RIGHTHANDLE);
/* draw the strip outline */
x1= seq->startdisp;
x2= seq->enddisp;
x1 = seq->startdisp;
x2 = seq->enddisp;
/* draw sound wave */
if (seq->type == SEQ_SOUND) drawseqwave(scene, seq, x1, y1, x2, y2, (ar->v2d.cur.xmax - ar->v2d.cur.xmin)/ar->winx);
if (seq->type == SEQ_SOUND) {
drawseqwave(scene, seq, x1, y1, x2, y2, (ar->v2d.cur.xmax - ar->v2d.cur.xmin) / ar->winx);
}
/* draw lock */
if (seq->flag & SEQ_LOCK) {
@@ -724,10 +743,10 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline
get_seq_color3ubv(scene, seq, col);
if (G.moving && (seq->flag & SELECT)) {
if (seq->flag & SEQ_OVERLAP) {
col[0]= 255; col[1]= col[2]= 40;
col[0] = 255; col[1] = col[2] = 40;
}
else
UI_GetColorPtrShade3ubv(col, col, 120+outline_tint);
UI_GetColorPtrShade3ubv(col, col, 120 + outline_tint);
}
else
UI_GetColorPtrShade3ubv(col, col, outline_tint);
@@ -745,27 +764,29 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline
glDisable(GL_LINE_STIPPLE);
}
if (seq->type==SEQ_META) drawmeta_contents(scene, seq, x1, y1, x2, y2);
if (seq->type == SEQ_META) {
drawmeta_contents(scene, seq, x1, y1, x2, y2);
}
/* calculate if seq is long enough to print a name */
x1= seq->startdisp+seq->handsize;
x2= seq->enddisp-seq->handsize;
x1 = seq->startdisp + seq->handsize;
x2 = seq->enddisp - seq->handsize;
/* info text on the strip */
if (x1<v2d->cur.xmin) x1= v2d->cur.xmin;
else if (x1>v2d->cur.xmax) x1= v2d->cur.xmax;
if (x2<v2d->cur.xmin) x2= v2d->cur.xmin;
else if (x2>v2d->cur.xmax) x2= v2d->cur.xmax;
if (x1 < v2d->cur.xmin) x1 = v2d->cur.xmin;
else if (x1 > v2d->cur.xmax) x1 = v2d->cur.xmax;
if (x2 < v2d->cur.xmin) x2 = v2d->cur.xmin;
else if (x2 > v2d->cur.xmax) x2 = v2d->cur.xmax;
/* nice text here would require changing the view matrix for texture text */
if ( (x2-x1) / pixelx > 32) {
if ((x2 - x1) / pixelx > 32) {
draw_seq_text(v2d, seq, x1, x2, y1, y2, background_col);
}
}
static Sequence *special_seq_update= NULL;
static Sequence *special_seq_update = NULL;
static void UNUSED_FUNCTION(set_special_seq_update)(int val)
static void UNUSED_FUNCTION(set_special_seq_update) (int val)
{
// int x;
@@ -773,14 +794,14 @@ static void UNUSED_FUNCTION(set_special_seq_update)(int val)
if (val) {
// XXX special_seq_update= find_nearest_seq(&x);
}
else special_seq_update= NULL;
else special_seq_update = NULL;
}
void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq, int cfra, int frame_ofs)
void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq, int cfra, int frame_ofs)
{
struct Main *bmain= CTX_data_main(C);
struct ImBuf *ibuf= NULL;
struct ImBuf *scope= NULL;
struct Main *bmain = CTX_data_main(C);
struct ImBuf *ibuf = NULL;
struct ImBuf *scope = NULL;
struct View2D *v2d = &ar->v2d;
int rectx, recty;
float viewrectx, viewrecty;
@@ -802,8 +823,8 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq
return;
}
viewrectx = (render_size*(float)scene->r.xsch)/100.0f;
viewrecty = (render_size*(float)scene->r.ysch)/100.0f;
viewrectx = (render_size * (float)scene->r.xsch) / 100.0f;
viewrecty = (render_size * (float)scene->r.ysch) / 100.0f;
rectx = viewrectx + 0.5f;
recty = viewrecty + 0.5f;
@@ -833,38 +854,38 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq
context = seq_new_render_data(bmain, scene, rectx, recty, proxy_size);
if (special_seq_update)
ibuf= give_ibuf_seq_direct(context, cfra + frame_ofs, special_seq_update);
ibuf = give_ibuf_seq_direct(context, cfra + frame_ofs, special_seq_update);
else if (!U.prefetchframes) // XXX || (G.f & G_PLAYANIM) == 0) {
ibuf= (ImBuf *)give_ibuf_seq(context, cfra + frame_ofs, sseq->chanshown);
ibuf = (ImBuf *)give_ibuf_seq(context, cfra + frame_ofs, sseq->chanshown);
else
ibuf= (ImBuf *)give_ibuf_seq_threaded(context, cfra + frame_ofs, sseq->chanshown);
ibuf = (ImBuf *)give_ibuf_seq_threaded(context, cfra + frame_ofs, sseq->chanshown);
if (ibuf==NULL)
if (ibuf == NULL)
return;
if (ibuf->rect==NULL && ibuf->rect_float == NULL)
if (ibuf->rect == NULL && ibuf->rect_float == NULL)
return;
switch(sseq->mainb) {
case SEQ_DRAW_IMG_IMBUF:
if (sseq->zebra != 0) {
scope = make_zebra_view_from_ibuf(ibuf, sseq->zebra);
}
break;
case SEQ_DRAW_IMG_WAVEFORM:
if ((sseq->flag & SEQ_DRAW_COLOR_SEPARATED) != 0) {
scope = make_sep_waveform_view_from_ibuf(ibuf);
}
else {
scope = make_waveform_view_from_ibuf(ibuf);
}
break;
case SEQ_DRAW_IMG_VECTORSCOPE:
scope = make_vectorscope_view_from_ibuf(ibuf);
break;
case SEQ_DRAW_IMG_HISTOGRAM:
scope = make_histogram_view_from_ibuf(ibuf);
break;
switch (sseq->mainb) {
case SEQ_DRAW_IMG_IMBUF:
if (sseq->zebra != 0) {
scope = make_zebra_view_from_ibuf(ibuf, sseq->zebra);
}
break;
case SEQ_DRAW_IMG_WAVEFORM:
if ((sseq->flag & SEQ_DRAW_COLOR_SEPARATED) != 0) {
scope = make_sep_waveform_view_from_ibuf(ibuf);
}
else {
scope = make_waveform_view_from_ibuf(ibuf);
}
break;
case SEQ_DRAW_IMG_VECTORSCOPE:
scope = make_vectorscope_view_from_ibuf(ibuf);
break;
case SEQ_DRAW_IMG_HISTOGRAM:
scope = make_histogram_view_from_ibuf(ibuf);
break;
}
if (scope) {
@@ -872,14 +893,14 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq
ibuf = scope;
}
if (ibuf->rect_float && ibuf->rect==NULL) {
if (ibuf->rect_float && ibuf->rect == NULL) {
IMB_rect_from_float(ibuf);
}
/* setting up the view - actual drawing starts here */
UI_view2d_view_ortho(v2d);
last_texid= glaGetOneInteger(GL_TEXTURE_2D);
last_texid = glaGetOneInteger(GL_TEXTURE_2D);
glEnable(GL_TEXTURE_2D);
glGenTextures(1, (GLuint *)&texid);
@@ -898,16 +919,16 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq
tot_clip.xmax = v2d->tot.xmin + (ABS(v2d->tot.xmax - v2d->tot.xmin) * scene->ed->over_border.xmax);
tot_clip.ymax = v2d->tot.ymin + (ABS(v2d->tot.ymax - v2d->tot.ymin) * scene->ed->over_border.ymax);
glTexCoord2f(scene->ed->over_border.xmin, scene->ed->over_border.ymin);glVertex2f(tot_clip.xmin, tot_clip.ymin);
glTexCoord2f(scene->ed->over_border.xmin, scene->ed->over_border.ymax);glVertex2f(tot_clip.xmin, tot_clip.ymax);
glTexCoord2f(scene->ed->over_border.xmax, scene->ed->over_border.ymax);glVertex2f(tot_clip.xmax, tot_clip.ymax);
glTexCoord2f(scene->ed->over_border.xmax, scene->ed->over_border.ymin);glVertex2f(tot_clip.xmax, tot_clip.ymin);
glTexCoord2f(scene->ed->over_border.xmin, scene->ed->over_border.ymin); glVertex2f(tot_clip.xmin, tot_clip.ymin);
glTexCoord2f(scene->ed->over_border.xmin, scene->ed->over_border.ymax); glVertex2f(tot_clip.xmin, tot_clip.ymax);
glTexCoord2f(scene->ed->over_border.xmax, scene->ed->over_border.ymax); glVertex2f(tot_clip.xmax, tot_clip.ymax);
glTexCoord2f(scene->ed->over_border.xmax, scene->ed->over_border.ymin); glVertex2f(tot_clip.xmax, tot_clip.ymin);
}
else {
glTexCoord2f(0.0f, 0.0f);glVertex2f(v2d->tot.xmin, v2d->tot.ymin);
glTexCoord2f(0.0f, 1.0f);glVertex2f(v2d->tot.xmin, v2d->tot.ymax);
glTexCoord2f(1.0f, 1.0f);glVertex2f(v2d->tot.xmax, v2d->tot.ymax);
glTexCoord2f(1.0f, 0.0f);glVertex2f(v2d->tot.xmax, v2d->tot.ymin);
glTexCoord2f(0.0f, 0.0f); glVertex2f(v2d->tot.xmin, v2d->tot.ymin);
glTexCoord2f(0.0f, 1.0f); glVertex2f(v2d->tot.xmin, v2d->tot.ymax);
glTexCoord2f(1.0f, 1.0f); glVertex2f(v2d->tot.xmax, v2d->tot.ymax);
glTexCoord2f(1.0f, 0.0f); glVertex2f(v2d->tot.xmax, v2d->tot.ymin);
}
glEnd( );
glBindTexture(GL_TEXTURE_2D, last_texid);
@@ -927,23 +948,23 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq
UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 1.0, 0);
glBegin(GL_LINE_LOOP);
glVertex2f(x1-0.5f, y1-0.5f);
glVertex2f(x1-0.5f, y2+0.5f);
glVertex2f(x2+0.5f, y2+0.5f);
glVertex2f(x2+0.5f, y1-0.5f);
glVertex2f(x1 - 0.5f, y1 - 0.5f);
glVertex2f(x1 - 0.5f, y2 + 0.5f);
glVertex2f(x2 + 0.5f, y2 + 0.5f);
glVertex2f(x2 + 0.5f, y1 - 0.5f);
glEnd();
/* safety border */
if ((sseq->flag & SEQ_DRAW_SAFE_MARGINS) != 0) {
float fac= 0.1;
float fac = 0.1;
float a= fac*(x2-x1);
x1+= a;
x2-= a;
float a = fac * (x2 - x1);
x1 += a;
x2 -= a;
a= fac*(y2-y1);
y1+= a;
y2-= a;
a = fac * (y2 - y1);
y1 += a;
y2 -= a;
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
@@ -987,13 +1008,13 @@ void drawprefetchseqspace(Scene *scene, ARegion *UNUSED(ar), SpaceSeq *sseq)
return;
}
rectx= (render_size*scene->r.xsch)/100;
recty= (render_size*scene->r.ysch)/100;
rectx = (render_size * scene->r.xsch) / 100;
recty = (render_size * scene->r.ysch) / 100;
if (sseq->mainb != SEQ_DRAW_SEQUENCE) {
give_ibuf_prefetch_request(
rectx, recty, (scene->r.cfra), sseq->chanshown,
proxy_size);
rectx, recty, (scene->r.cfra), sseq->chanshown,
proxy_size);
}
}
#endif
@@ -1008,60 +1029,60 @@ static void draw_seq_backdrop(View2D *v2d)
glRectf(v2d->cur.xmin, -1.0, v2d->cur.xmax, 1.0);
/* Alternating horizontal stripes */
i= MAX2(1, ((int)v2d->cur.ymin)-1);
i = MAX2(1, ((int)v2d->cur.ymin) - 1);
glBegin(GL_QUADS);
while (i<v2d->cur.ymax) {
if (((int)i) & 1)
UI_ThemeColorShade(TH_BACK, -15);
else
UI_ThemeColorShade(TH_BACK, -25);
while (i < v2d->cur.ymax) {
if (((int)i) & 1)
UI_ThemeColorShade(TH_BACK, -15);
else
UI_ThemeColorShade(TH_BACK, -25);
glVertex2f(v2d->cur.xmax, i);
glVertex2f(v2d->cur.xmin, i);
glVertex2f(v2d->cur.xmin, i+1);
glVertex2f(v2d->cur.xmax, i+1);
i+=1.0;
}
glVertex2f(v2d->cur.xmax, i);
glVertex2f(v2d->cur.xmin, i);
glVertex2f(v2d->cur.xmin, i + 1);
glVertex2f(v2d->cur.xmax, i + 1);
i += 1.0;
}
glEnd();
/* Darker lines separating the horizontal bands */
i= MAX2(1, ((int)v2d->cur.ymin)-1);
i = MAX2(1, ((int)v2d->cur.ymin) - 1);
UI_ThemeColor(TH_GRID);
glBegin(GL_LINES);
while (i < v2d->cur.ymax) {
glVertex2f(v2d->cur.xmax, i);
glVertex2f(v2d->cur.xmin, i);
while (i < v2d->cur.ymax) {
glVertex2f(v2d->cur.xmax, i);
glVertex2f(v2d->cur.xmin, i);
i+=1.0;
}
i += 1.0;
}
glEnd();
}
/* draw the contents of the sequencer strips view */
static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar)
{
Scene *scene= CTX_data_scene(C);
View2D *v2d= &ar->v2d;
Scene *scene = CTX_data_scene(C);
View2D *v2d = &ar->v2d;
Sequence *last_seq = seq_active_get(scene);
int sel = 0, j;
float pixelx = (v2d->cur.xmax - v2d->cur.xmin)/(v2d->mask.xmax - v2d->mask.xmin);
float pixelx = (v2d->cur.xmax - v2d->cur.xmin) / (v2d->mask.xmax - v2d->mask.xmin);
/* loop through twice, first unselected, then selected */
for (j=0; j<2; j++) {
for (j = 0; j < 2; j++) {
Sequence *seq;
int outline_tint= (j) ? -60 : -150; /* highlighting around strip edges indicating selection */
int outline_tint = (j) ? -60 : -150; /* highlighting around strip edges indicating selection */
/* loop through strips, checking for those that are visible */
for (seq= ed->seqbasep->first; seq; seq= seq->next) {
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
/* boundbox and selection tests for NOT drawing the strip... */
if ((seq->flag & SELECT) != sel) continue;
else if (seq == last_seq) continue;
else if (MIN2(seq->startdisp, seq->start) > v2d->cur.xmax) continue;
else if (MAX2(seq->enddisp, seq->start+seq->len) < v2d->cur.xmin) continue;
else if (seq->machine+1.0f < v2d->cur.ymin) continue;
else if (MAX2(seq->enddisp, seq->start + seq->len) < v2d->cur.xmin) continue;
else if (seq->machine + 1.0f < v2d->cur.ymin) continue;
else if (seq->machine > v2d->cur.ymax) continue;
/* strip passed all tests unscathed... so draw it now */
@@ -1069,7 +1090,7 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar)
}
/* draw selected next time round */
sel= SELECT;
sel = SELECT;
}
/* draw the last selected last (i.e. 'active' in other parts of Blender), removes some overlapping error */
@@ -1104,18 +1125,18 @@ static void seq_draw_sfra_efra(Scene *scene, View2D *v2d)
/* Draw Timeline/Strip Editor Mode for Sequencer */
void draw_timeline_seq(const bContext *C, ARegion *ar)
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
SpaceSeq *sseq= CTX_wm_space_seq(C);
View2D *v2d= &ar->v2d;
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
SpaceSeq *sseq = CTX_wm_space_seq(C);
View2D *v2d = &ar->v2d;
View2DScrollers *scrollers;
short unit=0, flag=0;
short unit = 0, flag = 0;
float col[3];
/* clear and setup matrix */
UI_GetThemeColor3fv(TH_BACK, col);
if (ed && ed->metastack.first)
glClearColor(col[0], col[1], col[2]-0.1f, 0.0f);
glClearColor(col[0], col[1], col[2] - 0.1f, 0.0f);
else
glClearColor(col[0], col[1], col[2], 0.0f);
glClear(GL_COLOR_BUFFER_BIT);
@@ -1136,7 +1157,7 @@ void draw_timeline_seq(const bContext *C, ARegion *ar)
// NOTE: the gridlines are currently spaced every 25 frames, which is only fine for 25 fps, but maybe not for 30...
UI_view2d_constant_grid_draw(v2d);
seq_draw_sfra_efra(scene, v2d);
seq_draw_sfra_efra(scene, v2d);
/* sequence strips (if there is data available to be drawn) */
if (ed) {
@@ -1149,8 +1170,8 @@ void draw_timeline_seq(const bContext *C, ARegion *ar)
/* current frame */
UI_view2d_view_ortho(v2d);
if ((sseq->flag & SEQ_DRAWFRAMES)==0) flag |= DRAWCFRA_UNIT_SECONDS;
if ((sseq->flag & SEQ_NO_DRAW_CFRANUM)==0) flag |= DRAWCFRA_SHOW_NUMBOX;
if ((sseq->flag & SEQ_DRAWFRAMES) == 0) flag |= DRAWCFRA_UNIT_SECONDS;
if ((sseq->flag & SEQ_NO_DRAW_CFRANUM) == 0) flag |= DRAWCFRA_SHOW_NUMBOX;
ANIM_draw_cfra(C, v2d, flag);
/* markers */
@@ -1163,13 +1184,13 @@ void draw_timeline_seq(const bContext *C, ARegion *ar)
/* overlap playhead */
if (scene->ed && scene->ed->over_flag & SEQ_EDIT_OVERLAY_SHOW) {
int cfra_over= (scene->ed->over_flag & SEQ_EDIT_OVERLAY_ABS) ? scene->ed->over_cfra : scene->r.cfra + scene->ed->over_ofs;
int cfra_over = (scene->ed->over_flag & SEQ_EDIT_OVERLAY_ABS) ? scene->ed->over_cfra : scene->r.cfra + scene->ed->over_ofs;
glColor3f(0.2, 0.2, 0.2);
// glRectf(cfra_over, v2d->cur.ymin, scene->ed->over_ofs + scene->r.cfra + 1, v2d->cur.ymax);
glBegin(GL_LINES);
glVertex2f(cfra_over, v2d->cur.ymin);
glVertex2f(cfra_over, v2d->cur.ymax);
glVertex2f(cfra_over, v2d->cur.ymin);
glVertex2f(cfra_over, v2d->cur.ymax);
glEnd();
}
@@ -1178,8 +1199,8 @@ void draw_timeline_seq(const bContext *C, ARegion *ar)
UI_view2d_view_restore(C);
/* scrollers */
unit= (sseq->flag & SEQ_DRAWFRAMES)? V2D_UNIT_FRAMES : V2D_UNIT_SECONDSSEQ;
scrollers= UI_view2d_scrollers_calc(C, v2d, unit, V2D_GRID_CLAMP, V2D_UNIT_VALUES, V2D_GRID_CLAMP);
unit = (sseq->flag & SEQ_DRAWFRAMES) ? V2D_UNIT_FRAMES : V2D_UNIT_SECONDSSEQ;
scrollers = UI_view2d_scrollers_calc(C, v2d, unit, V2D_GRID_CLAMP, V2D_UNIT_VALUES, V2D_GRID_CLAMP);
UI_view2d_scrollers_draw(C, v2d, scrollers);
UI_view2d_scrollers_free(scrollers);
}

View File

@@ -129,14 +129,14 @@ typedef struct TransSeq {
typedef struct ProxyBuildJob {
Scene *scene;
struct Main * main;
struct Main *main;
ListBase queue;
int stop;
} ProxyJob;
static void proxy_freejob(void *pjv)
{
ProxyJob *pj= pjv;
ProxyJob *pj = pjv;
BLI_freelistN(&pj->queue);
@@ -173,19 +173,19 @@ static void proxy_endjob(void *pjv)
free_imbuf_seq(pj->scene, &ed->seqbase, FALSE, FALSE);
WM_main_add_notifier(NC_SCENE|ND_SEQUENCER, pj->scene);
WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, pj->scene);
}
static void seq_proxy_build_job(const bContext *C)
{
wmJob * steve;
wmJob *steve;
ProxyJob *pj;
Scene *scene= CTX_data_scene(C);
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
ScrArea * sa= CTX_wm_area(C);
ScrArea *sa = CTX_wm_area(C);
struct SeqIndexBuildContext *context;
LinkData *link;
Sequence * seq;
Sequence *seq;
steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Building Proxies", WM_JOB_PROGRESS);
@@ -194,11 +194,11 @@ static void seq_proxy_build_job(const bContext *C)
if (!pj) {
pj = MEM_callocN(sizeof(ProxyJob), "proxy rebuild job");
pj->scene= scene;
pj->scene = scene;
pj->main = CTX_data_main(C);
WM_jobs_customdata(steve, pj, proxy_freejob);
WM_jobs_timer(steve, 0.1, NC_SCENE|ND_SEQUENCER, NC_SCENE|ND_SEQUENCER);
WM_jobs_timer(steve, 0.1, NC_SCENE | ND_SEQUENCER, NC_SCENE | ND_SEQUENCER);
WM_jobs_callbacks(steve, proxy_startjob, NULL, NULL, proxy_endjob);
}
@@ -225,19 +225,19 @@ void seq_rectf(Sequence *seq, rctf *rectf)
{
if (seq->startstill) rectf->xmin = seq->start;
else rectf->xmin = seq->startdisp;
rectf->ymin = seq->machine+SEQ_STRIP_OFSBOTTOM;
if (seq->endstill) rectf->xmax = seq->start+seq->len;
rectf->ymin = seq->machine + SEQ_STRIP_OFSBOTTOM;
if (seq->endstill) rectf->xmax = seq->start + seq->len;
else rectf->xmax = seq->enddisp;
rectf->ymax = seq->machine+SEQ_STRIP_OFSTOP;
rectf->ymax = seq->machine + SEQ_STRIP_OFSTOP;
}
static void UNUSED_FUNCTION(change_plugin_seq)(Scene *scene, char *str) /* called from fileselect */
static void UNUSED_FUNCTION(change_plugin_seq) (Scene * scene, char *str) /* called from fileselect */
{
Editing *ed= seq_give_editing(scene, FALSE);
Editing *ed = seq_give_editing(scene, FALSE);
struct SeqEffectHandle sh;
Sequence *last_seq= seq_active_get(scene);
Sequence *last_seq = seq_active_get(scene);
if (last_seq==NULL || last_seq->type != SEQ_PLUGIN) return;
if (last_seq == NULL || last_seq->type != SEQ_PLUGIN) return;
sh = get_sequence_effect(last_seq);
sh.free(last_seq);
@@ -247,7 +247,7 @@ static void UNUSED_FUNCTION(change_plugin_seq)(Scene *scene, char *str) /* calle
last_seq->seq2->machine,
last_seq->seq3->machine);
if ( seq_test_overlap(ed->seqbasep, last_seq) ) shuffle_seq(ed->seqbasep, last_seq, scene);
if (seq_test_overlap(ed->seqbasep, last_seq) ) shuffle_seq(ed->seqbasep, last_seq, scene);
}
@@ -255,25 +255,25 @@ static void UNUSED_FUNCTION(change_plugin_seq)(Scene *scene, char *str) /* calle
void boundbox_seq(Scene *scene, rctf *rect)
{
Sequence *seq;
Editing *ed= seq_give_editing(scene, FALSE);
Editing *ed = seq_give_editing(scene, FALSE);
float min[2], max[2];
if (ed==NULL) return;
if (ed == NULL) return;
min[0]= 0.0;
max[0]= EFRA+1;
min[1]= 0.0;
max[1]= 8.0;
min[0] = 0.0;
max[0] = EFRA + 1;
min[1] = 0.0;
max[1] = 8.0;
seq= ed->seqbasep->first;
seq = ed->seqbasep->first;
while (seq) {
if ( min[0] > seq->startdisp-1) min[0]= seq->startdisp-1;
if ( max[0] < seq->enddisp+1) max[0]= seq->enddisp+1;
if ( max[1] < seq->machine+2) max[1]= seq->machine+2;
if (min[0] > seq->startdisp - 1) min[0] = seq->startdisp - 1;
if (max[0] < seq->enddisp + 1) max[0] = seq->enddisp + 1;
if (max[1] < seq->machine + 2) max[1] = seq->machine + 2;
seq= seq->next;
seq = seq->next;
}
rect->xmin = min[0];
@@ -283,13 +283,13 @@ void boundbox_seq(Scene *scene, rctf *rect)
}
static int mouse_frame_side(View2D *v2d, short mouse_x, int frame )
static int mouse_frame_side(View2D *v2d, short mouse_x, int frame)
{
int mval[2];
float mouseloc[2];
mval[0]= mouse_x;
mval[1]= 0;
mval[0] = mouse_x;
mval[1] = 0;
/* choose the side based on which side of the playhead the mouse is on */
UI_view2d_region_to_view(v2d, mval[0], mval[1], &mouseloc[0], &mouseloc[1]);
@@ -302,28 +302,28 @@ Sequence *find_neighboring_sequence(Scene *scene, Sequence *test, int lr, int se
{
/* sel - 0==unselected, 1==selected, -1==done care*/
Sequence *seq;
Editing *ed= seq_give_editing(scene, FALSE);
Editing *ed = seq_give_editing(scene, FALSE);
if (ed==NULL) return NULL;
if (ed == NULL) return NULL;
if (sel>0) sel = SELECT;
if (sel > 0) sel = SELECT;
for (seq= ed->seqbasep->first; seq; seq= seq->next) {
if ( (seq!=test) &&
(test->machine==seq->machine) &&
((sel == -1) || (sel && (seq->flag & SELECT)) || (sel==0 && (seq->flag & SELECT)==0) ))
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
if ((seq != test) &&
(test->machine == seq->machine) &&
((sel == -1) || (sel && (seq->flag & SELECT)) || (sel == 0 && (seq->flag & SELECT) == 0) ))
{
switch (lr) {
case SEQ_SIDE_LEFT:
if (test->startdisp == (seq->enddisp)) {
return seq;
}
break;
case SEQ_SIDE_RIGHT:
if (test->enddisp == (seq->startdisp)) {
return seq;
}
break;
case SEQ_SIDE_LEFT:
if (test->startdisp == (seq->enddisp)) {
return seq;
}
break;
case SEQ_SIDE_RIGHT:
if (test->enddisp == (seq->startdisp)) {
return seq;
}
break;
}
}
}
@@ -333,38 +333,38 @@ Sequence *find_neighboring_sequence(Scene *scene, Sequence *test, int lr, int se
static Sequence *find_next_prev_sequence(Scene *scene, Sequence *test, int lr, int sel)
{
/* sel - 0==unselected, 1==selected, -1==done care*/
Sequence *seq,*best_seq = NULL;
Editing *ed= seq_give_editing(scene, FALSE);
Sequence *seq, *best_seq = NULL;
Editing *ed = seq_give_editing(scene, FALSE);
int dist, best_dist;
best_dist = MAXFRAME*2;
best_dist = MAXFRAME * 2;
if (ed==NULL) return NULL;
if (ed == NULL) return NULL;
seq= ed->seqbasep->first;
seq = ed->seqbasep->first;
while (seq) {
if ( (seq!=test) &&
(test->machine==seq->machine) &&
(test->depth==seq->depth) &&
((sel == -1) || (sel==(seq->flag & SELECT))))
if ((seq != test) &&
(test->machine == seq->machine) &&
(test->depth == seq->depth) &&
((sel == -1) || (sel == (seq->flag & SELECT))))
{
dist = MAXFRAME*2;
dist = MAXFRAME * 2;
switch (lr) {
case SEQ_SIDE_LEFT:
if (seq->enddisp <= test->startdisp) {
dist = test->enddisp - seq->startdisp;
}
break;
case SEQ_SIDE_RIGHT:
if (seq->startdisp >= test->enddisp) {
dist = seq->startdisp - test->enddisp;
}
break;
case SEQ_SIDE_LEFT:
if (seq->enddisp <= test->startdisp) {
dist = test->enddisp - seq->startdisp;
}
break;
case SEQ_SIDE_RIGHT:
if (seq->startdisp >= test->enddisp) {
dist = seq->startdisp - test->enddisp;
}
break;
}
if (dist==0) {
if (dist == 0) {
best_seq = seq;
break;
}
@@ -373,7 +373,7 @@ static Sequence *find_next_prev_sequence(Scene *scene, Sequence *test, int lr, i
best_seq = seq;
}
}
seq= seq->next;
seq = seq->next;
}
return best_seq; /* can be null */
}
@@ -382,27 +382,27 @@ static Sequence *find_next_prev_sequence(Scene *scene, Sequence *test, int lr, i
Sequence *find_nearest_seq(Scene *scene, View2D *v2d, int *hand, const int mval[2])
{
Sequence *seq;
Editing *ed= seq_give_editing(scene, FALSE);
Editing *ed = seq_give_editing(scene, FALSE);
float x, y;
float pixelx;
float handsize;
float displen;
*hand= SEQ_SIDE_NONE;
*hand = SEQ_SIDE_NONE;
if (ed==NULL) return NULL;
if (ed == NULL) return NULL;
pixelx = (v2d->cur.xmax - v2d->cur.xmin)/(v2d->mask.xmax - v2d->mask.xmin);
pixelx = (v2d->cur.xmax - v2d->cur.xmin) / (v2d->mask.xmax - v2d->mask.xmin);
UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, &y);
seq= ed->seqbasep->first;
seq = ed->seqbasep->first;
while (seq) {
if (seq->machine == (int)y) {
/* check for both normal strips, and strips that have been flipped horizontally */
if ( ((seq->startdisp < seq->enddisp) && (seq->startdisp<=x && seq->enddisp>=x)) ||
((seq->startdisp > seq->enddisp) && (seq->startdisp>=x && seq->enddisp<=x)) )
if ( ((seq->startdisp < seq->enddisp) && (seq->startdisp <= x && seq->enddisp >= x)) ||
((seq->startdisp > seq->enddisp) && (seq->startdisp >= x && seq->enddisp <= x)) )
{
if (seq_tx_test(seq)) {
@@ -415,23 +415,23 @@ Sequence *find_nearest_seq(Scene *scene, View2D *v2d, int *hand, const int mval[
/* Set the max value to handle to 1/3 of the total len when its less then 28.
* This is important because otherwise selecting handles happens even when you click in the middle */
if ((displen/3) < 30*pixelx) {
handsize = displen/3;
if ((displen / 3) < 30 * pixelx) {
handsize = displen / 3;
}
else {
CLAMP(handsize, 7*pixelx, 30*pixelx);
CLAMP(handsize, 7 * pixelx, 30 * pixelx);
}
if ( handsize+seq->startdisp >=x )
*hand= SEQ_SIDE_LEFT;
else if ( -handsize+seq->enddisp <=x )
*hand= SEQ_SIDE_RIGHT;
if (handsize + seq->startdisp >= x)
*hand = SEQ_SIDE_LEFT;
else if (-handsize + seq->enddisp <= x)
*hand = SEQ_SIDE_RIGHT;
}
}
return seq;
}
}
seq= seq->next;
seq = seq->next;
}
return NULL;
}
@@ -457,12 +457,13 @@ static int seq_is_predecessor(Sequence *pred, Sequence *seq)
void deselect_all_seq(Scene *scene)
{
Sequence *seq;
Editing *ed= seq_give_editing(scene, FALSE);
Editing *ed = seq_give_editing(scene, FALSE);
if (ed==NULL) return;
if (ed == NULL) return;
SEQP_BEGIN(ed, seq) {
SEQP_BEGIN(ed, seq)
{
seq->flag &= ~SEQ_ALLSEL;
}
SEQ_END
@@ -473,43 +474,43 @@ void recurs_sel_seq(Sequence *seqm)
{
Sequence *seq;
seq= seqm->seqbase.first;
seq = seqm->seqbase.first;
while (seq) {
if (seqm->flag & (SEQ_LEFTSEL+SEQ_RIGHTSEL)) seq->flag &= ~SEQ_ALLSEL;
if (seqm->flag & (SEQ_LEFTSEL + SEQ_RIGHTSEL)) seq->flag &= ~SEQ_ALLSEL;
else if (seqm->flag & SELECT) seq->flag |= SELECT;
else seq->flag &= ~SEQ_ALLSEL;
if (seq->seqbase.first) recurs_sel_seq(seq);
seq= seq->next;
seq = seq->next;
}
}
int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequence **selseq1, Sequence **selseq2, Sequence **selseq3, const char **error_str)
{
Editing *ed = seq_give_editing(scene, FALSE);
Sequence *seq1= NULL, *seq2= NULL, *seq3= NULL, *seq;
Sequence *seq1 = NULL, *seq2 = NULL, *seq3 = NULL, *seq;
*error_str= NULL;
*error_str = NULL;
if (!activeseq)
seq2= seq_active_get(scene);
seq2 = seq_active_get(scene);
for (seq=ed->seqbasep->first; seq; seq=seq->next) {
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
if (seq->flag & SELECT) {
if (seq->type == SEQ_SOUND && get_sequence_effect_num_inputs(type) != 0) {
*error_str= "Can't apply effects to audio sequence strips";
*error_str = "Can't apply effects to audio sequence strips";
return 0;
}
if ((seq != activeseq) && (seq != seq2)) {
if (seq2 == NULL) seq2= seq;
else if (seq1 == NULL) seq1= seq;
else if (seq3 == NULL) seq3= seq;
else {
*error_str= "Can't apply effect to more than 3 sequence strips";
return 0;
}
if (seq2 == NULL) seq2 = seq;
else if (seq1 == NULL) seq1 = seq;
else if (seq3 == NULL) seq3 = seq;
else {
*error_str = "Can't apply effect to more than 3 sequence strips";
return 0;
}
}
}
}
@@ -523,33 +524,33 @@ int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequen
}
switch(get_sequence_effect_num_inputs(type)) {
case 0:
*selseq1 = *selseq2 = *selseq3 = NULL;
return 1; /* succsess */
case 1:
if (seq2==NULL) {
*error_str= "Need at least one selected sequence strip";
return 0;
}
if (seq1==NULL) seq1= seq2;
if (seq3==NULL) seq3= seq2;
case 2:
if (seq1==NULL || seq2==NULL) {
*error_str= "Need 2 selected sequence strips";
return 0;
}
if (seq3 == NULL) seq3= seq2;
switch (get_sequence_effect_num_inputs(type)) {
case 0:
*selseq1 = *selseq2 = *selseq3 = NULL;
return 1; /* succsess */
case 1:
if (seq2 == NULL) {
*error_str = "Need at least one selected sequence strip";
return 0;
}
if (seq1 == NULL) seq1 = seq2;
if (seq3 == NULL) seq3 = seq2;
case 2:
if (seq1 == NULL || seq2 == NULL) {
*error_str = "Need 2 selected sequence strips";
return 0;
}
if (seq3 == NULL) seq3 = seq2;
}
if (seq1==NULL && seq2==NULL && seq3==NULL) {
*error_str= "TODO: in what cases does this happen?";
if (seq1 == NULL && seq2 == NULL && seq3 == NULL) {
*error_str = "TODO: in what cases does this happen?";
return 0;
}
*selseq1= seq1;
*selseq2= seq2;
*selseq3= seq3;
*selseq1 = seq1;
*selseq2 = seq2;
*selseq3 = seq3;
return 1;
}
@@ -564,23 +565,23 @@ static Sequence *del_seq_find_replace_recurs(Scene *scene, Sequence *seq)
if (!seq)
return NULL;
else if (!(seq->type & SEQ_EFFECT))
return ((seq->flag & SELECT)? NULL: seq);
return ((seq->flag & SELECT) ? NULL : seq);
else if (!(seq->flag & SELECT)) {
/* try to find replacement for effect inputs */
seq1= del_seq_find_replace_recurs(scene, seq->seq1);
seq2= del_seq_find_replace_recurs(scene, seq->seq2);
seq3= del_seq_find_replace_recurs(scene, seq->seq3);
seq1 = del_seq_find_replace_recurs(scene, seq->seq1);
seq2 = del_seq_find_replace_recurs(scene, seq->seq2);
seq3 = del_seq_find_replace_recurs(scene, seq->seq3);
if (seq1==seq->seq1 && seq2==seq->seq2 && seq3==seq->seq3);
if (seq1 == seq->seq1 && seq2 == seq->seq2 && seq3 == seq->seq3) ;
else if (seq1 || seq2 || seq3) {
seq->seq1= (seq1)? seq1: (seq2)? seq2: seq3;
seq->seq2= (seq2)? seq2: (seq1)? seq1: seq3;
seq->seq3= (seq3)? seq3: (seq1)? seq1: seq2;
seq->seq1 = (seq1) ? seq1 : (seq2) ? seq2 : seq3;
seq->seq2 = (seq2) ? seq2 : (seq1) ? seq1 : seq3;
seq->seq3 = (seq3) ? seq3 : (seq1) ? seq1 : seq2;
update_changed_seq_and_deps(scene, seq, 1, 1);
}
else
seq->flag |= SELECT; /* mark for delete */
seq->flag |= SELECT; /* mark for delete */
}
if (seq->flag & SELECT) {
@@ -598,63 +599,63 @@ static void recurs_del_seq_flag(Scene *scene, ListBase *lb, short flag, short de
Sequence *seq, *seqn;
Sequence *last_seq = seq_active_get(scene);
seq= lb->first;
seq = lb->first;
while (seq) {
seqn= seq->next;
seqn = seq->next;
if ((seq->flag & flag) || deleteall) {
BLI_remlink(lb, seq);
if (seq==last_seq) seq_active_set(scene, NULL);
if (seq->type==SEQ_META) recurs_del_seq_flag(scene, &seq->seqbase, flag, 1);
if (seq == last_seq) seq_active_set(scene, NULL);
if (seq->type == SEQ_META) recurs_del_seq_flag(scene, &seq->seqbase, flag, 1);
seq_free_sequence(scene, seq);
}
seq= seqn;
seq = seqn;
}
}
static Sequence *cut_seq_hard(Scene *scene, Sequence * seq, int cutframe)
static Sequence *cut_seq_hard(Scene *scene, Sequence *seq, int cutframe)
{
TransSeq ts;
Sequence *seqn = NULL;
int skip_dup = FALSE;
/* backup values */
ts.start= seq->start;
ts.machine= seq->machine;
ts.startstill= seq->startstill;
ts.endstill= seq->endstill;
ts.startdisp= seq->startdisp;
ts.enddisp= seq->enddisp;
ts.startofs= seq->startofs;
ts.endofs= seq->endofs;
ts.anim_startofs= seq->anim_startofs;
ts.anim_endofs= seq->anim_endofs;
ts.len= seq->len;
ts.start = seq->start;
ts.machine = seq->machine;
ts.startstill = seq->startstill;
ts.endstill = seq->endstill;
ts.startdisp = seq->startdisp;
ts.enddisp = seq->enddisp;
ts.startofs = seq->startofs;
ts.endofs = seq->endofs;
ts.anim_startofs = seq->anim_startofs;
ts.anim_endofs = seq->anim_endofs;
ts.len = seq->len;
/* First Strip! */
/* strips with extended stillfames before */
if ((seq->startstill) && (cutframe <seq->start)) {
if ((seq->startstill) && (cutframe < seq->start)) {
/* don't do funny things with METAs ... */
if (seq->type == SEQ_META) {
skip_dup = TRUE;
seq->startstill = seq->start - cutframe;
}
else {
seq->start= cutframe -1;
seq->startstill= cutframe -seq->startdisp -1;
seq->start = cutframe - 1;
seq->startstill = cutframe - seq->startdisp - 1;
seq->anim_endofs += seq->len - 1;
seq->endstill= 0;
seq->endstill = 0;
}
}
/* normal strip */
else if ((cutframe >=seq->start)&&(cutframe <=(seq->start+seq->len))) {
else if ((cutframe >= seq->start) && (cutframe <= (seq->start + seq->len))) {
seq->endofs = 0;
seq->endstill = 0;
seq->anim_endofs += (seq->start+seq->len) - cutframe;
seq->anim_endofs += (seq->start + seq->len) - cutframe;
}
/* strips with extended stillframes after */
else if (((seq->start+seq->len) < cutframe) && (seq->endstill)) {
else if (((seq->start + seq->len) < cutframe) && (seq->endstill)) {
seq->endstill -= seq->enddisp - cutframe;
/* don't do funny things with METAs ... */
if (seq->type == SEQ_META) {
@@ -677,13 +678,13 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence * seq, int cutframe)
/* strips with extended stillframes before */
if ((seqn->startstill) && (cutframe == seqn->start + 1)) {
seqn->start = ts.start;
seqn->startstill= ts.start- cutframe;
seqn->startstill = ts.start - cutframe;
seqn->anim_endofs = ts.anim_endofs;
seqn->endstill = ts.endstill;
}
/* normal strip */
else if ((cutframe>=seqn->start)&&(cutframe<=(seqn->start+seqn->len))) {
else if ((cutframe >= seqn->start) && (cutframe <= (seqn->start + seqn->len))) {
seqn->start = cutframe;
seqn->startstill = 0;
seqn->startofs = 0;
@@ -694,11 +695,11 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence * seq, int cutframe)
}
/* strips with extended stillframes after */
else if (((seqn->start+seqn->len) < cutframe) && (seqn->endstill)) {
else if (((seqn->start + seqn->len) < cutframe) && (seqn->endstill)) {
seqn->start = cutframe;
seqn->startofs = 0;
seqn->anim_startofs += ts.len-1;
seqn->endstill = ts.enddisp - cutframe -1;
seqn->anim_startofs += ts.len - 1;
seqn->endstill = ts.enddisp - cutframe - 1;
seqn->startstill = 0;
}
@@ -708,47 +709,47 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence * seq, int cutframe)
return seqn;
}
static Sequence *cut_seq_soft(Scene *scene, Sequence * seq, int cutframe)
static Sequence *cut_seq_soft(Scene *scene, Sequence *seq, int cutframe)
{
TransSeq ts;
Sequence *seqn = NULL;
int skip_dup = FALSE;
/* backup values */
ts.start= seq->start;
ts.machine= seq->machine;
ts.startstill= seq->startstill;
ts.endstill= seq->endstill;
ts.startdisp= seq->startdisp;
ts.enddisp= seq->enddisp;
ts.startofs= seq->startofs;
ts.endofs= seq->endofs;
ts.anim_startofs= seq->anim_startofs;
ts.anim_endofs= seq->anim_endofs;
ts.len= seq->len;
ts.start = seq->start;
ts.machine = seq->machine;
ts.startstill = seq->startstill;
ts.endstill = seq->endstill;
ts.startdisp = seq->startdisp;
ts.enddisp = seq->enddisp;
ts.startofs = seq->startofs;
ts.endofs = seq->endofs;
ts.anim_startofs = seq->anim_startofs;
ts.anim_endofs = seq->anim_endofs;
ts.len = seq->len;
/* First Strip! */
/* strips with extended stillfames before */
if ((seq->startstill) && (cutframe <seq->start)) {
if ((seq->startstill) && (cutframe < seq->start)) {
/* don't do funny things with METAs ... */
if (seq->type == SEQ_META) {
skip_dup = TRUE;
seq->startstill = seq->start - cutframe;
}
else {
seq->start= cutframe -1;
seq->startstill= cutframe -seq->startdisp -1;
seq->start = cutframe - 1;
seq->startstill = cutframe - seq->startdisp - 1;
seq->endofs = seq->len - 1;
seq->endstill= 0;
seq->endstill = 0;
}
}
/* normal strip */
else if ((cutframe >=seq->start)&&(cutframe <=(seq->start+seq->len))) {
seq->endofs = (seq->start+seq->len) - cutframe;
else if ((cutframe >= seq->start) && (cutframe <= (seq->start + seq->len))) {
seq->endofs = (seq->start + seq->len) - cutframe;
}
/* strips with extended stillframes after */
else if (((seq->start+seq->len) < cutframe) && (seq->endstill)) {
else if (((seq->start + seq->len) < cutframe) && (seq->endstill)) {
seq->endstill -= seq->enddisp - cutframe;
/* don't do funny things with METAs ... */
if (seq->type == SEQ_META) {
@@ -770,13 +771,13 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence * seq, int cutframe)
/* strips with extended stillframes before */
if ((seqn->startstill) && (cutframe == seqn->start + 1)) {
seqn->start = ts.start;
seqn->startstill= ts.start- cutframe;
seqn->startstill = ts.start - cutframe;
seqn->endofs = ts.endofs;
seqn->endstill = ts.endstill;
}
/* normal strip */
else if ((cutframe>=seqn->start)&&(cutframe<=(seqn->start+seqn->len))) {
else if ((cutframe >= seqn->start) && (cutframe <= (seqn->start + seqn->len))) {
seqn->startstill = 0;
seqn->startofs = cutframe - ts.start;
seqn->endofs = ts.endofs;
@@ -784,10 +785,10 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence * seq, int cutframe)
}
/* strips with extended stillframes after */
else if (((seqn->start+seqn->len) < cutframe) && (seqn->endstill)) {
seqn->start = cutframe - ts.len +1;
seqn->startofs = ts.len-1;
seqn->endstill = ts.enddisp - cutframe -1;
else if (((seqn->start + seqn->len) < cutframe) && (seqn->endstill)) {
seqn->start = cutframe - ts.len + 1;
seqn->startofs = ts.len - 1;
seqn->endstill = ts.enddisp - cutframe - 1;
seqn->startstill = 0;
}
@@ -800,21 +801,22 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence * seq, int cutframe)
/* like duplicate, but only duplicate and cut overlapping strips,
* strips to the left of the cutframe are ignored and strips to the right are moved into the new list */
static int cut_seq_list(Scene *scene, ListBase *old, ListBase *new, int cutframe,
Sequence * (*cut_seq)(Scene *, Sequence *, int))
Sequence * (*cut_seq)(Scene *, Sequence *, int))
{
int did_something = FALSE;
Sequence *seq, *seq_next_iter;
seq= old->first;
seq = old->first;
while (seq) {
seq_next_iter = seq->next; /* we need this because we may remove seq */
seq->tmp= NULL;
seq->tmp = NULL;
if (seq->flag & SELECT) {
if (cutframe > seq->startdisp &&
cutframe < seq->enddisp) {
Sequence * seqn = cut_seq(scene, seq, cutframe);
cutframe < seq->enddisp)
{
Sequence *seqn = cut_seq(scene, seq, cutframe);
if (seqn) {
BLI_addtail(new, seqn);
}
@@ -837,18 +839,18 @@ static int cut_seq_list(Scene *scene, ListBase *old, ListBase *new, int cutframe
static int insert_gap(Scene *scene, int gap, int cfra)
{
Sequence *seq;
Editing *ed= seq_give_editing(scene, FALSE);
int done=0;
Editing *ed = seq_give_editing(scene, FALSE);
int done = 0;
/* all strips >= cfra are shifted */
if (ed==NULL) return 0;
if (ed == NULL) return 0;
SEQP_BEGIN(ed, seq) {
if (seq->startdisp >= cfra) {
seq->start+= gap;
seq->start += gap;
calc_sequence(scene, seq);
done= 1;
done = 1;
}
}
SEQ_END
@@ -856,23 +858,24 @@ static int insert_gap(Scene *scene, int gap, int cfra)
return done;
}
static void UNUSED_FUNCTION(touch_seq_files)(Scene *scene)
static void UNUSED_FUNCTION(touch_seq_files) (Scene * scene)
{
Sequence *seq;
Editing *ed= seq_give_editing(scene, FALSE);
Editing *ed = seq_give_editing(scene, FALSE);
char str[256];
/* touch all strips with movies */
if (ed==NULL) return;
if (ed == NULL) return;
// XXX25 if (okee("Touch and print selected movies")==0) return;
WM_cursor_wait(1);
SEQP_BEGIN(ed, seq) {
SEQP_BEGIN(ed, seq)
{
if (seq->flag & SELECT) {
if (seq->type==SEQ_MOVIE) {
if (seq->type == SEQ_MOVIE) {
if (seq->strip && seq->strip->stripdata) {
BLI_make_file_string(G.main->name, str, seq->strip->dir, seq->strip->stripdata->name);
BLI_file_touch(seq->name);
@@ -890,16 +893,17 @@ static void UNUSED_FUNCTION(touch_seq_files)(Scene *scene)
static void set_filter_seq(Scene *scene)
{
Sequence *seq;
Editing *ed= seq_give_editing(scene, FALSE);
Editing *ed = seq_give_editing(scene, FALSE);
if (ed==NULL) return;
if (ed == NULL) return;
if (okee("Set Deinterlace")==0) return;
if (okee("Set Deinterlace") == 0) return;
SEQP_BEGIN(ed, seq) {
SEQP_BEGIN(ed, seq)
{
if (seq->flag & SELECT) {
if (seq->type==SEQ_MOVIE) {
if (seq->type == SEQ_MOVIE) {
seq->flag |= SEQ_FILTERY;
reload_sequence_new_file(scene, seq, FALSE);
calc_sequence(scene, seq);
@@ -911,14 +915,14 @@ static void set_filter_seq(Scene *scene)
}
#endif
static void UNUSED_FUNCTION(seq_remap_paths)(Scene *scene)
static void UNUSED_FUNCTION(seq_remap_paths) (Scene * scene)
{
Sequence *seq, *last_seq = seq_active_get(scene);
Editing *ed= seq_give_editing(scene, FALSE);
Editing *ed = seq_give_editing(scene, FALSE);
char from[FILE_MAX], to[FILE_MAX], stripped[FILE_MAX];
if (last_seq==NULL)
if (last_seq == NULL)
return;
BLI_strncpy(from, last_seq->strip->dir, sizeof(from));
@@ -929,16 +933,17 @@ static void UNUSED_FUNCTION(seq_remap_paths)(Scene *scene)
// XXX if (0==sbutton(to, 0, sizeof(to)-1, "To: "))
// return;
if (strcmp(to, from)==0)
if (strcmp(to, from) == 0)
return;
SEQP_BEGIN(ed, seq) {
SEQP_BEGIN(ed, seq)
{
if (seq->flag & SELECT) {
if (strncmp(seq->strip->dir, from, strlen(from))==0) {
if (strncmp(seq->strip->dir, from, strlen(from)) == 0) {
printf("found %s\n", seq->strip->dir);
/* strip off the beginning */
stripped[0]= 0;
stripped[0] = 0;
BLI_strncpy(stripped, seq->strip->dir + strlen(from), FILE_MAX);
/* new path */
@@ -952,25 +957,25 @@ static void UNUSED_FUNCTION(seq_remap_paths)(Scene *scene)
}
static void UNUSED_FUNCTION(no_gaps)(Scene *scene)
static void UNUSED_FUNCTION(no_gaps) (Scene * scene)
{
Editing *ed= seq_give_editing(scene, FALSE);
int cfra, first= 0, done;
Editing *ed = seq_give_editing(scene, FALSE);
int cfra, first = 0, done;
if (ed==NULL) return;
if (ed == NULL) return;
for (cfra= CFRA; cfra<=EFRA; cfra++) {
if (first==0) {
if ( evaluate_seq_frame(scene, cfra) ) first= 1;
for (cfra = CFRA; cfra <= EFRA; cfra++) {
if (first == 0) {
if (evaluate_seq_frame(scene, cfra) ) first = 1;
}
else {
done= 1;
while ( evaluate_seq_frame(scene, cfra) == 0) {
done= insert_gap(scene, -1, cfra);
if (done==0) break;
done = 1;
while (evaluate_seq_frame(scene, cfra) == 0) {
done = insert_gap(scene, -1, cfra);
if (done == 0) break;
}
if (done==0) break;
if (done == 0) break;
}
}
@@ -1001,20 +1006,20 @@ int sequencer_edit_poll(bContext *C)
int sequencer_strip_poll(bContext *C)
{
Editing *ed;
return (((ed= seq_give_editing(CTX_data_scene(C), FALSE)) != NULL) && (ed->act_seq != NULL));
return (((ed = seq_give_editing(CTX_data_scene(C), FALSE)) != NULL) && (ed->act_seq != NULL));
}
int sequencer_strip_has_path_poll(bContext *C)
{
Editing *ed;
Sequence *seq;
return (((ed= seq_give_editing(CTX_data_scene(C), FALSE)) != NULL) && ((seq= ed->act_seq) != NULL) && (SEQ_HAS_PATH(seq)));
return (((ed = seq_give_editing(CTX_data_scene(C), FALSE)) != NULL) && ((seq = ed->act_seq) != NULL) && (SEQ_HAS_PATH(seq)));
}
int sequencer_view_poll(bContext *C)
{
SpaceSeq *sseq= CTX_wm_space_seq(C);
Editing *ed= seq_give_editing(CTX_data_scene(C), FALSE);
SpaceSeq *sseq = CTX_wm_space_seq(C);
Editing *ed = seq_give_editing(CTX_data_scene(C), FALSE);
if (ed && sseq && (sseq->mainb == SEQ_DRAW_IMG_IMBUF))
return 1;
@@ -1024,23 +1029,24 @@ int sequencer_view_poll(bContext *C)
/* snap operator*/
static int sequencer_snap_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
Scene *scene = CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
Editing *ed = seq_give_editing(scene, FALSE);
Sequence *seq;
int snap_frame;
snap_frame= RNA_int_get(op->ptr, "frame");
snap_frame = RNA_int_get(op->ptr, "frame");
/* also check metas */
for (seq= ed->seqbasep->first; seq; seq= seq->next) {
if (seq->flag & SELECT && !(seq->depth==0 && seq->flag & SEQ_LOCK) &&
seq_tx_test(seq)) {
if ((seq->flag & (SEQ_LEFTSEL+SEQ_RIGHTSEL))==0) {
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
if (seq->flag & SELECT && !(seq->depth == 0 && seq->flag & SEQ_LOCK) &&
seq_tx_test(seq))
{
if ((seq->flag & (SEQ_LEFTSEL + SEQ_RIGHTSEL)) == 0) {
/* simple but no anim update */
/* seq->start= snap_frame-seq->startofs+seq->startstill; */
seq_translate(scene, seq, (snap_frame-seq->startofs+seq->startstill) - seq->start);
seq_translate(scene, seq, (snap_frame - seq->startofs + seq->startstill) - seq->start);
}
else {
if (seq->flag & SEQ_LEFTSEL) {
@@ -1057,10 +1063,10 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op)
/* test for effects and overlap
* don't use SEQP_BEGIN since that would be recursive */
for (seq= ed->seqbasep->first; seq; seq= seq->next) {
if (seq->flag & SELECT && !(seq->depth==0 && seq->flag & SEQ_LOCK)) {
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
if (seq->flag & SELECT && !(seq->depth == 0 && seq->flag & SEQ_LOCK)) {
seq->flag &= ~SEQ_OVERLAP;
if ( seq_test_overlap(ed->seqbasep, seq) ) {
if (seq_test_overlap(ed->seqbasep, seq) ) {
shuffle_seq(ed->seqbasep, seq, scene);
}
}
@@ -1077,7 +1083,7 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op)
/* as last: */
sort_seq(scene);
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@@ -1088,7 +1094,7 @@ static int sequencer_snap_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(ev
int snap_frame;
snap_frame= CFRA;
snap_frame = CFRA;
RNA_int_set(op->ptr, "frame", snap_frame);
return sequencer_snap_exec(C, op);
@@ -1107,7 +1113,7 @@ void SEQUENCER_OT_snap(struct wmOperatorType *ot)
ot->poll = sequencer_edit_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_int(ot->srna, "frame", 0, INT_MIN, INT_MAX, "Frame", "Frame where selected strips will be snapped", INT_MIN, INT_MAX);
}
@@ -1115,28 +1121,28 @@ void SEQUENCER_OT_snap(struct wmOperatorType *ot)
/* mute operator */
static int sequencer_mute_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Sequence *seq;
int selected;
selected= !RNA_boolean_get(op->ptr, "unselected");
selected = !RNA_boolean_get(op->ptr, "unselected");
for (seq= ed->seqbasep->first; seq; seq= seq->next) {
if ((seq->flag & SEQ_LOCK)==0) {
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
if ((seq->flag & SEQ_LOCK) == 0) {
if (selected) { /* mute unselected */
if (seq->flag & SELECT)
seq->flag |= SEQ_MUTE;
}
else {
if ((seq->flag & SELECT)==0)
if ((seq->flag & SELECT) == 0)
seq->flag |= SEQ_MUTE;
}
}
}
seq_update_muting(ed);
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@@ -1153,7 +1159,7 @@ void SEQUENCER_OT_mute(struct wmOperatorType *ot)
ot->poll = sequencer_edit_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Mute unselected rather than selected strips");
}
@@ -1162,28 +1168,28 @@ void SEQUENCER_OT_mute(struct wmOperatorType *ot)
/* unmute operator */
static int sequencer_unmute_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Sequence *seq;
int selected;
selected= !RNA_boolean_get(op->ptr, "unselected");
selected = !RNA_boolean_get(op->ptr, "unselected");
for (seq= ed->seqbasep->first; seq; seq= seq->next) {
if ((seq->flag & SEQ_LOCK)==0) {
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
if ((seq->flag & SEQ_LOCK) == 0) {
if (selected) { /* unmute unselected */
if (seq->flag & SELECT)
seq->flag &= ~SEQ_MUTE;
}
else {
if ((seq->flag & SELECT)==0)
if ((seq->flag & SELECT) == 0)
seq->flag &= ~SEQ_MUTE;
}
}
}
seq_update_muting(ed);
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@@ -1200,7 +1206,7 @@ void SEQUENCER_OT_unmute(struct wmOperatorType *ot)
ot->poll = sequencer_edit_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "UnMute unselected rather than selected strips");
}
@@ -1209,17 +1215,17 @@ void SEQUENCER_OT_unmute(struct wmOperatorType *ot)
/* lock operator */
static int sequencer_lock_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Sequence *seq;
for (seq= ed->seqbasep->first; seq; seq= seq->next) {
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
if (seq->flag & SELECT) {
seq->flag |= SEQ_LOCK;
}
}
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@@ -1236,23 +1242,23 @@ void SEQUENCER_OT_lock(struct wmOperatorType *ot)
ot->poll = sequencer_edit_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* unlock operator */
static int sequencer_unlock_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Sequence *seq;
for (seq= ed->seqbasep->first; seq; seq= seq->next) {
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
if (seq->flag & SELECT) {
seq->flag &= ~SEQ_LOCK;
}
}
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@@ -1269,18 +1275,18 @@ void SEQUENCER_OT_unlock(struct wmOperatorType *ot)
ot->poll = sequencer_edit_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* reload operator */
static int sequencer_reload_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Sequence *seq;
int adjust_length= RNA_boolean_get(op->ptr, "adjust_length");
int adjust_length = RNA_boolean_get(op->ptr, "adjust_length");
for (seq= ed->seqbasep->first; seq; seq= seq->next) {
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
if (seq->flag & SELECT) {
update_changed_seq_and_deps(scene, seq, 0, 1);
reload_sequence_new_file(scene, seq, !adjust_length);
@@ -1292,7 +1298,7 @@ static int sequencer_reload_exec(bContext *C, wmOperator *op)
}
}
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@@ -1320,12 +1326,12 @@ void SEQUENCER_OT_reload(struct wmOperatorType *ot)
/* reload operator */
static int sequencer_refresh_all_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
free_imbuf_seq(scene, &ed->seqbase, FALSE, FALSE);
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@@ -1344,7 +1350,7 @@ void SEQUENCER_OT_refresh_all(struct wmOperatorType *ot)
static int sequencer_reassign_inputs_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
Scene *scene = CTX_data_scene(C);
Sequence *seq1, *seq2, *seq3, *last_seq = seq_active_get(scene);
const char *error_msg;
@@ -1353,10 +1359,10 @@ static int sequencer_reassign_inputs_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
/* see reassigning would create a cycle */
if ( seq_is_predecessor(seq1, last_seq) ||
seq_is_predecessor(seq2, last_seq) ||
seq_is_predecessor(seq3, last_seq)
) {
if (seq_is_predecessor(seq1, last_seq) ||
seq_is_predecessor(seq2, last_seq) ||
seq_is_predecessor(seq3, last_seq)
) {
BKE_report(op->reports, RPT_ERROR, "Can't reassign inputs: no cycles allowed");
return OPERATOR_CANCELLED;
}
@@ -1367,18 +1373,18 @@ static int sequencer_reassign_inputs_exec(bContext *C, wmOperator *op)
update_changed_seq_and_deps(scene, last_seq, 1, 1);
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
static int sequencer_effect_poll(bContext *C)
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
if (ed) {
Sequence *last_seq= seq_active_get(scene);
Sequence *last_seq = seq_active_get(scene);
if (last_seq && (last_seq->type & SEQ_EFFECT)) {
return 1;
}
@@ -1399,16 +1405,16 @@ void SEQUENCER_OT_reassign_inputs(struct wmOperatorType *ot)
ot->poll = sequencer_effect_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int sequencer_swap_inputs_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
Scene *scene = CTX_data_scene(C);
Sequence *seq, *last_seq = seq_active_get(scene);
if (last_seq->seq1==NULL || last_seq->seq2 == NULL) {
if (last_seq->seq1 == NULL || last_seq->seq2 == NULL) {
BKE_report(op->reports, RPT_ERROR, "No valid inputs to swap");
return OPERATOR_CANCELLED;
}
@@ -1419,7 +1425,7 @@ static int sequencer_swap_inputs_exec(bContext *C, wmOperator *op)
update_changed_seq_and_deps(scene, last_seq, 1, 1);
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@@ -1435,7 +1441,7 @@ void SEQUENCER_OT_swap_inputs(struct wmOperatorType *ot)
ot->poll = sequencer_effect_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -1448,20 +1454,20 @@ static EnumPropertyItem prop_cut_types[] = {
static int sequencer_cut_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
int cut_side, cut_hard, cut_frame;
ListBase newlist;
int changed;
cut_frame= RNA_int_get(op->ptr, "frame");
cut_hard= RNA_enum_get(op->ptr, "type");
cut_side= RNA_enum_get(op->ptr, "side");
cut_frame = RNA_int_get(op->ptr, "frame");
cut_hard = RNA_enum_get(op->ptr, "type");
cut_side = RNA_enum_get(op->ptr, "side");
newlist.first= newlist.last= NULL;
newlist.first = newlist.last = NULL;
if (cut_hard==SEQ_CUT_HARD) {
if (cut_hard == SEQ_CUT_HARD) {
changed = cut_seq_list(scene, ed->seqbasep, &newlist, cut_frame, cut_seq_hard);
}
else {
@@ -1474,13 +1480,13 @@ static int sequencer_cut_exec(bContext *C, wmOperator *op)
if (cut_side != SEQ_SIDE_BOTH) {
SEQP_BEGIN(ed, seq) {
if (cut_side==SEQ_SIDE_LEFT) {
if ( seq->startdisp >= cut_frame ) {
if (cut_side == SEQ_SIDE_LEFT) {
if (seq->startdisp >= cut_frame) {
seq->flag &= ~SEQ_ALLSEL;
}
}
else {
if ( seq->enddisp <= cut_frame ) {
if (seq->enddisp <= cut_frame) {
seq->flag &= ~SEQ_ALLSEL;
}
}
@@ -1492,7 +1498,7 @@ static int sequencer_cut_exec(bContext *C, wmOperator *op)
}
if (changed) {
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
else {
@@ -1504,13 +1510,13 @@ static int sequencer_cut_exec(bContext *C, wmOperator *op)
static int sequencer_cut_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
Scene *scene = CTX_data_scene(C);
View2D *v2d= UI_view2d_fromcontext(C);
View2D *v2d = UI_view2d_fromcontext(C);
int cut_side= SEQ_SIDE_BOTH;
int cut_frame= CFRA;
int cut_side = SEQ_SIDE_BOTH;
int cut_frame = CFRA;
if (ED_operator_sequencer_active(C) && v2d)
cut_side= mouse_frame_side(v2d, event->mval[0], cut_frame);
cut_side = mouse_frame_side(v2d, event->mval[0], cut_frame);
RNA_int_set(op->ptr, "frame", cut_frame);
RNA_enum_set(op->ptr, "side", cut_side);
@@ -1533,7 +1539,7 @@ void SEQUENCER_OT_cut(struct wmOperatorType *ot)
ot->poll = sequencer_edit_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_int(ot->srna, "frame", 0, INT_MIN, INT_MAX, "Frame", "Frame where selected strips will be cut", INT_MIN, INT_MAX);
RNA_def_enum(ot->srna, "type", prop_cut_types, SEQ_CUT_SOFT, "Type", "The type of cut operation to perform on strips");
@@ -1543,37 +1549,37 @@ void SEQUENCER_OT_cut(struct wmOperatorType *ot)
/* duplicate operator */
static int apply_unique_name_cb(Sequence *seq, void *arg_pt)
{
Scene *scene= (Scene *)arg_pt;
char name[sizeof(seq->name)-2];
Scene *scene = (Scene *)arg_pt;
char name[sizeof(seq->name) - 2];
strcpy(name, seq->name+2);
strcpy(name, seq->name + 2);
seqbase_unique_name_recursive(&scene->ed->seqbase, seq);
seq_dupe_animdata(scene, name, seq->name+2);
seq_dupe_animdata(scene, name, seq->name + 2);
return 1;
}
static int sequencer_add_duplicate_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
ListBase nseqbase= {NULL, NULL};
ListBase nseqbase = {NULL, NULL};
if (ed==NULL)
if (ed == NULL)
return OPERATOR_CANCELLED;
seqbase_dupli_recursive(scene, NULL, &nseqbase, ed->seqbasep, SEQ_DUPE_CONTEXT);
if (nseqbase.first) {
Sequence * seq= nseqbase.first;
Sequence *seq = nseqbase.first;
/* rely on the nseqbase list being added at the end */
BLI_movelisttolist(ed->seqbasep, &nseqbase);
for ( ; seq; seq= seq->next)
for (; seq; seq = seq->next)
seq_recursive_apply(seq, apply_unique_name_cb, scene);
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@@ -1603,7 +1609,7 @@ void SEQUENCER_OT_duplicate(wmOperatorType *ot)
ot->poll = ED_operator_sequencer_active;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* to give to transform */
RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", "");
@@ -1612,13 +1618,13 @@ void SEQUENCER_OT_duplicate(wmOperatorType *ot)
/* delete operator */
static int sequencer_delete_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Sequence *seq;
MetaStack *ms;
int nothingSelected = TRUE;
seq=seq_active_get(scene);
seq = seq_active_get(scene);
if (seq && seq->flag & SELECT) { /* avoid a loop since this is likely to be selected */
nothingSelected = FALSE;
}
@@ -1635,7 +1641,7 @@ static int sequencer_delete_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
/* for effects, try to find a replacement input */
for (seq=ed->seqbasep->first; seq; seq=seq->next)
for (seq = ed->seqbasep->first; seq; seq = seq->next)
if ((seq->type & SEQ_EFFECT) && !(seq->flag & SELECT))
del_seq_find_replace_recurs(scene, seq);
@@ -1643,20 +1649,20 @@ static int sequencer_delete_exec(bContext *C, wmOperator *UNUSED(op))
recurs_del_seq_flag(scene, ed->seqbasep, SELECT, 0);
/* updates lengths etc */
seq= ed->seqbasep->first;
seq = ed->seqbasep->first;
while (seq) {
calc_sequence(scene, seq);
seq= seq->next;
seq = seq->next;
}
/* free parent metas */
ms= ed->metastack.last;
ms = ed->metastack.last;
while (ms) {
calc_sequence(scene, ms->parseq);
ms= ms->prev;
ms = ms->prev;
}
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@@ -1676,40 +1682,40 @@ void SEQUENCER_OT_delete(wmOperatorType *ot)
ot->poll = sequencer_edit_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* offset clear operator */
static int sequencer_offset_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Sequence *seq;
/* for effects, try to find a replacement input */
for (seq=ed->seqbasep->first; seq; seq=seq->next) {
if ((seq->type & SEQ_EFFECT)==0 && (seq->flag & SELECT)) {
seq->startofs= seq->endofs= seq->startstill= seq->endstill= 0;
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
if ((seq->type & SEQ_EFFECT) == 0 && (seq->flag & SELECT)) {
seq->startofs = seq->endofs = seq->startstill = seq->endstill = 0;
}
}
/* updates lengths etc */
seq= ed->seqbasep->first;
seq = ed->seqbasep->first;
while (seq) {
calc_sequence(scene, seq);
seq= seq->next;
seq = seq->next;
}
for (seq=ed->seqbasep->first; seq; seq=seq->next) {
if ((seq->type & SEQ_EFFECT)==0 && (seq->flag & SELECT)) {
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
if ((seq->type & SEQ_EFFECT) == 0 && (seq->flag & SELECT)) {
if (seq_test_overlap(ed->seqbasep, seq)) {
shuffle_seq(ed->seqbasep, seq, scene);
}
}
}
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@@ -1728,23 +1734,23 @@ void SEQUENCER_OT_offset_clear(wmOperatorType *ot)
ot->poll = sequencer_edit_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* separate_images operator */
static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Sequence *seq, *seq_new;
Strip *strip_new;
StripElem *se, *se_new;
int start_ofs, cfra, frame_end;
int step= RNA_int_get(op->ptr, "length");
int step = RNA_int_get(op->ptr, "length");
seq= ed->seqbasep->first; /* poll checks this is valid */
seq = ed->seqbasep->first; /* poll checks this is valid */
while (seq) {
if ((seq->flag & SELECT) && (seq->type == SEQ_IMAGE) && (seq->len > 1)) {
@@ -1761,20 +1767,20 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
/* new seq */
se = give_stripelem(seq, cfra);
seq_new= seq_dupli_recursive(scene, scene, seq, SEQ_DUPE_UNIQUE_NAME);
seq_new = seq_dupli_recursive(scene, scene, seq, SEQ_DUPE_UNIQUE_NAME);
BLI_addtail(ed->seqbasep, seq_new);
seq_new->start= start_ofs;
seq_new->type= SEQ_IMAGE;
seq_new->start = start_ofs;
seq_new->type = SEQ_IMAGE;
seq_new->len = 1;
seq_new->endstill = step-1;
seq_new->endstill = step - 1;
/* new strip */
strip_new= seq_new->strip;
strip_new->us= 1;
strip_new = seq_new->strip;
strip_new->us = 1;
/* new stripdata */
se_new= strip_new->stripdata;
se_new = strip_new->stripdata;
BLI_strncpy(se_new->name, se->name, sizeof(se_new->name));
calc_sequence(scene, seq_new);
@@ -1802,7 +1808,7 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
/* as last: */
sort_seq(scene);
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@@ -1820,7 +1826,7 @@ void SEQUENCER_OT_images_separate(wmOperatorType *ot)
ot->poll = sequencer_edit_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_int(ot->srna, "length", 1, 1, 1000, "Length", "Length of each frame", 1, INT_MAX);
}
@@ -1831,19 +1837,19 @@ void SEQUENCER_OT_images_separate(wmOperatorType *ot)
/* separate_meta_toggle operator */
static int sequencer_meta_toggle_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
Sequence *last_seq= seq_active_get(scene);
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Sequence *last_seq = seq_active_get(scene);
MetaStack *ms;
if (last_seq && last_seq->type==SEQ_META && last_seq->flag & SELECT) {
if (last_seq && last_seq->type == SEQ_META && last_seq->flag & SELECT) {
/* Enter Metastrip */
ms= MEM_mallocN(sizeof(MetaStack), "metastack");
ms = MEM_mallocN(sizeof(MetaStack), "metastack");
BLI_addtail(&ed->metastack, ms);
ms->parseq= last_seq;
ms->oldbasep= ed->seqbasep;
ms->parseq = last_seq;
ms->oldbasep = ed->seqbasep;
ed->seqbasep= &last_seq->seqbase;
ed->seqbasep = &last_seq->seqbase;
seq_active_set(scene, NULL);
@@ -1853,16 +1859,16 @@ static int sequencer_meta_toggle_exec(bContext *C, wmOperator *UNUSED(op))
Sequence *seq;
if (ed->metastack.first==NULL)
if (ed->metastack.first == NULL)
return OPERATOR_CANCELLED;
ms= ed->metastack.last;
ms = ed->metastack.last;
BLI_remlink(&ed->metastack, ms);
ed->seqbasep= ms->oldbasep;
ed->seqbasep = ms->oldbasep;
/* recalc all: the meta can have effects connected to it */
for (seq= ed->seqbasep->first; seq; seq= seq->next)
for (seq = ed->seqbasep->first; seq; seq = seq->next)
calc_sequence(scene, seq);
seq_active_set(scene, ms->parseq);
@@ -1875,7 +1881,7 @@ static int sequencer_meta_toggle_exec(bContext *C, wmOperator *UNUSED(op))
}
seq_update_muting(ed);
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@@ -1892,56 +1898,56 @@ void SEQUENCER_OT_meta_toggle(wmOperatorType *ot)
ot->poll = sequencer_edit_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* separate_meta_make operator */
static int sequencer_meta_make_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Sequence *seq, *seqm, *next, *last_seq = seq_active_get(scene);
int channel_max= 1;
int channel_max = 1;
if (seqbase_isolated_sel_check(ed->seqbasep)==FALSE) {
if (seqbase_isolated_sel_check(ed->seqbasep) == FALSE) {
BKE_report(op->reports, RPT_ERROR, "Please select all related strips");
return OPERATOR_CANCELLED;
}
/* remove all selected from main list, and put in meta */
seqm= alloc_sequence(ed->seqbasep, 1, 1); /* channel number set later */
strcpy(seqm->name+2, "MetaStrip");
seqm->type= SEQ_META;
seqm->flag= SELECT;
seqm = alloc_sequence(ed->seqbasep, 1, 1); /* channel number set later */
strcpy(seqm->name + 2, "MetaStrip");
seqm->type = SEQ_META;
seqm->flag = SELECT;
seq= ed->seqbasep->first;
seq = ed->seqbasep->first;
while (seq) {
next= seq->next;
if (seq!=seqm && (seq->flag & SELECT)) {
channel_max= MAX2(seq->machine, channel_max);
next = seq->next;
if (seq != seqm && (seq->flag & SELECT)) {
channel_max = MAX2(seq->machine, channel_max);
BLI_remlink(ed->seqbasep, seq);
BLI_addtail(&seqm->seqbase, seq);
}
seq= next;
seq = next;
}
seqm->machine= last_seq ? last_seq->machine : channel_max;
seqm->machine = last_seq ? last_seq->machine : channel_max;
calc_sequence(scene, seqm);
seqm->strip= MEM_callocN(sizeof(Strip), "metastrip");
seqm->strip->us= 1;
seqm->strip = MEM_callocN(sizeof(Strip), "metastrip");
seqm->strip->us = 1;
seq_active_set(scene, seqm);
if ( seq_test_overlap(ed->seqbasep, seqm) ) shuffle_seq(ed->seqbasep, seqm, scene);
if (seq_test_overlap(ed->seqbasep, seqm) ) shuffle_seq(ed->seqbasep, seqm, scene);
seq_update_muting(ed);
seqbase_unique_name_recursive(&scene->ed->seqbase, seqm);
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@@ -1959,7 +1965,7 @@ void SEQUENCER_OT_meta_make(wmOperatorType *ot)
ot->poll = sequencer_edit_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -1975,24 +1981,24 @@ static int seq_depends_on_meta(Sequence *seq, Sequence *seqm)
/* separate_meta_make operator */
static int sequencer_meta_separate_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Sequence *seq, *last_seq = seq_active_get(scene); /* last_seq checks ed==NULL */
if (last_seq==NULL || last_seq->type!=SEQ_META)
if (last_seq == NULL || last_seq->type != SEQ_META)
return OPERATOR_CANCELLED;
BLI_movelisttolist(ed->seqbasep, &last_seq->seqbase);
last_seq->seqbase.first= NULL;
last_seq->seqbase.last= NULL;
last_seq->seqbase.first = NULL;
last_seq->seqbase.last = NULL;
BLI_remlink(ed->seqbasep, last_seq);
seq_free_sequence(scene, last_seq);
/* emtpy meta strip, delete all effects depending on it */
for (seq=ed->seqbasep->first; seq; seq=seq->next)
for (seq = ed->seqbasep->first; seq; seq = seq->next)
if ((seq->type & SEQ_EFFECT) && seq_depends_on_meta(seq, last_seq))
seq->flag |= SEQ_FLAG_DELETE;
@@ -2000,7 +2006,7 @@ static int sequencer_meta_separate_exec(bContext *C, wmOperator *UNUSED(op))
/* test for effects and overlap
* don't use SEQP_BEGIN since that would be recursive */
for (seq= ed->seqbasep->first; seq; seq= seq->next) {
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
if (seq->flag & SELECT) {
seq->flag &= ~SEQ_OVERLAP;
if (seq_test_overlap(ed->seqbasep, seq)) {
@@ -2012,7 +2018,7 @@ static int sequencer_meta_separate_exec(bContext *C, wmOperator *UNUSED(op))
sort_seq(scene);
seq_update_muting(ed);
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@@ -2030,19 +2036,19 @@ void SEQUENCER_OT_meta_separate(wmOperatorType *ot)
ot->poll = sequencer_edit_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* view_all operator */
static int sequencer_view_all_exec(bContext *C, wmOperator *UNUSED(op))
{
//Scene *scene= CTX_data_scene(C);
bScreen *sc= CTX_wm_screen(C);
ScrArea *area= CTX_wm_area(C);
bScreen *sc = CTX_wm_screen(C);
ScrArea *area = CTX_wm_area(C);
//ARegion *ar= CTX_wm_region(C);
View2D *v2d= UI_view2d_fromcontext(C);
View2D *v2d = UI_view2d_fromcontext(C);
v2d->cur= v2d->tot;
v2d->cur = v2d->tot;
UI_view2d_curRect_validate(v2d);
UI_view2d_sync(sc, area, v2d, V2D_LOCK_COPY);
@@ -2068,16 +2074,16 @@ void SEQUENCER_OT_view_all(wmOperatorType *ot)
/* view_all operator */
static int sequencer_view_all_preview_exec(bContext *C, wmOperator *UNUSED(op))
{
bScreen *sc= CTX_wm_screen(C);
ScrArea *area= CTX_wm_area(C);
bScreen *sc = CTX_wm_screen(C);
ScrArea *area = CTX_wm_area(C);
#if 0
ARegion *ar= CTX_wm_region(C);
SpaceSeq *sseq= area->spacedata.first;
Scene *scene= CTX_data_scene(C);
ARegion *ar = CTX_wm_region(C);
SpaceSeq *sseq = area->spacedata.first;
Scene *scene = CTX_data_scene(C);
#endif
View2D *v2d= UI_view2d_fromcontext(C);
View2D *v2d = UI_view2d_fromcontext(C);
v2d->cur= v2d->tot;
v2d->cur = v2d->tot;
UI_view2d_curRect_validate(v2d);
UI_view2d_sync(sc, area, v2d, V2D_LOCK_COPY);
@@ -2091,24 +2097,24 @@ static int sequencer_view_all_preview_exec(bContext *C, wmOperator *UNUSED(op))
seq_reset_imageofs(sseq);
imgwidth= (scene->r.size*scene->r.xsch)/100;
imgheight= (scene->r.size*scene->r.ysch)/100;
imgwidth = (scene->r.size * scene->r.xsch) / 100;
imgheight = (scene->r.size * scene->r.ysch) / 100;
/* Apply aspect, dosnt need to be that accurate */
imgwidth= (int)(imgwidth * (scene->r.xasp / scene->r.yasp));
imgwidth = (int)(imgwidth * (scene->r.xasp / scene->r.yasp));
if (((imgwidth >= width) || (imgheight >= height)) &&
((width > 0) && (height > 0))) {
((width > 0) && (height > 0))) {
/* Find the zoom value that will fit the image in the image space */
zoomX = ((float)width) / ((float)imgwidth);
zoomY = ((float)height) / ((float)imgheight);
sseq->zoom= (zoomX < zoomY) ? zoomX : zoomY;
sseq->zoom = (zoomX < zoomY) ? zoomX : zoomY;
sseq->zoom = 1.0f / power_of_2(1/ MIN2(zoomX, zoomY) );
sseq->zoom = 1.0f / power_of_2(1 / MIN2(zoomX, zoomY) );
}
else {
sseq->zoom= 1.0f;
sseq->zoom = 1.0f;
}
#endif
@@ -2134,18 +2140,18 @@ void SEQUENCER_OT_view_all_preview(wmOperatorType *ot)
static int sequencer_view_zoom_ratio_exec(bContext *C, wmOperator *op)
{
RenderData *r= &CTX_data_scene(C)->r;
View2D *v2d= UI_view2d_fromcontext(C);
RenderData *r = &CTX_data_scene(C)->r;
View2D *v2d = UI_view2d_fromcontext(C);
float ratio= RNA_float_get(op->ptr, "ratio");
float ratio = RNA_float_get(op->ptr, "ratio");
float winx= (int)(r->size * r->xsch)/100;
float winy= (int)(r->size * r->ysch)/100;
float winx = (int)(r->size * r->xsch) / 100;
float winy = (int)(r->size * r->ysch) / 100;
float facx= (v2d->mask.xmax - v2d->mask.xmin) / winx;
float facy= (v2d->mask.ymax - v2d->mask.ymin) / winy;
float facx = (v2d->mask.xmax - v2d->mask.xmin) / winx;
float facy = (v2d->mask.ymax - v2d->mask.ymin) / winy;
BLI_resize_rctf(&v2d->cur, (int)(winx*facx*ratio) + 1, (int)(winy*facy*ratio) + 1);
BLI_resize_rctf(&v2d->cur, (int)(winx * facx * ratio) + 1, (int)(winy * facy * ratio) + 1);
ED_region_tag_redraw(CTX_wm_region(C));
@@ -2165,22 +2171,23 @@ void SEQUENCER_OT_view_zoom_ratio(wmOperatorType *ot)
/* properties */
RNA_def_float(ot->srna, "ratio", 1.0f, 0.0f, FLT_MAX,
"Ratio", "Zoom ratio, 1.0 is 1:1, higher is zoomed in, lower is zoomed out", -FLT_MAX, FLT_MAX);
"Ratio", "Zoom ratio, 1.0 is 1:1, higher is zoomed in, lower is zoomed out", -FLT_MAX, FLT_MAX);
}
#if 0
static EnumPropertyItem view_type_items[] = {
{SEQ_VIEW_SEQUENCE, "SEQUENCER", ICON_SEQ_SEQUENCER, "Sequencer", ""},
{SEQ_VIEW_PREVIEW, "PREVIEW", ICON_SEQ_PREVIEW, "Image Preview", ""},
{SEQ_VIEW_SEQUENCE_PREVIEW, "SEQUENCER_PREVIEW", ICON_SEQ_SEQUENCER, "Sequencer and Image Preview", ""},
{0, NULL, 0, NULL, NULL}};
{SEQ_VIEW_SEQUENCE, "SEQUENCER", ICON_SEQ_SEQUENCER, "Sequencer", ""},
{SEQ_VIEW_PREVIEW, "PREVIEW", ICON_SEQ_PREVIEW, "Image Preview", ""},
{SEQ_VIEW_SEQUENCE_PREVIEW, "SEQUENCER_PREVIEW", ICON_SEQ_SEQUENCER, "Sequencer and Image Preview", ""},
{0, NULL, 0, NULL, NULL}
};
#endif
/* view_all operator */
static int sequencer_view_toggle_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceSeq *sseq= (SpaceSeq *)CTX_wm_space_data(C);
SpaceSeq *sseq = (SpaceSeq *)CTX_wm_space_data(C);
sseq->view++;
if (sseq->view > SEQ_VIEW_SEQUENCE_PREVIEW) sseq->view = SEQ_VIEW_SEQUENCE;
@@ -2209,32 +2216,32 @@ void SEQUENCER_OT_view_toggle(wmOperatorType *ot)
/* view_selected operator */
static int sequencer_view_selected_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
View2D *v2d= UI_view2d_fromcontext(C);
ScrArea *area= CTX_wm_area(C);
bScreen *sc= CTX_wm_screen(C);
Editing *ed= seq_give_editing(scene, FALSE);
Scene *scene = CTX_data_scene(C);
View2D *v2d = UI_view2d_fromcontext(C);
ScrArea *area = CTX_wm_area(C);
bScreen *sc = CTX_wm_screen(C);
Editing *ed = seq_give_editing(scene, FALSE);
Sequence *seq;
int xmin= MAXFRAME*2;
int xmax= -MAXFRAME*2;
int ymin= MAXSEQ+1;
int ymax= 0;
int xmin = MAXFRAME * 2;
int xmax = -MAXFRAME * 2;
int ymin = MAXSEQ + 1;
int ymax = 0;
int orig_height;
int ymid;
int ymargin= 1;
int xmargin= FPS;
int ymargin = 1;
int xmargin = FPS;
if (ed==NULL)
if (ed == NULL)
return OPERATOR_CANCELLED;
for (seq=ed->seqbasep->first; seq; seq=seq->next) {
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
if (seq->flag & SELECT) {
xmin= MIN2(xmin, seq->startdisp);
xmax= MAX2(xmax, seq->enddisp);
xmin = MIN2(xmin, seq->startdisp);
xmax = MAX2(xmax, seq->enddisp);
ymin= MIN2(ymin, seq->machine);
ymax= MAX2(ymax, seq->machine);
ymin = MIN2(ymin, seq->machine);
ymax = MAX2(ymax, seq->machine);
}
}
@@ -2245,7 +2252,7 @@ static int sequencer_view_selected_exec(bContext *C, wmOperator *UNUSED(op))
ymax += ymargin;
ymin -= ymargin;
orig_height= v2d->cur.ymax - v2d->cur.ymin;
orig_height = v2d->cur.ymax - v2d->cur.ymin;
v2d->cur.xmin = xmin;
v2d->cur.xmax = xmax;
@@ -2255,10 +2262,10 @@ static int sequencer_view_selected_exec(bContext *C, wmOperator *UNUSED(op))
/* only zoom out vertically */
if (orig_height > v2d->cur.ymax - v2d->cur.ymin) {
ymid= (v2d->cur.ymax + v2d->cur.ymin) / 2;
ymid = (v2d->cur.ymax + v2d->cur.ymin) / 2;
v2d->cur.ymin = ymid - (orig_height/2);
v2d->cur.ymax = ymid + (orig_height/2);
v2d->cur.ymin = ymid - (orig_height / 2);
v2d->cur.ymax = ymid + (orig_height / 2);
}
UI_view2d_curRect_validate(v2d);
@@ -2288,16 +2295,16 @@ void SEQUENCER_OT_view_selected(wmOperatorType *ot)
static int find_next_prev_edit(Scene *scene, int cfra, int side)
{
Editing *ed= seq_give_editing(scene, FALSE);
Sequence *seq,*best_seq = NULL,*frame_seq = NULL;
Editing *ed = seq_give_editing(scene, FALSE);
Sequence *seq, *best_seq = NULL, *frame_seq = NULL;
int dist, best_dist;
best_dist = MAXFRAME*2;
best_dist = MAXFRAME * 2;
if (ed==NULL) return cfra;
if (ed == NULL) return cfra;
for (seq= ed->seqbasep->first; seq; seq= seq->next) {
dist = MAXFRAME*2;
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
dist = MAXFRAME * 2;
switch (side) {
case SEQ_SIDE_LEFT:
@@ -2310,7 +2317,7 @@ static int find_next_prev_edit(Scene *scene, int cfra, int side)
dist = seq->startdisp - cfra;
}
else if (seq->startdisp == cfra) {
frame_seq=seq;
frame_seq = seq;
}
break;
}
@@ -2331,13 +2338,13 @@ static int find_next_prev_edit(Scene *scene, int cfra, int side)
static int next_prev_edit_internal(Scene *scene, int side)
{
int change=0;
int change = 0;
int cfra = CFRA;
int nfra= find_next_prev_edit(scene, cfra, side);
int nfra = find_next_prev_edit(scene, cfra, side);
if (nfra != cfra) {
CFRA = nfra;
change= 1;
change = 1;
}
return change;
@@ -2346,12 +2353,12 @@ static int next_prev_edit_internal(Scene *scene, int side)
/* move frame to next edit point operator */
static int sequencer_next_edit_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Scene *scene = CTX_data_scene(C);
if (!next_prev_edit_internal(scene, SEQ_SIDE_RIGHT))
return OPERATOR_CANCELLED;
WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
return OPERATOR_FINISHED;
}
@@ -2368,7 +2375,7 @@ void SEQUENCER_OT_next_edit(wmOperatorType *ot)
ot->poll = sequencer_edit_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
}
@@ -2376,12 +2383,12 @@ void SEQUENCER_OT_next_edit(wmOperatorType *ot)
/* move frame to previous edit point operator */
static int sequencer_previous_edit_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Scene *scene = CTX_data_scene(C);
if (!next_prev_edit_internal(scene, SEQ_SIDE_LEFT))
return OPERATOR_CANCELLED;
WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
return OPERATOR_FINISHED;
}
@@ -2398,12 +2405,12 @@ void SEQUENCER_OT_previous_edit(wmOperatorType *ot)
ot->poll = sequencer_edit_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
}
static void swap_sequence(Scene* scene, Sequence* seqa, Sequence* seqb)
static void swap_sequence(Scene *scene, Sequence *seqa, Sequence *seqb)
{
int gap = seqb->startdisp - seqa->enddisp;
seqb->start = (seqb->start - seqb->startdisp) + seqa->startdisp;
@@ -2413,15 +2420,15 @@ static void swap_sequence(Scene* scene, Sequence* seqa, Sequence* seqb)
}
#if 0
static Sequence* sequence_find_parent(Scene* scene, Sequence* child)
static Sequence *sequence_find_parent(Scene *scene, Sequence *child)
{
Editing *ed= seq_give_editing(scene, FALSE);
Sequence *parent= NULL;
Editing *ed = seq_give_editing(scene, FALSE);
Sequence *parent = NULL;
Sequence *seq;
if (ed==NULL) return NULL;
if (ed == NULL) return NULL;
for (seq= ed->seqbasep->first; seq; seq= seq->next) {
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
if ( (seq != child) && seq_is_parent(seq, child) ) {
parent = seq;
break;
@@ -2434,13 +2441,13 @@ static Sequence* sequence_find_parent(Scene* scene, Sequence* child)
static int sequencer_swap_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Sequence *active_seq = seq_active_get(scene);
Sequence *seq, *iseq;
int side= RNA_enum_get(op->ptr, "side");
int side = RNA_enum_get(op->ptr, "side");
if (active_seq==NULL) return OPERATOR_CANCELLED;
if (active_seq == NULL) return OPERATOR_CANCELLED;
seq = find_next_prev_sequence(scene, active_seq, side, -1);
@@ -2462,17 +2469,17 @@ static int sequencer_swap_exec(bContext *C, wmOperator *op)
}
// XXX - should be a generic function
for (iseq= scene->ed->seqbasep->first; iseq; iseq= iseq->next) {
for (iseq = scene->ed->seqbasep->first; iseq; iseq = iseq->next) {
if ((iseq->type & SEQ_EFFECT) && (seq_is_parent(iseq, active_seq) || seq_is_parent(iseq, seq))) {
calc_sequence(scene, iseq);
}
}
/* do this in a new loop since both effects need to be calculated first */
for (iseq= scene->ed->seqbasep->first; iseq; iseq= iseq->next) {
for (iseq = scene->ed->seqbasep->first; iseq; iseq = iseq->next) {
if ((iseq->type & SEQ_EFFECT) && (seq_is_parent(iseq, active_seq) || seq_is_parent(iseq, seq))) {
/* this may now overlap */
if ( seq_test_overlap(ed->seqbasep, iseq) ) {
if (seq_test_overlap(ed->seqbasep, iseq) ) {
shuffle_seq(ed->seqbasep, iseq, scene);
}
}
@@ -2482,7 +2489,7 @@ static int sequencer_swap_exec(bContext *C, wmOperator *op)
sort_seq(scene);
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@@ -2502,7 +2509,7 @@ void SEQUENCER_OT_swap(wmOperatorType *ot)
ot->poll = sequencer_edit_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
RNA_def_enum(ot->srna, "side", prop_side_lr_types, SEQ_SIDE_RIGHT, "Side", "Side of the strip to swap");
@@ -2511,37 +2518,37 @@ void SEQUENCER_OT_swap(wmOperatorType *ot)
static int sequencer_rendersize_exec(bContext *C, wmOperator *UNUSED(op))
{
int retval = OPERATOR_CANCELLED;
Scene *scene= CTX_data_scene(C);
Scene *scene = CTX_data_scene(C);
Sequence *active_seq = seq_active_get(scene);
StripElem *se = NULL;
if (active_seq==NULL)
if (active_seq == NULL)
return OPERATOR_CANCELLED;
if (active_seq->strip) {
switch (active_seq->type) {
case SEQ_IMAGE:
se = give_stripelem(active_seq, scene->r.cfra);
break;
case SEQ_MOVIE:
se = active_seq->strip->stripdata;
break;
case SEQ_SCENE:
case SEQ_META:
case SEQ_RAM_SOUND:
case SEQ_HD_SOUND:
default:
break;
case SEQ_IMAGE:
se = give_stripelem(active_seq, scene->r.cfra);
break;
case SEQ_MOVIE:
se = active_seq->strip->stripdata;
break;
case SEQ_SCENE:
case SEQ_META:
case SEQ_RAM_SOUND:
case SEQ_HD_SOUND:
default:
break;
}
}
if (se) {
// prevent setting the render size if sequence values aren't initialized
if ( (se->orig_width > 0) && (se->orig_height > 0) ) {
scene->r.xsch= se->orig_width;
scene->r.ysch= se->orig_height;
WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
scene->r.xsch = se->orig_width;
scene->r.ysch = se->orig_height;
WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene);
retval = OPERATOR_FINISHED;
}
}
@@ -2561,7 +2568,7 @@ void SEQUENCER_OT_rendersize(wmOperatorType *ot)
ot->poll = sequencer_edit_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
}
@@ -2570,7 +2577,7 @@ static void seq_copy_del_sound(Scene *scene, Sequence *seq)
{
if (seq->type == SEQ_META) {
Sequence *iseq;
for (iseq= seq->seqbase.first; iseq; iseq= iseq->next) {
for (iseq = seq->seqbase.first; iseq; iseq = iseq->next) {
seq_copy_del_sound(scene, iseq);
}
}
@@ -2583,15 +2590,15 @@ static void seq_copy_del_sound(Scene *scene, Sequence *seq)
/* TODO, validate scenes */
static int sequencer_copy_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Sequence *seq;
ListBase nseqbase= {NULL, NULL};
ListBase nseqbase = {NULL, NULL};
seq_free_clipboard();
if (seqbase_isolated_sel_check(ed->seqbasep)==FALSE) {
if (seqbase_isolated_sel_check(ed->seqbasep) == FALSE) {
BKE_report(op->reports, RPT_ERROR, "Please select all related strips");
return OPERATOR_CANCELLED;
}
@@ -2605,7 +2612,7 @@ static int sequencer_copy_exec(bContext *C, wmOperator *op)
Sequence *seq, *first_seq = nseqbase.first;
BLI_movelisttolist(ed->seqbasep, &nseqbase);
for (seq=first_seq; seq; seq=seq->next)
for (seq = first_seq; seq; seq = seq->next)
seq_recursive_apply(seq, apply_unique_name_cb, scene);
seqbase_clipboard.first = first_seq;
@@ -2618,10 +2625,10 @@ static int sequencer_copy_exec(bContext *C, wmOperator *op)
}
}
seqbase_clipboard_frame= scene->r.cfra;
seqbase_clipboard_frame = scene->r.cfra;
/* Need to remove anything that references the current scene */
for (seq= seqbase_clipboard.first; seq; seq= seq->next) {
for (seq = seqbase_clipboard.first; seq; seq = seq->next) {
seq_copy_del_sound(scene, seq);
}
@@ -2649,7 +2656,7 @@ static void seq_paste_add_sound(Scene *scene, Sequence *seq)
{
if (seq->type == SEQ_META) {
Sequence *iseq;
for (iseq= seq->seqbase.first; iseq; iseq= iseq->next) {
for (iseq = seq->seqbase.first; iseq; iseq = iseq->next) {
seq_paste_add_sound(scene, iseq);
}
}
@@ -2660,8 +2667,8 @@ static void seq_paste_add_sound(Scene *scene, Sequence *seq)
static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, TRUE); /* create if needed */
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, TRUE); /* create if needed */
ListBase nseqbase = {NULL, NULL};
int ofs;
Sequence *iseq;
@@ -2673,7 +2680,7 @@ static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op))
/* transform pasted strips before adding */
if (ofs) {
for (iseq= nseqbase.first; iseq; iseq= iseq->next) {
for (iseq = nseqbase.first; iseq; iseq = iseq->next) {
seq_translate(scene, iseq, ofs);
seq_sound_init(scene, iseq);
}
@@ -2684,14 +2691,14 @@ static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op))
BLI_movelisttolist(ed->seqbasep, &nseqbase);
/* make sure the pasted strips have unique names between them */
for (; iseq; iseq=iseq->next) {
for (; iseq; iseq = iseq->next) {
seq_recursive_apply(iseq, apply_unique_name_cb, scene);
/* restore valid sound_scene for newly added strips */
seq_paste_add_sound(scene, iseq);
}
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@@ -2708,14 +2715,14 @@ void SEQUENCER_OT_paste(wmOperatorType *ot)
ot->poll = ED_operator_sequencer_active;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
}
static int sequencer_swap_data_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
Scene *scene = CTX_data_scene(C);
Sequence *seq_act;
Sequence *seq_other;
const char *error_msg;
@@ -2733,16 +2740,16 @@ static int sequencer_swap_data_exec(bContext *C, wmOperator *op)
sound_remove_scene_sound(scene, seq_act->scene_sound);
sound_remove_scene_sound(scene, seq_other->scene_sound);
seq_act->scene_sound= NULL;
seq_other->scene_sound= NULL;
seq_act->scene_sound = NULL;
seq_other->scene_sound = NULL;
calc_sequence(scene, seq_act);
calc_sequence(scene, seq_other);
if (seq_act->sound) sound_add_scene_sound_defaults(scene, seq_act);
if (seq_other->sound) sound_add_scene_sound_defaults(scene, seq_other);
if (seq_act->sound) sound_add_scene_sound_defaults(scene, seq_act);
if (seq_other->sound) sound_add_scene_sound_defaults(scene, seq_other);
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@@ -2759,7 +2766,7 @@ void SEQUENCER_OT_swap_data(wmOperatorType *ot)
ot->poll = ED_operator_sequencer_active;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
}
@@ -2767,9 +2774,9 @@ void SEQUENCER_OT_swap_data(wmOperatorType *ot)
/* borderselect operator */
static int view_ghost_border_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
View2D *v2d= UI_view2d_fromcontext(C);
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
View2D *v2d = UI_view2d_fromcontext(C);
rctf rect;
@@ -2777,7 +2784,7 @@ static int view_ghost_border_exec(bContext *C, wmOperator *op)
UI_view2d_region_to_view(v2d, RNA_int_get(op->ptr, "xmin"), RNA_int_get(op->ptr, "ymin"), &rect.xmin, &rect.ymin);
UI_view2d_region_to_view(v2d, RNA_int_get(op->ptr, "xmax"), RNA_int_get(op->ptr, "ymax"), &rect.xmax, &rect.ymax);
if (ed==NULL)
if (ed == NULL)
return OPERATOR_CANCELLED;
rect.xmin /= (float)(ABS(v2d->tot.xmax - v2d->tot.xmin));
@@ -2786,19 +2793,19 @@ static int view_ghost_border_exec(bContext *C, wmOperator *op)
rect.xmax /= (float)(ABS(v2d->tot.xmax - v2d->tot.xmin));
rect.ymax /= (float)(ABS(v2d->tot.ymax - v2d->tot.ymin));
rect.xmin+=0.5f;
rect.xmax+=0.5f;
rect.ymin+=0.5f;
rect.ymax+=0.5f;
rect.xmin += 0.5f;
rect.xmax += 0.5f;
rect.ymin += 0.5f;
rect.ymax += 0.5f;
CLAMP(rect.xmin, 0.0f, 1.0f);
CLAMP(rect.ymin, 0.0f, 1.0f);
CLAMP(rect.xmax, 0.0f, 1.0f);
CLAMP(rect.ymax, 0.0f, 1.0f);
scene->ed->over_border= rect;
scene->ed->over_border = rect;
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@@ -2859,24 +2866,24 @@ static EnumPropertyItem prop_change_effect_input_types[] = {
static int sequencer_change_effect_input_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
Sequence *seq= seq_active_get(scene);
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Sequence *seq = seq_active_get(scene);
Sequence **seq_1, **seq_2;
switch(RNA_enum_get(op->ptr, "swap")) {
switch (RNA_enum_get(op->ptr, "swap")) {
case 0:
seq_1= &seq->seq1;
seq_2= &seq->seq2;
seq_1 = &seq->seq1;
seq_2 = &seq->seq2;
break;
case 1:
seq_1= &seq->seq2;
seq_2= &seq->seq3;
seq_1 = &seq->seq2;
seq_2 = &seq->seq3;
break;
default: /* 2 */
seq_1= &seq->seq1;
seq_2= &seq->seq3;
seq_1 = &seq->seq1;
seq_2 = &seq->seq3;
break;
}
@@ -2893,7 +2900,7 @@ static int sequencer_change_effect_input_exec(bContext *C, wmOperator *op)
/* important else we don't get the imbuf cache flushed */
free_imbuf_seq(scene, &ed->seqbase, FALSE, FALSE);
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@@ -2910,17 +2917,17 @@ void SEQUENCER_OT_change_effect_input(struct wmOperatorType *ot)
ot->poll = sequencer_effect_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
ot->prop = RNA_def_enum(ot->srna, "swap", prop_change_effect_input_types, 0, "Swap", "The effect inputs to swap");
}
static int sequencer_change_effect_type_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
Sequence *seq= seq_active_get(scene);
const int new_type= RNA_enum_get(op->ptr, "type");
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Sequence *seq = seq_active_get(scene);
const int new_type = RNA_enum_get(op->ptr, "type");
/* free previous effect and init new effect */
struct SeqEffectHandle sh;
@@ -2932,8 +2939,8 @@ static int sequencer_change_effect_type_exec(bContext *C, wmOperator *op)
/* can someone explain the logic behind only allowing to increase this,
* copied from 2.4x - campbell */
if (get_sequence_effect_num_inputs(seq->type) <
get_sequence_effect_num_inputs(new_type)
) {
get_sequence_effect_num_inputs(new_type))
{
BKE_report(op->reports, RPT_ERROR, "New effect needs more input strips");
return OPERATOR_CANCELLED;
}
@@ -2941,7 +2948,7 @@ static int sequencer_change_effect_type_exec(bContext *C, wmOperator *op)
sh = get_sequence_effect(seq);
sh.free(seq);
seq->type= new_type;
seq->type = new_type;
sh = get_sequence_effect(seq);
sh.init(seq);
@@ -2953,7 +2960,7 @@ static int sequencer_change_effect_type_exec(bContext *C, wmOperator *op)
/* important else we don't get the imbuf cache flushed */
free_imbuf_seq(scene, &ed->seqbase, FALSE, FALSE);
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
@@ -2970,25 +2977,25 @@ void SEQUENCER_OT_change_effect_type(struct wmOperatorType *ot)
ot->poll = sequencer_effect_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
ot->prop = RNA_def_enum(ot->srna, "type", sequencer_prop_effect_types, SEQ_CROSS, "Type", "Sequencer effect type");
}
static int sequencer_change_path_exec(bContext *C, wmOperator *op)
{
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
Sequence *seq= seq_active_get(scene);
const int is_relative_path= RNA_boolean_get(op->ptr, "relative_path");
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Sequence *seq = seq_active_get(scene);
const int is_relative_path = RNA_boolean_get(op->ptr, "relative_path");
if (seq->type == SEQ_IMAGE) {
char directory[FILE_MAX];
const int len= RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files"));
const int len = RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files"));
StripElem *se;
if (len==0)
if (len == 0)
return OPERATOR_CANCELLED;
RNA_string_get(op->ptr, "directory", directory);
@@ -3003,10 +3010,10 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op)
if (seq->strip->stripdata) {
MEM_freeN(seq->strip->stripdata);
}
seq->strip->stripdata= se= MEM_callocN(len*sizeof(StripElem), "stripelem");
seq->strip->stripdata = se = MEM_callocN(len * sizeof(StripElem), "stripelem");
RNA_BEGIN(op->ptr, itemptr, "files") {
char *filename= RNA_string_get_alloc(&itemptr, "name", NULL, 0);
char *filename = RNA_string_get_alloc(&itemptr, "name", NULL, 0);
BLI_strncpy(se->name, filename, sizeof(se->name));
MEM_freeN(filename);
se++;
@@ -3014,7 +3021,7 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op)
RNA_END;
/* reset these else we wont see all the images */
seq->anim_startofs= seq->anim_endofs= 0;
seq->anim_startofs = seq->anim_endofs = 0;
/* correct start/end frames so we don't move
* important not to set seq->len= len; allow the function to handle it */
@@ -3034,20 +3041,20 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op)
RNA_pointer_create(&scene->id, &RNA_Sequence, seq, &seq_ptr);
RNA_string_get(op->ptr, "filepath", filepath);
prop= RNA_struct_find_property(&seq_ptr, "filepath");
prop = RNA_struct_find_property(&seq_ptr, "filepath");
RNA_property_string_set(&seq_ptr, prop, filepath);
RNA_property_update(C, &seq_ptr, prop);
}
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
static int sequencer_change_path_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
Scene *scene= CTX_data_scene(C);
Sequence *seq= seq_active_get(scene);
Scene *scene = CTX_data_scene(C);
Sequence *seq = seq_active_get(scene);
RNA_string_set(op->ptr, "directory", seq->strip->dir);
@@ -3077,8 +3084,8 @@ void SEQUENCER_OT_change_path(struct wmOperatorType *ot)
ot->poll = sequencer_strip_has_path_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_DIRECTORY|WM_FILESEL_RELPATH|WM_FILESEL_FILEPATH|WM_FILESEL_FILES, FILE_DEFAULTDISPLAY);
WM_operator_properties_filesel(ot, FOLDERFILE | IMAGEFILE | MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_DIRECTORY | WM_FILESEL_RELPATH | WM_FILESEL_FILEPATH | WM_FILESEL_FILES, FILE_DEFAULTDISPLAY);
}

View File

@@ -136,33 +136,33 @@ void sequencer_keymap(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "SEQUENCER_OT_properties", NKEY, KM_PRESS, 0, 0);
kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select_all", AKEY, KM_PRESS, 0, 0);
RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE);
RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE);
kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_cut", KKEY, KM_PRESS, 0, 0);
RNA_enum_set(kmi->ptr, "type", SEQ_CUT_SOFT);
RNA_enum_set(kmi->ptr, "type", SEQ_CUT_SOFT);
kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_cut", KKEY, KM_PRESS, KM_SHIFT, 0);
RNA_enum_set(kmi->ptr, "type", SEQ_CUT_HARD);
RNA_enum_set(kmi->ptr, "type", SEQ_CUT_HARD);
kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_mute", HKEY, KM_PRESS, 0, 0);
RNA_boolean_set(kmi->ptr, "unselected", FALSE);
RNA_boolean_set(kmi->ptr, "unselected", FALSE);
kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_mute", HKEY, KM_PRESS, KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "unselected", TRUE);
RNA_boolean_set(kmi->ptr, "unselected", TRUE);
kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_unmute", HKEY, KM_PRESS, KM_ALT, 0);
RNA_boolean_set(kmi->ptr, "unselected", FALSE);
kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_unmute", HKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "unselected", TRUE);
RNA_boolean_set(kmi->ptr, "unselected", FALSE);
kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_unmute", HKEY, KM_PRESS, KM_ALT | KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "unselected", TRUE);
WM_keymap_add_item(keymap, "SEQUENCER_OT_lock", LKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "SEQUENCER_OT_unlock", LKEY, KM_PRESS, KM_SHIFT|KM_ALT, 0);
WM_keymap_add_item(keymap, "SEQUENCER_OT_unlock", LKEY, KM_PRESS, KM_SHIFT | KM_ALT, 0);
WM_keymap_add_item(keymap, "SEQUENCER_OT_reassign_inputs", RKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "SEQUENCER_OT_reload", RKEY, KM_PRESS, KM_ALT, 0);
kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_reload", RKEY, KM_PRESS, KM_SHIFT|KM_ALT, 0);
RNA_boolean_set(kmi->ptr, "adjust_length", TRUE);
kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_reload", RKEY, KM_PRESS, KM_SHIFT | KM_ALT, 0);
RNA_boolean_set(kmi->ptr, "adjust_length", TRUE);
WM_keymap_add_item(keymap, "SEQUENCER_OT_offset_clear", OKEY, KM_PRESS, KM_ALT, 0);
@@ -197,25 +197,25 @@ void sequencer_keymap(wmKeyConfig *keyconf)
* regular number keys */
{
int keys[] = { ONEKEY, TWOKEY, THREEKEY, FOURKEY, FIVEKEY,
SIXKEY, SEVENKEY, EIGHTKEY, NINEKEY, ZEROKEY };
SIXKEY, SEVENKEY, EIGHTKEY, NINEKEY, ZEROKEY };
int i;
for (i = 1; i <= 10; i++) {
RNA_int_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_cut_multicam", keys[i-1], KM_PRESS, 0, 0)->ptr, "camera", i);
RNA_int_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_cut_multicam", keys[i - 1], KM_PRESS, 0, 0)->ptr, "camera", i);
}
}
/* Mouse selection, a bit verbose :/ */
kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, 0, 0);
RNA_boolean_set(kmi->ptr, "extend", FALSE);
RNA_boolean_set(kmi->ptr, "linked_handle", FALSE);
RNA_boolean_set(kmi->ptr, "left_right", FALSE);
RNA_boolean_set(kmi->ptr, "linked_time", FALSE);
RNA_boolean_set(kmi->ptr, "extend", FALSE);
RNA_boolean_set(kmi->ptr, "linked_handle", FALSE);
RNA_boolean_set(kmi->ptr, "left_right", FALSE);
RNA_boolean_set(kmi->ptr, "linked_time", FALSE);
kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "extend", TRUE);
RNA_boolean_set(kmi->ptr, "linked_handle", FALSE);
RNA_boolean_set(kmi->ptr, "left_right", FALSE);
RNA_boolean_set(kmi->ptr, "linked_time", FALSE);
RNA_boolean_set(kmi->ptr, "extend", TRUE);
RNA_boolean_set(kmi->ptr, "linked_handle", FALSE);
RNA_boolean_set(kmi->ptr, "left_right", FALSE);
RNA_boolean_set(kmi->ptr, "linked_time", FALSE);
/* 2.4x method, now use Alt for handles and select the side based on which handle was selected */
@@ -225,50 +225,50 @@ void sequencer_keymap(wmKeyConfig *keyconf)
kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
RNA_boolean_set(kmi->ptr, "linked_right", TRUE);
kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL|KM_ALT, 0);
kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL | KM_ALT, 0);
RNA_boolean_set(kmi->ptr, "linked_left", TRUE);
RNA_boolean_set(kmi->ptr, "linked_right", TRUE);
kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_CTRL|KM_ALT, 0);
kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT | KM_CTRL | KM_ALT, 0);
RNA_boolean_set(kmi->ptr, "extend", TRUE);
RNA_boolean_set(kmi->ptr, "linked_left", TRUE);
RNA_boolean_set(kmi->ptr, "linked_right", TRUE);
kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
RNA_boolean_set(kmi->ptr, "extend", TRUE);
RNA_boolean_set(kmi->ptr, "linked_left", TRUE);
kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_ALT, 0);
kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT | KM_ALT, 0);
RNA_boolean_set(kmi->ptr, "extend", TRUE);
RNA_boolean_set(kmi->ptr, "linked_right", TRUE);
#endif
/* 2.5 method, Alt and use selected handle */
kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
RNA_boolean_set(kmi->ptr, "extend", FALSE);
RNA_boolean_set(kmi->ptr, "linked_handle", TRUE);
RNA_boolean_set(kmi->ptr, "left_right", FALSE);
RNA_boolean_set(kmi->ptr, "linked_time", FALSE);
RNA_boolean_set(kmi->ptr, "extend", FALSE);
RNA_boolean_set(kmi->ptr, "linked_handle", TRUE);
RNA_boolean_set(kmi->ptr, "left_right", FALSE);
RNA_boolean_set(kmi->ptr, "linked_time", FALSE);
kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_ALT, 0);
RNA_boolean_set(kmi->ptr, "extend", TRUE);
RNA_boolean_set(kmi->ptr, "linked_handle", TRUE);
RNA_boolean_set(kmi->ptr, "left_right", FALSE);
RNA_boolean_set(kmi->ptr, "linked_time", FALSE);
kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT | KM_ALT, 0);
RNA_boolean_set(kmi->ptr, "extend", TRUE);
RNA_boolean_set(kmi->ptr, "linked_handle", TRUE);
RNA_boolean_set(kmi->ptr, "left_right", FALSE);
RNA_boolean_set(kmi->ptr, "linked_time", FALSE);
/* match action editor */
kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
RNA_boolean_set(kmi->ptr, "extend", FALSE);
RNA_boolean_set(kmi->ptr, "linked_handle", FALSE);
RNA_boolean_set(kmi->ptr, "left_right", TRUE); /* grr, these conflict - only use left_right if not over an active seq */
RNA_boolean_set(kmi->ptr, "linked_time", TRUE);
RNA_boolean_set(kmi->ptr, "extend", FALSE);
RNA_boolean_set(kmi->ptr, "linked_handle", FALSE);
RNA_boolean_set(kmi->ptr, "left_right", TRUE); /* grr, these conflict - only use left_right if not over an active seq */
RNA_boolean_set(kmi->ptr, "linked_time", TRUE);
/* adjusted since 2.4 */
kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
RNA_boolean_set(kmi->ptr, "extend", TRUE);
RNA_boolean_set(kmi->ptr, "linked_handle", FALSE);
RNA_boolean_set(kmi->ptr, "left_right", FALSE);
RNA_boolean_set(kmi->ptr, "linked_time", TRUE);
kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
RNA_boolean_set(kmi->ptr, "extend", TRUE);
RNA_boolean_set(kmi->ptr, "linked_handle", FALSE);
RNA_boolean_set(kmi->ptr, "left_right", FALSE);
RNA_boolean_set(kmi->ptr, "linked_time", TRUE);
WM_keymap_add_item(keymap, "SEQUENCER_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "SEQUENCER_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0);

View File

@@ -41,27 +41,27 @@
* only difference is it does some normalize after, need to double check on this - campbell */
static void rgb_to_yuv_normalized(const float rgb[3], float yuv[3])
{
yuv[0]= 0.299f*rgb[0] + 0.587f*rgb[1] + 0.114f*rgb[2];
yuv[1]= 0.492f*(rgb[2] - yuv[0]);
yuv[2]= 0.877f*(rgb[0] - yuv[0]);
yuv[0] = 0.299f * rgb[0] + 0.587f * rgb[1] + 0.114f * rgb[2];
yuv[1] = 0.492f * (rgb[2] - yuv[0]);
yuv[2] = 0.877f * (rgb[0] - yuv[0]);
/* Normalize */
yuv[1]*= 255.0f/(122*2.0f);
yuv[1]+= 0.5f;
/* Normalize */
yuv[1] *= 255.0f / (122 * 2.0f);
yuv[1] += 0.5f;
yuv[2]*= 255.0f/(157*2.0f);
yuv[2]+= 0.5f;
yuv[2] *= 255.0f / (157 * 2.0f);
yuv[2] += 0.5f;
}
static void scope_put_pixel(unsigned char* table, unsigned char * pos)
static void scope_put_pixel(unsigned char *table, unsigned char *pos)
{
char newval = table[*pos];
pos[0] = pos[1] = pos[2] = newval;
pos[3] = 255;
}
static void scope_put_pixel_single(unsigned char* table, unsigned char * pos,
int col)
static void scope_put_pixel_single(unsigned char *table, unsigned char *pos,
int col)
{
char newval = table[pos[col]];
pos[col] = newval;
@@ -69,10 +69,10 @@ static void scope_put_pixel_single(unsigned char* table, unsigned char * pos,
}
static void wform_put_line(int w,
unsigned char * last_pos, unsigned char * new_pos)
unsigned char *last_pos, unsigned char *new_pos)
{
if (last_pos > new_pos) {
unsigned char* temp = new_pos;
unsigned char *temp = new_pos;
new_pos = last_pos;
last_pos = temp;
}
@@ -82,15 +82,15 @@ static void wform_put_line(int w,
last_pos[0] = last_pos[1] = last_pos[2] = 32;
last_pos[3] = 255;
}
last_pos += 4*w;
last_pos += 4 * w;
}
}
static void wform_put_line_single(
int w, unsigned char * last_pos, unsigned char * new_pos, int col)
int w, unsigned char *last_pos, unsigned char *new_pos, int col)
{
if (last_pos > new_pos) {
unsigned char* temp = new_pos;
unsigned char *temp = new_pos;
new_pos = last_pos;
last_pos = temp;
}
@@ -100,16 +100,16 @@ static void wform_put_line_single(
last_pos[col] = 32;
last_pos[3] = 255;
}
last_pos += 4*w;
last_pos += 4 * w;
}
}
static void wform_put_border(unsigned char * tgt, int w, int h)
static void wform_put_border(unsigned char *tgt, int w, int h)
{
int x, y;
for (x = 0; x < w; x++) {
unsigned char * p = tgt + 4 * x;
unsigned char *p = tgt + 4 * x;
p[1] = p[3] = 255.0;
p[4 * w + 1] = p[4 * w + 3] = 255.0;
p = tgt + 4 * (w * (h - 1) + x);
@@ -118,7 +118,7 @@ static void wform_put_border(unsigned char * tgt, int w, int h)
}
for (y = 0; y < h; y++) {
unsigned char * p = tgt + 4 * w * y;
unsigned char *p = tgt + 4 * w * y;
p[1] = p[3] = 255.0;
p[4 + 1] = p[4 + 3] = 255.0;
p = tgt + 4 * (w * y + w - 1);
@@ -127,32 +127,32 @@ static void wform_put_border(unsigned char * tgt, int w, int h)
}
}
static void wform_put_gridrow(unsigned char * tgt, float perc, int w, int h)
static void wform_put_gridrow(unsigned char *tgt, float perc, int w, int h)
{
int i;
tgt += (int) (perc/100.0f * h) * w * 4;
tgt += (int) (perc / 100.0f * h) * w * 4;
for (i = 0; i < w*2; i++) {
for (i = 0; i < w * 2; i++) {
tgt[0] = 255;
tgt += 4;
}
}
static void wform_put_grid(unsigned char * tgt, int w, int h)
static void wform_put_grid(unsigned char *tgt, int w, int h)
{
wform_put_gridrow(tgt, 90.0, w, h);
wform_put_gridrow(tgt, 70.0, w, h);
wform_put_gridrow(tgt, 10.0, w, h);
}
static struct ImBuf *make_waveform_view_from_ibuf_byte(struct ImBuf * ibuf)
static ImBuf *make_waveform_view_from_ibuf_byte(ImBuf *ibuf)
{
struct ImBuf * rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect);
int x,y;
unsigned char* src = (unsigned char*) ibuf->rect;
unsigned char* tgt = (unsigned char*) rval->rect;
ImBuf *rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect);
int x, y;
unsigned char *src = (unsigned char *) ibuf->rect;
unsigned char *tgt = (unsigned char *) rval->rect;
int w = ibuf->x + 3;
int h = 515;
float waveform_gamma = 0.2;
@@ -161,17 +161,17 @@ static struct ImBuf *make_waveform_view_from_ibuf_byte(struct ImBuf * ibuf)
wform_put_grid(tgt, w, h);
for (x = 0; x < 256; x++) {
wtable[x] = (unsigned char) (pow(((float) x + 1)/256,
waveform_gamma)*255);
wtable[x] = (unsigned char) (pow(((float) x + 1) / 256,
waveform_gamma) * 255);
}
for (y = 0; y < ibuf->y; y++) {
unsigned char * last_p = NULL;
unsigned char *last_p = NULL;
for (x = 0; x < ibuf->x; x++) {
unsigned char * rgb = src + 4 * (ibuf->x * y + x);
unsigned char *rgb = src + 4 * (ibuf->x * y + x);
float v = (float)rgb_to_luma_byte(rgb) / 255.0f;
unsigned char * p = tgt;
unsigned char *p = tgt;
p += 4 * (w * ((int) (v * (h - 3)) + 1) + x + 1);
scope_put_pixel(wtable, p);
@@ -190,12 +190,12 @@ static struct ImBuf *make_waveform_view_from_ibuf_byte(struct ImBuf * ibuf)
return rval;
}
static struct ImBuf *make_waveform_view_from_ibuf_float(struct ImBuf * ibuf)
static ImBuf *make_waveform_view_from_ibuf_float(ImBuf *ibuf)
{
struct ImBuf * rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect);
int x,y;
float* src = ibuf->rect_float;
unsigned char* tgt = (unsigned char*) rval->rect;
ImBuf *rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect);
int x, y;
float *src = ibuf->rect_float;
unsigned char *tgt = (unsigned char *) rval->rect;
int w = ibuf->x + 3;
int h = 515;
float waveform_gamma = 0.2;
@@ -204,17 +204,17 @@ static struct ImBuf *make_waveform_view_from_ibuf_float(struct ImBuf * ibuf)
wform_put_grid(tgt, w, h);
for (x = 0; x < 256; x++) {
wtable[x] = (unsigned char) (pow(((float) x + 1)/256,
waveform_gamma)*255);
wtable[x] = (unsigned char) (pow(((float) x + 1) / 256,
waveform_gamma) * 255);
}
for (y = 0; y < ibuf->y; y++) {
unsigned char * last_p = NULL;
unsigned char *last_p = NULL;
for (x = 0; x < ibuf->x; x++) {
float * rgb = src + 4 * (ibuf->x * y + x);
float *rgb = src + 4 * (ibuf->x * y + x);
float v = rgb_to_luma(rgb);
unsigned char * p = tgt;
unsigned char *p = tgt;
CLAMP(v, 0.0f, 1.0f);
@@ -236,7 +236,7 @@ static struct ImBuf *make_waveform_view_from_ibuf_float(struct ImBuf * ibuf)
return rval;
}
struct ImBuf *make_waveform_view_from_ibuf(struct ImBuf * ibuf)
ImBuf *make_waveform_view_from_ibuf(ImBuf *ibuf)
{
if (ibuf->rect_float) {
return make_waveform_view_from_ibuf_float(ibuf);
@@ -247,15 +247,14 @@ struct ImBuf *make_waveform_view_from_ibuf(struct ImBuf * ibuf)
}
static struct ImBuf *make_sep_waveform_view_from_ibuf_byte(struct ImBuf * ibuf)
{
struct ImBuf * rval = IMB_allocImBuf(
ibuf->x + 3, 515, 32, IB_rect);
int x,y;
unsigned char* src = (unsigned char*) ibuf->rect;
unsigned char* tgt = (unsigned char*) rval->rect;
static ImBuf *make_sep_waveform_view_from_ibuf_byte(ImBuf *ibuf){
ImBuf *rval = IMB_allocImBuf(
ibuf->x + 3, 515, 32, IB_rect);
int x, y;
unsigned char *src = (unsigned char *) ibuf->rect;
unsigned char *tgt = (unsigned char *) rval->rect;
int w = ibuf->x + 3;
int sw = ibuf->x/3;
int sw = ibuf->x / 3;
int h = 515;
float waveform_gamma = 0.2;
unsigned char wtable[256];
@@ -263,8 +262,8 @@ static struct ImBuf *make_sep_waveform_view_from_ibuf_byte(struct ImBuf * ibuf)
wform_put_grid(tgt, w, h);
for (x = 0; x < 256; x++) {
wtable[x] = (unsigned char) (pow(((float) x + 1)/256,
waveform_gamma)*255);
wtable[x] = (unsigned char) (pow(((float) x + 1) / 256,
waveform_gamma) * 255);
}
for (y = 0; y < ibuf->y; y++) {
@@ -272,11 +271,11 @@ static struct ImBuf *make_sep_waveform_view_from_ibuf_byte(struct ImBuf * ibuf)
for (x = 0; x < ibuf->x; x++) {
int c;
unsigned char * rgb = src + 4 * (ibuf->x * y + x);
unsigned char *rgb = src + 4 * (ibuf->x * y + x);
for (c = 0; c < 3; c++) {
unsigned char * p = tgt;
p += 4 * (w * ((rgb[c] * (h - 3))/255 + 1)
+ c * sw + x/3 + 1);
unsigned char *p = tgt;
p += 4 * (w * ((rgb[c] * (h - 3)) / 255 + 1)
+ c * sw + x / 3 + 1);
scope_put_pixel_single(wtable, p, c);
p += 4 * w;
@@ -284,7 +283,7 @@ static struct ImBuf *make_sep_waveform_view_from_ibuf_byte(struct ImBuf * ibuf)
if (last_p[c] != NULL) {
wform_put_line_single(
w, last_p[c], p, c);
w, last_p[c], p, c);
}
last_p[c] = p;
}
@@ -296,16 +295,14 @@ static struct ImBuf *make_sep_waveform_view_from_ibuf_byte(struct ImBuf * ibuf)
return rval;
}
static struct ImBuf *make_sep_waveform_view_from_ibuf_float(
struct ImBuf * ibuf)
static ImBuf *make_sep_waveform_view_from_ibuf_float(ImBuf *ibuf)
{
struct ImBuf * rval = IMB_allocImBuf(
ibuf->x + 3, 515, 32, IB_rect);
int x,y;
float* src = ibuf->rect_float;
unsigned char* tgt = (unsigned char*) rval->rect;
ImBuf *rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect);
int x, y;
float *src = ibuf->rect_float;
unsigned char *tgt = (unsigned char *) rval->rect;
int w = ibuf->x + 3;
int sw = ibuf->x/3;
int sw = ibuf->x / 3;
int h = 515;
float waveform_gamma = 0.2;
unsigned char wtable[256];
@@ -313,8 +310,8 @@ static struct ImBuf *make_sep_waveform_view_from_ibuf_float(
wform_put_grid(tgt, w, h);
for (x = 0; x < 256; x++) {
wtable[x] = (unsigned char) (pow(((float) x + 1)/256,
waveform_gamma)*255);
wtable[x] = (unsigned char) (pow(((float) x + 1) / 256,
waveform_gamma) * 255);
}
for (y = 0; y < ibuf->y; y++) {
@@ -322,15 +319,15 @@ static struct ImBuf *make_sep_waveform_view_from_ibuf_float(
for (x = 0; x < ibuf->x; x++) {
int c;
float * rgb = src + 4 * (ibuf->x * y + x);
float *rgb = src + 4 * (ibuf->x * y + x);
for (c = 0; c < 3; c++) {
unsigned char * p = tgt;
unsigned char *p = tgt;
float v = rgb[c];
CLAMP(v, 0.0f, 1.0f);
p += 4 * (w * ((int) (v * (h - 3)) + 1)
+ c * sw + x/3 + 1);
+ c * sw + x / 3 + 1);
scope_put_pixel_single(wtable, p, c);
p += 4 * w;
@@ -338,7 +335,7 @@ static struct ImBuf *make_sep_waveform_view_from_ibuf_float(
if (last_p[c] != NULL) {
wform_put_line_single(
w, last_p[c], p, c);
w, last_p[c], p, c);
}
last_p[c] = p;
}
@@ -350,7 +347,7 @@ static struct ImBuf *make_sep_waveform_view_from_ibuf_float(
return rval;
}
struct ImBuf *make_sep_waveform_view_from_ibuf(struct ImBuf * ibuf)
ImBuf *make_sep_waveform_view_from_ibuf(ImBuf *ibuf)
{
if (ibuf->rect_float) {
return make_sep_waveform_view_from_ibuf_float(ibuf);
@@ -360,11 +357,11 @@ struct ImBuf *make_sep_waveform_view_from_ibuf(struct ImBuf * ibuf)
}
}
static void draw_zebra_byte(struct ImBuf * src,struct ImBuf * ibuf, float perc)
static void draw_zebra_byte(ImBuf *src, ImBuf *ibuf, float perc)
{
unsigned int limit = 255.0f * perc / 100.0f;
unsigned char * p = (unsigned char*) src->rect;
unsigned char * o = (unsigned char*) ibuf->rect;
unsigned char *p = (unsigned char *) src->rect;
unsigned char *o = (unsigned char *) ibuf->rect;
int x;
int y;
@@ -391,11 +388,11 @@ static void draw_zebra_byte(struct ImBuf * src,struct ImBuf * ibuf, float perc)
}
static void draw_zebra_float(struct ImBuf * src,struct ImBuf * ibuf,float perc)
static void draw_zebra_float(ImBuf *src, ImBuf *ibuf, float perc)
{
float limit = perc / 100.0f;
float * p = src->rect_float;
unsigned char * o = (unsigned char*) ibuf->rect;
float *p = src->rect_float;
unsigned char *o = (unsigned char *) ibuf->rect;
int x;
int y;
@@ -422,9 +419,9 @@ static void draw_zebra_float(struct ImBuf * src,struct ImBuf * ibuf,float perc)
}
}
struct ImBuf * make_zebra_view_from_ibuf(struct ImBuf * src, float perc)
ImBuf *make_zebra_view_from_ibuf(ImBuf *src, float perc)
{
struct ImBuf * ibuf = IMB_allocImBuf(src->x, src->y, 32, IB_rect);
ImBuf *ibuf = IMB_allocImBuf(src->x, src->y, 32, IB_rect);
if (src->rect_float) {
draw_zebra_float(src, ibuf, perc);
@@ -435,23 +432,23 @@ struct ImBuf * make_zebra_view_from_ibuf(struct ImBuf * src, float perc)
return ibuf;
}
static void draw_histogram_marker(struct ImBuf * ibuf, int x)
static void draw_histogram_marker(ImBuf *ibuf, int x)
{
unsigned char * p = (unsigned char*) ibuf->rect;
unsigned char *p = (unsigned char *) ibuf->rect;
int barh = ibuf->y * 0.1;
int i;
p += 4 * (x + ibuf->x * (ibuf->y - barh + 1));
for (i = 0; i < barh-1; i++) {
for (i = 0; i < barh - 1; i++) {
p[0] = p[1] = p[2] = 255;
p += ibuf->x * 4;
}
}
static void draw_histogram_bar(struct ImBuf * ibuf, int x,float val, int col)
static void draw_histogram_bar(ImBuf *ibuf, int x, float val, int col)
{
unsigned char * p = (unsigned char*) ibuf->rect;
unsigned char *p = (unsigned char *) ibuf->rect;
int barh = ibuf->y * val * 0.9f;
int i;
@@ -463,17 +460,16 @@ static void draw_histogram_bar(struct ImBuf * ibuf, int x,float val, int col)
}
}
static struct ImBuf *make_histogram_view_from_ibuf_byte(
struct ImBuf * ibuf)
static ImBuf *make_histogram_view_from_ibuf_byte(ImBuf *ibuf)
{
struct ImBuf * rval = IMB_allocImBuf(515, 128, 32, IB_rect);
int c,x,y;
ImBuf *rval = IMB_allocImBuf(515, 128, 32, IB_rect);
int c, x, y;
unsigned int n;
unsigned char* src = (unsigned char*) ibuf->rect;
unsigned char *src = (unsigned char *) ibuf->rect;
unsigned int bins[3][256];
memset(bins, 0, 3 * 256* sizeof(unsigned int));
memset(bins, 0, 3 * 256 * sizeof(unsigned int));
for (y = 0; y < ibuf->y; y++) {
for (x = 0; x < ibuf->x; x++) {
@@ -495,14 +491,14 @@ static struct ImBuf *make_histogram_view_from_ibuf_byte(
for (c = 0; c < 3; c++) {
for (x = 0; x < 256; x++) {
draw_histogram_bar(rval, x*2+1,
((float) bins[c][x])/n, c);
draw_histogram_bar(rval, x*2+2,
((float) bins[c][x])/n, c);
draw_histogram_bar(rval, x * 2 + 1,
((float) bins[c][x]) / n, c);
draw_histogram_bar(rval, x * 2 + 2,
((float) bins[c][x]) / n, c);
}
}
wform_put_border((unsigned char*) rval->rect, rval->x, rval->y);
wform_put_border((unsigned char *) rval->rect, rval->x, rval->y);
return rval;
}
@@ -519,16 +515,15 @@ static int get_bin_float(float f)
return (int) (((f + 0.25f) / 1.5f) * 512);
}
static struct ImBuf *make_histogram_view_from_ibuf_float(
struct ImBuf * ibuf)
static ImBuf *make_histogram_view_from_ibuf_float(ImBuf *ibuf)
{
struct ImBuf * rval = IMB_allocImBuf(515, 128, 32, IB_rect);
int n,c,x,y;
float* src = ibuf->rect_float;
ImBuf *rval = IMB_allocImBuf(515, 128, 32, IB_rect);
int n, c, x, y;
float *src = ibuf->rect_float;
unsigned int bins[3][512];
memset(bins, 0, 3 * 256* sizeof(unsigned int));
memset(bins, 0, 3 * 256 * sizeof(unsigned int));
for (y = 0; y < ibuf->y; y++) {
for (x = 0; x < ibuf->x; x++) {
@@ -552,16 +547,16 @@ static struct ImBuf *make_histogram_view_from_ibuf_float(
}
for (c = 0; c < 3; c++) {
for (x = 0; x < 512; x++) {
draw_histogram_bar(rval, x+1, (float) bins[c][x]/n, c);
draw_histogram_bar(rval, x + 1, (float) bins[c][x] / n, c);
}
}
wform_put_border((unsigned char*) rval->rect, rval->x, rval->y);
wform_put_border((unsigned char *) rval->rect, rval->x, rval->y);
return rval;
}
struct ImBuf *make_histogram_view_from_ibuf(struct ImBuf * ibuf)
ImBuf *make_histogram_view_from_ibuf(ImBuf *ibuf)
{
if (ibuf->rect_float) {
return make_histogram_view_from_ibuf_float(ibuf);
@@ -572,21 +567,21 @@ struct ImBuf *make_histogram_view_from_ibuf(struct ImBuf * ibuf)
}
static void vectorscope_put_cross(unsigned char r, unsigned char g,
unsigned char b,
char * tgt, int w, int h, int size)
unsigned char b,
char *tgt, int w, int h, int size)
{
float rgb[3], yuv[3];
char * p;
char *p;
int x = 0;
int y = 0;
rgb[0]= (float)r/255.0f;
rgb[1]= (float)g/255.0f;
rgb[2]= (float)b/255.0f;
rgb[0] = (float)r / 255.0f;
rgb[1] = (float)g / 255.0f;
rgb[2] = (float)b / 255.0f;
rgb_to_yuv_normalized(rgb, yuv);
p = tgt + 4 * (w * (int) ((yuv[2] * (h - 3) + 1))
+ (int) ((yuv[1] * (w - 3) + 1)));
+ (int) ((yuv[1] * (w - 3) + 1)));
if (r == 0 && g == 0 && b == 0) {
r = 255;
@@ -594,18 +589,18 @@ static void vectorscope_put_cross(unsigned char r, unsigned char g,
for (y = -size; y <= size; y++) {
for (x = -size; x <= size; x++) {
char * q = p + 4 * (y * w + x);
char *q = p + 4 * (y * w + x);
q[0] = r; q[1] = g; q[2] = b; q[3] = 255;
}
}
}
static struct ImBuf *make_vectorscope_view_from_ibuf_byte(struct ImBuf * ibuf)
static ImBuf *make_vectorscope_view_from_ibuf_byte(ImBuf *ibuf)
{
struct ImBuf * rval = IMB_allocImBuf(515, 515, 32, IB_rect);
int x,y;
char* src = (char*) ibuf->rect;
char* tgt = (char*) rval->rect;
ImBuf *rval = IMB_allocImBuf(515, 515, 32, IB_rect);
int x, y;
char *src = (char *) ibuf->rect;
char *tgt = (char *) rval->rect;
float rgb[3], yuv[3];
int w = 515;
int h = 515;
@@ -613,14 +608,14 @@ static struct ImBuf *make_vectorscope_view_from_ibuf_byte(struct ImBuf * ibuf)
unsigned char wtable[256];
for (x = 0; x < 256; x++) {
wtable[x] = (unsigned char) (pow(((float) x + 1)/256,
scope_gamma)*255);
wtable[x] = (unsigned char) (pow(((float) x + 1) / 256,
scope_gamma) * 255);
}
for (x = 0; x <= 255; x++) {
vectorscope_put_cross(255 , 0,255 - x, tgt, w, h, 1);
vectorscope_put_cross(255 , x, 0, tgt, w, h, 1);
vectorscope_put_cross(255- x, 255, 0, tgt, w, h, 1);
vectorscope_put_cross(255, 0, 255 - x, tgt, w, h, 1);
vectorscope_put_cross(255, x, 0, tgt, w, h, 1);
vectorscope_put_cross(255 - x, 255, 0, tgt, w, h, 1);
vectorscope_put_cross(0, 255, x, tgt, w, h, 1);
vectorscope_put_cross(0, 255 - x, 255, tgt, w, h, 1);
vectorscope_put_cross(x, 0, 255, tgt, w, h, 1);
@@ -628,17 +623,17 @@ static struct ImBuf *make_vectorscope_view_from_ibuf_byte(struct ImBuf * ibuf)
for (y = 0; y < ibuf->y; y++) {
for (x = 0; x < ibuf->x; x++) {
char * src1 = src + 4 * (ibuf->x * y + x);
char * p;
char *src1 = src + 4 * (ibuf->x * y + x);
char *p;
rgb[0]= (float)src1[0]/255.0f;
rgb[1]= (float)src1[1]/255.0f;
rgb[2]= (float)src1[2]/255.0f;
rgb[0] = (float)src1[0] / 255.0f;
rgb[1] = (float)src1[1] / 255.0f;
rgb[2] = (float)src1[2] / 255.0f;
rgb_to_yuv_normalized(rgb, yuv);
p = tgt + 4 * (w * (int) ((yuv[2] * (h - 3) + 1))
+ (int) ((yuv[1] * (w - 3) + 1)));
scope_put_pixel(wtable, (unsigned char*)p);
+ (int) ((yuv[1] * (w - 3) + 1)));
scope_put_pixel(wtable, (unsigned char *)p);
}
}
@@ -647,12 +642,12 @@ static struct ImBuf *make_vectorscope_view_from_ibuf_byte(struct ImBuf * ibuf)
return rval;
}
static struct ImBuf *make_vectorscope_view_from_ibuf_float(struct ImBuf * ibuf)
static ImBuf *make_vectorscope_view_from_ibuf_float(ImBuf *ibuf)
{
struct ImBuf * rval = IMB_allocImBuf(515, 515, 32, IB_rect);
int x,y;
float* src = ibuf->rect_float;
char* tgt = (char*) rval->rect;
ImBuf *rval = IMB_allocImBuf(515, 515, 32, IB_rect);
int x, y;
float *src = ibuf->rect_float;
char *tgt = (char *) rval->rect;
float rgb[3], yuv[3];
int w = 515;
int h = 515;
@@ -660,14 +655,14 @@ static struct ImBuf *make_vectorscope_view_from_ibuf_float(struct ImBuf * ibuf)
unsigned char wtable[256];
for (x = 0; x < 256; x++) {
wtable[x] = (unsigned char) (pow(((float) x + 1)/256,
scope_gamma)*255);
wtable[x] = (unsigned char) (pow(((float) x + 1) / 256,
scope_gamma) * 255);
}
for (x = 0; x <= 255; x++) {
vectorscope_put_cross(255 , 0,255 - x, tgt, w, h, 1);
vectorscope_put_cross(255 , x, 0, tgt, w, h, 1);
vectorscope_put_cross(255- x, 255, 0, tgt, w, h, 1);
vectorscope_put_cross(255, 0, 255 - x, tgt, w, h, 1);
vectorscope_put_cross(255, x, 0, tgt, w, h, 1);
vectorscope_put_cross(255 - x, 255, 0, tgt, w, h, 1);
vectorscope_put_cross(0, 255, x, tgt, w, h, 1);
vectorscope_put_cross(0, 255 - x, 255, tgt, w, h, 1);
vectorscope_put_cross(x, 0, 255, tgt, w, h, 1);
@@ -675,8 +670,8 @@ static struct ImBuf *make_vectorscope_view_from_ibuf_float(struct ImBuf * ibuf)
for (y = 0; y < ibuf->y; y++) {
for (x = 0; x < ibuf->x; x++) {
float * src1 = src + 4 * (ibuf->x * y + x);
char * p;
float *src1 = src + 4 * (ibuf->x * y + x);
char *p;
memcpy(rgb, src1, 3 * sizeof(float));
@@ -687,8 +682,8 @@ static struct ImBuf *make_vectorscope_view_from_ibuf_float(struct ImBuf * ibuf)
rgb_to_yuv_normalized(rgb, yuv);
p = tgt + 4 * (w * (int) ((yuv[2] * (h - 3) + 1))
+ (int) ((yuv[1] * (w - 3) + 1)));
scope_put_pixel(wtable, (unsigned char*)p);
+ (int) ((yuv[1] * (w - 3) + 1)));
scope_put_pixel(wtable, (unsigned char *)p);
}
}
@@ -697,7 +692,7 @@ static struct ImBuf *make_vectorscope_view_from_ibuf_float(struct ImBuf * ibuf)
return rval;
}
struct ImBuf *make_vectorscope_view_from_ibuf(struct ImBuf * ibuf)
ImBuf *make_vectorscope_view_from_ibuf(ImBuf *ibuf)
{
if (ibuf->rect_float) {
return make_vectorscope_view_from_ibuf_float(ibuf);

View File

@@ -63,19 +63,22 @@
/* own include */
#include "sequencer_intern.h"
static void *find_nearest_marker(int UNUSED(d1), int UNUSED(d2)) {return NULL;}
static void *find_nearest_marker(int UNUSED(d1), int UNUSED(d2))
{
return NULL;
}
static void select_surrounding_handles(Scene *scene, Sequence *test) /* XXX BRING BACK */
{
Sequence *neighbor;
neighbor=find_neighboring_sequence(scene, test, SEQ_SIDE_LEFT, -1);
neighbor = find_neighboring_sequence(scene, test, SEQ_SIDE_LEFT, -1);
if (neighbor) {
neighbor->flag |= SELECT;
recurs_sel_seq(neighbor);
neighbor->flag |= SEQ_RIGHTSEL;
}
neighbor=find_neighboring_sequence(scene, test, SEQ_SIDE_RIGHT, -1);
neighbor = find_neighboring_sequence(scene, test, SEQ_SIDE_RIGHT, -1);
if (neighbor) {
neighbor->flag |= SELECT;
recurs_sel_seq(neighbor);
@@ -89,24 +92,24 @@ static void select_active_side(ListBase *seqbase, int sel_side, int channel, int
{
Sequence *seq;
for (seq= seqbase->first; seq; seq=seq->next) {
if (channel==seq->machine) {
switch(sel_side) {
case SEQ_SIDE_LEFT:
if (frame > (seq->startdisp)) {
seq->flag &= ~(SEQ_RIGHTSEL|SEQ_LEFTSEL);
seq->flag |= SELECT;
}
break;
case SEQ_SIDE_RIGHT:
if (frame < (seq->startdisp)) {
seq->flag &= ~(SEQ_RIGHTSEL|SEQ_LEFTSEL);
seq->flag |= SELECT;
}
break;
case SEQ_SIDE_BOTH:
seq->flag &= ~(SEQ_RIGHTSEL|SEQ_LEFTSEL);
break;
for (seq = seqbase->first; seq; seq = seq->next) {
if (channel == seq->machine) {
switch (sel_side) {
case SEQ_SIDE_LEFT:
if (frame > (seq->startdisp)) {
seq->flag &= ~(SEQ_RIGHTSEL | SEQ_LEFTSEL);
seq->flag |= SELECT;
}
break;
case SEQ_SIDE_RIGHT:
if (frame < (seq->startdisp)) {
seq->flag &= ~(SEQ_RIGHTSEL | SEQ_LEFTSEL);
seq->flag |= SELECT;
}
break;
case SEQ_SIDE_BOTH:
seq->flag &= ~(SEQ_RIGHTSEL | SEQ_LEFTSEL);
break;
}
}
}
@@ -117,28 +120,28 @@ static void select_linked_time(ListBase *seqbase, Sequence *seq_link)
{
Sequence *seq;
for (seq= seqbase->first; seq; seq=seq->next) {
for (seq = seqbase->first; seq; seq = seq->next) {
if (seq_link->machine != seq->machine) {
int left_match = (seq->startdisp == seq_link->startdisp) ? 1:0;
int right_match = (seq->enddisp == seq_link->enddisp) ? 1:0;
int left_match = (seq->startdisp == seq_link->startdisp) ? 1 : 0;
int right_match = (seq->enddisp == seq_link->enddisp) ? 1 : 0;
if (left_match && right_match) {
/* a direct match, copy the selection settinhs */
seq->flag &= ~(SELECT|SEQ_LEFTSEL|SEQ_RIGHTSEL);
seq->flag |= seq_link->flag & (SELECT|SEQ_LEFTSEL|SEQ_RIGHTSEL);
seq->flag &= ~(SELECT | SEQ_LEFTSEL | SEQ_RIGHTSEL);
seq->flag |= seq_link->flag & (SELECT | SEQ_LEFTSEL | SEQ_RIGHTSEL);
recurs_sel_seq(seq);
}
else if (seq_link->flag & SELECT && (left_match || right_match)) {
/* clear for reselection */
seq->flag &= ~(SEQ_LEFTSEL|SEQ_RIGHTSEL);
seq->flag &= ~(SEQ_LEFTSEL | SEQ_RIGHTSEL);
if (left_match && seq_link->flag & SEQ_LEFTSEL)
seq->flag |= SELECT|SEQ_LEFTSEL;
seq->flag |= SELECT | SEQ_LEFTSEL;
if (right_match && seq_link->flag & SEQ_RIGHTSEL)
seq->flag |= SELECT|SEQ_RIGHTSEL;
seq->flag |= SELECT | SEQ_RIGHTSEL;
recurs_sel_seq(seq);
}
@@ -149,9 +152,9 @@ static void select_linked_time(ListBase *seqbase, Sequence *seq_link)
#if 0 // BRING BACK
void select_surround_from_last(Scene *scene)
{
Sequence *seq=get_last_seq(scene);
Sequence *seq = get_last_seq(scene);
if (seq==NULL)
if (seq == NULL)
return;
select_surrounding_handles(scene, seq);
@@ -159,51 +162,51 @@ void select_surround_from_last(Scene *scene)
#endif
static void UNUSED_FUNCTION(select_single_seq)(Scene *scene, Sequence *seq, int deselect_all) /* BRING BACK */
static void UNUSED_FUNCTION(select_single_seq) (Scene * scene, Sequence * seq, int deselect_all) /* BRING BACK */
{
Editing *ed= seq_give_editing(scene, FALSE);
Editing *ed = seq_give_editing(scene, FALSE);
if (deselect_all)
deselect_all_seq(scene);
seq_active_set(scene, seq);
if ((seq->type==SEQ_IMAGE) || (seq->type==SEQ_MOVIE)) {
if ((seq->type == SEQ_IMAGE) || (seq->type == SEQ_MOVIE)) {
if (seq->strip)
BLI_strncpy(ed->act_imagedir, seq->strip->dir, FILE_MAXDIR);
}
else if (seq->type==SEQ_SOUND) {
else if (seq->type == SEQ_SOUND) {
if (seq->strip)
BLI_strncpy(ed->act_sounddir, seq->strip->dir, FILE_MAXDIR);
}
seq->flag|= SELECT;
seq->flag |= SELECT;
recurs_sel_seq(seq);
}
#if 0
static void select_neighbor_from_last(Scene *scene, int lr)
{
Sequence *seq= seq_active_get(scene);
Sequence *seq = seq_active_get(scene);
Sequence *neighbor;
int change = 0;
if (seq) {
neighbor=find_neighboring_sequence(scene, seq, lr, -1);
neighbor = find_neighboring_sequence(scene, seq, lr, -1);
if (neighbor) {
switch (lr) {
case SEQ_SIDE_LEFT:
neighbor->flag |= SELECT;
recurs_sel_seq(neighbor);
neighbor->flag |= SEQ_RIGHTSEL;
seq->flag |= SEQ_LEFTSEL;
break;
case SEQ_SIDE_RIGHT:
neighbor->flag |= SELECT;
recurs_sel_seq(neighbor);
neighbor->flag |= SEQ_LEFTSEL;
seq->flag |= SEQ_RIGHTSEL;
break;
case SEQ_SIDE_LEFT:
neighbor->flag |= SELECT;
recurs_sel_seq(neighbor);
neighbor->flag |= SEQ_RIGHTSEL;
seq->flag |= SEQ_LEFTSEL;
break;
case SEQ_SIDE_RIGHT:
neighbor->flag |= SELECT;
recurs_sel_seq(neighbor);
neighbor->flag |= SEQ_LEFTSEL;
seq->flag |= SEQ_RIGHTSEL;
break;
}
seq->flag |= SELECT;
change = 1;
seq->flag |= SELECT;
change = 1;
}
}
if (change) {
@@ -268,7 +271,7 @@ void SEQUENCER_OT_select_all(struct wmOperatorType *ot)
ot->poll = sequencer_edit_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
WM_operator_properties_select_all(ot);
}
@@ -277,21 +280,21 @@ void SEQUENCER_OT_select_all(struct wmOperatorType *ot)
/* (de)select operator */
static int sequencer_select_inverse_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
Sequence *seq;
for (seq= ed->seqbasep->first; seq; seq=seq->next) {
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
if (seq->flag & SELECT) {
seq->flag &= ~SEQ_ALLSEL;
}
else {
seq->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL);
seq->flag &= ~(SEQ_LEFTSEL + SEQ_RIGHTSEL);
seq->flag |= SELECT;
}
}
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER|NA_SELECTED, scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
return OPERATOR_FINISHED;
}
@@ -308,40 +311,40 @@ void SEQUENCER_OT_select_inverse(struct wmOperatorType *ot)
ot->poll = sequencer_edit_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
View2D *v2d= UI_view2d_fromcontext(C);
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
short extend= RNA_boolean_get(op->ptr, "extend");
short linked_handle= RNA_boolean_get(op->ptr, "linked_handle");
short left_right= RNA_boolean_get(op->ptr, "left_right");
short linked_time= RNA_boolean_get(op->ptr, "linked_time");
View2D *v2d = UI_view2d_fromcontext(C);
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
short extend = RNA_boolean_get(op->ptr, "extend");
short linked_handle = RNA_boolean_get(op->ptr, "linked_handle");
short left_right = RNA_boolean_get(op->ptr, "left_right");
short linked_time = RNA_boolean_get(op->ptr, "linked_time");
Sequence *seq,*neighbor, *act_orig;
int hand,sel_side;
Sequence *seq, *neighbor, *act_orig;
int hand, sel_side;
TimeMarker *marker;
if (ed==NULL)
if (ed == NULL)
return OPERATOR_CANCELLED;
marker=find_nearest_marker(SCE_MARKERS, 1); //XXX - dummy function for now
marker = find_nearest_marker(SCE_MARKERS, 1); //XXX - dummy function for now
seq= find_nearest_seq(scene, v2d, &hand, event->mval);
seq = find_nearest_seq(scene, v2d, &hand, event->mval);
// XXX - not nice, Ctrl+RMB needs to do left_right only when not over a strip
if (seq && linked_time && left_right)
left_right= FALSE;
left_right = FALSE;
if (marker) {
int oldflag;
/* select timeline marker */
if (extend) {
oldflag= marker->flag;
oldflag = marker->flag;
if (oldflag & SELECT)
marker->flag &= ~SELECT;
else
@@ -359,7 +362,8 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
deselect_all_seq(scene);
UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, NULL);
SEQP_BEGIN(ed, seq) {
SEQP_BEGIN(ed, seq)
{
if (x < CFRA) {
if (seq->enddisp < CFRA) {
seq->flag |= SELECT;
@@ -376,14 +380,14 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
SEQ_END
{
SpaceSeq *sseq= CTX_wm_space_seq(C);
SpaceSeq *sseq = CTX_wm_space_seq(C);
if (sseq && sseq->flag & SEQ_MARKER_TRANS) {
TimeMarker *tmarker;
for (tmarker= scene->markers.first; tmarker; tmarker= tmarker->next) {
if ( ((x < CFRA) && tmarker->frame < CFRA) ||
((x >= CFRA) && tmarker->frame >= CFRA)
) {
for (tmarker = scene->markers.first; tmarker; tmarker = tmarker->next) {
if (((x < CFRA) && tmarker->frame < CFRA) ||
((x >= CFRA) && tmarker->frame >= CFRA))
{
tmarker->flag |= SELECT;
}
else {
@@ -396,9 +400,9 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
else {
// seq= find_nearest_seq(scene, v2d, &hand, mval);
act_orig= ed->act_seq;
act_orig = ed->act_seq;
if (extend == 0 && linked_handle==0)
if (extend == 0 && linked_handle == 0)
deselect_all_seq(scene);
if (seq) {
@@ -416,29 +420,29 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
}
}
if (extend && (seq->flag & SELECT) && ed->act_seq == act_orig ) {
switch(hand) {
case SEQ_SIDE_NONE:
if (linked_handle==0)
seq->flag &= ~SEQ_ALLSEL;
break;
case SEQ_SIDE_LEFT:
seq->flag ^= SEQ_LEFTSEL;
break;
case SEQ_SIDE_RIGHT:
seq->flag ^= SEQ_RIGHTSEL;
break;
if (extend && (seq->flag & SELECT) && ed->act_seq == act_orig) {
switch (hand) {
case SEQ_SIDE_NONE:
if (linked_handle == 0)
seq->flag &= ~SEQ_ALLSEL;
break;
case SEQ_SIDE_LEFT:
seq->flag ^= SEQ_LEFTSEL;
break;
case SEQ_SIDE_RIGHT:
seq->flag ^= SEQ_RIGHTSEL;
break;
}
}
else {
seq->flag |= SELECT;
if (hand==SEQ_SIDE_LEFT) seq->flag |= SEQ_LEFTSEL;
if (hand==SEQ_SIDE_RIGHT) seq->flag |= SEQ_RIGHTSEL;
if (hand == SEQ_SIDE_LEFT) seq->flag |= SEQ_LEFTSEL;
if (hand == SEQ_SIDE_RIGHT) seq->flag |= SEQ_RIGHTSEL;
}
/* On Alt selection, select the strip and bordering handles */
if (linked_handle && !ELEM(hand, SEQ_SIDE_LEFT, SEQ_SIDE_RIGHT)) {
if (extend==0) deselect_all_seq(scene);
if (extend == 0) deselect_all_seq(scene);
seq->flag |= SELECT;
select_surrounding_handles(scene, seq);
}
@@ -448,48 +452,48 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
* Second click selects all strips in that direction.
* If there are no adjacent strips, it just selects all in that direction.
*/
sel_side= hand;
neighbor=find_neighboring_sequence(scene, seq, sel_side, -1);
sel_side = hand;
neighbor = find_neighboring_sequence(scene, seq, sel_side, -1);
if (neighbor) {
switch (sel_side) {
case SEQ_SIDE_LEFT:
if ((seq->flag & SEQ_LEFTSEL) && (neighbor->flag & SEQ_RIGHTSEL)) {
if (extend==0) deselect_all_seq(scene);
seq->flag |= SELECT;
select_active_side(ed->seqbasep, SEQ_SIDE_LEFT, seq->machine, seq->startdisp);
}
else {
if (extend==0) deselect_all_seq(scene);
seq->flag |= SELECT;
case SEQ_SIDE_LEFT:
if ((seq->flag & SEQ_LEFTSEL) && (neighbor->flag & SEQ_RIGHTSEL)) {
if (extend == 0) deselect_all_seq(scene);
seq->flag |= SELECT;
neighbor->flag |= SELECT;
recurs_sel_seq(neighbor);
neighbor->flag |= SEQ_RIGHTSEL;
seq->flag |= SEQ_LEFTSEL;
}
break;
case SEQ_SIDE_RIGHT:
if ((seq->flag & SEQ_RIGHTSEL) && (neighbor->flag & SEQ_LEFTSEL)) {
if (extend==0) deselect_all_seq(scene);
seq->flag |= SELECT;
select_active_side(ed->seqbasep, SEQ_SIDE_LEFT, seq->machine, seq->startdisp);
}
else {
if (extend == 0) deselect_all_seq(scene);
seq->flag |= SELECT;
select_active_side(ed->seqbasep, SEQ_SIDE_RIGHT, seq->machine, seq->startdisp);
}
else {
if (extend==0) deselect_all_seq(scene);
seq->flag |= SELECT;
neighbor->flag |= SELECT;
recurs_sel_seq(neighbor);
neighbor->flag |= SEQ_RIGHTSEL;
seq->flag |= SEQ_LEFTSEL;
}
break;
case SEQ_SIDE_RIGHT:
if ((seq->flag & SEQ_RIGHTSEL) && (neighbor->flag & SEQ_LEFTSEL)) {
if (extend == 0) deselect_all_seq(scene);
seq->flag |= SELECT;
neighbor->flag |= SELECT;
recurs_sel_seq(neighbor);
neighbor->flag |= SEQ_LEFTSEL;
seq->flag |= SEQ_RIGHTSEL;
}
break;
select_active_side(ed->seqbasep, SEQ_SIDE_RIGHT, seq->machine, seq->startdisp);
}
else {
if (extend == 0) deselect_all_seq(scene);
seq->flag |= SELECT;
neighbor->flag |= SELECT;
recurs_sel_seq(neighbor);
neighbor->flag |= SEQ_LEFTSEL;
seq->flag |= SEQ_RIGHTSEL;
}
break;
}
}
else {
if (extend==0) deselect_all_seq(scene);
if (extend == 0) deselect_all_seq(scene);
select_active_side(ed->seqbasep, sel_side, seq->machine, seq->startdisp);
}
}
@@ -506,12 +510,12 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
if (marker) {
int mval[2], xo, yo;
// getmouseco_areawin(mval);
xo= mval[0];
yo= mval[1];
xo = mval[0];
yo = mval[1];
while (get_mbut()) {
// getmouseco_areawin(mval);
if (abs(mval[0]-xo)+abs(mval[1]-yo) > 4) {
if (abs(mval[0] - xo) + abs(mval[1] - yo) > 4) {
transform_markers('g', 0);
return;
}
@@ -519,10 +523,10 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
}
#endif
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER|NA_SELECTED, scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
/* allowing tweaks */
return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
}
void SEQUENCER_OT_select(wmOperatorType *ot)
@@ -537,7 +541,7 @@ void SEQUENCER_OT_select(wmOperatorType *ot)
ot->poll = ED_operator_sequencer_active;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend the selection");
@@ -553,12 +557,12 @@ void SEQUENCER_OT_select(wmOperatorType *ot)
/* run recursively to select linked */
static int select_more_less_seq__internal(Scene *scene, int sel, int linked)
{
Editing *ed= seq_give_editing(scene, FALSE);
Editing *ed = seq_give_editing(scene, FALSE);
Sequence *seq, *neighbor;
int change=0;
int change = 0;
int isel;
if (ed==NULL) return 0;
if (ed == NULL) return 0;
if (sel) {
sel = SELECT;
@@ -571,27 +575,27 @@ static int select_more_less_seq__internal(Scene *scene, int sel, int linked)
if (!linked) {
/* if not linked we only want to touch each seq once, newseq */
for (seq= ed->seqbasep->first; seq; seq= seq->next) {
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
seq->tmp = NULL;
}
}
for (seq= ed->seqbasep->first; seq; seq= seq->next) {
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
if ((int)(seq->flag & SELECT) == sel) {
if ((linked==0 && seq->tmp)==0) {
if ((linked == 0 && seq->tmp) == 0) {
/* only get unselected nabours */
neighbor = find_neighboring_sequence(scene, seq, SEQ_SIDE_LEFT, isel);
if (neighbor) {
if (sel) {neighbor->flag |= SELECT; recurs_sel_seq(neighbor);}
else neighbor->flag &= ~SELECT;
if (linked==0) neighbor->tmp = (Sequence *)1;
if (sel) {neighbor->flag |= SELECT; recurs_sel_seq(neighbor); }
else neighbor->flag &= ~SELECT;
if (linked == 0) neighbor->tmp = (Sequence *)1;
change = 1;
}
neighbor = find_neighboring_sequence(scene, seq, SEQ_SIDE_RIGHT, isel);
if (neighbor) {
if (sel) {neighbor->flag |= SELECT; recurs_sel_seq(neighbor);}
else neighbor->flag &= ~SELECT;
if (linked==0) neighbor->tmp = (void *)1;
if (sel) {neighbor->flag |= SELECT; recurs_sel_seq(neighbor); }
else neighbor->flag &= ~SELECT;
if (linked == 0) neighbor->tmp = (void *)1;
change = 1;
}
}
@@ -606,12 +610,12 @@ static int select_more_less_seq__internal(Scene *scene, int sel, int linked)
/* select more operator */
static int sequencer_select_more_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Scene *scene = CTX_data_scene(C);
if (!select_more_less_seq__internal(scene, 0, 0))
return OPERATOR_CANCELLED;
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER|NA_SELECTED, scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
return OPERATOR_FINISHED;
}
@@ -628,7 +632,7 @@ void SEQUENCER_OT_select_more(wmOperatorType *ot)
ot->poll = sequencer_edit_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
}
@@ -637,12 +641,12 @@ void SEQUENCER_OT_select_more(wmOperatorType *ot)
/* select less operator */
static int sequencer_select_less_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Scene *scene = CTX_data_scene(C);
if (!select_more_less_seq__internal(scene, 1, 0))
return OPERATOR_CANCELLED;
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER|NA_SELECTED, scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
return OPERATOR_FINISHED;
}
@@ -659,7 +663,7 @@ void SEQUENCER_OT_select_less(wmOperatorType *ot)
ot->poll = sequencer_edit_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
}
@@ -668,20 +672,20 @@ void SEQUENCER_OT_select_less(wmOperatorType *ot)
/* select pick linked operator (uses the mouse) */
static int sequencer_select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
Scene *scene= CTX_data_scene(C);
View2D *v2d= UI_view2d_fromcontext(C);
Scene *scene = CTX_data_scene(C);
View2D *v2d = UI_view2d_fromcontext(C);
short extend= RNA_boolean_get(op->ptr, "extend");
short extend = RNA_boolean_get(op->ptr, "extend");
Sequence *mouse_seq;
int selected, hand;
/* this works like UV, not mesh */
mouse_seq= find_nearest_seq(scene, v2d, &hand, event->mval);
mouse_seq = find_nearest_seq(scene, v2d, &hand, event->mval);
if (!mouse_seq)
return OPERATOR_FINISHED; /* user error as with mesh?? */
return OPERATOR_FINISHED; /* user error as with mesh?? */
if (extend==0)
if (extend == 0)
deselect_all_seq(scene);
mouse_seq->flag |= SELECT;
@@ -692,7 +696,7 @@ static int sequencer_select_linked_pick_invoke(bContext *C, wmOperator *op, wmEv
selected = select_more_less_seq__internal(scene, 1, 1);
}
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER|NA_SELECTED, scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
return OPERATOR_FINISHED;
}
@@ -709,7 +713,7 @@ void SEQUENCER_OT_select_linked_pick(wmOperatorType *ot)
ot->poll = ED_operator_sequencer_active;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend the selection");
@@ -719,7 +723,7 @@ void SEQUENCER_OT_select_linked_pick(wmOperatorType *ot)
/* select linked operator */
static int sequencer_select_linked_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
Scene *scene = CTX_data_scene(C);
int selected;
selected = 1;
@@ -727,7 +731,7 @@ static int sequencer_select_linked_exec(bContext *C, wmOperator *UNUSED(op))
selected = select_more_less_seq__internal(scene, 1, 1);
}
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER|NA_SELECTED, scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
return OPERATOR_FINISHED;
}
@@ -744,7 +748,7 @@ void SEQUENCER_OT_select_linked(wmOperatorType *ot)
ot->poll = sequencer_edit_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
}
@@ -753,31 +757,31 @@ void SEQUENCER_OT_select_linked(wmOperatorType *ot)
/* select handles operator */
static int sequencer_select_handles_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, 0);
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, 0);
Sequence *seq;
int sel_side= RNA_enum_get(op->ptr, "side");
int sel_side = RNA_enum_get(op->ptr, "side");
for (seq= ed->seqbasep->first; seq; seq=seq->next) {
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
if (seq->flag & SELECT) {
switch(sel_side) {
case SEQ_SIDE_LEFT:
seq->flag &= ~SEQ_RIGHTSEL;
seq->flag |= SEQ_LEFTSEL;
break;
case SEQ_SIDE_RIGHT:
seq->flag &= ~SEQ_LEFTSEL;
seq->flag |= SEQ_RIGHTSEL;
break;
case SEQ_SIDE_BOTH:
seq->flag |= SEQ_LEFTSEL+SEQ_RIGHTSEL;
break;
switch (sel_side) {
case SEQ_SIDE_LEFT:
seq->flag &= ~SEQ_RIGHTSEL;
seq->flag |= SEQ_LEFTSEL;
break;
case SEQ_SIDE_RIGHT:
seq->flag &= ~SEQ_LEFTSEL;
seq->flag |= SEQ_RIGHTSEL;
break;
case SEQ_SIDE_BOTH:
seq->flag |= SEQ_LEFTSEL + SEQ_RIGHTSEL;
break;
}
}
}
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER|NA_SELECTED, scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
return OPERATOR_FINISHED;
}
@@ -794,7 +798,7 @@ void SEQUENCER_OT_select_handles(wmOperatorType *ot)
ot->poll = sequencer_edit_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
RNA_def_enum(ot->srna, "side", prop_side_types, SEQ_SIDE_BOTH, "Side", "The side of the handle that is selected");
@@ -803,18 +807,18 @@ void SEQUENCER_OT_select_handles(wmOperatorType *ot)
/* select side operator */
static int sequencer_select_active_side_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, 0);
Sequence *seq_act= seq_active_get(scene);
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, 0);
Sequence *seq_act = seq_active_get(scene);
if (ed==NULL || seq_act==NULL)
if (ed == NULL || seq_act == NULL)
return OPERATOR_CANCELLED;
seq_act->flag |= SELECT;
select_active_side(ed->seqbasep, RNA_enum_get(op->ptr, "side"), seq_act->machine, seq_act->startdisp);
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER|NA_SELECTED, scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
return OPERATOR_FINISHED;
}
@@ -831,7 +835,7 @@ void SEQUENCER_OT_select_active_side(wmOperatorType *ot)
ot->poll = sequencer_edit_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
RNA_def_enum(ot->srna, "side", prop_side_types, SEQ_SIDE_BOTH, "Side", "The side of the handle that is selected");
@@ -841,18 +845,18 @@ void SEQUENCER_OT_select_active_side(wmOperatorType *ot)
/* borderselect operator */
static int sequencer_borderselect_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
View2D *v2d= UI_view2d_fromcontext(C);
Scene *scene = CTX_data_scene(C);
Editing *ed = seq_give_editing(scene, FALSE);
View2D *v2d = UI_view2d_fromcontext(C);
Sequence *seq;
rcti rect;
rctf rectf, rq;
short selecting = (RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_SELECT);
short selecting = (RNA_int_get(op->ptr, "gesture_mode") == GESTURE_MODAL_SELECT);
int extend = RNA_boolean_get(op->ptr, "extend");
int mval[2];
if (ed==NULL)
if (ed == NULL)
return OPERATOR_CANCELLED;
rect.xmin = RNA_int_get(op->ptr, "xmin");
@@ -860,19 +864,19 @@ static int sequencer_borderselect_exec(bContext *C, wmOperator *op)
rect.xmax = RNA_int_get(op->ptr, "xmax");
rect.ymax = RNA_int_get(op->ptr, "ymax");
mval[0]= rect.xmin;
mval[1]= rect.ymin;
mval[0] = rect.xmin;
mval[1] = rect.ymin;
UI_view2d_region_to_view(v2d, mval[0], mval[1], &rectf.xmin, &rectf.ymin);
mval[0]= rect.xmax;
mval[1]= rect.ymax;
mval[0] = rect.xmax;
mval[1] = rect.ymax;
UI_view2d_region_to_view(v2d, mval[0], mval[1], &rectf.xmax, &rectf.ymax);
for (seq= ed->seqbasep->first; seq; seq= seq->next) {
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
seq_rectf(seq, &rq);
if (BLI_isect_rctf(&rq, &rectf, NULL)) {
if (selecting) seq->flag |= SELECT;
else seq->flag &= ~SEQ_ALLSEL;
if (selecting) seq->flag |= SELECT;
else seq->flag &= ~SEQ_ALLSEL;
recurs_sel_seq(seq);
}
else if (!extend) {
@@ -881,7 +885,7 @@ static int sequencer_borderselect_exec(bContext *C, wmOperator *op)
}
}
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER|NA_SELECTED, scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
return OPERATOR_FINISHED;
}
@@ -904,7 +908,7 @@ void SEQUENCER_OT_select_border(wmOperatorType *ot)
ot->poll = ED_operator_sequencer_active;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* rna */
WM_operator_properties_gesture_border(ot, TRUE);
@@ -916,11 +920,11 @@ static EnumPropertyItem sequencer_prop_select_grouped_types[] = {
{1, "TYPE", 0, "Type", "Shared strip type"},
{2, "TYPE_BASIC", 0, "Global Type", "All strips of same basic type (Graphical or Sound)"},
{3, "TYPE_EFFECT", 0, "Effect Type",
"Shared strip effect type (if active strip is not an effect one, select all non-effect strips)"},
"Shared strip effect type (if active strip is not an effect one, select all non-effect strips)"},
{4, "DATA", 0, "Data", "Shared data (scene, image, sound, etc.)"},
{5, "EFFECT", 0, "Effect", "Shared effects"},
{6, "EFFECT_LINK", 0, "Effect/Linked",
"Other strips affected by the active one (sharing some time, and below or effect-assigned)"},
"Other strips affected by the active one (sharing some time, and below or effect-assigned)"},
{7, "OVERLAP", 0, "Overlap", "Overlapping time"},
{0, NULL, 0, NULL, NULL}
};
@@ -1027,7 +1031,7 @@ static short select_grouped_effect(Editing *ed, Sequence *actseq)
{
Sequence *seq;
short changed = FALSE;
short effects[SEQ_EFFECT_MAX+1];
short effects[SEQ_EFFECT_MAX + 1];
int i;
for (i = 0; i <= SEQ_EFFECT_MAX; i++)
@@ -1084,7 +1088,7 @@ static short select_grouped_effect_link(Editing *ed, Sequence *actseq)
}
SEQ_END;
actseq->tmp= SET_INT_IN_POINTER(TRUE);
actseq->tmp = SET_INT_IN_POINTER(TRUE);
for (seq_begin(ed, &iter, 1); iter.valid; seq_next(&iter)) {
seq = iter.seq;
@@ -1106,7 +1110,7 @@ static short select_grouped_effect_link(Editing *ed, Sequence *actseq)
if (enddisp < seq->enddisp) enddisp = seq->enddisp;
if (machine < seq->machine) machine = seq->machine;
seq->tmp= SET_INT_IN_POINTER(TRUE);
seq->tmp = SET_INT_IN_POINTER(TRUE);
seq->flag |= SELECT;
changed = TRUE;
@@ -1154,16 +1158,16 @@ static int sequencer_select_grouped_exec(bContext *C, wmOperator *op)
SEQ_END;
}
if (type==1) changed |= select_grouped_type(ed, actseq);
else if (type==2) changed |= select_grouped_type_basic(ed, actseq);
else if (type==3) changed |= select_grouped_type_effect(ed, actseq);
else if (type==4) changed |= select_grouped_data(ed, actseq);
else if (type==5) changed |= select_grouped_effect(ed, actseq);
else if (type==6) changed |= select_grouped_effect_link(ed, actseq);
else if (type==7) changed |= select_grouped_time_overlap(ed, actseq);
if (type == 1) changed |= select_grouped_type(ed, actseq);
else if (type == 2) changed |= select_grouped_type_basic(ed, actseq);
else if (type == 3) changed |= select_grouped_type_effect(ed, actseq);
else if (type == 4) changed |= select_grouped_data(ed, actseq);
else if (type == 5) changed |= select_grouped_effect(ed, actseq);
else if (type == 6) changed |= select_grouped_effect_link(ed, actseq);
else if (type == 7) changed |= select_grouped_time_overlap(ed, actseq);
if (changed) {
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER|NA_SELECTED, scene);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
return OPERATOR_FINISHED;
}
@@ -1183,7 +1187,7 @@ void SEQUENCER_OT_select_grouped(wmOperatorType *ot)
ot->poll = sequencer_edit_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "extend", FALSE, "Extend", "Extend selection instead of deselecting everything first");

View File

@@ -56,7 +56,7 @@
#include "UI_resources.h"
#include "UI_view2d.h"
#include "sequencer_intern.h" // own include
#include "sequencer_intern.h" // own include
/* ******************** manage regions ********************* */
@@ -64,20 +64,20 @@ ARegion *sequencer_has_buttons_region(ScrArea *sa)
{
ARegion *ar, *arnew;
ar= BKE_area_find_region_type(sa, RGN_TYPE_UI);
ar = BKE_area_find_region_type(sa, RGN_TYPE_UI);
if (ar) return ar;
/* add subdiv level; after header */
ar= BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
ar = BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
/* is error! */
if (ar==NULL) return NULL;
if (ar == NULL) return NULL;
arnew= MEM_callocN(sizeof(ARegion), "buttons for sequencer");
arnew = MEM_callocN(sizeof(ARegion), "buttons for sequencer");
BLI_insertlinkafter(&sa->regionbase, ar, arnew);
arnew->regiontype= RGN_TYPE_UI;
arnew->alignment= RGN_ALIGN_RIGHT;
arnew->regiontype = RGN_TYPE_UI;
arnew->alignment = RGN_ALIGN_RIGHT;
arnew->flag = RGN_FLAG_HIDDEN;
@@ -86,10 +86,10 @@ ARegion *sequencer_has_buttons_region(ScrArea *sa)
static ARegion *sequencer_find_region(ScrArea *sa, short type)
{
ARegion *ar=NULL;
ARegion *ar = NULL;
for (ar= sa->regionbase.first; ar; ar= ar->next)
if (ar->regiontype==type)
for (ar = sa->regionbase.first; ar; ar = ar->next)
if (ar->regiontype == type)
return ar;
return ar;
@@ -99,59 +99,59 @@ static ARegion *sequencer_find_region(ScrArea *sa, short type)
static SpaceLink *sequencer_new(const bContext *C)
{
Scene *scene= CTX_data_scene(C);
Scene *scene = CTX_data_scene(C);
ARegion *ar;
SpaceSeq *sseq;
sseq= MEM_callocN(sizeof(SpaceSeq), "initsequencer");
sseq->spacetype= SPACE_SEQ;
sseq = MEM_callocN(sizeof(SpaceSeq), "initsequencer");
sseq->spacetype = SPACE_SEQ;
sseq->chanshown = 0;
sseq->view = SEQ_VIEW_SEQUENCE;
sseq->mainb = SEQ_DRAW_IMG_IMBUF;
/* header */
ar= MEM_callocN(sizeof(ARegion), "header for sequencer");
ar = MEM_callocN(sizeof(ARegion), "header for sequencer");
BLI_addtail(&sseq->regionbase, ar);
ar->regiontype= RGN_TYPE_HEADER;
ar->alignment= RGN_ALIGN_BOTTOM;
ar->regiontype = RGN_TYPE_HEADER;
ar->alignment = RGN_ALIGN_BOTTOM;
/* buttons/list view */
ar= MEM_callocN(sizeof(ARegion), "buttons for sequencer");
ar = MEM_callocN(sizeof(ARegion), "buttons for sequencer");
BLI_addtail(&sseq->regionbase, ar);
ar->regiontype= RGN_TYPE_UI;
ar->alignment= RGN_ALIGN_RIGHT;
ar->regiontype = RGN_TYPE_UI;
ar->alignment = RGN_ALIGN_RIGHT;
ar->flag = RGN_FLAG_HIDDEN;
/* preview area */
/* NOTE: if you change values here, also change them in sequencer_init_preview_region */
ar= MEM_callocN(sizeof(ARegion), "preview area for sequencer");
ar = MEM_callocN(sizeof(ARegion), "preview area for sequencer");
BLI_addtail(&sseq->regionbase, ar);
ar->regiontype= RGN_TYPE_PREVIEW;
ar->alignment= RGN_ALIGN_TOP;
ar->regiontype = RGN_TYPE_PREVIEW;
ar->alignment = RGN_ALIGN_TOP;
ar->flag |= RGN_FLAG_HIDDEN;
/* for now, aspect ratio should be maintained, and zoom is clamped within sane default limits */
ar->v2d.keepzoom= V2D_KEEPASPECT | V2D_KEEPZOOM;
ar->v2d.minzoom= 0.00001f;
ar->v2d.maxzoom= 100000.0f;
ar->v2d.keepzoom = V2D_KEEPASPECT | V2D_KEEPZOOM;
ar->v2d.minzoom = 0.00001f;
ar->v2d.maxzoom = 100000.0f;
ar->v2d.tot.xmin = -960.0f; /* 1920 width centered */
ar->v2d.tot.ymin = -540.0f; /* 1080 height centered */
ar->v2d.tot.xmax = 960.0f;
ar->v2d.tot.ymax = 540.0f;
ar->v2d.min[0]= 0.0f;
ar->v2d.min[1]= 0.0f;
ar->v2d.max[0]= 12000.0f;
ar->v2d.max[1]= 12000.0f;
ar->v2d.cur= ar->v2d.tot;
ar->v2d.align= V2D_ALIGN_FREE;
ar->v2d.keeptot= V2D_KEEPTOT_FREE;
ar->v2d.min[0] = 0.0f;
ar->v2d.min[1] = 0.0f;
ar->v2d.max[0] = 12000.0f;
ar->v2d.max[1] = 12000.0f;
ar->v2d.cur = ar->v2d.tot;
ar->v2d.align = V2D_ALIGN_FREE;
ar->v2d.keeptot = V2D_KEEPTOT_FREE;
/* main area */
ar= MEM_callocN(sizeof(ARegion), "main area for sequencer");
ar = MEM_callocN(sizeof(ARegion), "main area for sequencer");
BLI_addtail(&sseq->regionbase, ar);
ar->regiontype= RGN_TYPE_WINDOW;
ar->regiontype = RGN_TYPE_WINDOW;
/* seq space goes from (0,8) to (0, efra) */
@@ -161,22 +161,22 @@ static SpaceLink *sequencer_new(const bContext *C)
ar->v2d.tot.xmax = scene->r.efra;
ar->v2d.tot.ymax = 8.0f;
ar->v2d.cur= ar->v2d.tot;
ar->v2d.cur = ar->v2d.tot;
ar->v2d.min[0]= 10.0f;
ar->v2d.min[1]= 0.5f;
ar->v2d.min[0] = 10.0f;
ar->v2d.min[1] = 0.5f;
ar->v2d.max[0]= MAXFRAMEF;
ar->v2d.max[1]= MAXSEQ;
ar->v2d.max[0] = MAXFRAMEF;
ar->v2d.max[1] = MAXSEQ;
ar->v2d.minzoom= 0.01f;
ar->v2d.maxzoom= 100.0f;
ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
ar->v2d.scroll |= (V2D_SCROLL_LEFT|V2D_SCROLL_SCALE_VERTICAL);
ar->v2d.keepzoom= 0;
ar->v2d.keeptot= 0;
ar->v2d.align= V2D_ALIGN_NO_NEG_Y;
ar->v2d.minzoom = 0.01f;
ar->v2d.maxzoom = 100.0f;
ar->v2d.scroll |= (V2D_SCROLL_BOTTOM | V2D_SCROLL_SCALE_HORIZONTAL);
ar->v2d.scroll |= (V2D_SCROLL_LEFT | V2D_SCROLL_SCALE_VERTICAL);
ar->v2d.keepzoom = 0;
ar->v2d.keeptot = 0;
ar->v2d.align = V2D_ALIGN_NO_NEG_Y;
return (SpaceLink *)sseq;
}
@@ -199,76 +199,76 @@ static void sequencer_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(s
static void sequencer_refresh(const bContext *C, ScrArea *sa)
{
wmWindowManager *wm= CTX_wm_manager(C);
wmWindow *window= CTX_wm_window(C);
SpaceSeq *sseq= (SpaceSeq *)sa->spacedata.first;
ARegion *ar_main= sequencer_find_region(sa, RGN_TYPE_WINDOW);
ARegion *ar_preview= sequencer_find_region(sa, RGN_TYPE_PREVIEW);
int view_changed= 0;
wmWindowManager *wm = CTX_wm_manager(C);
wmWindow *window = CTX_wm_window(C);
SpaceSeq *sseq = (SpaceSeq *)sa->spacedata.first;
ARegion *ar_main = sequencer_find_region(sa, RGN_TYPE_WINDOW);
ARegion *ar_preview = sequencer_find_region(sa, RGN_TYPE_PREVIEW);
int view_changed = 0;
switch (sseq->view) {
case SEQ_VIEW_SEQUENCE:
if (ar_main && (ar_main->flag & RGN_FLAG_HIDDEN)) {
ar_main->flag &= ~RGN_FLAG_HIDDEN;
ar_main->v2d.flag &= ~V2D_IS_INITIALISED;
view_changed= 1;
view_changed = 1;
}
if (ar_preview && !(ar_preview->flag & RGN_FLAG_HIDDEN)) {
ar_preview->flag |= RGN_FLAG_HIDDEN;
ar_preview->v2d.flag &= ~V2D_IS_INITIALISED;
WM_event_remove_handlers((bContext*)C, &ar_preview->handlers);
view_changed= 1;
WM_event_remove_handlers((bContext *)C, &ar_preview->handlers);
view_changed = 1;
}
if (ar_main && ar_main->alignment != RGN_ALIGN_NONE) {
ar_main->alignment= RGN_ALIGN_NONE;
view_changed= 1;
ar_main->alignment = RGN_ALIGN_NONE;
view_changed = 1;
}
if (ar_preview && ar_preview->alignment != RGN_ALIGN_NONE) {
ar_preview->alignment= RGN_ALIGN_NONE;
view_changed= 1;
ar_preview->alignment = RGN_ALIGN_NONE;
view_changed = 1;
}
break;
case SEQ_VIEW_PREVIEW:
if (ar_main && !(ar_main->flag & RGN_FLAG_HIDDEN)) {
ar_main->flag |= RGN_FLAG_HIDDEN;
ar_main->v2d.flag &= ~V2D_IS_INITIALISED;
WM_event_remove_handlers((bContext*)C, &ar_main->handlers);
view_changed= 1;
WM_event_remove_handlers((bContext *)C, &ar_main->handlers);
view_changed = 1;
}
if (ar_preview && (ar_preview->flag & RGN_FLAG_HIDDEN)) {
ar_preview->flag &= ~RGN_FLAG_HIDDEN;
ar_preview->v2d.flag &= ~V2D_IS_INITIALISED;
ar_preview->v2d.cur = ar_preview->v2d.tot;
view_changed= 1;
view_changed = 1;
}
if (ar_main && ar_main->alignment != RGN_ALIGN_NONE) {
ar_main->alignment= RGN_ALIGN_NONE;
view_changed= 1;
ar_main->alignment = RGN_ALIGN_NONE;
view_changed = 1;
}
if (ar_preview && ar_preview->alignment != RGN_ALIGN_NONE) {
ar_preview->alignment= RGN_ALIGN_NONE;
view_changed= 1;
ar_preview->alignment = RGN_ALIGN_NONE;
view_changed = 1;
}
break;
case SEQ_VIEW_SEQUENCE_PREVIEW:
if (ar_main && (ar_main->flag & RGN_FLAG_HIDDEN)) {
ar_main->flag &= ~RGN_FLAG_HIDDEN;
ar_main->v2d.flag &= ~V2D_IS_INITIALISED;
view_changed= 1;
view_changed = 1;
}
if (ar_preview && (ar_preview->flag & RGN_FLAG_HIDDEN)) {
ar_preview->flag &= ~RGN_FLAG_HIDDEN;
ar_preview->v2d.flag &= ~V2D_IS_INITIALISED;
ar_preview->v2d.cur = ar_preview->v2d.tot;
view_changed= 1;
view_changed = 1;
}
if (ar_main && ar_main->alignment != RGN_ALIGN_NONE) {
ar_main->alignment= RGN_ALIGN_NONE;
view_changed= 1;
ar_main->alignment = RGN_ALIGN_NONE;
view_changed = 1;
}
if (ar_preview && ar_preview->alignment != RGN_ALIGN_TOP) {
ar_preview->alignment= RGN_ALIGN_TOP;
view_changed= 1;
ar_preview->alignment = RGN_ALIGN_TOP;
view_changed = 1;
}
break;
}
@@ -281,7 +281,7 @@ static void sequencer_refresh(const bContext *C, ScrArea *sa)
static SpaceLink *sequencer_duplicate(SpaceLink *sl)
{
SpaceSeq *sseqn= MEM_dupallocN(sl);
SpaceSeq *sseqn = MEM_dupallocN(sl);
/* clear or remove stuff from old */
// XXX sseq->gpd= gpencil_data_duplicate(sseq->gpd);
@@ -308,7 +308,7 @@ static void sequencer_main_area_init(wmWindowManager *wm, ARegion *ar)
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
/* add drop boxes */
lb= WM_dropboxmap_find("Sequencer", SPACE_SEQ, RGN_TYPE_WINDOW);
lb = WM_dropboxmap_find("Sequencer", SPACE_SEQ, RGN_TYPE_WINDOW);
WM_event_add_dropbox_handler(&ar->handlers, lb);
@@ -326,24 +326,24 @@ static void sequencer_main_area_draw(const bContext *C, ARegion *ar)
static int image_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
{
if (drag->type==WM_DRAG_PATH)
if (ELEM(drag->icon, ICON_FILE_IMAGE, ICON_FILE_BLANK)) /* rule might not work? */
if (drag->type == WM_DRAG_PATH)
if (ELEM(drag->icon, ICON_FILE_IMAGE, ICON_FILE_BLANK)) /* rule might not work? */
return 1;
return 0;
}
static int movie_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
{
if (drag->type==WM_DRAG_PATH)
if (ELEM3(drag->icon, 0, ICON_FILE_MOVIE, ICON_FILE_BLANK)) /* rule might not work? */
if (drag->type == WM_DRAG_PATH)
if (ELEM3(drag->icon, 0, ICON_FILE_MOVIE, ICON_FILE_BLANK)) /* rule might not work? */
return 1;
return 0;
}
static int sound_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
{
if (drag->type==WM_DRAG_PATH)
if (ELEM(drag->icon, ICON_FILE_SOUND, ICON_FILE_BLANK)) /* rule might not work? */
if (drag->type == WM_DRAG_PATH)
if (ELEM(drag->icon, ICON_FILE_SOUND, ICON_FILE_BLANK)) /* rule might not work? */
return 1;
return 0;
}
@@ -371,7 +371,7 @@ static void sequencer_drop_copy(wmDrag *drag, wmDropBox *drop)
/* this region dropbox definition */
static void sequencer_dropboxes(void)
{
ListBase *lb= WM_dropboxmap_find("Sequencer", SPACE_SEQ, RGN_TYPE_WINDOW);
ListBase *lb = WM_dropboxmap_find("Sequencer", SPACE_SEQ, RGN_TYPE_WINDOW);
WM_dropbox_add(lb, "SEQUENCER_OT_image_strip_add", image_drop_poll, sequencer_drop_copy);
WM_dropbox_add(lb, "SEQUENCER_OT_movie_strip_add", movie_drop_poll, sequencer_drop_copy);
@@ -394,9 +394,9 @@ static void sequencer_header_area_draw(const bContext *C, ARegion *ar)
static void sequencer_main_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
switch(wmn->category) {
switch (wmn->category) {
case NC_SCENE:
switch(wmn->data) {
switch (wmn->data) {
case ND_FRAME:
case ND_FRAME_RANGE:
case ND_MARKERS:
@@ -434,9 +434,9 @@ static void sequencer_preview_area_init(wmWindowManager *wm, ARegion *ar)
static void sequencer_preview_area_draw(const bContext *C, ARegion *ar)
{
ScrArea *sa= CTX_wm_area(C);
SpaceSeq *sseq= sa->spacedata.first;
Scene *scene= CTX_data_scene(C);
ScrArea *sa = CTX_wm_area(C);
SpaceSeq *sseq = sa->spacedata.first;
Scene *scene = CTX_data_scene(C);
/* XXX temp fix for wrong setting in sseq->mainb */
if (sseq->mainb == SEQ_DRAW_SEQUENCE) sseq->mainb = SEQ_DRAW_IMG_IMBUF;
@@ -447,9 +447,9 @@ static void sequencer_preview_area_draw(const bContext *C, ARegion *ar)
int over_cfra;
if (scene->ed->over_flag & SEQ_EDIT_OVERLAY_ABS)
over_cfra= scene->ed->over_cfra;
over_cfra = scene->ed->over_cfra;
else
over_cfra= scene->r.cfra + scene->ed->over_ofs;
over_cfra = scene->r.cfra + scene->ed->over_ofs;
if (over_cfra != scene->r.cfra)
draw_image_seq(C, scene, ar, sseq, scene->r.cfra, over_cfra - scene->r.cfra);
@@ -460,9 +460,9 @@ static void sequencer_preview_area_draw(const bContext *C, ARegion *ar)
static void sequencer_preview_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
switch(wmn->category) {
switch (wmn->category) {
case NC_SCENE:
switch(wmn->data) {
switch (wmn->data) {
case ND_FRAME:
case ND_MARKERS:
case ND_SEQUENCER:
@@ -475,7 +475,7 @@ static void sequencer_preview_area_listener(ARegion *ar, wmNotifier *wmn)
ED_region_tag_redraw(ar);
break;
case NC_ID:
switch(wmn->data) {
switch (wmn->data) {
case NA_RENAME:
ED_region_tag_redraw(ar);
break;
@@ -502,15 +502,15 @@ static void sequencer_buttons_area_draw(const bContext *C, ARegion *ar)
static void sequencer_buttons_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
switch(wmn->category) {
switch (wmn->category) {
case NC_SCENE:
switch(wmn->data) {
case ND_FRAME:
case ND_SEQUENCER:
ED_region_tag_redraw(ar);
break;
}
break;
switch (wmn->data) {
case ND_FRAME:
case ND_SEQUENCER:
ED_region_tag_redraw(ar);
break;
}
break;
case NC_SPACE:
if (wmn->data == ND_SPACE_SEQUENCER)
ED_region_tag_redraw(ar);
@@ -526,49 +526,49 @@ static void sequencer_buttons_area_listener(ARegion *ar, wmNotifier *wmn)
/* only called once, from space/spacetypes.c */
void ED_spacetype_sequencer(void)
{
SpaceType *st= MEM_callocN(sizeof(SpaceType), "spacetype sequencer");
SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype sequencer");
ARegionType *art;
st->spaceid= SPACE_SEQ;
st->spaceid = SPACE_SEQ;
strncpy(st->name, "Sequencer", BKE_ST_MAXNAME);
st->new= sequencer_new;
st->free= sequencer_free;
st->init= sequencer_init;
st->duplicate= sequencer_duplicate;
st->operatortypes= sequencer_operatortypes;
st->keymap= sequencer_keymap;
st->dropboxes= sequencer_dropboxes;
st->refresh= sequencer_refresh;
st->new = sequencer_new;
st->free = sequencer_free;
st->init = sequencer_init;
st->duplicate = sequencer_duplicate;
st->operatortypes = sequencer_operatortypes;
st->keymap = sequencer_keymap;
st->dropboxes = sequencer_dropboxes;
st->refresh = sequencer_refresh;
/* regions: main window */
art= MEM_callocN(sizeof(ARegionType), "spacetype sequencer region");
art = MEM_callocN(sizeof(ARegionType), "spacetype sequencer region");
art->regionid = RGN_TYPE_WINDOW;
art->init= sequencer_main_area_init;
art->draw= sequencer_main_area_draw;
art->listener= sequencer_main_area_listener;
art->keymapflag= ED_KEYMAP_VIEW2D|ED_KEYMAP_MARKERS|ED_KEYMAP_FRAMES|ED_KEYMAP_ANIMATION;
art->init = sequencer_main_area_init;
art->draw = sequencer_main_area_draw;
art->listener = sequencer_main_area_listener;
art->keymapflag = ED_KEYMAP_VIEW2D | ED_KEYMAP_MARKERS | ED_KEYMAP_FRAMES | ED_KEYMAP_ANIMATION;
BLI_addhead(&st->regiontypes, art);
/* preview */
art= MEM_callocN(sizeof(ARegionType), "spacetype sequencer region");
art = MEM_callocN(sizeof(ARegionType), "spacetype sequencer region");
art->regionid = RGN_TYPE_PREVIEW;
art->prefsizey = 240; // XXX
art->init= sequencer_preview_area_init;
art->draw= sequencer_preview_area_draw;
art->listener= sequencer_preview_area_listener;
art->keymapflag= ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_ANIMATION;
art->init = sequencer_preview_area_init;
art->draw = sequencer_preview_area_draw;
art->listener = sequencer_preview_area_listener;
art->keymapflag = ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_ANIMATION;
BLI_addhead(&st->regiontypes, art);
/* regions: listview/buttons */
art= MEM_callocN(sizeof(ARegionType), "spacetype sequencer region");
art = MEM_callocN(sizeof(ARegionType), "spacetype sequencer region");
art->regionid = RGN_TYPE_UI;
art->prefsizex= 220; // XXX
art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_FRAMES;
art->listener= sequencer_buttons_area_listener;
art->init= sequencer_buttons_area_init;
art->draw= sequencer_buttons_area_draw;
art->prefsizex = 220; // XXX
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES;
art->listener = sequencer_buttons_area_listener;
art->init = sequencer_buttons_area_init;
art->draw = sequencer_buttons_area_draw;
BLI_addhead(&st->regiontypes, art);
/* Keep as python only for now
@@ -576,21 +576,21 @@ void ED_spacetype_sequencer(void)
*/
/* regions: header */
art= MEM_callocN(sizeof(ARegionType), "spacetype sequencer region");
art = MEM_callocN(sizeof(ARegionType), "spacetype sequencer region");
art->regionid = RGN_TYPE_HEADER;
art->prefsizey= HEADERY;
art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_HEADER;
art->prefsizey = HEADERY;
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_HEADER;
art->init= sequencer_header_area_init;
art->draw= sequencer_header_area_draw;
art->listener= sequencer_main_area_listener;
art->init = sequencer_header_area_init;
art->draw = sequencer_header_area_draw;
art->listener = sequencer_main_area_listener;
BLI_addhead(&st->regiontypes, art);
BKE_spacetype_register(st);
/* set the sequencer callback when not in background mode */
if (G.background==0) {
if (G.background == 0) {
sequencer_view3d_cb = ED_view3d_draw_offscreen_imbuf_simple;
}
}