From 8a1266661e2d3d5f9032d14b30187a9f0151de39 Mon Sep 17 00:00:00 2001 From: Alexander Ewering Date: Wed, 21 Sep 2005 20:28:44 +0000 Subject: [PATCH] Courtesy of Shaul Kedem: Option to play sequence strips (Movie, Image, Scene) in reverse. New toggle in the NKEY buttons for sequence strips. Thanks Shaul! --- source/blender/makesdna/DNA_sequence_types.h | 11 ++++++----- source/blender/src/drawseq.c | 6 +++++- source/blender/src/sequence.c | 18 +++++++++++++++--- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h index ff3c76dc125..d5731c0bd86 100644 --- a/source/blender/makesdna/DNA_sequence_types.h +++ b/source/blender/makesdna/DNA_sequence_types.h @@ -82,7 +82,7 @@ typedef struct PluginSeq { void (*callback)(void); } PluginSeq; - +/* The sequence structure is the basic struct used by any strip. each of the strips uses a different sequence structure.*/ /* WATCH IT: first part identical to ID (for use in ipo's) */ typedef struct Sequence { @@ -91,14 +91,14 @@ typedef struct Sequence { void *lib; char name[24]; - short flag, type; + short flag, type; /*flags bitmap (see below) and the type of sequence*/ int len; int start, startofs, endofs; int startstill, endstill; int machine, depth; - int startdisp, enddisp; + int startdisp, enddisp; /*starting and ending points in the sequence*/ float mul, handsize; - int sfra; + int sfra; /* starting frame according to the timeline of the scene */ Strip *strip; StripElem *curelem; @@ -164,8 +164,9 @@ typedef struct GlowVars { #define SEQ_FILTERY 16 #define SEQ_MUTE 32 #define SEQ_MAKE_PREMUL 64 +#define SEQ_REVERSE_FRAMES 128 -/* seq->type WATCH IT: BIT 3!!! */ +/* seq->type WATCH IT: SEQ_EFFECT BIT is used to determine if this is an effect strip!!! */ #define SEQ_IMAGE 0 #define SEQ_META 1 #define SEQ_SCENE 2 diff --git a/source/blender/src/drawseq.c b/source/blender/src/drawseq.c index 6b5c3ea026d..721507e607f 100644 --- a/source/blender/src/drawseq.c +++ b/source/blender/src/drawseq.c @@ -670,6 +670,7 @@ static void seq_panel_properties(short cntrl) // SEQ_HANDLER_PROPERTIES uiDefButBitS(block, TOG, SEQ_MAKE_PREMUL, SEQ_BUT_RELOAD, "Convert to Premul", 10,90,150,19, &last_seq->flag, 0.0, 21.0, 100, 0, "Converts RGB values to become premultiplied with Alpha"); uiDefButBitS(block, TOG, SEQ_FILTERY, SEQ_BUT_RELOAD, "FilterY", 10,70,150,19, &last_seq->flag, 0.0, 21.0, 100, 0, "For video movies to remove fields"); uiDefButF(block, NUM, SEQ_BUT_RELOAD, "Mul:", 10,50,150,19, &last_seq->mul, 0.001, 5.0, 100, 0, "Multiply colors"); + uiDefButS(block, TOG|BIT|7, SEQ_BUT_RELOAD, "Reverse Frames", 10,30,150,19, &last_seq->flag, 0.0, 21.0, 100, 0, "Reverse frame order"); } else if(last_seq->type==SEQ_META) { @@ -681,7 +682,7 @@ static void seq_panel_properties(short cntrl) // SEQ_HANDLER_PROPERTIES uiDefBut(block, LABEL, 0, "Type: Scene", 10,140,150,20, 0, 0, 0, 0, 0, ""); uiDefBut(block, TEX, B_NOP, "Name: ", 10,120,150,19, last_seq->name+2, 0.0, 21.0, 100, 0, ""); - + uiDefButS(block, TOG|BIT|7, SEQ_BUT_RELOAD, "Reverse Frames", 10,90,150,19, &last_seq->flag, 0.0, 21.0, 100, 0, "Reverse frame order"); } else if(last_seq->type==SEQ_MOVIE) { @@ -693,6 +694,9 @@ static void seq_panel_properties(short cntrl) // SEQ_HANDLER_PROPERTIES uiDefButBitS(block, TOG, SEQ_MAKE_PREMUL, SEQ_BUT_RELOAD, "Make Premul Alpha ", 10,90,150,19, &last_seq->flag, 0.0, 21.0, 100, 0, "Converts RGB values to become premultiplied with Alpha"); uiDefButBitS(block, TOG, SEQ_FILTERY, SEQ_BUT_RELOAD, "FilterY ", 10,70,150,19, &last_seq->flag, 0.0, 21.0, 100, 0, "For video movies to remove fields"); uiDefButF(block, NUM, SEQ_BUT_RELOAD, "Mul:", 10,50,150,19, &last_seq->mul, 0.001, 5.0, 100, 0, "Multiply colors"); + + uiDefButS(block, TOG|BIT|7, SEQ_BUT_RELOAD, "Reverse Frames", 10,30,150,19, &last_seq->flag, 0.0, 21.0, 100, 0, "Reverse frame order"); + } else if(last_seq->type==SEQ_SOUND) { diff --git a/source/blender/src/sequence.c b/source/blender/src/sequence.c index a63d26d8bbd..da6c1197951 100644 --- a/source/blender/src/sequence.c +++ b/source/blender/src/sequence.c @@ -1710,16 +1710,25 @@ StripElem *give_stripelem(Sequence *seq, int cfra) if(se==0) return 0; if(seq->startdisp >cfra || seq->enddisp <= cfra) return 0; + if(seq->flag&SEQ_REVERSE_FRAMES) { + /*reverse frame in this sequence */ + if(cfra <= seq->start) nr= seq->len-1; + else if(cfra >= seq->start+seq->len-1) nr= 0; + else nr= (seq->start + seq->len) - cfra; + } else { if(cfra <= seq->start) nr= 0; else if(cfra >= seq->start+seq->len-1) nr= seq->len-1; else nr= cfra-seq->start; + } - se+= nr; + + se+= nr; /* don't get confused by the increment, this is the same as strip->stripdata[nr], which works on some compilers...*/ se->nr= nr; return se; } + void set_meta_stripdata(Sequence *seqm) { Sequence *seq, *seqim, *seqeff; @@ -1951,8 +1960,11 @@ void do_build_seqar_cfra(ListBase *seqbase, Sequence ***seqar, int cfra) doseq= G.scene->r.scemode & R_DOSEQ; G.scene->r.scemode &= ~R_DOSEQ; - /* store stuffies */ - oldcfra= CFRA; CFRA= seq->sfra + se->nr; + /* store Current FRAme */ + oldcfra= CFRA; + + CFRA= ( seq->sfra + se->nr ); + waitcursor(1); rectot= R.rectot; R.rectot= NULL;