Page MenuHome

ipoballs.txt

ipoballs.txt

Index: source/blender/src/drawipo.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/drawipo.c,v
retrieving revision 1.88
diff -u -p -u -r1.88 drawipo.c
--- source/blender/src/drawipo.c 30 Nov 2006 02:47:28 -0000 1.88
+++ source/blender/src/drawipo.c 1 Dec 2006 09:48:04 -0000
@@ -95,6 +95,8 @@
#include "butspace.h" // shouldnt be...
#include "winlay.h"
+#include "DNA_node_types.h" // for SOCK_VALUE
+
/* local define... also used in editipo ... */
#define ISPOIN(a, b, c) ( (a->b) && (a->c) )
#define ISPOIN3(a, b, c, d) ( (a->b) && (a->c) && (a->d) )
@@ -1083,6 +1085,93 @@ static void draw_ipobuts(SpaceIpo *sipo)
uiDrawBlock(block);
}
+/* nice AA filled circle */
+static void socket_circle_draw(float x, float y, float size, int type, int select)
+{
+ /* 16 values of sin function */
+ static float si[16] = {
+ 0.00000000, 0.39435585,0.72479278,0.93775213,
+ 0.99871650,0.89780453,0.65137248,0.29936312,
+ -0.10116832,-0.48530196,-0.79077573,-0.96807711,
+ -0.98846832,-0.84864425,-0.57126821,-0.20129852
+ };
+ /* 16 values of cos function */
+ static float co[16] ={
+ 1.00000000,0.91895781,0.68896691,0.34730525,
+ -0.05064916,-0.44039415,-0.75875812,-0.95413925,
+ -0.99486932,-0.87434661,-0.61210598,-0.25065253,
+ 0.15142777,0.52896401,0.82076344,0.97952994,
+ };
+ float width, widthscalingfactor, height, heightscalingfactor;
+ int a, xmin, xmax, ymin, ymax;
+ rcti rect;
+
+ if(select==0) {
+ if(type==-1)
+ glColor3ub(0, 0, 0);
+ else if(type==SOCK_VALUE)
+ glColor3ub(160, 160, 160);
+ else if(type==SOCK_VECTOR)
+ glColor3ub(100, 100, 200);
+ else if(type==SOCK_RGBA)
+ glColor3ub(200, 200, 40);
+ else
+ glColor3ub(100, 200, 100);
+ }
+ else {
+ if(type==SOCK_VALUE)
+ glColor3ub(200, 200, 200);
+ else if(type==SOCK_VECTOR)
+ glColor3ub(140, 140, 240);
+ else if(type==SOCK_RGBA)
+ glColor3ub(240, 240, 100);
+ else
+ glColor3ub(140, 240, 140);
+ }
+
+ /* calculate scaling ratio for x\y */
+ /* get rect */
+ rect= G.v2d->mask;
+ /* get min/max x */
+ xmin= rect.xmin;
+ xmax= rect.xmax;
+ /* get min/max y */
+ ymin= rect.ymin;
+ ymax= rect.ymax;
+ /* get height/width. is it always positive? abs? */
+ height= ymax-ymin;
+ width= xmax-xmin;
+
+ /* check if width is bigger than height -> scale width */
+ if(width >= height) {
+ widthscalingfactor= height/width;
+ heightscalingfactor= 1;
+ }
+ else {
+ widthscalingfactor= 1;
+ heightscalingfactor= width/height;
+ }
+
+ printf("xmin: %d, xmax: %d, ymin: %d, ymax: %d \n", xmin, xmax, ymin, ymax);
+ printf("height: %f, width: %f \n", height, width);
+ printf("wscale: %f, hscale: %f \n\n", widthscalingfactor, heightscalingfactor);
+
+ glBegin(GL_POLYGON);
+ for(a=0; a<16; a++)
+ glVertex2f(x+size*si[a]*widthscalingfactor, y+size*co[a]*heightscalingfactor*0.05);
+ glEnd();
+
+ glColor4ub(0, 0, 0, 150);
+ glEnable(GL_BLEND);
+ glEnable( GL_LINE_SMOOTH );
+ glBegin(GL_LINE_LOOP);
+ for(a=0; a<16; a++)
+ glVertex2f(x+size*si[a]*widthscalingfactor, y+size*co[a]*heightscalingfactor*0.05);
+ glEnd();
+ glDisable( GL_LINE_SMOOTH );
+ glDisable(GL_BLEND);
+}
+
static void draw_ipovertices(int sel)
{
EditIpo *ei;
@@ -1092,7 +1181,7 @@ static void draw_ipovertices(int sel)
if(G.f & G_PICKSEL) return;
- glPointSize(3.0);
+ //glPointSize(3.0);
ei= G.sipo->editipo;
for(nr=0; nr<G.sipo->totipo; nr++, ei++) {
@@ -1119,7 +1208,7 @@ static void draw_ipovertices(int sel)
a= ei->icu->totvert;
bezt= ei->icu->bezt;
- bglBegin(GL_POINTS);
+ //bglBegin(GL_POINTS);
while(a--) {
@@ -1141,7 +1230,9 @@ static void draw_ipovertices(int sel)
while(b<31) {
if(val & (1<<b)) {
v1[1]= b+1;
- bglVertex3fv(v1);
+ //bglVertex3fv(v1);
+ //use node draw here
+ socket_circle_draw(v1[0], v1[1], 3, SOCK_VALUE, 0);
}
b++;
}
@@ -1152,32 +1243,38 @@ static void draw_ipovertices(int sel)
if(ei->icu->ipo==IPO_BEZ) {
/* Draw the editmode hendels for a bezier curve */
if( (bezt->f1 & 1) == sel)/* && G.v2d->cur.xmin < bezt->vec[0][0] < G.v2d->cur.xmax)*/
- bglVertex3fv(bezt->vec[0]);
+ socket_circle_draw(bezt->vec[0][0], bezt->vec[0][1], 3, SOCK_VALUE, 0);
+ //use node draw here
+ //bglVertex3fv(bezt->vec[0]);
if( (bezt->f3 & 1) == sel)/* && G.v2d->cur.xmin < bezt->vec[2][0] < G.v2d->cur.xmax)*/
- bglVertex3fv(bezt->vec[2]);
+ socket_circle_draw(bezt->vec[2][0], bezt->vec[2][1], 3, SOCK_VALUE, 0);
+ //use node draw here
+ //bglVertex3fv(bezt->vec[2]);
}
if( (bezt->f2 & 1) == sel) /* && G.v2d->cur.xmin < bezt->vec[1][0] < G.v2d->cur.xmax)*/
- bglVertex3fv(bezt->vec[1]);
+ socket_circle_draw(bezt->vec[1][0], bezt->vec[1][1], 3, SOCK_VALUE, 0);
+ //use node draw here
+ //bglVertex3fv(bezt->vec[1]);
}
else {
/* draw only if in bounds */
/*if (G.v2d->cur.xmin < bezt->vec[1][0] < G.v2d->cur.xmax)*/
- bglVertex3fv(bezt->vec[1]);
-
+ //bglVertex3fv(bezt->vec[1]);
+ socket_circle_draw(bezt->vec[1][0], bezt->vec[1][1], 3, SOCK_VALUE, 0);
}
}
bezt++;
}
- bglEnd();
+ //bglEnd();
}
}
- glPointSize(1.0);
+ //glPointSize(1.0);
}
static void draw_ipohandles(int sel)
@@ -2621,4 +2718,3 @@ EditIpo *select_proj_ipo(rctf *rectf, in
}
return 0;
}
-

File Metadata

Mime Type
text/x-diff
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
62/60/93f459e1f3e9f2d20972d7054804

Event Timeline