Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnny Matthews <johnny.matthews@gmail.com>2004-07-12 21:59:42 +0400
committerJohnny Matthews <johnny.matthews@gmail.com>2004-07-12 21:59:42 +0400
commitab200e3f92a60be1f7b205db891b073016a59e98 (patch)
treed2041439a3b84daed85164139f306f63c97821fe /source/blender
parentf32b8e6b7f2caef90ef83b44864d2499619c4169 (diff)
This commit add the clock wipe effect to the sweep menu in the sequence editor
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/include/BSE_sequence.h2
-rw-r--r--source/blender/src/drawseq.c12
-rw-r--r--source/blender/src/sequence.c62
3 files changed, 67 insertions, 9 deletions
diff --git a/source/blender/include/BSE_sequence.h b/source/blender/include/BSE_sequence.h
index c8bbedd2fbb..a592c516f08 100644
--- a/source/blender/include/BSE_sequence.h
+++ b/source/blender/include/BSE_sequence.h
@@ -97,7 +97,7 @@ void do_mul_effect(float facf0, float facf1,
unsigned int *out);
/* Sweep effect */
enum {DO_SINGLE_WIPE, DO_DOUBLE_WIPE, DO_BOX_WIPE, DO_CROSS_WIPE,
- DO_IRIS_WIPE};
+ DO_IRIS_WIPE,DO_CLOCK_WIPE};
float in_band(float width,float dist, float perc,int side,int dir);
float check_zone(int x, int y, int xo, int yo, struct Sequence *seq, float facf0);
void init_sweep_effect(struct Sequence *seq);
diff --git a/source/blender/src/drawseq.c b/source/blender/src/drawseq.c
index 212b936a6a7..0e0645a85dc 100644
--- a/source/blender/src/drawseq.c
+++ b/source/blender/src/drawseq.c
@@ -713,11 +713,17 @@ static void seq_panel_properties(short cntrl) // SEQ_HANDLER_PROPERTIES
if(last_seq->type==SEQ_SWEEP){
SweepVars *sweep = (SweepVars *)last_seq->effectdata;
char formatstring[1024];
- strcpy(formatstring, "Select Sweep Type %t|Single Wipe%x0|Double Wipe %x1|Iris Wipe %x4");
+ strcpy(formatstring, "Select Sweep Type %t|Single Wipe%x0|Double Wipe %x1|Iris Wipe %x4|Clock Wipe %x5");
uiDefButS(block, MENU,SEQ_BUT_EFFECT | B_NOP, formatstring, 10,90,220,22, &sweep->sweeptype, 0, 0, 0, 0, "What type of sweep should be performed");
uiDefButF(block, NUM,SEQ_BUT_EFFECT| B_NOP,"Blur:", 10,65,220,22, &sweep->edgeWidth,0.0,1.0, 1, 2, "The percent width of the blur edge");
- if(sweep->sweeptype != DO_IRIS_WIPE)
- uiDefButF(block, NUM,SEQ_BUT_EFFECT| B_NOP,"Angle:", 10,40,220,22, &sweep->angle,-90.0,90.0, 1, 2, "The Angle of the Edge");
+ switch(sweep->sweeptype){ /*Skip Types that do not require angle*/
+ case DO_IRIS_WIPE:
+ case DO_CLOCK_WIPE:
+ break;
+
+ default:
+ uiDefButF(block, NUM,SEQ_BUT_EFFECT| B_NOP,"Angle:", 10,40,220,22, &sweep->angle,-90.0,90.0, 1, 2, "The Angle of the Edge");
+ }
uiDefButS(block, TOG,SEQ_BUT_EFFECT| B_NOP,"Wipe In", 10,15,220,22, &sweep->forward,0,0, 0, 0, "Controls Primary Direction of Sweep");
}
else if(last_seq->type==SEQ_GLOW){
diff --git a/source/blender/src/sequence.c b/source/blender/src/sequence.c
index 48e84f32c82..3ff185626a0 100644
--- a/source/blender/src/sequence.c
+++ b/source/blender/src/sequence.c
@@ -989,12 +989,12 @@ float check_zone(int x, int y, int xo, int yo, Sequence *seq, float facf0) {
/*some future stuff
float hyp3,hyp4,b4,b5
*/
- float temp1,temp2; //some placeholder variables
+ float temp1,temp2,temp3,temp4,hold; //some placeholder variables
float halfx = xo/2;
float halfy = yo/2;
- float output=0;
+ float widthf,output=0;
SweepVars *sweep = (SweepVars *)seq->effectdata;
- int width,invert = 0;
+ int width;
angle = sweep->angle;
if(angle < 0){
@@ -1019,7 +1019,7 @@ float check_zone(int x, int y, int xo, int yo, Sequence *seq, float facf0) {
if (angle == 0.0)angle = 0.000001;
b1 = posy - (-angle)*posx;
b2 = y - (-angle)*x;
- hyp = abs(angle*x+y+(-posy-angle*posx))/sqrt(angle*angle+1);
+ hyp = fabs(angle*x+y+(-posy-angle*posx))/sqrt(angle*angle+1);
if(angle < 0){
temp1 = b1;
b1 = b2;
@@ -1074,7 +1074,59 @@ float check_zone(int x, int y, int xo, int yo, Sequence *seq, float facf0) {
output = in_band(hwidth,hyp2,facf0,1,1) * in_band(hwidth,hyp,facf0,1,1);
}
if(!sweep->forward)output = 1-output;
- break;
+ break;
+ case DO_CLOCK_WIPE:
+ /*
+ temp1: angle of effect center in rads
+ temp2: angle of line through (halfx,halfy) and (x,y) in rads
+ temp3: angle of low side of blur
+ temp4: angle of high side of blur
+ */
+ output = 1-facf0;
+ widthf = sweep->edgeWidth*2*3.14159;
+ temp1 = 2 * 3.14159 * facf0;
+
+ if(sweep->forward){
+ temp1 = 2*3.14159-temp1;
+ }
+
+ x = x - halfx;
+ y = y - halfy;
+
+ temp2 = asin(abs(y)/sqrt(x*x + y*y));
+ if(x <= 0 && y >= 0)
+ temp2 = 3.14159 - temp2;
+ else if(x<=0 && y <= 0)
+ temp2 += 3.14159;
+ else if(x >= 0 && y <= 0)
+ temp2 = 2*3.14159 - temp2;
+
+ if(sweep->forward){
+ temp3 = temp1-(widthf/2)*facf0;
+ temp4 = temp1+(widthf/2)*(1-facf0);
+ }
+ else{
+ temp3 = temp1-(widthf/2)*(1-facf0);
+ temp4 = temp1+(widthf/2)*facf0;
+ }
+ if (temp3 < 0) temp3 = 0;
+ if (temp4 > 2*3.14159) temp4 = 2*3.14159;
+
+
+ if(temp2 < temp3)
+ output = 0;
+ else if (temp2 > temp4)
+ output = 1;
+ else
+ output = (temp2-temp3)/(temp4-temp3);
+ if(x == 0 && y == 0){
+ output = 1;
+ }
+ if(output != output)
+ output = 1;
+ if(sweep->forward)
+ output = 1 - output;
+ break;
/* BOX WIPE IS NOT WORKING YET */
/* case DO_CROSS_WIPE: */
/* BOX WIPE IS NOT WORKING YET */