Index: source/blender/src/drawseq.c =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/src/drawseq.c,v retrieving revision 1.66 diff -u -r1.66 drawseq.c --- source/blender/src/drawseq.c 8 Jul 2006 10:54:53 -0000 1.66 +++ source/blender/src/drawseq.c 25 Sep 2006 07:42:21 -0000 @@ -105,6 +105,7 @@ else if(seq->type==SEQ_MOVIE) return "Movie"; else if(seq->type==SEQ_RAM_SOUND) return "Audio (RAM)"; else if(seq->type==SEQ_HD_SOUND) return "Audio (HD)"; + else if(seq->type==SEQ_COLOR) return "Color"; else if(seq->typestrip->dir; else if(seq->type==SEQ_CROSS) return "Cross"; else if(seq->type==SEQ_GAMCROSS) return "Gamma Cross"; @@ -139,6 +140,7 @@ { char blendcol[3]; float hsv[3], rgb[3]; + SolidColorVars *colvars = (SolidColorVars *)seq->effectdata; switch(seq->type) { case SEQ_IMAGE: @@ -157,7 +159,16 @@ BIF_GetColorPtrBlendShade3ubv(col, col, col, 1.0, 20); } break; - + case SEQ_COLOR: + if (colvars->col) { + col[0]= (char)(colvars->col[0]*255); + col[1]= (char)(colvars->col[1]*255); + col[2]= (char)(colvars->col[2]*255); + } else { + col[0] = col[1] = col[2] = 128; + } + break; + /* transitions */ case SEQ_CROSS: case SEQ_GAMCROSS: @@ -591,6 +602,9 @@ else if (seq->type == SEQ_MOVIE) { sprintf(str, "%d | %s%s", seq->len, seq->strip->dir, seq->strip->stripdata->name); } + else if (seq->type == SEQ_COLOR) { + sprintf(str, "%d | %s", seq->len, give_seqname(seq)); + } } strp= str; @@ -704,6 +718,7 @@ else BIF_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -60); glColor3ubv(col); + gl_round_box_shade(GL_LINE_LOOP, x1, y1, x2, y2, 0.0, 0.1, 0.0); @@ -1116,6 +1131,14 @@ uiDefButF(block, NUM, SEQ_BUT_RELOAD, "Gain (dB):", 10,50,150,19, &last_seq->level, -96.0, 6.0, 100, 0, ""); uiDefButF(block, NUM, SEQ_BUT_RELOAD, "Pan:", 10,30,150,19, &last_seq->pan, -1.0, 1.0, 100, 0, ""); uiBlockEndAlign(block); + } + else if(last_seq->type==SEQ_COLOR) { + SolidColorVars *colvars = (SolidColorVars *)last_seq->effectdata; + + uiDefBut(block, LABEL, 0, "Type: Color", 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, ""); + + uiDefButF(block, COL, SEQ_BUT_RELOAD, "",10,90,150,19, colvars->col, 0, 0, 0, 0, ""); } else if(last_seq->type>=SEQ_EFFECT) { uiDefBut(block, LABEL, 0, "Type: Effect", 10,140,150,20, 0, 0, 0, 0, 0, ""); Index: source/blender/src/editseq.c =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/src/editseq.c,v retrieving revision 1.42 diff -u -r1.42 editseq.c --- source/blender/src/editseq.c 27 Aug 2006 13:03:23 -0000 1.42 +++ source/blender/src/editseq.c 25 Sep 2006 07:42:23 -0000 @@ -1039,6 +1039,48 @@ return 0; } +static int add_solid_color_strip() +{ + Editing *ed; + Sequence *seq; + Strip *strip; + float x, y; + int cfra, machine; + short mval[2]; + struct SeqEffectHandle sh; + + if(G.scene->ed==0) return 0; + ed= G.scene->ed; + + deselect_all_seq(); + + /* where will it be (cfra is not realy needed) */ + getmouseco_areawin(mval); + areamouseco_to_ipoco(G.v2d, mval, &x, &y); + cfra= (int)(x+0.5); + machine= (int)(y+0.5); + + seq= alloc_sequence(cfra, machine); + seq->type= SEQ_COLOR; + seq->len= 1; + seq->startstill= 25; + seq->endstill= 24; + + sh = get_sequence_effect(seq); + + sh.init(seq); + + calc_sequence(seq); + + seq->strip= strip= MEM_callocN(sizeof(Strip), "strip"); + strip->len= seq->len; + strip->us= 1; + if(seq->len>0) strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem"); + + BIF_undo_push("Add solid color strip Sequencer"); + return 1; +} + static int add_seq_effect(int type) { Editing *ed; @@ -1181,6 +1223,9 @@ case SEQ_MOVIE_AND_HD_SOUND: event = 105; break; + case SEQ_COLOR: + event = 106; + break; case SEQ_PLUGIN: event = 10; break; @@ -1231,6 +1276,7 @@ "|Audio (Wav)%x103" #endif "|Scene%x101" + "|Color%x106" "|Plugin%x10" "|Cross%x2" "|Gamma Cross%x3" @@ -1306,6 +1352,10 @@ MEM_freeN(str); break; + case 106: + + if( add_solid_color_strip() ) transform_seq('g', 0); + break; case 2: case 3: case 4: @@ -1624,6 +1674,24 @@ se++; } } + + seq->flag &= SEQ_DESEL; + seqn->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL); + } + else if(seq->type == SEQ_COLOR) { + struct SeqEffectHandle sh; + + seqn= MEM_dupallocN(seq); + seq->newseq= seqn; + BLI_addtail(new, seqn); + + if(seqn->ipo) seqn->ipo->id.us++; + + sh = get_sequence_effect(seq); + if(sh.copy) sh.copy(seq, seqn); + + seqn->strip= MEM_dupallocN(seq->strip); + if(seq->len>0) seq->strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem"); seq->flag &= SEQ_DESEL; seqn->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL); Index: source/blender/src/header_seq.c =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/src/header_seq.c,v retrieving revision 1.29 diff -u -r1.29 header_seq.c --- source/blender/src/header_seq.c 7 Jul 2006 09:39:37 -0000 1.29 +++ source/blender/src/header_seq.c 25 Sep 2006 07:42:23 -0000 @@ -285,6 +285,9 @@ case 5: add_sequence(SEQ_MOVIE_AND_HD_SOUND); break; + case 6: + add_sequence(SEQ_COLOR); + break; } } @@ -306,6 +309,7 @@ #else uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Audio (Wav)", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, ""); #endif + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Color", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Scene", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Images", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Movie", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, ""); Index: source/blender/src/seqeffects.c =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/src/seqeffects.c,v retrieving revision 1.6 diff -u -r1.6 seqeffects.c --- source/blender/src/seqeffects.c 27 Jun 2006 10:28:00 -0000 1.6 +++ source/blender/src/seqeffects.c 25 Sep 2006 07:42:26 -0000 @@ -311,6 +311,67 @@ } /* ********************************************************************** + SOLID COLOR + ********************************************************************** */ + +static void init_solid_color(Sequence *seq) +{ + SolidColorVars *cv; + + if(seq->effectdata)MEM_freeN(seq->effectdata); + seq->effectdata = MEM_callocN(sizeof(struct SolidColorVars), "solidcolor"); + + cv = (SolidColorVars *)seq->effectdata; + cv->col[0] = cv->col[1] = cv->col[2] = 0.5; +} + +static void free_solid_color(Sequence *seq) +{ + if(seq->effectdata)MEM_freeN(seq->effectdata); + seq->effectdata = 0; +} + +static void copy_solid_color(Sequence *dst, Sequence *src) +{ + dst->effectdata = MEM_dupallocN(src->effectdata); +} + +static void do_solid_color(Sequence * seq,int cfra, + float facf0, float facf1, int x, int y, + struct ImBuf *ibuf1, struct ImBuf *ibuf2, + struct ImBuf *ibuf3, struct ImBuf *out) +{ + SolidColorVars *cv = (SolidColorVars *)seq->effectdata; + + unsigned char *rect; + float *rect_float; + + if (out->rect) { + rect = (unsigned char *)out->rect; + + for(y=0; yy; y++) { + for(x=0; xx; x++, rect+=4) { + rect[0]= (char)(cv->col[0]*255); + rect[1]= (char)(cv->col[1]*255); + rect[2]= (char)(cv->col[2]*255); + rect[3]= 255; + } + } + } else if (out->rect_float) { + rect_float = out->rect_float; + + for(y=0; yy; y++) { + for(x=0; xx; x++, rect_float+=4) { + rect_float[0]= cv->col[0]; + rect_float[1]= cv->col[1]; + rect_float[2]= cv->col[2]; + rect_float[3]= 1.0; + } + } + } +} + +/* ********************************************************************** ALPHA OVER ********************************************************************** */ @@ -2502,6 +2563,15 @@ rval.copy = NULL; switch (sequence_type) { + + /* solid color is not an 'effect' per se, but it uses this SeqEffectHandle + * system because it's convenient, centralised and prevents code duplication */ + case SEQ_COLOR: + rval.init = init_solid_color; + rval.free = free_solid_color; + rval.copy = copy_solid_color; + rval.execute = do_solid_color; + break; case SEQ_CROSS: rval.execute = do_cross_effect; rval.early_out = early_out_fade; Index: source/blender/src/sequence.c =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/src/sequence.c,v retrieving revision 1.55 diff -u -r1.55 sequence.c --- source/blender/src/sequence.c 10 Aug 2006 13:48:04 -0000 1.55 +++ source/blender/src/sequence.c 25 Sep 2006 07:42:28 -0000 @@ -127,7 +127,7 @@ if(seq->anim) IMB_free_anim(seq->anim); if(seq->hdaudio) sound_close_hdaudio(seq->hdaudio); - if (seq->type & SEQ_EFFECT) { + if ((seq->type & SEQ_EFFECT) || (seq->type == SEQ_COLOR)) { struct SeqEffectHandle sh = get_sequence_effect(seq); sh.free(seq); @@ -408,6 +408,28 @@ } } +void do_color_strip(int cfra, Sequence *seq, StripElem *se) +{ + float fac, facf; + int x, y; + struct SeqEffectHandle sh = get_sequence_effect(seq); + + if(seq->ipo && seq->ipo->curve.first) { + do_seq_ipo(seq); + fac= seq->facf0; + facf= seq->facf1; + } else { + sh.get_default_fac(seq, cfra, &fac, &facf); + } + + if( G.scene->r.mode & R_FIELDS ); else facf= fac; + + x= se->ibuf->x; + y= se->ibuf->y; + + sh.execute(seq, cfra, fac, facf, x, y, NULL, NULL, NULL, se->ibuf); +} + void do_effect(int cfra, Sequence *seq, StripElem *se) { StripElem *se1, *se2, *se3; @@ -831,7 +853,15 @@ } } - if(seq->type==SEQ_IMAGE) { + if(seq->type==SEQ_COLOR) { + if((se->ibuf==0) || (se->ibuf==NULL)) { + /* use an 8bpc color, float is not really necessary here */ + se->ibuf= IMB_allocImBuf((short)seqrectx, (short)seqrecty, 32, IB_rect, 0); + + do_color_strip(cfra, seq, se); + } + } + else if(seq->type==SEQ_IMAGE) { if(se->ok && se->ibuf==0) { /* if playanim or render: no waitcursor */ Index: source/blender/makesdna/DNA_sequence_types.h =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/makesdna/DNA_sequence_types.h,v retrieving revision 1.22 diff -u -r1.22 DNA_sequence_types.h --- source/blender/makesdna/DNA_sequence_types.h 26 Mar 2006 21:36:42 -0000 1.22 +++ source/blender/makesdna/DNA_sequence_types.h 25 Sep 2006 07:42:28 -0000 @@ -145,7 +145,13 @@ int rt; } Editing; + /* ************* Effect Variable Structs ********* */ +typedef struct SolidColorVars { + float col[3]; + float pad; +} SolidColorVars; + typedef struct WipeVars { float edgeWidth,angle; short forward, wipetype; @@ -182,7 +188,7 @@ #define SEQ_RAM_SOUND 4 #define SEQ_HD_SOUND 5 #define SEQ_MOVIE_AND_HD_SOUND 6 /* helper for add_sequence */ - +#define SEQ_COLOR 7 #define SEQ_EFFECT 8 #define SEQ_CROSS 8 #define SEQ_ADD 9 @@ -195,6 +201,7 @@ #define SEQ_PLUGIN 24 #define SEQ_WIPE 25 #define SEQ_GLOW 26 + #endif Index: source/blender/blenloader/intern/writefile.c =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/blenloader/intern/writefile.c,v retrieving revision 1.71 diff -u -r1.71 writefile.c --- source/blender/blenloader/intern/writefile.c 3 Sep 2006 12:16:13 -0000 1.71 +++ source/blender/blenloader/intern/writefile.c 25 Sep 2006 07:42:31 -0000 @@ -1220,6 +1220,9 @@ if(seq->plugin) writestruct(wd, DATA, "PluginSeq", 1, seq->plugin); if(seq->effectdata) { switch(seq->type){ + case SEQ_COLOR: + writestruct(wd, DATA, "SolidColorVars", 1, seq->effectdata); + break; case SEQ_WIPE: writestruct(wd, DATA, "WipeVars", 1, seq->effectdata); break;