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!
This commit is contained in:
Alexander Ewering 2005-09-21 20:28:44 +00:00
parent 5bac916e83
commit 8a1266661e
3 changed files with 26 additions and 9 deletions

@ -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

@ -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) {
@ -694,6 +695,9 @@ static void seq_panel_properties(short cntrl) // SEQ_HANDLER_PROPERTIES
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) {

@ -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;