first of the c code comment translation in the mother of all directories!

This commit is contained in:
2003-04-28 14:43:20 +00:00
parent 85c55f3dff
commit 597875cb69
13 changed files with 315 additions and 344 deletions

View File

@@ -289,7 +289,7 @@ char texstr[15][8]= {"None" , "Clouds" , "Wood",
#define B_PRINTLEN 1414 #define B_PRINTLEN 1414
#define B_RELKEY 1415 #define B_RELKEY 1415
/* heeft MAX_EFFECT standen! Volgende pas 1450... */ /* this has MAX_EFFECT settings! Next free define is 1450... */
#define B_SELEFFECT 1430 #define B_SELEFFECT 1430
@@ -369,7 +369,7 @@ enum {
#define B_DOCENTRENEW 2016 #define B_DOCENTRENEW 2016
#define B_DOCENTRECURSOR 2017 #define B_DOCENTRECURSOR 2017
/* 32 getallen! */ /* 32 values! */
#define B_OBLAY 2018 #define B_OBLAY 2018
#define B_MESHBUTS 2100 #define B_MESHBUTS 2100
@@ -973,7 +973,7 @@ static void do_common_editbuts(unsigned short event)
scrarea_queue_winredraw(curarea); scrarea_queue_winredraw(curarea);
} }
BASACT->lay += local; BASACT->lay += local;
/* optimale redraw */ /* optimal redraw */
if( (OBACT->lay & G.vd->lay) && (BASACT->lay & G.vd->lay) ); if( (OBACT->lay & G.vd->lay) && (BASACT->lay & G.vd->lay) );
else if( (OBACT->lay & G.vd->lay)==0 && (BASACT->lay & G.vd->lay)==0 ); else if( (OBACT->lay & G.vd->lay)==0 && (BASACT->lay & G.vd->lay)==0 );
else allqueue(REDRAWVIEW3D, 0); else allqueue(REDRAWVIEW3D, 0);
@@ -1031,7 +1031,7 @@ void common_editbuts(void)
uiBlockSetCol(block, BUTGREY); uiBlockSetCol(block, BUTGREY);
/* material en select swap en hide */ /* material and select swap and hide */
if ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL) { if ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL) {
if(ob->type==OB_MESH) poin= &( ((Mesh *)ob->data)->texflag ); if(ob->type==OB_MESH) poin= &( ((Mesh *)ob->data)->texflag );
@@ -1468,7 +1468,7 @@ void do_meshbuts(unsigned short event)
vertexsmooth(); vertexsmooth();
break; break;
} }
/* LETOP: bovenstaande events alleen in editmode! */ /* WATCH IT: previous events only in editmode! */
} }
static void verify_vertexgroup_name_func(void *datav, void *data2_unused) static void verify_vertexgroup_name_func(void *datav, void *data2_unused)
@@ -2023,7 +2023,7 @@ void do_curvebuts(unsigned short event)
if(ob->type==OB_FONT) text_to_curve(ob, 0); if(ob->type==OB_FONT) text_to_curve(ob, 0);
makeDispList(ob); makeDispList(ob);
allqueue(REDRAWVIEW3D, 0); allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWINFO, 1); /* 1, want header->win==0! */ allqueue(REDRAWINFO, 1); /* 1, because header->win==0! */
break; break;
case B_SUBDIVCURVE: case B_SUBDIVCURVE:
@@ -3066,7 +3066,7 @@ void latticebuts(void)
Tex *cur_imatex=0; Tex *cur_imatex=0;
int prv_win= 0; int prv_win= 0;
void load_tex_image(char *str) /* aangeroepen vanuit fileselect */ void load_tex_image(char *str) /* called from fileselect */
{ {
Image *ima=0; Image *ima=0;
Tex *tex; Tex *tex;
@@ -3081,7 +3081,7 @@ void load_tex_image(char *str) /* aangeroepen vanuit fileselect */
} }
tex->ima= ima; tex->ima= ima;
free_image_buffers(ima); /* forceer opnieuw inlezen */ free_image_buffers(ima); /* force reading again */
ima->ok= 1; ima->ok= 1;
} }
@@ -3091,7 +3091,7 @@ void load_tex_image(char *str) /* aangeroepen vanuit fileselect */
} }
} }
void load_plugin_tex(char *str) /* aangeroepen vanuit fileselect */ void load_plugin_tex(char *str) /* called from fileselect */
{ {
Tex *tex; Tex *tex;
@@ -3188,7 +3188,7 @@ void drawcolorband(ColorBand *coba, float x1, float y1, float sizex, float sizey
glEnd(); glEnd();
glShadeModel(GL_FLAT); glShadeModel(GL_FLAT);
/* hulplijntjes */ /* help lines */
v1[0]= v2[0]=v3[0]= x1; v1[0]= v2[0]=v3[0]= x1;
v1[1]= y1; v1[1]= y1;
@@ -3264,7 +3264,7 @@ void do_texbuts(unsigned short event)
case B_LOADTEXIMA: case B_LOADTEXIMA:
case B_LOADTEXIMA1: case B_LOADTEXIMA1:
if(tex==0) return; if(tex==0) return;
/* globals: even onthouden: we maken andere area fileselect */ /* globals: temporal store them: we make another area a fileselect */
cur_imatex= tex; cur_imatex= tex;
prv_win= curarea->win; prv_win= curarea->win;
@@ -3294,7 +3294,7 @@ void do_texbuts(unsigned short event)
cur_imatex= tex; cur_imatex= tex;
prv_win= curarea->win; prv_win= curarea->win;
/* naam in tex->ima is door button veranderd! */ /* name in tex->ima has been changed by button! */
strcpy(str, tex->ima->name); strcpy(str, tex->ima->name);
if(tex->ima->ibuf) strcpy(tex->ima->name, tex->ima->ibuf->name); if(tex->ima->ibuf) strcpy(tex->ima->name, tex->ima->ibuf->name);
@@ -3403,7 +3403,7 @@ void do_texbuts(unsigned short event)
case B_LOADPLUGIN: case B_LOADPLUGIN:
if(tex==0) return; if(tex==0) return;
/* globals: even onthouden: we maken andere area fileselect */ /* globals: store temporal: we make another area a fileselect */
cur_imatex= tex; cur_imatex= tex;
prv_win= curarea->win; prv_win= curarea->win;
@@ -3497,7 +3497,7 @@ void do_texbuts(unsigned short event)
glDrawBuffer(GL_BACK); glDrawBuffer(GL_BACK);
do_texbuts(B_CALCCBAND2); do_texbuts(B_CALCCBAND2);
cbd= tex->coba->data + tex->coba->cur; /* ivm qsort */ cbd= tex->coba->data + tex->coba->cur; /* because qsort */
mvalo[0]= mval[0]; mvalo[0]= mval[0];
} }
@@ -3848,7 +3848,7 @@ void texbuts(void)
uiBlockSetCol(block, BUTGREY); uiBlockSetCol(block, BUTGREY);
/* printen aantal frames anim */ /* print amount of frames anim */
if(tex->ima && tex->ima->anim) { if(tex->ima && tex->ima->anim) {
uiDefBut(block, BUT, B_TEXSETFRAMES, "<", 802, 110, 20, 18, 0, 0, 0, 0, 0, "Paste number of frames in Frames: button"); uiDefBut(block, BUT, B_TEXSETFRAMES, "<", 802, 110, 20, 18, 0, 0, 0, 0, 0, "Paste number of frames in Frames: button");
sprintf(str, "%d frs ", IMB_anim_get_duration(tex->ima->anim)); sprintf(str, "%d frs ", IMB_anim_get_duration(tex->ima->anim));
@@ -3959,7 +3959,7 @@ void texbuts(void)
uiBlockSetCol(block, BUTPURPLE); uiBlockSetCol(block, BUTPURPLE);
uiDefButS(block, NUM, B_REDR, "Cur:", 1082,104,132,20, &tex->coba->cur, 0.0, (float)(tex->coba->tot-1), 0, 0, "The active colour from the colorband"); uiDefButS(block, NUM, B_REDR, "Cur:", 1082,104,132,20, &tex->coba->cur, 0.0, (float)(tex->coba->tot-1), 0, 0, "The active colour from the colorband");
uiDefBut(block, LABEL, B_DOCOLORBAND, "", 923,81,345,20, 0, 0, 0, 0, 0, "Colorband"); /* alleen voor event! */ uiDefBut(block, LABEL, B_DOCOLORBAND, "", 923,81,345,20, 0, 0, 0, 0, 0, "Colorband"); /* only for event! */
drawcolorband(tex->coba, 923,81,345,20); drawcolorband(tex->coba, 923,81,345,20);
cbd= tex->coba->data + tex->coba->cur; cbd= tex->coba->data + tex->coba->cur;
@@ -4024,7 +4024,7 @@ void do_matbuts(unsigned short event)
BIF_previewdraw(G.buts); BIF_previewdraw(G.buts);
break; break;
case B_MATPRV: case B_MATPRV:
/* dit event wordt ook door lamp, tex en sky gebruikt */ /* this event also used by lamp, tex and sky */
BIF_preview_changed(G.buts); BIF_preview_changed(G.buts);
break; break;
case B_MATPRV_DRAW: case B_MATPRV_DRAW:
@@ -4097,9 +4097,9 @@ void matbuts(void)
sprintf(str, "buttonswin %d", curarea->win); sprintf(str, "buttonswin %d", curarea->win);
block= uiNewBlock(&curarea->uiblocks, str, UI_EMBOSSX, UI_HELV, curarea->win); block= uiNewBlock(&curarea->uiblocks, str, UI_EMBOSSX, UI_HELV, curarea->win);
if(ob->actcol==0) ob->actcol= 1; /* ivm TOG|BIT button */ if(ob->actcol==0) ob->actcol= 1; /* because of TOG|BIT button */
/* aangeven waar het materiaal aan hangt */ /* indicate which one is linking a material */
uiBlockSetCol(block, BUTSALMON); uiBlockSetCol(block, BUTSALMON);
uiDefButS(block, TOG|BIT|(ob->actcol-1), B_MATFROM, "OB", 342, 195, 33, 20, &ob->colbits, 0, 0, 0, 0, "Link material to object"); uiDefButS(block, TOG|BIT|(ob->actcol-1), B_MATFROM, "OB", 342, 195, 33, 20, &ob->colbits, 0, 0, 0, 0, "Link material to object");
idn= ob->data; idn= ob->data;
@@ -4109,7 +4109,7 @@ void matbuts(void)
uiDefButS(block, TOGN|BIT|(ob->actcol-1), B_MATFROM, str, 380, 195, 33, 20, &ob->colbits, 0, 0, 0, 0, "Show the block the material is linked to"); uiDefButS(block, TOGN|BIT|(ob->actcol-1), B_MATFROM, str, 380, 195, 33, 20, &ob->colbits, 0, 0, 0, 0, "Show the block the material is linked to");
uiBlockSetCol(block, BUTGREY); uiBlockSetCol(block, BUTGREY);
/* id is het blok waarvan materiaal wordt gepakt */ /* id is the block from which the material is used */
if( BTST(ob->colbits, ob->actcol-1) ) id= (ID *)ob; if( BTST(ob->colbits, ob->actcol-1) ) id= (ID *)ob;
else id= ob->data; else id= ob->data;
@@ -4966,7 +4966,7 @@ void lampbuts(void)
id= (ID *)mtex->tex; id= (ID *)mtex->tex;
IDnames_to_pupstring(&strp, NULL, "ADD NEW %x 32767", &(G.main->tex), id, &(G.buts->texnr)); IDnames_to_pupstring(&strp, NULL, "ADD NEW %x 32767", &(G.main->tex), id, &(G.buts->texnr));
/* werkt niet omdat lockpoin op lamp staat, niet op texture */ /* doesnt work, because lockpoin points to lamp, not to texture */
uiDefButS(block, MENU, B_LTEXBROWSE, strp, 900,146,20,19, &(G.buts->texnr), 0, 0, 0, 0, "Select an existing texture, or create new"); uiDefButS(block, MENU, B_LTEXBROWSE, strp, 900,146,20,19, &(G.buts->texnr), 0, 0, 0, 0, "Select an existing texture, or create new");
MEM_freeN(strp); MEM_freeN(strp);
@@ -5451,10 +5451,10 @@ void animbuts(void)
} }
} }
/* IPO BUTTONS ALS LAATSTE */ /* IPO BUTTONS AS LAST */
ok= 0; ok= 0;
if(G.sipo) { if(G.sipo) {
/* bestaat deze? */ /* do these exist? */
sa= G.curscreen->areabase.first; sa= G.curscreen->areabase.first;
while(sa) { while(sa) {
if(sa->spacetype==SPACE_IPO && sa->spacedata.first==G.sipo) break; if(sa->spacetype==SPACE_IPO && sa->spacedata.first==G.sipo) break;
@@ -5650,7 +5650,7 @@ void worldbuts(void)
uiDefButF(block, NUM, B_MATPRV, "sizeY", 745,30,133,18, mtex->size+1, -20.0, 20.0, 10, 0, "Set an extra scaling for the texture coordinate"); uiDefButF(block, NUM, B_MATPRV, "sizeY", 745,30,133,18, mtex->size+1, -20.0, 20.0, 10, 0, "Set an extra scaling for the texture coordinate");
uiDefButF(block, NUM, B_MATPRV, "sizeZ", 745,10,133,18, mtex->size+2, -20.0, 20.0, 10, 0, "Set an extra scaling for the texture coordinate"); uiDefButF(block, NUM, B_MATPRV, "sizeZ", 745,10,133,18, mtex->size+2, -20.0, 20.0, 10, 0, "Set an extra scaling for the texture coordinate");
/* TEXTUREBLOK SELECT */ /* TEXTUREBLOCK SELECT */
id= (ID *)mtex->tex; id= (ID *)mtex->tex;
IDnames_to_pupstring(&strp, NULL, "ADD NEW %x 32767", &(G.main->tex), id, &(G.buts->texnr)); IDnames_to_pupstring(&strp, NULL, "ADD NEW %x 32767", &(G.main->tex), id, &(G.buts->texnr));
uiDefButS(block, MENU, B_WTEXBROWSE, strp, 900,146,20,19, &(G.buts->texnr), 0, 0, 0, 0, "Browse"); uiDefButS(block, MENU, B_WTEXBROWSE, strp, 900,146,20,19, &(G.buts->texnr), 0, 0, 0, 0, "Browse");
@@ -5748,7 +5748,7 @@ static void load_bgpic_image(char *name)
} }
vd->bgpic->ima= ima; vd->bgpic->ima= ima;
free_image_buffers(ima); /* forceer opnieuw inlezen */ free_image_buffers(ima); /* force read again */
ima->ok= 1; ima->ok= 1;
} }
allqueue(REDRAWBUTSVIEW, 0); allqueue(REDRAWBUTSVIEW, 0);
@@ -5815,7 +5815,7 @@ void viewbuts(void)
uiBlock *block; uiBlock *block;
char *strp, str[64]; char *strp, str[64];
/* op zoek naar spacedata */ /* searching for spacedata */
vd= scrarea_find_space_of_type(curarea, SPACE_VIEW3D); vd= scrarea_find_space_of_type(curarea, SPACE_VIEW3D);
if(vd==0) return; if(vd==0) return;
@@ -5852,7 +5852,7 @@ void viewbuts(void)
} }
/* There is a bug here ... (what bug? where? what is this? - zr) */ /* There is a bug here ... (what bug? where? what is this? - zr) */
/* textureblok: */ /* texture block: */
id= (ID *)vd->bgpic->tex; id= (ID *)vd->bgpic->tex;
IDnames_to_pupstring(&strp, NULL, NULL, &(G.main->tex), id, &(G.buts->texnr)); IDnames_to_pupstring(&strp, NULL, NULL, &(G.main->tex), id, &(G.buts->texnr));
if (strp[0]) if (strp[0])
@@ -5899,7 +5899,7 @@ void backbuf_pic(char *name)
ima= add_image(name); ima= add_image(name);
if(ima) { if(ima) {
free_image_buffers(ima); /* forceer opnieuw inlezen */ free_image_buffers(ima); /* force read again */
ima->ok= 1; ima->ok= 1;
} }
} }
@@ -7233,7 +7233,7 @@ void do_blenderbuttons(unsigned short event)
{ {
SpaceButs *buts; SpaceButs *buts;
/* teken ook de soortgelijke windows? */ /* redraw windows of the same type? */
buts= curarea->spacedata.first; buts= curarea->spacedata.first;
if(buts->mainb==BUTS_VIEW) allqueue(REDRAWBUTSVIEW, curarea->win); if(buts->mainb==BUTS_VIEW) allqueue(REDRAWBUTSVIEW, curarea->win);
else if(buts->mainb==BUTS_LAMP) allqueue(REDRAWBUTSLAMP, curarea->win); else if(buts->mainb==BUTS_LAMP) allqueue(REDRAWBUTSLAMP, curarea->win);

View File

@@ -80,15 +80,15 @@ void rectwrite_part(int winxmin, int winymin, int winxmax, int winymax, int x1,
oldxim= xim; oldxim= xim;
/* coordinaten hoe 't op scherm komt */ /* coordinates how its drawn at the screen */
x2= x1+ zoomx*xim; x2= x1+ zoomx*xim;
y2= y1+ zoomy*yim; y2= y1+ zoomy*yim;
/* partiele clip */ /* partial clip */
if(x1<winxmin) { if(x1<winxmin) {
/* recten bij OpenGL mogen niet links/onder van windowrand beginnen */ /* with OpenGL, rects are not allowed to start outside of the left/bottom window edge */
cx= winxmin-x1+(int)zoomx; cx= winxmin-x1+(int)zoomx;
/* zorg ervoor dat de rect pixelnauwkeurig wordt neergezet */ /* make sure the rect will be drawn pixel-exact */
cx/= zoomx; cx/= zoomx;
cx++; cx++;
x1+= zoomx*cx; x1+= zoomx*cx;
@@ -177,11 +177,11 @@ void calc_image_view(SpaceImage *sima, char mode)
/* float! */ /* float! */
zoom= sima->zoom; zoom= sima->zoom;
/* relatieve afbeeld links */ /* relative display right */
sima->v2d.cur.xmin= ((curarea->winrct.xmin - (float)x1)/zoom); sima->v2d.cur.xmin= ((curarea->winrct.xmin - (float)x1)/zoom);
sima->v2d.cur.xmax= sima->v2d.cur.xmin + ((float)curarea->winx/zoom); sima->v2d.cur.xmax= sima->v2d.cur.xmin + ((float)curarea->winx/zoom);
/* relatieve afbeeld links */ /* relative display left */
sima->v2d.cur.ymin= ((curarea->winrct.ymin-(float)y1)/zoom); sima->v2d.cur.ymin= ((curarea->winrct.ymin-(float)y1)/zoom);
sima->v2d.cur.ymax= sima->v2d.cur.ymin + ((float)curarea->winy/zoom); sima->v2d.cur.ymax= sima->v2d.cur.ymin + ((float)curarea->winy/zoom);
@@ -332,7 +332,7 @@ void draw_tfaces(void)
glEnd(); glEnd();
setlinestyle(2); setlinestyle(2);
/* kleuren: R=x G=y */ /* colors: R=x G=y */
if(tface->flag & TF_ACTIVE) cpack(0xFF00); else cpack(0xFFFFFF); if(tface->flag & TF_ACTIVE) cpack(0xFF00); else cpack(0xFFFFFF);
@@ -393,7 +393,7 @@ static unsigned int *get_part_from_ibuf(ImBuf *ibuf, short startx, short starty,
unsigned int *rt, *rp, *rectmain; unsigned int *rt, *rp, *rectmain;
short y, heigth, len; short y, heigth, len;
/* de juiste offset in rectot */ /* the right offset in rectot */
rt= ibuf->rect+ (starty*ibuf->x+ startx); rt= ibuf->rect+ (starty*ibuf->x+ startx);
@@ -445,7 +445,7 @@ void drawimagespace(ScrArea *sa, void *spacedata)
return; return;
} }
/* plek berekenen */ /* calc location */
x1= xmin+(curarea->winx-G.sima->zoom*ibuf->x)/2; x1= xmin+(curarea->winx-G.sima->zoom*ibuf->x)/2;
y1= ymin+(curarea->winy-G.sima->zoom*ibuf->y)/2; y1= ymin+(curarea->winy-G.sima->zoom*ibuf->y)/2;
@@ -476,7 +476,7 @@ void drawimagespace(ScrArea *sa, void *spacedata)
if(G.sima->image->tpageflag & IMA_TILES) { if(G.sima->image->tpageflag & IMA_TILES) {
/* eventjes laten staan */ /* just leave this a while */
if(G.sima->image->xrep<1) return; if(G.sima->image->xrep<1) return;
if(G.sima->image->yrep<1) return; if(G.sima->image->yrep<1) return;

View File

@@ -82,15 +82,15 @@ void rectwrite_imasel(int winxmin, int winymin, int winxmax, int winymax, int x1
oldxim= xim; oldxim= xim;
/* coordinaten hoe 't op scherm komt */ /* coordinates how it will be put at screen */
x2= x1+ zoomx*xim; x2= x1+ zoomx*xim;
y2= y1+ zoomy*yim; y2= y1+ zoomy*yim;
/* partiele clip */ /* partial clip */
if(x1<=winxmin) { if(x1<=winxmin) {
/* recten bij OpenGL mogen niet links/onder van windowrand beginnen */ /* with OpenGL, rects are not allowed to start outside of the left/bottom window edge */
cx= winxmin-x1+(int)zoomx; cx= winxmin-x1+(int)zoomx;
/* zorg ervoor dat de rect pixelnauwkeurig wordt neergezet */ /* make sure the rect will be drawn pixel-exact */
cx/= zoomx; cx/= zoomx;
cx++; cx++;
x1+= zoomx*cx; x1+= zoomx*cx;
@@ -616,7 +616,7 @@ void draw_sima_area(SpaceImaSel *simasel)
ima = ima->next; ima = ima->next;
} }
if ((simasel->mode & 8) == 8) { /* if loep */ if ((simasel->mode & 8) == 8) { /* if magnify */
if (bitset(simasel->fase, IMS_KNOW_IMA) && (simasel->hilite_ima)) { if (bitset(simasel->fase, IMS_KNOW_IMA) && (simasel->hilite_ima)) {
@@ -857,9 +857,9 @@ void pibplay(SpaceImaSel *simasel)
/* ************** hoofdtekenfunktie ************** */ /* ************** main drawing function ************** */
void drawimaselspace(ScrArea *sa, void *spacedata) /* hoofdtekenfunktie */ void drawimaselspace(ScrArea *sa, void *spacedata)
{ {
SpaceImaSel *simasel; SpaceImaSel *simasel;
simasel= curarea->spacedata.first; simasel= curarea->spacedata.first;

View File

@@ -130,7 +130,7 @@ static void step_to_grid(float *step, int *macht)
{ {
float loga, rem; float loga, rem;
/* proberen step als 10e macht te schrijven */ /* try to write step as a power of 10 */
loga= log10(*step); loga= log10(*step);
*macht= (int)(loga); *macht= (int)(loga);
@@ -161,8 +161,8 @@ void calc_ipogrid()
{ {
float space, pixels; float space, pixels;
/* regel: gridstep is minimaal IPOSTEP pixels */ /* rule: gridstep is minimal IPOSTEP pixels */
/* hoe groot zijn IPOSTEP pixels? */ /* how large is IPOSTEP pixels? */
if(G.v2d==0) return; if(G.v2d==0) return;
@@ -370,7 +370,7 @@ void view2d_zoom(View2D *v2d, float factor, int winx, int winy) {
void test_view2d(View2D *v2d, int winx, int winy) void test_view2d(View2D *v2d, int winx, int winy)
{ {
/* cur mag niet groter dan max, kleiner dan min of buiten tot vallen */ /* cur is not allowed to be larger than max, smaller than min, or outside of tot */
rctf *cur, *tot; rctf *cur, *tot;
float dx, dy, temp, fac, zoom; float dx, dy, temp, fac, zoom;
@@ -389,7 +389,7 @@ void test_view2d(View2D *v2d, int winx, int winy)
v2d->cur.xmax=v2d->cur.xmin+((float)winx); v2d->cur.xmax=v2d->cur.xmin+((float)winx);
if(v2d->keepzoom & V2D_KEEPZOOM) { if(v2d->keepzoom & V2D_KEEPZOOM) {
/* niet op min/max testen: ahv curarea de zoom fixeren */ /* do not test for min/max: usiig curarea try to fixate zoom */
zoom= ((float)winx)/dx; zoom= ((float)winx)/dx;
if(zoom<v2d->minzoom || zoom>v2d->maxzoom) { if(zoom<v2d->minzoom || zoom>v2d->maxzoom) {
@@ -524,7 +524,7 @@ void test_view2d(View2D *v2d, int winx, int winy)
dx= (cur->ymax-cur->ymin)/(cur->xmax-cur->xmin); dx= (cur->ymax-cur->ymin)/(cur->xmax-cur->xmin);
dy= ((float)winy)/((float)winx); dy= ((float)winy)/((float)winx);
/* dx/dy is de totale aspect */ /* dx/dy is the total aspect */
/* this exception is for buttons...keepzoom doesnt work proper */ /* this exception is for buttons...keepzoom doesnt work proper */
if(v2d->keepzoom) fac= dy; if(v2d->keepzoom) fac= dy;
@@ -532,7 +532,7 @@ void test_view2d(View2D *v2d, int winx, int winy)
if(fac>1.0) { if(fac>1.0) {
/* portrait window: x corrigeren */ /* portrait window: correct for x */
dx= cur->ymax-cur->ymin; dx= cur->ymax-cur->ymin;
temp= (cur->xmax+cur->xmin); temp= (cur->xmax+cur->xmin);
@@ -625,7 +625,7 @@ static void draw_solution(SpaceIpo *sipo)
if ISPOIN(ei, flag & IPO_VISIBLE, icu) { if ISPOIN(ei, flag & IPO_VISIBLE, icu) {
cpack(ei->col); cpack(ei->col);
/* DISPBITS ipo's have 'multiple' values. */ /* DISPBITS ipos have 'multiple' values. */
if(ei->disptype==IPO_DISPBITS) { if(ei->disptype==IPO_DISPBITS) {
int b, val= ei->icu->curval; int b, val= ei->icu->curval;
@@ -673,13 +673,13 @@ void drawscroll(int disptype)
glRecti(horxmin, hor.ymin+1, horxmax, hor.ymax-1); glRecti(horxmin, hor.ymin+1, horxmax, hor.ymax-1);
cpack(light); cpack(light);
sdrawline(horxmin, hor.ymax-1, horxmax, hor.ymax-1); /* boven */ sdrawline(horxmin, hor.ymax-1, horxmax, hor.ymax-1); /* top */
sdrawline(horxmin, hor.ymin+1, horxmin, hor.ymax-1); /* links */ sdrawline(horxmin, hor.ymin+1, horxmin, hor.ymax-1); /* left */
cpack(darker); cpack(darker);
sdrawline(horxmin, hor.ymin+1, horxmax, hor.ymin+1); /* onder */ sdrawline(horxmin, hor.ymin+1, horxmax, hor.ymin+1); /* bottom */
sdrawline(horxmax, hor.ymin+1, horxmax, hor.ymax-1); /* rechts */ sdrawline(horxmax, hor.ymin+1, horxmax, hor.ymax-1); /* right */
/* de cijfers: ipogrid_startx en -dx omzetten naar scroll coordinaten */ /* the numbers: convert ipogrid_startx and -dx to scroll coordinates */
fac= (ipogrid_startx- G.v2d->cur.xmin)/(G.v2d->cur.xmax-G.v2d->cur.xmin); fac= (ipogrid_startx- G.v2d->cur.xmin)/(G.v2d->cur.xmax-G.v2d->cur.xmin);
fac= hor.xmin+fac*(hor.xmax-hor.xmin); fac= hor.xmin+fac*(hor.xmax-hor.xmin);
@@ -731,13 +731,13 @@ void drawscroll(int disptype)
cpack(light); cpack(light);
sdrawline(vert.xmin+1, vertymax, vert.xmax-1, vertymax); /* boven */ sdrawline(vert.xmin+1, vertymax, vert.xmax-1, vertymax); /* top */
sdrawline(vert.xmin+1, vertymin, vert.xmin+1, vertymax); /* links */ sdrawline(vert.xmin+1, vertymin, vert.xmin+1, vertymax); /* left */
cpack(darker); cpack(darker);
sdrawline(vert.xmin+1, vertymin, vert.xmax-1, vertymin); /* onder */ sdrawline(vert.xmin+1, vertymin, vert.xmax-1, vertymin); /* bottom */
sdrawline(vert.xmax-1, vertymin, vert.xmax-1, vertymax); /* rechts */ sdrawline(vert.xmax-1, vertymin, vert.xmax-1, vertymax); /* right */
/* de cijfers: ipogrid_starty en -dy omzetten naar scroll coordinaten */ /* the numbers: convert ipogrid_starty and -dy to scroll coordinates */
fac= (ipogrid_starty- G.v2d->cur.ymin)/(G.v2d->cur.ymax-G.v2d->cur.ymin); fac= (ipogrid_starty- G.v2d->cur.ymin)/(G.v2d->cur.ymax-G.v2d->cur.ymin);
fac= vert.ymin+SCROLLH+fac*(vert.ymax-vert.ymin-SCROLLH); fac= vert.ymin+SCROLLH+fac*(vert.ymax-vert.ymin-SCROLLH);
@@ -1063,7 +1063,7 @@ static void draw_ipocurves(int sel)
if(ei->disptype==IPO_DISPBITS) { if(ei->disptype==IPO_DISPBITS) {
/* lijnen */ /* lines */
cpack(ei->col); cpack(ei->col);
bezt= icu->bezt; bezt= icu->bezt;
a= icu->totvert; a= icu->totvert;
@@ -1106,7 +1106,7 @@ static void draw_ipocurves(int sel)
glBegin(GL_LINE_STRIP); glBegin(GL_LINE_STRIP);
/* extrap naar links? */ /* extrapolate to left? */
if( (icu->extrap & IPO_CYCL)==0) { if( (icu->extrap & IPO_CYCL)==0) {
if(prevbezt->vec[1][0] > G.v2d->cur.xmin) { if(prevbezt->vec[1][0] > G.v2d->cur.xmin) {
v1[0]= G.v2d->cur.xmin; v1[0]= G.v2d->cur.xmin;
@@ -1176,7 +1176,7 @@ static void draw_ipocurves(int sel)
prevbezt= bezt; prevbezt= bezt;
bezt++; bezt++;
/* laatste punt? */ /* last point? */
if(b==0) { if(b==0) {
v1[0]= prevbezt->vec[1][0]+cycxofs; v1[0]= prevbezt->vec[1][0]+cycxofs;
v1[1]= prevbezt->vec[1][1]+cycyofs; v1[1]= prevbezt->vec[1][1]+cycyofs;
@@ -1184,7 +1184,7 @@ static void draw_ipocurves(int sel)
} }
} }
/* extrap naar rechts? */ /* extrapolate to right? */
if( (icu->extrap & IPO_CYCL)==0) { if( (icu->extrap & IPO_CYCL)==0) {
if(prevbezt->vec[1][0] < G.v2d->cur.xmax) { if(prevbezt->vec[1][0] < G.v2d->cur.xmax) {
v1[0]= G.v2d->cur.xmax; v1[0]= G.v2d->cur.xmax;
@@ -1205,7 +1205,7 @@ static void draw_ipocurves(int sel)
if(icu->extrap & IPO_DIR) cycyofs+= cycdy; if(icu->extrap & IPO_DIR) cycyofs+= cycdy;
} }
/* lijn die het einde van een snelheidscurve aangeeft */ /* line that indicates the end of a speed curve */
if(G.sipo->blocktype==ID_CU && icu->adrcode==CU_SPEED) { if(G.sipo->blocktype==ID_CU && icu->adrcode==CU_SPEED) {
b= icu->totvert-1; b= icu->totvert-1;
if(b) { if(b) {
@@ -1353,14 +1353,14 @@ void drawipospace(ScrArea *sa, void *spacedata)
} }
} }
test_editipo(); /* test of huidige editipo klopt, make_editipo zet de v2d->cur */ test_editipo(); /* test if current editipo is correct, make_editipo sets v2d->cur */
myortho2(v2d->cur.xmin, v2d->cur.xmax, v2d->cur.ymin, v2d->cur.ymax); myortho2(v2d->cur.xmin, v2d->cur.xmax, v2d->cur.ymin, v2d->cur.ymax);
if(sipo->editipo) { if(sipo->editipo) {
/* schaal corrigeren voor graden? */ /* correct scale for degrees? */
disptype= -1; disptype= -1;
ei= sipo->editipo; ei= sipo->editipo;
for(a=0; a<sipo->totipo; a++, ei++) { for(a=0; a<sipo->totipo; a++, ei++) {
@@ -1403,7 +1403,7 @@ void drawipospace(ScrArea *sa, void *spacedata)
if(curarea->winx>SCROLLB+10 && curarea->winy>SCROLLH+10) { if(curarea->winx>SCROLLB+10 && curarea->winy>SCROLLH+10) {
/* ortho op pixelnivo curarea */ /* ortho at pixel level curarea */
myortho2(-0.5, curarea->winx+0.5, -0.5, curarea->winy+0.5); myortho2(-0.5, curarea->winx+0.5, -0.5, curarea->winy+0.5);
if(v2d->scroll) { if(v2d->scroll) {
@@ -1456,7 +1456,7 @@ int view2dzoom(unsigned short event)
float fac, dx, dy, wtemp; float fac, dx, dy, wtemp;
short mval[2], mvalo[2]; short mval[2], mvalo[2];
areawinset(curarea->win); /* vanuit buttons */ areawinset(curarea->win); /* from buttons */
curarea->head_swap= 0; curarea->head_swap= 0;
getmouseco_areawin(mvalo); getmouseco_areawin(mvalo);
@@ -1564,11 +1564,11 @@ void center_currframe(void)
int view2dmove(unsigned short event) int view2dmove(unsigned short event)
{ {
/* return 1 als er iets gedaan is */ /* return 1 when something was done */
float facx=0.0, facy=0.0, dx, dy, left=1.0, right=1.0; float facx=0.0, facy=0.0, dx, dy, left=1.0, right=1.0;
short mval[2], mvalo[2], leftret=1; short mval[2], mvalo[2], leftret=1;
/* alles goedzetten */ /* init */
scrarea_do_windraw(curarea); scrarea_do_windraw(curarea);
curarea->head_swap= 0; curarea->head_swap= 0;
@@ -1586,7 +1586,7 @@ int view2dmove(unsigned short event)
} }
} }
/* testen waar muis is */ /* test where mouse is */
getmouseco_areawin(mvalo); getmouseco_areawin(mvalo);
if ELEM6(curarea->spacetype, SPACE_IPO, SPACE_SEQ, SPACE_OOPS, SPACE_SOUND, SPACE_ACTION, SPACE_NLA) if ELEM6(curarea->spacetype, SPACE_IPO, SPACE_SEQ, SPACE_OOPS, SPACE_SOUND, SPACE_ACTION, SPACE_NLA)
@@ -1598,7 +1598,7 @@ int view2dmove(unsigned short event)
else if(IN_2D_VERT_SCROLL((int)mvalo)) { else if(IN_2D_VERT_SCROLL((int)mvalo)) {
facy= -(G.v2d->tot.ymax-G.v2d->tot.ymin)/(float)(G.v2d->mask.ymax-G.v2d->mask.ymin); facy= -(G.v2d->tot.ymax-G.v2d->tot.ymin)/(float)(G.v2d->mask.ymax-G.v2d->mask.ymin);
if(get_mbut()&L_MOUSE) { if(get_mbut()&L_MOUSE) {
/* welk deel van de scrollbar moet bewegen? */ /* which part of scrollbar should move? */
if(mvalo[1]< (vertymin+vertymax)/2 ) right= 0.0; if(mvalo[1]< (vertymin+vertymax)/2 ) right= 0.0;
else left= 0.0; else left= 0.0;
leftret= 0; leftret= 0;
@@ -1607,7 +1607,7 @@ int view2dmove(unsigned short event)
else if(IN_2D_HORIZ_SCROLL((int)mvalo)) { else if(IN_2D_HORIZ_SCROLL((int)mvalo)) {
facx= -(G.v2d->tot.xmax-G.v2d->tot.xmin)/(float)(G.v2d->mask.xmax-G.v2d->mask.xmin); facx= -(G.v2d->tot.xmax-G.v2d->tot.xmin)/(float)(G.v2d->mask.xmax-G.v2d->mask.xmin);
if(get_mbut()&L_MOUSE) { if(get_mbut()&L_MOUSE) {
/* welk deel van de scrollbar moet bewegen? */ /* which part of scrollbar should move? */
if(mvalo[0]< (horxmin+horxmax)/2 ) right= 0.0; if(mvalo[0]< (horxmin+horxmax)/2 ) right= 0.0;
else left= 0.0; else left= 0.0;
leftret= 0; leftret= 0;
@@ -1728,7 +1728,7 @@ EditIpo *select_proj_ipo(rctf *rectf, int event)
glSelectBuffer( MAXPICKBUF, buffer); glSelectBuffer( MAXPICKBUF, buffer);
glRenderMode(GL_SELECT); glRenderMode(GL_SELECT);
glInitNames(); /* deze twee fies zijn waarvoor? Anders werkt het niet */ glInitNames(); /* whatfor? but otherwise it does not work */
glPushName(-1); glPushName(-1);
init_pickselcode(); /* drawipo.c */ init_pickselcode(); /* drawipo.c */
@@ -1737,7 +1737,7 @@ EditIpo *select_proj_ipo(rctf *rectf, int event)
G.f -= G_PICKSEL; G.f -= G_PICKSEL;
hits= glRenderMode(GL_RENDER); hits= glRenderMode(GL_RENDER);
glPopName(); /* zie boven (pushname) */ glPopName(); /* see above (pushname) */
if(hits<1) return 0; if(hits<1) return 0;
code= 1; code= 1;

View File

@@ -186,7 +186,7 @@ int set_tpage(TFace *tface)
unsigned int *rect, *bind; unsigned int *rect, *bind;
int tpx, tpy, tilemode, tileXRep,tileYRep; int tpx, tpy, tilemode, tileXRep,tileYRep;
/* afschakelen */ /* disable */
if(tface==0) { if(tface==0) {
if(lasttface==0) return 0; if(lasttface==0) return 0;
@@ -476,7 +476,7 @@ void update_realtime_textures()
if(ima->tpageflag & IMA_TWINANIM) { if(ima->tpageflag & IMA_TWINANIM) {
if(ima->twend >= ima->xrep*ima->yrep) ima->twend= ima->xrep*ima->yrep-1; if(ima->twend >= ima->xrep*ima->yrep) ima->twend= ima->xrep*ima->yrep-1;
/* check: zit de bindcode niet het array? Vrijgeven. (nog doen) */ /* check: is bindcode not in the array? Free. (to do) */
ima->lastframe++; ima->lastframe++;
if(ima->lastframe > ima->twend) ima->lastframe= ima->twsta; if(ima->lastframe > ima->twend) ima->lastframe= ima->twsta;
@@ -487,10 +487,6 @@ void update_realtime_textures()
} }
/* XXX, this routine should die but
* the great wisdom of NaN has inspired
* its progation.
*/
void spack(unsigned int ucol) void spack(unsigned int ucol)
{ {
char *cp= (char *)&ucol; char *cp= (char *)&ucol;
@@ -571,7 +567,7 @@ void draw_tfaces3D(Object *ob, Mesh *me)
} }
if(tface->flag & TF_ACTIVE) { if(tface->flag & TF_ACTIVE) {
/* kleuren: R=x G=y */ /* colors: R=x G=y */
cpack(0xFF); cpack(0xFF);
glBegin(GL_LINE_STRIP); glVertex3fv(v1); if(v4) glVertex3fv(v4); else glVertex3fv(v3); glEnd(); glBegin(GL_LINE_STRIP); glVertex3fv(v1); if(v4) glVertex3fv(v4); else glVertex3fv(v3); glEnd();
cpack(0xFF00); cpack(0xFF00);
@@ -753,7 +749,8 @@ static int set_draw_settings_cached(int clearcache, int textured, TFace *texface
return c_badtex; return c_badtex;
} }
void draw_tface_mesh(Object *ob, Mesh *me, int dt) /* maximum dt: precies volgens ingestelde waardes */ void draw_tface_mesh(Object *ob, Mesh *me, int dt)
/* maximum dt (drawtype): exactly according values that have been set */
{ {
TFace *tface; TFace *tface;
MFace *mface; MFace *mface;
@@ -774,7 +771,7 @@ void draw_tface_mesh(Object *ob, Mesh *me, int dt) /* maximum dt: precies volgen
obcol[2]= CLAMPIS(ob->col[2]*255, 0, 255); obcol[2]= CLAMPIS(ob->col[2]*255, 0, 255);
obcol[3]= CLAMPIS(ob->col[3]*255, 0, 255); obcol[3]= CLAMPIS(ob->col[3]*255, 0, 255);
/* eerst alle texture polys */ /* first all texture polys */
glCullFace(GL_BACK); glEnable(GL_CULL_FACE); glCullFace(GL_BACK); glEnable(GL_CULL_FACE);
if(G.vd->drawtype==OB_TEXTURE) istex= 1; if(G.vd->drawtype==OB_TEXTURE) istex= 1;
@@ -965,7 +962,7 @@ void draw_tface_mesh(Object *ob, Mesh *me, int dt) /* maximum dt: precies volgen
} }
} }
/* textures uitzetten */ /* switch off textures */
set_tpage(0); set_tpage(0);
} }

View File

@@ -136,7 +136,7 @@ static void init_gl_materials(Object *ob)
matbuf[0][1][2]= defmaterial.specb; matbuf[0][1][2]= defmaterial.specb;
matbuf[0][1][3]= 1.0; matbuf[0][1][3]= 1.0;
/* ook matnr 1, displists! */ /* do material 1 too, for displists! */
VECCOPY(matbuf[1][0], matbuf[0][0]); VECCOPY(matbuf[1][0], matbuf[0][0]);
VECCOPY(matbuf[1][1], matbuf[0][1]); VECCOPY(matbuf[1][1], matbuf[0][1]);
} }
@@ -450,24 +450,24 @@ static void tekenshadbuflimits(Lamp *la, float mat[][4])
static void spotvolume(float *lvec, float *vvec, float inp) static void spotvolume(float *lvec, float *vvec, float inp)
{ {
/* camera staat op 0,0,0 */ /* camera is at 0,0,0 */
float temp[3],plane[3],mat1[3][3],mat2[3][3],mat3[3][3],mat4[3][3],q[4],co,si,hoek; float temp[3],plane[3],mat1[3][3],mat2[3][3],mat3[3][3],mat4[3][3],q[4],co,si,hoek;
Normalise(lvec); Normalise(lvec);
Normalise(vvec); /* is dit de goede vector ? */ Normalise(vvec); /* is this the correct vector ? */
Crossf(temp,vvec,lvec); /* vergelijking van vlak door vvec en lvec */ Crossf(temp,vvec,lvec); /* equation for a plane through vvec en lvec */
Crossf(plane,lvec,temp); /* en dan het vlak loodrecht daarop en evenwijdig aan lvec */ Crossf(plane,lvec,temp); /* a plane perpendicular to this, parrallel with lvec */
Normalise(plane); Normalise(plane);
/* nu hebben we twee vergelijkingen: die van de kegel en die van het vlak, maar we hebben /* now we've got two equations: one of a cone and one of a plane, but we have
drie onbekenden We halen nu een onbekende weg door het vlak naar z=0 te roteren */ three unknowns. We remove one unkown by rotating the plane to z=0 (the plane normal) */
/* Ik heb geen flauw idee of dat mag, we moeten tenslotte twee oplossingen krijgen, maar we
proberen het gewoon: vlak vector moet (0,0,1) worden*/
/* roteer om uitproduct vector van (0,0,1) en vlakvector, inproduct graden */ /* rotate around cross product vector of (0,0,1) and plane normal, dot product degrees */
/* volgens defenitie volgt dat uitproduct is (plane[1],-plane[0],0), en cos() = plane[2]);*/ /* according definition, we derive cross product is (plane[1],-plane[0],0), en cos = plane[2]);*/
/* translating this comment to english didnt really help me understanding the math! :-) (ton) */
q[1] = plane[1] ; q[1] = plane[1] ;
q[2] = -plane[0] ; q[2] = -plane[0] ;
@@ -485,7 +485,7 @@ static void spotvolume(float *lvec, float *vvec, float inp)
QuatToMat3(q,mat1); QuatToMat3(q,mat1);
/* lampvector nu over acos(inp) graden roteren */ /* rotate lamp vector now over acos(inp) degrees */
vvec[0] = lvec[0] ; vvec[0] = lvec[0] ;
vvec[1] = lvec[1] ; vvec[1] = lvec[1] ;
@@ -629,7 +629,7 @@ static void draw_limit_line(float sta, float end, unsigned int col)
void drawcamera(Object *ob) void drawcamera(Object *ob)
{ {
/* een staande piramide met (0,0,0) als top */ /* a standing up pyramid with (0,0,0) as top */
Camera *cam; Camera *cam;
World *wrld; World *wrld;
float vec[8][4], tmat[4][4], fac, facx, facy, depth; float vec[8][4], tmat[4][4], fac, facx, facy, depth;
@@ -638,7 +638,7 @@ void drawcamera(Object *ob)
glDisable(GL_LIGHTING); glDisable(GL_LIGHTING);
glDisable(GL_CULL_FACE); glDisable(GL_CULL_FACE);
/* zo is ie altijd te zien */ /* that way it's always visible */
fac= cam->drawsize; fac= cam->drawsize;
if(G.vd->persp>=2) fac= cam->clipsta+0.1; if(G.vd->persp>=2) fac= cam->clipsta+0.1;
@@ -646,7 +646,7 @@ void drawcamera(Object *ob)
facx= fac*1.28; facx= fac*1.28;
facy= fac*1.024; facy= fac*1.024;
vec[0][0]= 0; vec[0][1]= 0; vec[0][2]= 0.001; /* GLBUG: z niet op nul vanwege picking op entry */ vec[0][0]= 0; vec[0][1]= 0; vec[0][2]= 0.001; /* GLBUG: for picking at iris Entry (well thats old!) */
vec[1][0]= facx; vec[1][1]= facy; vec[1][2]= depth; vec[1][0]= facx; vec[1][1]= facy; vec[1][2]= depth;
vec[2][0]= facx; vec[2][1]= -facy; vec[2][2]= depth; vec[2][0]= facx; vec[2][1]= -facy; vec[2][2]= depth;
vec[3][0]= -facx; vec[3][1]= -facy; vec[3][2]= depth; vec[3][0]= -facx; vec[3][1]= -facy; vec[3][2]= depth;
@@ -674,7 +674,7 @@ void drawcamera(Object *ob)
if(G.vd->persp>=2) return; if(G.vd->persp>=2) return;
if(G.f & G_BACKBUFSEL) return; if(G.f & G_BACKBUFSEL) return;
/* pijl aan top */ /* arrow on top */
vec[0][2]= depth; vec[0][2]= depth;
glBegin(GL_QUADS); glBegin(GL_QUADS);
@@ -1039,7 +1039,7 @@ void tekenvertices_ext(int mode)
glDrawBuffer(GL_FRONT); glDrawBuffer(GL_FRONT);
/* alle views aflopen */ /* check all views */
tempsa= curarea; tempsa= curarea;
sa= G.curscreen->areabase.first; sa= G.curscreen->areabase.first;
while(sa) { while(sa) {
@@ -1423,7 +1423,7 @@ static void drawDispListsolid(ListBase *lb, Object *ob)
set_gl_material(dl->col+1); set_gl_material(dl->col+1);
/* voor poly's is er maar 1 normaal nodig */ /* voor polys only one normal needed */
if(index3_nors_incr==0) { if(index3_nors_incr==0) {
while(parts--) { while(parts--) {
@@ -1773,7 +1773,7 @@ static void drawmeshsolid(Object *ob, float *nors)
} }
/* dit GL_QUADS grapje is op snelheid getest: factor 2! */ /* this GL_QUADS joke below was tested for speed: a factor 2! */
if(v4) {if(glmode==GL_TRIANGLES) {glmode= GL_QUADS; glEnd(); glBegin(GL_QUADS);}} if(v4) {if(glmode==GL_TRIANGLES) {glmode= GL_QUADS; glEnd(); glBegin(GL_QUADS);}}
else {if(glmode==GL_QUADS) {glmode= GL_TRIANGLES; glEnd(); glBegin(GL_TRIANGLES);}} else {if(glmode==GL_QUADS) {glmode= GL_TRIANGLES; glEnd(); glBegin(GL_TRIANGLES);}}
@@ -1891,7 +1891,7 @@ static void drawmeshshaded(Object *ob, unsigned int *col1, unsigned int *col2)
me= ob->data; me= ob->data;
mface= me->mface; mface= me->mface;
/* tekent ie geen hide */ /* then it does not draw hide */
if( (G.f & G_FACESELECT) && ob==((G.scene->basact) ? (G.scene->basact->object) : 0)) tface= me->tface; if( (G.f & G_FACESELECT) && ob==((G.scene->basact) ? (G.scene->basact->object) : 0)) tface= me->tface;
else tface= 0; else tface= 0;
@@ -2088,7 +2088,7 @@ static void drawDispList(Object *ob, int dt)
else else
#endif #endif
if( G.f & (G_VERTEXPAINT+G_TEXTUREPAINT)) { if( G.f & (G_VERTEXPAINT+G_TEXTUREPAINT)) {
/* in deze volgorde: vertexpaint heeft soms al mcol gemaakt */ /* in order: vertexpaint already made mcol */
///* ///*
//*/ //*/
@@ -2152,7 +2152,7 @@ static void drawDispList(Object *ob, int dt)
dl= lb->first; dl= lb->first;
if(dl==0) return; if(dl==0) return;
/* regel: dl->type INDEX3 altijd vooraan in lijst */ /* rule: dl->type INDEX3 is always first in list */
if(dl->type!=DL_INDEX3) { if(dl->type!=DL_INDEX3) {
curve_to_filledpoly(ob->data, lb); curve_to_filledpoly(ob->data, lb);
dl= lb->first; dl= lb->first;
@@ -2430,7 +2430,7 @@ static void drawmeshwire(Object *ob)
glEnd(); glEnd();
} }
if(G.f & (G_FACESELECT+G_DRAWFACES)) { /* vlakken */ if(G.f & (G_FACESELECT+G_DRAWFACES)) { /* faces */
evl= G.edvl.first; evl= G.edvl.first;
while(evl) { while(evl) {
@@ -2868,7 +2868,7 @@ static void drawnurb(Object *ob, Nurb *nurb, int dt)
float vec[3]; float vec[3];
int a, nr, skip; int a, nr, skip;
/* eerst handles niet select */ /* first non-selected handles */
nu= nurb; nu= nurb;
while(nu) { while(nu) {
if((nu->type & 7)==CU_BEZIER) { if((nu->type & 7)==CU_BEZIER) {
@@ -2877,7 +2877,7 @@ static void drawnurb(Object *ob, Nurb *nurb, int dt)
nu= nu->next; nu= nu->next;
} }
/* dan DispList */ /* then DispList */
cpack(0); cpack(0);
cu= ob->data; cu= ob->data;
@@ -3247,7 +3247,7 @@ void draw_object(Base *base)
ob= base->object; ob= base->object;
/* keys tekenen? */ /* draw keys? */
if(base==(G.scene->basact) || (base->flag & (SELECT+BA_WASSEL))) { if(base==(G.scene->basact) || (base->flag & (SELECT+BA_WASSEL))) {
if(warning_recursive==0 && ob!=G.obedit) { if(warning_recursive==0 && ob!=G.obedit) {
if(ob->ipo && ob->ipo->showkey && (ob->ipoflag & OB_DRAWKEY)) { if(ob->ipo && ob->ipo->showkey && (ob->ipoflag & OB_DRAWKEY)) {
@@ -3318,12 +3318,12 @@ void draw_object(Base *base)
} }
} }
/* patch? kinderen met timeoffs verprutsen ouders. Hoe los je dat op! */ /* patch? children objects with a timeoffs change the parents. How to solve! */
/* if( ((int)ob->ctime) != F_(G.scene->r.cfra)) where_is_object(ob); */ /* if( ((int)ob->ctime) != F_(G.scene->r.cfra)) where_is_object(ob); */
mymultmatrix(ob->obmat); mymultmatrix(ob->obmat);
/* welke wire kleur */ /* which wire color */
if((G.f & (G_BACKBUFSEL+G_PICKSEL)) == 0) { if((G.f & (G_BACKBUFSEL+G_PICKSEL)) == 0) {
project_short(ob->obmat[3], &base->sx); project_short(ob->obmat[3], &base->sx);
@@ -3350,7 +3350,7 @@ void draw_object(Base *base)
if(G.zbuf==0 && dt>OB_WIRE) dt= OB_WIRE; if(G.zbuf==0 && dt>OB_WIRE) dt= OB_WIRE;
dtx= 0; dtx= 0;
/* faceselect uitzondering: ook solid tekenen als dt==wire, behalve in editmode */ /* faceselect exception: also draw solid when dt==wire, except in editmode */
if(ob==((G.scene->basact) ? (G.scene->basact->object) : 0) && (G.f & (G_FACESELECT+G_VERTEXPAINT+G_TEXTUREPAINT+G_WEIGHTPAINT))) { if(ob==((G.scene->basact) ? (G.scene->basact->object) : 0) && (G.f & (G_FACESELECT+G_VERTEXPAINT+G_TEXTUREPAINT+G_WEIGHTPAINT))) {
if(ob->type==OB_MESH) { if(ob->type==OB_MESH) {
@@ -3466,7 +3466,7 @@ void draw_object(Base *base)
&& ((G.f & (G_BACKBUFSEL+G_PICKSEL)) == 0) ) { && ((G.f & (G_BACKBUFSEL+G_PICKSEL)) == 0) ) {
paf = give_parteff(ob); paf = give_parteff(ob);
if( paf ) { if( paf ) {
if(col) cpack(0xFFFFFF); /* zichtbaarheid */ if(col) cpack(0xFFFFFF); /* for visibility */
if(paf->flag & PAF_STATIC) draw_static_particle_system(ob, paf); if(paf->flag & PAF_STATIC) draw_static_particle_system(ob, paf);
else draw_particle_system(ob, paf); else draw_particle_system(ob, paf);
cpack(col); cpack(col);
@@ -3488,8 +3488,6 @@ void draw_object(Base *base)
case OB_CURVE: case OB_CURVE:
case OB_SURF: case OB_SURF:
cu= ob->data; cu= ob->data;
/* een pad niet solid tekenen: wel dus!!! */
/* if(cu->flag & CU_PATH) if(dt>OB_WIRE) dt= OB_WIRE; */
if(ob==G.obedit) { if(ob==G.obedit) {
drawnurb(ob, editNurb.first, dt); drawnurb(ob, editNurb.first, dt);
@@ -3508,7 +3506,7 @@ void draw_object(Base *base)
drawaxes(1.0); drawaxes(1.0);
break; break;
case OB_LAMP: case OB_LAMP:
/* doet myloadmatrix */ /* does a myloadmatrix */
drawlamp(ob); drawlamp(ob);
break; break;
case OB_CAMERA: case OB_CAMERA:
@@ -3531,7 +3529,7 @@ void draw_object(Base *base)
} }
} }
/* draw extra: na gewone draw ivm makeDispList */ /* draw extra: after normal draw because of makeDispList */
if(dtx) { if(dtx) {
if(G.f & G_SIMULATION); if(G.f & G_SIMULATION);
else if(dtx & OB_AXIS) { else if(dtx & OB_AXIS) {
@@ -3573,7 +3571,7 @@ void draw_object(Base *base)
if(G.f & G_SIMULATION) return; if(G.f & G_SIMULATION) return;
if((G.f & (G_BACKBUFSEL+G_PICKSEL))==0) { if((G.f & (G_BACKBUFSEL+G_PICKSEL))==0) {
/* hulplijnen e.d. */ /* help lines and so */
if(ob->parent && (ob->parent->lay & G.vd->lay)) { if(ob->parent && (ob->parent->lay & G.vd->lay)) {
setlinestyle(3); setlinestyle(3);
glBegin(GL_LINES); glBegin(GL_LINES);
@@ -3643,12 +3641,12 @@ void draw_object_ext(Base *base)
glDrawBuffer(GL_FRONT); glDrawBuffer(GL_FRONT);
/* alle views aflopen */ /* check all views */
tempsa= curarea; tempsa= curarea;
sa= G.curscreen->areabase.first; sa= G.curscreen->areabase.first;
while(sa) { while(sa) {
if(sa->spacetype==SPACE_VIEW3D) { if(sa->spacetype==SPACE_VIEW3D) {
/* er wordt beperkt in beide buffers getekend: selectbuffer! */ /* limited drawing in both buffers: selectbuffer! */
vd= sa->spacedata.first; vd= sa->spacedata.first;
if(base->lay & vd->lay) { if(base->lay & vd->lay) {

View File

@@ -213,7 +213,7 @@ void mysbox(float x1, float y1, float x2, float y2)
unsigned int give_oops_color(short type, short sel, unsigned int *border) unsigned int give_oops_color(short type, short sel, unsigned int *border)
{ {
unsigned int body; unsigned int body;
/* geeft ook aan of stippellijn getekend moet */ /* also finds out if a dashed line should be drawn */
switch(type) { switch(type) {
case ID_OB: case ID_OB:
@@ -333,7 +333,7 @@ void draw_oops(Oops *oops, uiBlock *block)
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
if(line) setlinestyle(0); if(line) setlinestyle(0);
/* connectieblokjes */ /* connection blocks */
ol= oops->link.first; ol= oops->link.first;
while(ol) { while(ol) {
@@ -386,7 +386,7 @@ void drawoopsspace(ScrArea *sa, void *spacedata)
if(curarea->winx>SCROLLB+10 && curarea->winy>SCROLLH+10) { if(curarea->winx>SCROLLB+10 && curarea->winy>SCROLLH+10) {
if(G.v2d->scroll) { if(G.v2d->scroll) {
ofsx= curarea->winrct.xmin; /* ivm mywin */ ofsx= curarea->winrct.xmin; /* because of mywin */
ofsy= curarea->winrct.ymin; ofsy= curarea->winrct.ymin;
glViewport(ofsx+G.v2d->mask.xmin, ofsy+G.v2d->mask.ymin, ( ofsx+G.v2d->mask.xmax-1)-(ofsx+G.v2d->mask.xmin)+1, ( ofsy+G.v2d->mask.ymax-1)-( ofsy+G.v2d->mask.ymin)+1); glViewport(ofsx+G.v2d->mask.xmin, ofsy+G.v2d->mask.ymin, ( ofsx+G.v2d->mask.xmax-1)-(ofsx+G.v2d->mask.xmin)+1, ( ofsy+G.v2d->mask.ymax-1)-( ofsy+G.v2d->mask.ymin)+1);
@@ -397,7 +397,7 @@ void drawoopsspace(ScrArea *sa, void *spacedata)
myortho2(G.v2d->cur.xmin, G.v2d->cur.xmax, G.v2d->cur.ymin, G.v2d->cur.ymax); myortho2(G.v2d->cur.xmin, G.v2d->cur.xmax, G.v2d->cur.ymin, G.v2d->cur.ymax);
oopscalex= .14*((float)curarea->winx)/(G.v2d->cur.xmax-G.v2d->cur.xmin); oopscalex= .14*((float)curarea->winx)/(G.v2d->cur.xmax-G.v2d->cur.xmin);
calc_ipogrid(); /* voor scrollvariables */ calc_ipogrid(); /* for scrollvariables */
build_oops(); build_oops();
oops= G.soops->oops.first; oops= G.soops->oops.first;
@@ -427,7 +427,7 @@ void drawoopsspace(ScrArea *sa, void *spacedata)
if(G.v2d->scroll) { if(G.v2d->scroll) {
/* ortho op pixelnivo curarea */ /* ortho at pixel level curarea */
myortho2(-0.5, curarea->winx+0.5, -0.5, curarea->winy+0.5); myortho2(-0.5, curarea->winx+0.5, -0.5, curarea->winy+0.5);
drawscroll(0); drawscroll(0);
} }

View File

@@ -54,14 +54,14 @@
#include "BSE_view.h" #include "BSE_view.h"
#include "blendef.h" /* DIE ! */ #include "blendef.h" /* old */
#include "mydevice.h" #include "mydevice.h"
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> #include <config.h>
#endif #endif
void set_scene(Scene *sce) /* zie ook scene.c: set_scene_bg() */ void set_scene(Scene *sce) /* also see scene.c: set_scene_bg() */
{ {
bScreen *sc; bScreen *sc;
@@ -72,7 +72,7 @@ void set_scene(Scene *sce) /* zie ook scene.c: set_scene_bg() */
if((U.flag & SCENEGLOBAL) || sc==G.curscreen) { if((U.flag & SCENEGLOBAL) || sc==G.curscreen) {
if(sce != sc->scene) { if(sce != sc->scene) {
/* alle area's endlocalview */ /* all areas endlocalview */
ScrArea *sa= sc->areabase.first; ScrArea *sa= sc->areabase.first;
while(sa) { while(sa) {
endlocalview(sa); endlocalview(sa);
@@ -87,7 +87,7 @@ void set_scene(Scene *sce) /* zie ook scene.c: set_scene_bg() */
copy_view3d_lock(0); /* space.c */ copy_view3d_lock(0); /* space.c */
/* zijn er camera's in de views die niet in de scene zitten? */ /* are there cameras in the views that are not in the scene? */
sc= G.main->screen.first; sc= G.main->screen.first;
while(sc) { while(sc) {
if( (U.flag & SCENEGLOBAL) || sc==G.curscreen) { if( (U.flag & SCENEGLOBAL) || sc==G.curscreen) {
@@ -113,9 +113,9 @@ void set_scene(Scene *sce) /* zie ook scene.c: set_scene_bg() */
set_scene_bg(G.scene); set_scene_bg(G.scene);
/* volledige redraw */ /* complete redraw */
allqueue(REDRAWALL, 0); allqueue(REDRAWALL, 0);
allqueue(REDRAWDATASELECT, 0); /* doet remake */ allqueue(REDRAWDATASELECT, 0); /* does a remake */
} }

View File

@@ -79,15 +79,15 @@ static void EmbossBoxf(float x1, float y1, float x2, float y2, int sel, unsigned
if(sel) cpack(dark); if(sel) cpack(dark);
else cpack(light); else cpack(light);
if(sel) glLineWidth(2.0); if(sel) glLineWidth(2.0);
fdrawline(x1, y2, x2, y2); /* boven */ fdrawline(x1, y2, x2, y2); /* top */
if(no_leftbox==0) fdrawline(x1, y1, x1, y2); /* links */ if(no_leftbox==0) fdrawline(x1, y1, x1, y2); /* left */
if(sel) glLineWidth(1.0); if(sel) glLineWidth(1.0);
if(sel) cpack(light); if(sel) cpack(light);
else cpack(dark); else cpack(dark);
fdrawline(x1, y1, x2, y1); /* onder */ fdrawline(x1, y1, x2, y1); /* bottom */
if(no_rightbox==0) fdrawline(x2, y1, x2, y2); /* rechts */ if(no_rightbox==0) fdrawline(x2, y1, x2, y2); /* right */
} }
@@ -223,7 +223,7 @@ void drawseq(Sequence *seq)
v2[1]= y2; v2[1]= y2;
if(seq->type < SEQ_EFFECT) { if(seq->type < SEQ_EFFECT) {
/* decoratie: balkjes */ /* decoration: the bars */
x1= seq->startdisp; x1= seq->startdisp;
x2= seq->enddisp; x2= seq->enddisp;
@@ -255,11 +255,11 @@ void drawseq(Sequence *seq)
} }
/* berekenen of seq lang genoeg is om naam te printen */ /* calculate if seq is long enough to print a name */
x1= seq->startdisp+seq->handsize; x1= seq->startdisp+seq->handsize;
x2= seq->enddisp-seq->handsize; x2= seq->enddisp-seq->handsize;
/* maar eerst de inhoud van de meta */ /* but first the contents of a meta */
if(seq->type==SEQ_META) drawmeta_contents(seq, x1, y1+0.15, x2, y2-0.15); if(seq->type==SEQ_META) drawmeta_contents(seq, x1, y1+0.15, x2, y2-0.15);
if(x1<G.v2d->cur.xmin) x1= G.v2d->cur.xmin; if(x1<G.v2d->cur.xmin) x1= G.v2d->cur.xmin;
@@ -310,7 +310,7 @@ void drawseq(Sequence *seq)
if(seq->type < SEQ_EFFECT) { if(seq->type < SEQ_EFFECT) {
/* decoratie: driehoekjes */ /* decoration: triangles */
x1= seq->startdisp; x1= seq->startdisp;
x2= seq->enddisp; x2= seq->enddisp;
@@ -318,7 +318,7 @@ void drawseq(Sequence *seq)
dark= 0x202020; dark= 0x202020;
light= 0xB0B0B0; light= 0xB0B0B0;
/* linker driehoek */ /* left triangle */
if(seq->flag & SEQ_LEFTSEL) { if(seq->flag & SEQ_LEFTSEL) {
cpack(body+0x20); cpack(body+0x20);
@@ -354,7 +354,7 @@ void drawseq(Sequence *seq)
BMF_DrawString(G.font, str); BMF_DrawString(G.font, str);
} }
/* rechter driehoek */ /* right triangle */
dark= 0x202020; dark= 0x202020;
light= 0xB0B0B0; light= 0xB0B0B0;
@@ -401,7 +401,7 @@ void set_special_seq_update(int val)
{ {
int x; int x;
/* als met muis in sequence && LEFTMOUSE */ /* if mouse over a sequence && LEFTMOUSE */
if(val) { if(val) {
special_seq_update= find_nearest_seq(&x); special_seq_update= find_nearest_seq(&x);
} }
@@ -438,17 +438,14 @@ static void draw_image_seq(void)
sseq= curarea->spacedata.first; sseq= curarea->spacedata.first;
if(sseq==0) return; if(sseq==0) return;
/* plek berekenen */ /* calc location */
x1= curarea->winrct.xmin+(curarea->winx-sseq->zoom*ibuf->x)/2; x1= curarea->winrct.xmin+(curarea->winx-sseq->zoom*ibuf->x)/2;
y1= curarea->winrct.ymin+(curarea->winy-sseq->zoom*ibuf->y)/2; y1= curarea->winrct.ymin+(curarea->winy-sseq->zoom*ibuf->y)/2;
/* convert_rgba_to_abgr(ibuf->x*ibuf->y, ibuf->rect); */
rectwrite_part(curarea->winrct.xmin, curarea->winrct.ymin, rectwrite_part(curarea->winrct.xmin, curarea->winrct.ymin,
curarea->winrct.xmax, curarea->winrct.ymax, curarea->winrct.xmax, curarea->winrct.ymax,
x1, y1, ibuf->x, ibuf->y, (float)sseq->zoom,(float)sseq->zoom, ibuf->rect); x1, y1, ibuf->x, ibuf->y, (float)sseq->zoom,(float)sseq->zoom, ibuf->rect);
/* convert_rgba_to_abgr(ibuf->x*ibuf->y, ibuf->rect); */
} }
static void draw_extra_seqinfo(void) static void draw_extra_seqinfo(void)
@@ -461,14 +458,14 @@ static void draw_extra_seqinfo(void)
if(last_seq==0) return; if(last_seq==0) return;
/* xfac: afm 1 pixel */ /* xfac: size of 1 pixel */
xfac= G.v2d->cur.xmax - G.v2d->cur.xmin; xfac= G.v2d->cur.xmax - G.v2d->cur.xmin;
xfac/= (float)(G.v2d->mask.xmax-G.v2d->mask.xmin); xfac/= (float)(G.v2d->mask.xmax-G.v2d->mask.xmin);
xco= G.v2d->cur.xmin+40*xfac; xco= G.v2d->cur.xmin+40*xfac;
cpack(0); cpack(0);
/* NAAM */ /* NAME */
glRasterPos3f(xco, 0.3, 0.0); glRasterPos3f(xco, 0.3, 0.0);
strcpy(str, give_seqname(last_seq)); strcpy(str, give_seqname(last_seq));
BMF_DrawString(G.font, str); BMF_DrawString(G.font, str);
@@ -501,7 +498,7 @@ static void draw_extra_seqinfo(void)
xco += xfac*BMF_GetStringWidth(G.font, str) +30.0*xfac; xco += xfac*BMF_GetStringWidth(G.font, str) +30.0*xfac;
} }
/* FIRST EN LAST */ /* FIRST AND LAST */
if(last_seq->strip) { if(last_seq->strip) {
se= last_seq->strip->stripdata; se= last_seq->strip->stripdata;
@@ -559,7 +556,7 @@ void drawseqspace(ScrArea *sa, void *spacedata)
if(curarea->winx>SCROLLB+10 && curarea->winy>SCROLLH+10) { if(curarea->winx>SCROLLB+10 && curarea->winy>SCROLLH+10) {
if(G.v2d->scroll) { if(G.v2d->scroll) {
ofsx= curarea->winrct.xmin; /* ivm mywin */ ofsx= curarea->winrct.xmin; /* because of mywin */
ofsy= curarea->winrct.ymin; ofsy= curarea->winrct.ymin;
glViewport(ofsx+G.v2d->mask.xmin, ofsy+G.v2d->mask.ymin, ( ofsx+G.v2d->mask.xmax-1)-(ofsx+G.v2d->mask.xmin)+1, ( ofsy+G.v2d->mask.ymax-1)-( ofsy+G.v2d->mask.ymin)+1); glViewport(ofsx+G.v2d->mask.xmin, ofsy+G.v2d->mask.ymin, ( ofsx+G.v2d->mask.xmax-1)-(ofsx+G.v2d->mask.xmin)+1, ( ofsy+G.v2d->mask.ymax-1)-( ofsy+G.v2d->mask.ymin)+1);
glScissor(ofsx+G.v2d->mask.xmin, ofsy+G.v2d->mask.ymin, ( ofsx+G.v2d->mask.xmax-1)-(ofsx+G.v2d->mask.xmin)+1, ( ofsy+G.v2d->mask.ymax-1)-( ofsy+G.v2d->mask.ymin)+1); glScissor(ofsx+G.v2d->mask.xmin, ofsy+G.v2d->mask.ymin, ( ofsx+G.v2d->mask.xmax-1)-(ofsx+G.v2d->mask.xmin)+1, ( ofsy+G.v2d->mask.ymax-1)-( ofsy+G.v2d->mask.ymin)+1);
@@ -577,7 +574,7 @@ void drawseqspace(ScrArea *sa, void *spacedata)
draw_ipogrid(); draw_ipogrid();
draw_cfra_seq(); draw_cfra_seq();
/* sequenties: eerst de deselect */ /* sequences: first deselect */
if(ed) { if(ed) {
seq= ed->seqbasep->first; seq= ed->seqbasep->first;
@@ -602,7 +599,7 @@ void drawseqspace(ScrArea *sa, void *spacedata)
if(curarea->winx>SCROLLB+10 && curarea->winy>SCROLLH+10) { if(curarea->winx>SCROLLB+10 && curarea->winy>SCROLLH+10) {
/* ortho op pixelnivo curarea */ /* ortho at pixel level curarea */
myortho2(-0.5, curarea->winx+0.5, -0.5, curarea->winy+0.5); myortho2(-0.5, curarea->winx+0.5, -0.5, curarea->winy+0.5);
if(G.v2d->scroll) { if(G.v2d->scroll) {

View File

@@ -174,7 +174,7 @@ void drawsoundspace(ScrArea *sa, void *spacedata)
if(curarea->winx>SCROLLB+10 && curarea->winy>SCROLLH+10) { if(curarea->winx>SCROLLB+10 && curarea->winy>SCROLLH+10) {
if(G.v2d->scroll) { if(G.v2d->scroll) {
ofsx= curarea->winrct.xmin; /* ivm mywin */ ofsx= curarea->winrct.xmin; /* because mywin */
ofsy= curarea->winrct.ymin; ofsy= curarea->winrct.ymin;
glViewport(ofsx+G.v2d->mask.xmin, ofsy+G.v2d->mask.ymin, ( ofsx+G.v2d->mask.xmax-1)-(ofsx+G.v2d->mask.xmin)+1, ( ofsy+G.v2d->mask.ymax-1)-( ofsy+G.v2d->mask.ymin)+1); glViewport(ofsx+G.v2d->mask.xmin, ofsy+G.v2d->mask.ymin, ( ofsx+G.v2d->mask.xmax-1)-(ofsx+G.v2d->mask.xmin)+1, ( ofsy+G.v2d->mask.ymax-1)-( ofsy+G.v2d->mask.ymin)+1);
glScissor(ofsx+G.v2d->mask.xmin, ofsy+G.v2d->mask.ymin, ( ofsx+G.v2d->mask.xmax-1)-(ofsx+G.v2d->mask.xmin)+1, ( ofsy+G.v2d->mask.ymax-1)-( ofsy+G.v2d->mask.ymin)+1); glScissor(ofsx+G.v2d->mask.xmin, ofsy+G.v2d->mask.ymin, ( ofsx+G.v2d->mask.xmax-1)-(ofsx+G.v2d->mask.xmin)+1, ( ofsy+G.v2d->mask.ymax-1)-( ofsy+G.v2d->mask.ymin)+1);
@@ -199,7 +199,7 @@ void drawsoundspace(ScrArea *sa, void *spacedata)
if(curarea->winx>SCROLLB+10 && curarea->winy>SCROLLH+10) { if(curarea->winx>SCROLLB+10 && curarea->winy>SCROLLH+10) {
/* ortho op pixelnivo curarea */ /* ortho at pixel level curarea */
myortho2(-0.5, curarea->winx+0.5, -0.5, curarea->winy+0.5); myortho2(-0.5, curarea->winx+0.5, -0.5, curarea->winy+0.5);
if(G.v2d->scroll) { if(G.v2d->scroll) {

View File

@@ -234,7 +234,7 @@ void init_gl_stuff(void)
void two_sided(int val) void two_sided(int val)
{ {
/* twosided aan: geft errors bij x flip! */ /* twosided on: gives errors with x flip! */
glLightModeliv(GL_LIGHT_MODEL_TWO_SIDE, (GLint *)&val); glLightModeliv(GL_LIGHT_MODEL_TWO_SIDE, (GLint *)&val);
} }
@@ -272,7 +272,7 @@ void circ(float x, float y, float rad)
gluDeleteQuadric(qobj); gluDeleteQuadric(qobj);
} }
/* ********** IN ONTWIKKELING ********** */ /* ********** ********** */
static void draw_bgpic(void) static void draw_bgpic(void)
{ {
@@ -298,7 +298,7 @@ static void draw_bgpic(void)
if(ima==0) return; if(ima==0) return;
if(ima->ok==0) return; if(ima->ok==0) return;
/* plaatje testen */ /* test for image */
if(ima->ibuf==0) { if(ima->ibuf==0) {
if(bgpic->rect) MEM_freeN(bgpic->rect); if(bgpic->rect) MEM_freeN(bgpic->rect);
@@ -337,7 +337,7 @@ static void draw_bgpic(void)
y2= vb.ymax; y2= vb.ymax;
} }
else { else {
/* windowco berekenen */ /* calc window coord */
initgrabz(0.0, 0.0, 0.0); initgrabz(0.0, 0.0, 0.0);
window_to_3d(vec, 1, 0); window_to_3d(vec, 1, 0);
fac= MAX3( fabs(vec[0]), fabs(vec[1]), fabs(vec[1]) ); fac= MAX3( fabs(vec[0]), fabs(vec[1]), fabs(vec[1]) );
@@ -356,7 +356,7 @@ static void draw_bgpic(void)
y2= cy+ asp*fac*(bgpic->yof+bgpic->size); y2= cy+ asp*fac*(bgpic->yof+bgpic->size);
} }
/* volledige clip? */ /* complete clip? */
if(x2 < 0 ) return; if(x2 < 0 ) return;
if(y2 < 0 ) return; if(y2 < 0 ) return;
@@ -384,7 +384,7 @@ static void draw_bgpic(void)
void timestr(double time, char *str) void timestr(double time, char *str)
{ {
/* formaat 00:00:00.00 (hr:min:sec) string moet 12 lang */ /* format 00:00:00.00 (hr:min:sec) string has to be 12 long */
int hr= (int) time/(60*60); int hr= (int) time/(60*60);
int min= (int) fmod(time/60, 60.0); int min= (int) fmod(time/60, 60.0);
int sec= (int) fmod(time, 60.0); int sec= (int) fmod(time, 60.0);
@@ -413,7 +413,7 @@ static void drawgrid(void)
fy= vec4[1]; fy= vec4[1];
fw= vec4[3]; fw= vec4[3];
wx= (curarea->winx/2.0); /* ivm afrondfoutjes, grid op verkeerde plek */ wx= (curarea->winx/2.0); /* because of rounding errors, grid at wrong location */
wy= (curarea->winy/2.0); wy= (curarea->winy/2.0);
x= (wx)*fx/fw; x= (wx)*fx/fw;
@@ -465,7 +465,7 @@ static void drawgrid(void)
fy+= dx; fy+= dx;
} }
/* kruis in midden */ /* center cross */
if(G.vd->view==3) cpack(0xA0D0A0); /* y-as */ if(G.vd->view==3) cpack(0xA0D0A0); /* y-as */
else cpack(0xA0A0D0); /* x-as */ else cpack(0xA0A0D0); /* x-as */
@@ -591,6 +591,11 @@ void calc_viewborder(struct View3D *v3d, rcti *viewborder_r)
/* magic zoom calculation, no idea what /* magic zoom calculation, no idea what
* it signifies, if you find out, tell me! -zr * it signifies, if you find out, tell me! -zr
*/ */
/* simple, its magic dude!
* well, to be honest, this gives a natural feeling zooming
* with multiple keypad presses (ton)
*/
zoomfac= (M_SQRT2 + v3d->camzoom/50.0); zoomfac= (M_SQRT2 + v3d->camzoom/50.0);
zoomfac= (zoomfac*zoomfac)*0.25; zoomfac= (zoomfac*zoomfac)*0.25;
@@ -628,7 +633,7 @@ static void drawviewborder(void)
x2= viewborder.xmax; x2= viewborder.xmax;
y2= viewborder.ymax; y2= viewborder.ymax;
/* rand */ /* edge */
setlinestyle(3); setlinestyle(3);
cpack(0); cpack(0);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
@@ -652,7 +657,7 @@ static void drawviewborder(void)
glRectf(x3, y3, x4, y4); glRectf(x3, y3, x4, y4);
} }
/* safetykader */ /* safety border */
fac= 0.1; fac= 0.1;
@@ -727,7 +732,7 @@ void backdrawview3d(int test)
base= (G.scene->base.first); base= (G.scene->base.first);
while(base) { while(base) {
/* elke base ivm meerdere windows */ /* each base, because of multiple windows */
base->selcol= 0x070707 | ( ((tel & 0xF00)<<12) + ((tel & 0xF0)<<8) + ((tel & 0xF)<<4) ); base->selcol= 0x070707 | ( ((tel & 0xF00)<<12) + ((tel & 0xF0)<<8) + ((tel & 0xF)<<4) );
tel++; tel++;
@@ -802,7 +807,7 @@ void drawview3dspace(ScrArea *sa, void *spacedata)
Base *base; Base *base;
Object *ob; Object *ob;
setwinmatrixview3d(0); /* 0= geen pick rect */ setwinmatrixview3d(0); /* 0= no pick rect */
setviewmatrixview3d(); setviewmatrixview3d();
@@ -854,10 +859,10 @@ void drawview3dspace(ScrArea *sa, void *spacedata)
clear_object_constraint_status(base->object); clear_object_constraint_status(base->object);
} }
/* eerst set tekenen */ /* draw set first */
if(G.scene->set) { if(G.scene->set) {
/* patchje: kleur blijft constant */ /* patch: color remains constant */
G.f |= G_PICKSEL; G.f |= G_PICKSEL;
base= G.scene->set->base.first; base= G.scene->set->base.first;
@@ -892,13 +897,7 @@ void drawview3dspace(ScrArea *sa, void *spacedata)
G.f &= ~G_PICKSEL; G.f &= ~G_PICKSEL;
} }
/* SILLY CODE!!!! */ /* first draw not selected and the duplis */
/* See next silly code... why is the same code
* ~ duplicated twice, and then this silly if(FALSE)
* in part... wacky! and bad!
*/
/* eerst niet selected en dupli's */
base= G.scene->base.first; base= G.scene->base.first;
while(base) { while(base) {
@@ -906,14 +905,15 @@ void drawview3dspace(ScrArea *sa, void *spacedata)
where_is_object(base->object); where_is_object(base->object);
/* dupli drawing temporal off here */
if(FALSE && base->object->transflag & OB_DUPLI) { if(FALSE && base->object->transflag & OB_DUPLI) {
extern ListBase duplilist; extern ListBase duplilist;
Base tbase; Base tbase;
/* altijd eerst original tekenen vanwege make_displist */ /* draw original always first because of make_displist */
draw_object(base); draw_object(base);
/* patchje: kleur blijft constant */ /* patch: color remains constant */
G.f |= G_PICKSEL; G.f |= G_PICKSEL;
cpack(0x404040); cpack(0x404040);
@@ -938,7 +938,7 @@ void drawview3dspace(ScrArea *sa, void *spacedata)
base= base->next; base= base->next;
} }
/* selected */ /* draw selected */
base= G.scene->base.first; base= G.scene->base.first;
while(base) { while(base) {
@@ -950,7 +950,7 @@ void drawview3dspace(ScrArea *sa, void *spacedata)
} }
/* SILLY CODE!!!! */ /* SILLY CODE!!!! */
/* dupli's, als laatste om zeker te zijn de displisten zijn ok */ /* duplis, draw as last to make sure the displists are ok */
base= G.scene->base.first; base= G.scene->base.first;
while(base) { while(base) {
@@ -959,7 +959,7 @@ void drawview3dspace(ScrArea *sa, void *spacedata)
extern ListBase duplilist; extern ListBase duplilist;
Base tbase; Base tbase;
/* patchje: kleur blijft constant */ /* patch: color remains constant */
G.f |= G_PICKSEL; G.f |= G_PICKSEL;
cpack(0x404040); cpack(0x404040);
@@ -1062,17 +1062,17 @@ void drawview3d_render(struct View3D *v3d)
test_all_displists(); test_all_displists();
/* niet erg nette calc_ipo en where_is forceer */ /* not really nice forcing of calc_ipo and where_is */
ob= G.main->object.first; ob= G.main->object.first;
while(ob) { while(ob) {
ob->ctime= -123.456; ob->ctime= -123.456;
ob= ob->id.next; ob= ob->id.next;
} }
/* eerst set tekenen */ /* first deaw set */
if(G.scene->set) { if(G.scene->set) {
/* patchje: kleur blijft constant */ /* patch: color remains constant */
G.f |= G_PICKSEL; G.f |= G_PICKSEL;
base= G.scene->set->base.first; base= G.scene->set->base.first;
@@ -1109,7 +1109,7 @@ void drawview3d_render(struct View3D *v3d)
for (base = G.scene->base.first; base; base=base->next){ for (base = G.scene->base.first; base; base=base->next){
clear_object_constraint_status(base->object); clear_object_constraint_status(base->object);
} }
/* eerst niet selected en dupli's */ /* first not selected and duplis */
base= G.scene->base.first; base= G.scene->base.first;
while(base) { while(base) {
@@ -1122,10 +1122,10 @@ void drawview3d_render(struct View3D *v3d)
extern ListBase duplilist; extern ListBase duplilist;
Base tbase; Base tbase;
/* altijd eerst original tekenen vanwege make_displist */ /* always draw original first because of make_displist */
draw_object(base); draw_object(base);
/* patchje: kleur blijft constant */ /* patch: color remains constant */
G.f |= G_PICKSEL; G.f |= G_PICKSEL;
cpack(0x404040); cpack(0x404040);
@@ -1150,7 +1150,7 @@ void drawview3d_render(struct View3D *v3d)
base= base->next; base= base->next;
} }
/* selected */ /* draw selected */
base= G.scene->base.first; base= G.scene->base.first;
while(base) { while(base) {
@@ -1284,6 +1284,9 @@ void sumo_callback(void *obp)
Mat3ToEul(matf, ob->rot); Mat3ToEul(matf, ob->rot);
} }
/* for test and fun, i've written the next functions to play with dynamics
using a variant of play-anim... was never released nor really tested (ton) */
void init_anim_sumo(void) void init_anim_sumo(void)
{ {
extern Material defmaterial; extern Material defmaterial;
@@ -1459,7 +1462,7 @@ void update_anim_sumo(void)
if(ob->sumohandle) { if(ob->sumohandle) {
if((ob->gameflag & OB_DYNAMIC)==0) { if((ob->gameflag & OB_DYNAMIC)==0) {
/* evt: optimise, check for anim */ /* maybe: optimise, check for anim */
scaling[0] = ob->size[0]; scaling[0] = ob->size[0];
scaling[1] = ob->size[1]; scaling[1] = ob->size[1];
scaling[2] = ob->size[2]; scaling[2] = ob->size[2];
@@ -1554,7 +1557,7 @@ void inner_play_anim_loop(int init, int mode)
sa= sa->next; sa= sa->next;
} }
/* minimaal swaptime laten voorbijgaan */ /* make sure that swaptime passed by */
tottime -= swaptime; tottime -= swaptime;
while (update_time()) PIL_sleep_ms(1); while (update_time()) PIL_sleep_ms(1);
@@ -1573,7 +1576,7 @@ int play_anim(int mode)
unsigned short event=0; unsigned short event=0;
short val; short val;
/* patch voor zeer oude scenes */ /* patch for very very old scenes */
if(SFRA==0) SFRA= 1; if(SFRA==0) SFRA= 1;
if(EFRA==0) EFRA= 250; if(EFRA==0) EFRA= 250;
@@ -1582,7 +1585,7 @@ int play_anim(int mode)
update_time(); update_time();
/* waitcursor(1); */ /* waitcursor(1); */
G.f |= G_PLAYANIM; /* in sequence.c en view.c wordt dit afgevangen */ G.f |= G_PLAYANIM; /* in sequence.c and view.c this is handled */
cfraont= CFRA; cfraont= CFRA;
oldsa= curarea; oldsa= curarea;
@@ -1659,7 +1662,7 @@ int play_anim(int mode)
allqueue(REDRAWIPO, 0); allqueue(REDRAWIPO, 0);
allqueue(REDRAWNLA, 0); allqueue(REDRAWNLA, 0);
allqueue (REDRAWACTION, 0); allqueue (REDRAWACTION, 0);
/* vooropig */ /* for the time being */
update_for_newframe(); update_for_newframe();
#ifdef NAN_LINEAR_PHYSICS #ifdef NAN_LINEAR_PHYSICS
end_anim_sumo(); end_anim_sumo();

View File

@@ -128,7 +128,7 @@ int get_border(rcti *rect, short col)
mywinset(G.curscreen->mainwin); mywinset(G.curscreen->mainwin);
/* pietsje groter, 1 pixel aan de rand */ /* slightly larger, 1 pixel at the edge */
glReadBuffer(GL_FRONT); glReadBuffer(GL_FRONT);
glDrawBuffer(GL_FRONT); glDrawBuffer(GL_FRONT);
@@ -149,7 +149,7 @@ int get_border(rcti *rect, short col)
while(TRUE) { while(TRUE) {
/* als een renderwindow open is en de muis gaat erin */ /* for when a renderwindow is open, and a mouse cursor activates it */
persp(1); persp(1);
mywinset(curarea->win); mywinset(curarea->win);
persp(0); persp(0);
@@ -286,7 +286,7 @@ int get_border(rcti *rect, short col)
rect->ymax= mval[1]; rect->ymax= mval[1];
retval= event; retval= event;
/* normaliseren */ /* normalise */
if(rect->xmin>rect->xmax) SWAP(int, rect->xmin, rect->xmax); if(rect->xmin>rect->xmax) SWAP(int, rect->xmin, rect->xmax);
if(rect->ymin>rect->ymax) SWAP(int, rect->ymin, rect->ymax); if(rect->ymin>rect->ymax) SWAP(int, rect->ymin, rect->ymax);
@@ -296,7 +296,7 @@ int get_border(rcti *rect, short col)
} }
/* wissen */ /* clear */
if(event!=BKEY) { if(event!=BKEY) {
if ELEM(curarea->spacetype, SPACE_VIEW3D, SPACE_IPO) { if ELEM(curarea->spacetype, SPACE_VIEW3D, SPACE_IPO) {
scrarea_queue_winredraw(curarea); scrarea_queue_winredraw(curarea);
@@ -338,7 +338,7 @@ void draw_sel_circle(short *mval, short *mvalo, float rad, float rado, int selec
persp(0); persp(0);
glDrawBuffer(GL_FRONT); glDrawBuffer(GL_FRONT);
/* cirkel tekenen */ /* draw circle */
if(mvalo && no_mvalo==0) { if(mvalo && no_mvalo==0) {
sdrawXORcirc(mvalo[0], mvalo[1], rado); sdrawXORcirc(mvalo[0], mvalo[1], rado);
@@ -381,7 +381,7 @@ void circle_selectCB(select_CBfunc callback)
while(TRUE) { while(TRUE) {
/* als een renderwindow open is en de muis gaat erin */ /* for when another window is open and a mouse cursor activates it */
mywinset(curarea->win); mywinset(curarea->win);
@@ -432,7 +432,7 @@ void circle_selectCB(select_CBfunc callback)
} }
} }
/* cirkel wissen */ /* clear circle */
draw_sel_circle(0, mvalo, 0, rad, 1); draw_sel_circle(0, mvalo, 0, rad, 1);
countall(); countall();
@@ -545,7 +545,7 @@ void countall()
else if (G.obedit->type==OB_ARMATURE){ else if (G.obedit->type==OB_ARMATURE){
for (ebo=G.edbo.first;ebo;ebo=ebo->next){ for (ebo=G.edbo.first;ebo;ebo=ebo->next){
/* Synch selection to parent for ik children */ /* Sync selection to parent for ik children */
if ((ebo->flag & BONE_IK_TOPARENT) && ebo->parent){ if ((ebo->flag & BONE_IK_TOPARENT) && ebo->parent){
G.totvert--; G.totvert--;
if (ebo->parent->flag & BONE_TIPSEL) if (ebo->parent->flag & BONE_TIPSEL)
@@ -621,7 +621,7 @@ void countall()
} }
} }
allqueue(REDRAWINFO, 1); /* 1, want header->win==0! */ allqueue(REDRAWINFO, 1); /* 1, because header->win==0! */
return; return;
} }
else if(G.f & (G_FACESELECT + G_VERTEXPAINT + G_TEXTUREPAINT +G_WEIGHTPAINT)) { else if(G.f & (G_FACESELECT + G_VERTEXPAINT + G_TEXTUREPAINT +G_WEIGHTPAINT)) {
@@ -630,7 +630,7 @@ void countall()
G.totface= me->totface; G.totface= me->totface;
G.totvert= me->totvert; G.totvert= me->totvert;
} }
allqueue(REDRAWINFO, 1); /* 1, want header->win==0! */ allqueue(REDRAWINFO, 1); /* 1, because header->win==0! */
return; return;
} }
@@ -661,7 +661,7 @@ void countall()
} }
base= base->next; base= base->next;
} }
allqueue(REDRAWINFO, 1); /* 1, want header->win==0! */ allqueue(REDRAWINFO, 1); /* 1, because header->win==0! */
} }

View File

@@ -101,7 +101,7 @@
ListBase editNurb; ListBase editNurb;
BPoint *lastselbp; BPoint *lastselbp;
Nurb *lastnu; /* voor selected */ Nurb *lastnu; /* for selected */
/* void freeNurblist(ListBase *lb); already declared in the kernel */ /* void freeNurblist(ListBase *lb); already declared in the kernel */
@@ -231,11 +231,11 @@ static void printweightsNurb(void)
#endif #endif
/* ********************* LOAD EN MAKE *************** */ /* ********************* LOAD and MAKE *************** */
void load_editNurb() void load_editNurb()
{ {
/* laad editNurb in object */ /* load editNurb in object */
Curve *cu= 0; Curve *cu= 0;
Nurb *nu, *newnu; Nurb *nu, *newnu;
KeyBlock *actkey=0; KeyBlock *actkey=0;
@@ -248,7 +248,7 @@ void load_editNurb()
cu= G.obedit->data; cu= G.obedit->data;
/* zijn er keys? */ /* are there keys? */
if(cu->key) { if(cu->key) {
actkey= cu->key->block.first; actkey= cu->key->block.first;
while(actkey) { while(actkey) {
@@ -257,7 +257,7 @@ void load_editNurb()
} }
if(actkey) { if(actkey) {
/* aktieve key: de vertices */ /* active key: the vertices */
if(G.totvert) { if(G.totvert) {
if(actkey->data) MEM_freeN(actkey->data); if(actkey->data) MEM_freeN(actkey->data);
@@ -271,8 +271,8 @@ void load_editNurb()
} }
if(cu->key && actkey!=cu->key->refkey) { if(cu->key && actkey!=cu->key->refkey) {
/* er zijn keys, alleen veranderingen in verts schrijven */ /* there are keys, only write changes in vertices */
/* als aantal vertices verschillen, beetje onvoorspelbaar */ /* when amount of vertices differs, becomes unpredictable a bit */
/* vertex -> vertex copy! */ /* vertex -> vertex copy! */
if(actkey) key_to_curve(actkey, cu, &cu->nurb); if(actkey) key_to_curve(actkey, cu, &cu->nurb);
@@ -296,13 +296,13 @@ void load_editNurb()
} }
lastnu= 0; /* voor selected */ lastnu= 0; /* for selected */
} }
void make_editNurb() void make_editNurb()
{ {
/* maak kopie van baseNurb in editNurb */ /* make copy of baseNurb in editNurb */
Curve *cu=0; Curve *cu=0;
Nurb *nu, *newnu; Nurb *nu, *newnu;
BezTriple *bezt; BezTriple *bezt;
@@ -312,7 +312,7 @@ void make_editNurb()
if(G.obedit==0) return; if(G.obedit==0) return;
lastselbp= 0; /* global voor select row */ lastselbp= 0; /* global for select row */
if ELEM(G.obedit->type, OB_CURVE, OB_SURF) { if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
freeNurblist(&editNurb); freeNurblist(&editNurb);
@@ -323,7 +323,7 @@ void make_editNurb()
while(nu) { while(nu) {
newnu= duplicateNurb(nu); newnu= duplicateNurb(nu);
BLI_addtail(&editNurb, newnu); BLI_addtail(&editNurb, newnu);
/* flags op nul */ /* flags zero */
newnu->hide= 0; newnu->hide= 0;
if((nu->type & 7)==CU_BEZIER) { if((nu->type & 7)==CU_BEZIER) {
a= nu->pntsu; a= nu->pntsu;
@@ -363,7 +363,7 @@ void make_editNurb()
countall(); countall();
lastnu= 0; /* voor selected */ lastnu= 0; /* for selected */
} }
void remake_editNurb() void remake_editNurb()
@@ -398,14 +398,14 @@ void separate_nurb()
return; return;
} }
/* we gaan de zaak als volgt neppen: /* we are going to trick everything as follows:
* 1. duplicate base: dit wordt de nieuwe, oude pointer onthouden * 1. duplicate base: this is the new one, remember old pointer
* 2. alle NIET geselecteerde curves/nurbs apart zetten * 2. set aside all NOT selected curves/nurbs
* 3. load_ebaseNurb(): dit is de nieuwe base * 3. load_ebaseNurb(): this will be the new base
* 4. freelist en oude nurbs weer terughalen * 4. freelist and restore old nurbs
*/ */
/* alleen ebase geselecteerd */ /* only edit-base selected */
base= FIRSTBASE; base= FIRSTBASE;
while(base) { while(base) {
if(base->lay & G.vd->lay) { if(base->lay & G.vd->lay) {
@@ -415,7 +415,7 @@ void separate_nurb()
base= base->next; base= base->next;
} }
/* apart zetten: alles wat maar enigszins NIET select is */ /* set aside: everything that is not selected */
editnurbo.first= editnurbo.last= 0; editnurbo.first= editnurbo.last= 0;
nu= editNurb.first; nu= editNurb.first;
while(nu) { while(nu) {
@@ -432,14 +432,14 @@ void separate_nurb()
trans[0]=trans[1]=trans[2]=trans[3]=trans[4]=trans[5]= 0.0; trans[0]=trans[1]=trans[2]=trans[3]=trans[4]=trans[5]= 0.0;
trans[6]=trans[7]=trans[8]= 1.0; trans[6]=trans[7]=trans[8]= 1.0;
G.qual |= LR_ALTKEY; /* patch om zeker te zijn van gelinkte dupli */ G.qual |= LR_ALTKEY; /* patch to make sure we get a linked dupli */
adduplicate(trans); adduplicate(trans);
G.qual &= ~LR_ALTKEY; G.qual &= ~LR_ALTKEY;
G.obedit= BASACT->object; /* basact wordt in adduplicate() gezet */ G.obedit= BASACT->object; /* basact is set in adduplicate() */
G.obedit->data= copy_curve(cu); G.obedit->data= copy_curve(cu);
/* omdat nieuwe curve een kopie is: aantal users verlagen */ /* because new curve is a copy: reduce user count */
cu->id.us--; cu->id.us--;
load_editNurb(); load_editNurb();
@@ -450,8 +450,8 @@ void separate_nurb()
editNurb= editnurbo; editNurb= editnurbo;
G.obedit= 0; /* displisten doen anders in editmode */ G.obedit= 0; /* displists behave different in edit mode */
makeDispList(OBACT); /* de gesepareerde */ makeDispList(OBACT); /* this is the separated one */
G.obedit= oldob; G.obedit= oldob;
BASACT= oldbase; BASACT= oldbase;
@@ -462,20 +462,16 @@ void separate_nurb()
countall(); countall();
allqueue(REDRAWVIEW3D, 0); allqueue(REDRAWVIEW3D, 0);
lastnu= 0; /* voor selected */ lastnu= 0; /* for selected */
} }
/* ******************* FLAGS ********************* */ /* ******************* FLAGS ********************* */
short isNurbselUV(Nurb *nu, int *u, int *v, int flag) short isNurbselUV(Nurb *nu, int *u, int *v, int flag)
/*
Nurb *nu;
int *u, *v, flag;
*/
{ {
/* return u!=-1: 1 rij in u-richting geselecteerd. U heeft de waarde tussen 0-pntsv /* return u!=-1: 1 row in u-direction selected. U has value between 0-pntsv
* return v!=-1: 1 kolom in v-richting geselecteerd. V heeft de waarde tussen 0-pntsu * return v!=-1: 1 collumn in v-direction selected. V has value between 0-pntsu
*/ */
BPoint *bp; BPoint *bp;
int a, b, sel; int a, b, sel;
@@ -492,7 +488,7 @@ int *u, *v, flag;
if(*u== -1) *u= b; if(*u== -1) *u= b;
else return 0; else return 0;
} }
else if(sel>1) return 0; /* want sel==1 is nog goed */ else if(sel>1) return 0; /* because sel==1 is still ok */
} }
for(a=0; a<nu->pntsu; a++) { for(a=0; a<nu->pntsu; a++) {
@@ -514,7 +510,6 @@ int *u, *v, flag;
} }
void setflagsNurb(short flag) void setflagsNurb(short flag)
/* short flag; */
{ {
Nurb *nu; Nurb *nu;
BezTriple *bezt; BezTriple *bezt;
@@ -545,7 +540,7 @@ void setflagsNurb(short flag)
void rotateflagNurb(short flag, float *cent, float rotmat[][3]) void rotateflagNurb(short flag, float *cent, float rotmat[][3])
{ {
/* alle verts met (flag & 'flag') rotate */ /* all verts with (flag & 'flag') rotate */
Nurb *nu; Nurb *nu;
BPoint *bp; BPoint *bp;
int a; int a;
@@ -576,7 +571,7 @@ void rotateflagNurb(short flag, float *cent, float rotmat[][3])
void translateflagNurb(short flag, float *vec) void translateflagNurb(short flag, float *vec)
{ {
/* alle verts met (->f & flag) translate */ /* all verts with ('flag' & flag) translate */
Nurb *nu; Nurb *nu;
BezTriple *bezt; BezTriple *bezt;
BPoint *bp; BPoint *bp;
@@ -609,7 +604,7 @@ void translateflagNurb(short flag, float *vec)
} }
} }
void weightflagNurb(short flag, float w, int mode) /* mode==0: vervangen, mode==1: vermenigvuldigen */ void weightflagNurb(short flag, float w, int mode) /* mode==0: replace, mode==1: multiply */
{ {
Nurb *nu; Nurb *nu;
BPoint *bp; BPoint *bp;
@@ -647,7 +642,7 @@ void deleteflagNurb(short flag)
while(nu) { while(nu) {
next= nu->next; next= nu->next;
/* is de hele nurb geselecteerd */ /* is entire nurb selected */
bp= nu->bp; bp= nu->bp;
a= nu->pntsu*nu->pntsv; a= nu->pntsu*nu->pntsv;
while(a) { while(a) {
@@ -661,7 +656,7 @@ void deleteflagNurb(short flag)
freeNurb(nu); freeNurb(nu);
} }
else { else {
/* is de nurb in U richting geselecteerd */ /* is nurb in U direction selected */
newv= nu->pntsv; newv= nu->pntsv;
bp= nu->bp; bp= nu->bp;
for(b=0; b<nu->pntsv; b++) { for(b=0; b<nu->pntsv; b++) {
@@ -678,7 +673,7 @@ void deleteflagNurb(short flag)
} }
} }
if(newv!=nu->pntsv && b==nu->pntsv) { if(newv!=nu->pntsv && b==nu->pntsv) {
/* deleten */ /* delete */
bp= nu->bp; bp= nu->bp;
bpn = newbp = bpn = newbp =
(BPoint*) MEM_mallocN(newv * nu->pntsu * sizeof(BPoint), "deleteNurb"); (BPoint*) MEM_mallocN(newv * nu->pntsu * sizeof(BPoint), "deleteNurb");
@@ -697,7 +692,7 @@ void deleteflagNurb(short flag)
makeknots(nu, 2, nu->flagv>>1); makeknots(nu, 2, nu->flagv>>1);
} }
else { else {
/* is de nurb in V richting geselecteerd */ /* is the nurb in V direction selected */
newu= nu->pntsu; newu= nu->pntsu;
for(a=0; a<nu->pntsu; a++) { for(a=0; a<nu->pntsu; a++) {
bp= nu->bp+a; bp= nu->bp+a;
@@ -714,7 +709,7 @@ void deleteflagNurb(short flag)
} }
} }
if(newu!=nu->pntsu && a==nu->pntsu) { if(newu!=nu->pntsu && a==nu->pntsu) {
/* deleten */ /* delete */
bp= nu->bp; bp= nu->bp;
bpn = newbp = bpn = newbp =
(BPoint*) MEM_mallocN(newu * nu->pntsv * sizeof(BPoint), "deleteNurb"); (BPoint*) MEM_mallocN(newu * nu->pntsv * sizeof(BPoint), "deleteNurb");
@@ -728,7 +723,7 @@ void deleteflagNurb(short flag)
} }
MEM_freeN(nu->bp); MEM_freeN(nu->bp);
nu->bp= newbp; nu->bp= newbp;
if(newu==1 && nu->pntsv>1) { /* maak een U spline */ if(newu==1 && nu->pntsv>1) { /* make a U spline */
nu->pntsu= nu->pntsv; nu->pntsu= nu->pntsv;
nu->pntsv= 1; nu->pntsv= 1;
SWAP(short, nu->orderu, nu->orderv); SWAP(short, nu->orderu, nu->orderv);
@@ -749,7 +744,6 @@ void deleteflagNurb(short flag)
} }
short extrudeflagNurb(int flag) short extrudeflagNurb(int flag)
/* int flag; */
{ {
Nurb *nu; Nurb *nu;
BPoint *bp, *bpn, *newbp; BPoint *bp, *bpn, *newbp;
@@ -793,11 +787,11 @@ short extrudeflagNurb(int flag)
} }
} }
else { else {
/* welke rij of kolom is geselecteerd */ /* which row or collumn is selected */
if( isNurbselUV(nu, &u, &v, flag) ) { if( isNurbselUV(nu, &u, &v, flag) ) {
/* alles deselecteren */ /* deselect all */
bp= nu->bp; bp= nu->bp;
a= nu->pntsu*nu->pntsv; a= nu->pntsu*nu->pntsv;
while(a--) { while(a--) {
@@ -805,7 +799,7 @@ short extrudeflagNurb(int flag)
bp++; bp++;
} }
if(u==0 || u== nu->pntsv-1) { /* rij in u-richting geselecteerd */ if(u==0 || u== nu->pntsv-1) { /* row in u-direction selected */
ok= 1; ok= 1;
newbp = newbp =
(BPoint*) MEM_mallocN(nu->pntsu*(nu->pntsv + 1) (BPoint*) MEM_mallocN(nu->pntsu*(nu->pntsv + 1)
@@ -835,7 +829,7 @@ short extrudeflagNurb(int flag)
if(nu->resolv<3) nu->resolv++; if(nu->resolv<3) nu->resolv++;
makeknots(nu, 2, nu->flagv>>1); makeknots(nu, 2, nu->flagv>>1);
} }
else if(v==0 || v== nu->pntsu-1) { /* kolom in v-richting geselecteerd */ else if(v==0 || v== nu->pntsu-1) { /* collumn in v-direction selected */
ok= 1; ok= 1;
bpn = newbp = bpn = newbp =
(BPoint*) MEM_mallocN((nu->pntsu + 1) * nu->pntsv * sizeof(BPoint), "extrudeNurb1"); (BPoint*) MEM_mallocN((nu->pntsu + 1) * nu->pntsv * sizeof(BPoint), "extrudeNurb1");
@@ -873,7 +867,6 @@ short extrudeflagNurb(int flag)
void adduplicateflagNurb(short flag) void adduplicateflagNurb(short flag)
/* short flag; */
{ {
Nurb *nu, *newnu; Nurb *nu, *newnu;
BezTriple *bezt, *bezt1; BezTriple *bezt, *bezt1;
@@ -923,7 +916,7 @@ void adduplicateflagNurb(short flag)
bezt++; bezt++;
} }
} }
else if(nu->pntsv==1) { /* want UV Nurb heeft andere duplimethode */ else if(nu->pntsv==1) { /* because UV Nurb has a different method for dupli */
bp= nu->bp; bp= nu->bp;
for(a=0; a<nu->pntsu; a++) { for(a=0; a<nu->pntsu; a++) {
enda= -1; enda= -1;
@@ -963,7 +956,7 @@ void adduplicateflagNurb(short flag)
} }
} }
else { else {
/* een rechthoekig gebied in de nurb moet geselecteerd zijn */ /* a rectangular area in nurb has to be selected */
if(isNurbsel(nu)) { if(isNurbsel(nu)) {
usel= MEM_callocN(nu->pntsu, "adduplicateN4"); usel= MEM_callocN(nu->pntsu, "adduplicateN4");
bp= nu->bp; bp= nu->bp;
@@ -1069,7 +1062,7 @@ void switchdirection_knots(float *base, int tot)
if(base==NULL || tot==0) return; if(base==NULL || tot==0) return;
/* de knots omkeren */ /* reverse knots */
a= tot; a= tot;
fp1= base; fp1= base;
fp2= fp1+(a-1); fp2= fp1+(a-1);
@@ -1080,7 +1073,7 @@ void switchdirection_knots(float *base, int tot)
fp1++; fp1++;
fp2--; fp2--;
} }
/* en weer in stijgende lijn maken */ /* and make in increasing order again */
a= tot; a= tot;
fp1= base; fp1= base;
fp2=tempf= MEM_mallocN(sizeof(float)*a, "switchdirect"); fp2=tempf= MEM_mallocN(sizeof(float)*a, "switchdirect");
@@ -1363,7 +1356,7 @@ void subdivideNurb()
Endpoints are preserved. Otherwise, all selected and inserted points are Endpoints are preserved. Otherwise, all selected and inserted points are
newly created. Old points are discarded. newly created. Old points are discarded.
*/ */
/* tellen */ /* count */
if(nu->flagu & 1) { if(nu->flagu & 1) {
a= nu->pntsu; a= nu->pntsu;
bezt= nu->bezt; bezt= nu->bezt;
@@ -1381,13 +1374,9 @@ void subdivideNurb()
} }
if(aantal) { if(aantal) {
/* inserten */ /* insert */
beztnew = beztnew =
/* I have some severe doubt about the original
* formulation... I stick to the upper bound to be
* on the safe side */
(BezTriple*)MEM_mallocN((aantal + nu->pntsu) * sizeof(BezTriple), "subdivNurb"); (BezTriple*)MEM_mallocN((aantal + nu->pntsu) * sizeof(BezTriple), "subdivNurb");
/* mallocstructN(BezTriple, aantal+nu->pntsu, "subdivNurb"); */
beztn= beztnew; beztn= beztnew;
if(nu->flagu & 1) { if(nu->flagu & 1) {
a= nu->pntsu; a= nu->pntsu;
@@ -1420,7 +1409,7 @@ void subdivideNurb()
prevbezt= bezt; prevbezt= bezt;
bezt++; bezt++;
} }
/* laatste punt */ /* last point */
if((nu->flagu & 1)==0) memcpy(beztn, prevbezt, sizeof(BezTriple)); if((nu->flagu & 1)==0) memcpy(beztn, prevbezt, sizeof(BezTriple));
MEM_freeN(nu->bezt); MEM_freeN(nu->bezt);
@@ -1437,7 +1426,7 @@ void subdivideNurb()
should be. I split it off just now, let's see if it is should be. I split it off just now, let's see if it is
stable... nzc 30-5-'00 stable... nzc 30-5-'00
*/ */
/* tellen */ /* count */
if(nu->flagu & 1) { if(nu->flagu & 1) {
a= nu->pntsu*nu->pntsv; a= nu->pntsu*nu->pntsv;
bp= nu->bp; bp= nu->bp;
@@ -1455,7 +1444,7 @@ void subdivideNurb()
} }
if(aantal) { if(aantal) {
/* inserten */ /* insert */
bpnew = bpnew =
(BPoint*)MEM_mallocN((aantal + nu->pntsu) * sizeof(BPoint), "subdivNurb2"); (BPoint*)MEM_mallocN((aantal + nu->pntsu) * sizeof(BPoint), "subdivNurb2");
bpn= bpnew; bpn= bpnew;
@@ -1487,7 +1476,7 @@ void subdivideNurb()
prevbp= bp; prevbp= bp;
bp++; bp++;
} }
if((nu->flagu & 1)==0) memcpy(bpn, prevbp, sizeof(BPoint)); /* laatste punt */ if((nu->flagu & 1)==0) memcpy(bpn, prevbp, sizeof(BPoint)); /* last point */
MEM_freeN(nu->bp); MEM_freeN(nu->bp);
nu->bp= bpnew; nu->bp= bpnew;
@@ -1541,7 +1530,7 @@ void subdivideNurb()
fit the order, duplicates of the endpoints are added as fit the order, duplicates of the endpoints are added as
needed. needed.
*/ */
/* selecteer-arrays aanleggen */ /* selection-arrays */
usel= MEM_callocN(sizeof(int)*nu->pntsu, "subivideNurb3"); usel= MEM_callocN(sizeof(int)*nu->pntsu, "subivideNurb3");
vsel= MEM_callocN(sizeof(int)*nu->pntsv, "subivideNurb3"); vsel= MEM_callocN(sizeof(int)*nu->pntsv, "subivideNurb3");
sel= 0; sel= 0;
@@ -1558,12 +1547,12 @@ void subdivideNurb()
bp++; bp++;
} }
} }
if( sel == (nu->pntsu*nu->pntsv) ) { /* hele nurb subdividen */ if( sel == (nu->pntsu*nu->pntsv) ) { /* subdivide entire nurb */
/* Global subdivision is a special case of partial /* Global subdivision is a special case of partial
subdivision. Strange it is considered separately... */ subdivision. Strange it is considered separately... */
bpn=bpnew= MEM_mallocN( (2*nu->pntsu-1)*(2*nu->pntsv-1)*sizeof(BPoint), "subdivideNurb4"); bpn=bpnew= MEM_mallocN( (2*nu->pntsu-1)*(2*nu->pntsv-1)*sizeof(BPoint), "subdivideNurb4");
bp= nu->bp; bp= nu->bp;
/* eerst de rijen subdividen */ /* first subdivide rows */
for(a=0; a<nu->pntsv; a++) { for(a=0; a<nu->pntsv; a++) {
for(b=0; b<nu->pntsu; b++) { for(b=0; b<nu->pntsu; b++) {
*bpn= *bp; *bpn= *bp;
@@ -1581,7 +1570,7 @@ void subdivideNurb()
} }
bpn+= (2*nu->pntsu-1); bpn+= (2*nu->pntsu-1);
} }
/* nu nieuwe invoegen */ /* now insert new */
bpn= bpnew+(2*nu->pntsu-1); bpn= bpnew+(2*nu->pntsu-1);
bp= bpnew+(4*nu->pntsu-2); bp= bpnew+(4*nu->pntsu-2);
prevbp= bpnew; prevbp= bpnew;
@@ -1609,7 +1598,7 @@ void subdivideNurb()
makeknots(nu, 2, nu->flagv>>1); makeknots(nu, 2, nu->flagv>>1);
} /* End of 'if(sel== nu->pntsu*nu->pntsv)' (subdivide entire NURB) */ } /* End of 'if(sel== nu->pntsu*nu->pntsv)' (subdivide entire NURB) */
else { else {
/* in v richting subdividen? */ /* subdivide in v direction? */
sel= 0; sel= 0;
for(a=0; a<nu->pntsv-1; a++) { for(a=0; a<nu->pntsv-1; a++) {
if(vsel[a]==nu->pntsu && vsel[a+1]==nu->pntsu) sel++; if(vsel[a]==nu->pntsu && vsel[a+1]==nu->pntsu) sel++;
@@ -1652,7 +1641,7 @@ void subdivideNurb()
makeknots(nu, 2, nu->flagv>>1); makeknots(nu, 2, nu->flagv>>1);
} }
else { else {
/* of in u richting? */ /* or in u direction? */
sel= 0; sel= 0;
for(a=0; a<nu->pntsu-1; a++) { for(a=0; a<nu->pntsu-1; a++) {
if(usel[a]==nu->pntsv && usel[a+1]==nu->pntsv) sel++; if(usel[a]==nu->pntsv && usel[a+1]==nu->pntsv) sel++;
@@ -1696,13 +1685,11 @@ void subdivideNurb()
} }
MEM_freeN(usel); MEM_freeN(usel);
MEM_freeN(vsel); MEM_freeN(vsel);
// printf("*** subdivideNurb: end of NURB splitting part\n");
} /* End of 'if((nu->type & 7)==CU_NURBS)' */ } /* End of 'if((nu->type & 7)==CU_NURBS)' */
nu= nu->next; nu= nu->next;
} }
/* Sync flushing */
// printf("*** subdivideNurb: subdivide done\n");
makeDispList(G.obedit); makeDispList(G.obedit);
countall(); countall();
@@ -1711,15 +1698,9 @@ void subdivideNurb()
short findnearestNurbvert(short sel, Nurb **nurb, BezTriple **bezt, BPoint **bp) short findnearestNurbvert(short sel, Nurb **nurb, BezTriple **bezt, BPoint **bp)
/*
short sel;
Nurb **nurb;
BezTriple **bezt;
BPoint **bp;
*/
{ {
/* sel==1: selected krijgen een nadeel */ /* sel==1: selected gets a disadvantage */
/* in nurb en bezt of bp wordt nearest weggeschreven */ /* in nurb and bezt or bp the nearest is written */
/* return 0 1 2: handlepunt */ /* return 0 1 2: handlepunt */
Nurb *nu; Nurb *nu;
BezTriple *bezt1; BezTriple *bezt1;
@@ -1730,7 +1711,7 @@ BPoint **bp;
*bezt= 0; *bezt= 0;
*bp= 0; *bp= 0;
/* projektie doen */ /* do projection */
calc_nurbverts_ext(); /* drawobject.c */ calc_nurbverts_ext(); /* drawobject.c */
getmouseco_areawin(mval); getmouseco_areawin(mval);
@@ -1752,7 +1733,7 @@ BPoint **bp;
*bp= 0; *bp= 0;
} }
/* middelste punten een klein nadeel */ /* middle points get a small disadvantage */
temp= 3+abs(mval[0]- bezt1->s[1][0])+ abs(mval[1]- bezt1->s[1][1]); temp= 3+abs(mval[0]- bezt1->s[1][0])+ abs(mval[1]- bezt1->s[1][1]);
if( (bezt1->f2 & 1)==sel) temp+=5; if( (bezt1->f2 & 1)==sel) temp+=5;
if(temp<dist) { if(temp<dist) {
@@ -1803,8 +1784,8 @@ BPoint **bp;
void findselectedNurbvert(Nurb **nu, BezTriple **bezt, BPoint **bp) void findselectedNurbvert(Nurb **nu, BezTriple **bezt, BPoint **bp)
{ {
/* in nu en (bezt of bp) wordt selected weggeschreven als er 1 sel. is */ /* in nu and (bezt or bp) selected are written if there's 1 sel. */
/* als er meer punten in 1 spline selected: alleen nu terug, bezt en bp zijn 0 */ /* if more points selected in 1 spline: return only nu, bezt and bp are 0 */
Nurb *nu1; Nurb *nu1;
BezTriple *bezt1; BezTriple *bezt1;
BPoint *bp1; BPoint *bp1;
@@ -1866,9 +1847,6 @@ void findselectedNurbvert(Nurb **nu, BezTriple **bezt, BPoint **bp)
} }
void setsplinetype(short type) void setsplinetype(short type)
/*
short type;
*/
{ {
Nurb *nu; Nurb *nu;
BezTriple *bezt; BezTriple *bezt;
@@ -1885,7 +1863,7 @@ short type;
if(isNurbsel(nu)) { if(isNurbsel(nu)) {
if((nu->type & 7)==0) { /* Poly */ if((nu->type & 7)==0) { /* Poly */
if(type==CU_BEZIER) { /* naar Bezier met vecthandles */ if(type==CU_BEZIER) { /* to Bezier with vecthandles */
nr= nu->pntsu; nr= nu->pntsu;
bezt = bezt =
(BezTriple*)MEM_callocN(nr * sizeof(BezTriple), "setsplinetype2"); (BezTriple*)MEM_callocN(nr * sizeof(BezTriple), "setsplinetype2");
@@ -1906,7 +1884,7 @@ short type;
nu->type |= 1; nu->type |= 1;
calchandlesNurb(nu); calchandlesNurb(nu);
} }
else if(type==4) { /* naar Nurb */ else if(type==4) { /* to Nurb */
nu->type &= ~7; nu->type &= ~7;
nu->type+= 4; nu->type+= 4;
nu->orderu= 4; nu->orderu= 4;
@@ -1922,7 +1900,7 @@ short type;
} }
} }
else if((nu->type & 7)==CU_BEZIER) { /* Bezier */ else if((nu->type & 7)==CU_BEZIER) { /* Bezier */
if(type==0 || type==4) { /* naar Poly of Nurb */ if(type==0 || type==4) { /* to Poly or Nurb */
nr= 3*nu->pntsu; nr= 3*nu->pntsu;
nu->bp = nu->bp =
(BPoint*)MEM_callocN(nr * sizeof(BPoint), "setsplinetype"); (BPoint*)MEM_callocN(nr * sizeof(BPoint), "setsplinetype");
@@ -1931,7 +1909,7 @@ short type;
bp= nu->bp; bp= nu->bp;
while(a--) { while(a--) {
if(type==0 && bezt->h1==HD_VECT && bezt->h2==HD_VECT) { if(type==0 && bezt->h1==HD_VECT && bezt->h2==HD_VECT) {
/* vectorhandle wordt 1 polyvert */ /* vector handle becomes 1 poly vertice */
VECCOPY(bp->vec, bezt->vec[1]); VECCOPY(bp->vec, bezt->vec[1]);
bp->vec[3]= 1.0; bp->vec[3]= 1.0;
bp->f1= bezt->f2; bp->f1= bezt->f2;
@@ -1968,14 +1946,14 @@ short type;
} }
} }
else if( (nu->type & 7)==CU_NURBS && G.obedit->type==OB_CURVE) { else if( (nu->type & 7)==CU_NURBS && G.obedit->type==OB_CURVE) {
if(type==0) { /* naar Poly */ if(type==0) { /* to Poly */
nu->type &= ~7; nu->type &= ~7;
MEM_freeN(nu->knotsu); MEM_freeN(nu->knotsu);
nu->knotsu= 0; nu->knotsu= 0;
if(nu->knotsv) MEM_freeN(nu->knotsv); if(nu->knotsv) MEM_freeN(nu->knotsv);
nu->knotsv= 0; nu->knotsv= 0;
} }
else if(type==CU_BEZIER) { /* naar Bezier */ else if(type==CU_BEZIER) { /* to Bezier */
nr= nu->pntsu/3; nr= nu->pntsu/3;
bezt = bezt =
(BezTriple*)MEM_callocN(nr * sizeof(BezTriple), "setsplinetype2"); (BezTriple*)MEM_callocN(nr * sizeof(BezTriple), "setsplinetype2");
@@ -2297,7 +2275,7 @@ void merge_nurb()
void addsegment_nurb() void addsegment_nurb()
{ {
/* voegt twee curves samen */ /* joins 2 curves */
Nurb *nu, *nu1=0, *nu2=0; Nurb *nu, *nu1=0, *nu2=0;
BezTriple *bezt; BezTriple *bezt;
BPoint *bp; BPoint *bp;
@@ -2328,10 +2306,10 @@ void addsegment_nurb()
return; return;
} }
/* vind de beide nurben en punten, nu1 wordt achter nu2 gezet */ /* find both nurbs and points, nu1 will be put behind nu2 */
nu= editNurb.first; nu= editNurb.first;
while(nu) { while(nu) {
if((nu->flagu & 1)==0) { /* niet cyclic */ if((nu->flagu & 1)==0) { /* not cyclic */
if( (nu->type & 7)==CU_BEZIER ) { if( (nu->type & 7)==CU_BEZIER ) {
bezt= nu->bezt; bezt= nu->bezt;
if(nu1==0) { if(nu1==0) {
@@ -2415,7 +2393,7 @@ void addsegment_nurb()
nu1->pntsu+= nu2->pntsu; nu1->pntsu+= nu2->pntsu;
BLI_remlink(&editNurb, nu2); BLI_remlink(&editNurb, nu2);
/* en de knots aaneenrijgen */ /* now join the knots */
if((nu1->type & 7)==4) { if((nu1->type & 7)==4) {
fp= MEM_mallocN(sizeof(float)*KNOTSU(nu1), "addsegment3"); fp= MEM_mallocN(sizeof(float)*KNOTSU(nu1), "addsegment3");
memcpy(fp, nu1->knotsu, sizeof(float)*a); memcpy(fp, nu1->knotsu, sizeof(float)*a);
@@ -2529,8 +2507,6 @@ void mouse_nurb()
} }
void spinNurb(float *dvec, short mode) void spinNurb(float *dvec, short mode)
/* float *dvec; */
/* short mode; */ /* 0 is extrude, 1 is duplicate */
{ {
Nurb *nu; Nurb *nu;
float *curs, si,phi,n[3],q[4],cmat[3][3],tmat[3][3],imat[3][3]; float *curs, si,phi,n[3],q[4],cmat[3][3],tmat[3][3],imat[3][3];
@@ -2544,7 +2520,7 @@ void spinNurb(float *dvec, short mode)
Mat3CpyMat4(persmat, G.vd->viewmat); Mat3CpyMat4(persmat, G.vd->viewmat);
Mat3Inv(persinv, persmat); Mat3Inv(persinv, persmat);
/* imat en centrum en afmeting */ /* imat and centre and size */
Mat3CpyMat4(bmat, G.obedit->obmat); Mat3CpyMat4(bmat, G.obedit->obmat);
Mat3Inv(imat, bmat); Mat3Inv(imat, bmat);
@@ -2650,8 +2626,8 @@ void addvert_Nurb(int mode)
if(bezt==0 && bp==0) return; if(bezt==0 && bp==0) return;
if((nu->type & 7)==CU_BEZIER) { if((nu->type & 7)==CU_BEZIER) {
/* welk bezpoint? */ /* which bezpoint? */
if(bezt== nu->bezt) { /* eerste */ if(bezt== nu->bezt) { /* first */
bezt->f1= bezt->f2= bezt->f3= 0; bezt->f1= bezt->f2= bezt->f3= 0;
newbezt = newbezt =
(BezTriple*)MEM_callocN((nu->pntsu+1) * sizeof(BezTriple), "addvert_Nurb"); (BezTriple*)MEM_callocN((nu->pntsu+1) * sizeof(BezTriple), "addvert_Nurb");
@@ -2665,7 +2641,7 @@ void addvert_Nurb(int mode)
nu->bezt= newbezt; nu->bezt= newbezt;
bezt= newbezt+1; bezt= newbezt+1;
} }
else if(bezt== (nu->bezt+nu->pntsu-1)) { /* laatste */ else if(bezt== (nu->bezt+nu->pntsu-1)) { /* last */
bezt->f1= bezt->f2= bezt->f3= 0; bezt->f1= bezt->f2= bezt->f3= 0;
newbezt = newbezt =
(BezTriple*)MEM_callocN((nu->pntsu+1) * sizeof(BezTriple), "addvert_Nurb"); (BezTriple*)MEM_callocN((nu->pntsu+1) * sizeof(BezTriple), "addvert_Nurb");
@@ -2706,8 +2682,8 @@ void addvert_Nurb(int mode)
} }
} }
else if(nu->pntsv==1) { else if(nu->pntsv==1) {
/* welk b-point? */ /* which b-point? */
if(bp== nu->bp) { /* eerste */ if(bp== nu->bp) { /* first */
bp->f1= 0; bp->f1= 0;
newbp = newbp =
(BPoint*)MEM_callocN((nu->pntsu+1) * sizeof(BPoint), "addvert_Nurb3"); (BPoint*)MEM_callocN((nu->pntsu+1) * sizeof(BPoint), "addvert_Nurb3");
@@ -2717,7 +2693,7 @@ void addvert_Nurb(int mode)
MEM_freeN(nu->bp); MEM_freeN(nu->bp);
nu->bp= newbp; nu->bp= newbp;
} }
else if(bp== (nu->bp+nu->pntsu-1)) { /* laatste */ else if(bp== (nu->bp+nu->pntsu-1)) { /* last */
bp->f1= 0; bp->f1= 0;
newbp = newbp =
(BPoint*)MEM_callocN((nu->pntsu+1) * sizeof(BPoint), "addvert_Nurb4"); (BPoint*)MEM_callocN((nu->pntsu+1) * sizeof(BPoint), "addvert_Nurb4");
@@ -2958,7 +2934,7 @@ void selectrow_nurb()
if(G.obedit==0 || G.obedit->type!=OB_SURF) return; if(G.obedit==0 || G.obedit->type!=OB_SURF) return;
if(lastselbp==0) return; if(lastselbp==0) return;
/* zoek de juiste nurb en toggle met u of v */ /* find the correct nurb and toggle with u of v */
nu= editNurb.first; nu= editNurb.first;
while(nu) { while(nu) {
bp= nu->bp; bp= nu->bp;
@@ -3037,7 +3013,7 @@ void delNurb()
} }
if(event==0) { if(event==0) {
/* eerste doorloop, kunnen hele stukken weg? */ /* first loop, can we remove entire pieces? */
nu= editNurb.first; nu= editNurb.first;
while(nu) { while(nu) {
next= nu->next; next= nu->next;
@@ -3075,7 +3051,7 @@ void delNurb()
} }
nu= next; nu= next;
} }
/* tweede doorloop, kleine stukken weg: alleen curves */ /* 2nd loop, delete small pieces: just for curves */
nu= editNurb.first; nu= editNurb.first;
while(nu) { while(nu) {
next= nu->next; next= nu->next;
@@ -3126,7 +3102,7 @@ void delNurb()
} }
} }
else if(event==1) { /* erase segment */ else if(event==1) { /* erase segment */
/* vind de twee geselecteerde punten */ /* find the 2 selected points */
bezt1= bezt2= 0; bezt1= bezt2= 0;
bp1= bp2= 0; bp1= bp2= 0;
nu= editNurb.first; nu= editNurb.first;
@@ -3140,7 +3116,7 @@ void delNurb()
bezt1= bezt; bezt1= bezt;
bezt2= bezt+1; bezt2= bezt+1;
if( (bezt2->f1 & 1) || (bezt2->f2 & 1) || (bezt2->f3 & 1) ) ; if( (bezt2->f1 & 1) || (bezt2->f2 & 1) || (bezt2->f3 & 1) ) ;
else { /* misschien niet cyclic maken */ else { /* maybe do not make cyclic */
if(a==0 && (nu->flagu & 1) ) { if(a==0 && (nu->flagu & 1) ) {
bezt2= bezt+(nu->pntsu-1); bezt2= bezt+(nu->pntsu-1);
if( (bezt2->f1 & 1) || (bezt2->f2 & 1) || (bezt2->f3 & 1) ) { if( (bezt2->f1 & 1) || (bezt2->f2 & 1) || (bezt2->f3 & 1) ) {
@@ -3165,7 +3141,7 @@ void delNurb()
bp1= bp; bp1= bp;
bp2= bp+1; bp2= bp+1;
if( bp2->f1 & 1 ) ; if( bp2->f1 & 1 ) ;
else { /* misschien niet cyclic maken */ else { /* maybe do not make cyclic */
if(a==0 && (nu->flagu & 1) ) { if(a==0 && (nu->flagu & 1) ) {
bp2= bp+(nu->pntsu-1); bp2= bp+(nu->pntsu-1);
if( bp2->f1 & 1 ) { if( bp2->f1 & 1 ) {
@@ -3189,7 +3165,7 @@ void delNurb()
} }
if(nu1) { if(nu1) {
if(bezt1) { if(bezt1) {
if(nu1->pntsu==2) { /* helemaal weg */ if(nu1->pntsu==2) { /* remove completely */
BLI_remlink(&editNurb, nu); BLI_remlink(&editNurb, nu);
freeNurb(nu); freeNurb(nu);
} }
@@ -3204,9 +3180,9 @@ void delNurb()
MEM_freeN(bezt); MEM_freeN(bezt);
calchandlesNurb(nu); calchandlesNurb(nu);
} }
else { /* nieuwe curve erbij */ else { /* add new curve */
/* hier zit een fout in... maar waar? (a kan nul worden) */ /* seems to be an error here... but where? (a can become zero) */
nu = nu =
(Nurb*)MEM_mallocN(sizeof(Nurb), "delNurb2"); (Nurb*)MEM_mallocN(sizeof(Nurb), "delNurb2");
@@ -3231,7 +3207,7 @@ void delNurb()
} }
} }
else if(bp1) { else if(bp1) {
if(nu1->pntsu==2) { /* helemaal weg */ if(nu1->pntsu==2) { /* remove completely */
BLI_remlink(&editNurb, nu); BLI_remlink(&editNurb, nu);
freeNurb(nu); freeNurb(nu);
} }
@@ -3245,7 +3221,7 @@ void delNurb()
nu1->flagu--; nu1->flagu--;
MEM_freeN(bp); MEM_freeN(bp);
} }
else { /* nieuwe curve erbij */ else { /* add new curve */
nu = (Nurb*)MEM_mallocN(sizeof(Nurb), "delNurb6"); nu = (Nurb*)MEM_mallocN(sizeof(Nurb), "delNurb6");
memcpy(nu, nu1, sizeof(Nurb)); memcpy(nu, nu1, sizeof(Nurb));
BLI_addtail(&editNurb, nu); BLI_addtail(&editNurb, nu);
@@ -3298,7 +3274,7 @@ void join_curve(int type)
} }
else if(okee("Join selected Curves")==0) return; else if(okee("Join selected Curves")==0) return;
/* alle geselecteerde curves invers transformen in obact */ /* trasnform all selected curves inverse in obact */
Mat4Invert(imat, ob->obmat); Mat4Invert(imat, ob->obmat);
base= FIRSTBASE; base= FIRSTBASE;
@@ -3311,7 +3287,7 @@ void join_curve(int type)
cu= base->object->data; cu= base->object->data;
if(cu->nurb.first) { if(cu->nurb.first) {
/* let op: matmul omkeren is ECHT fout */ /* watch it: switch order here really goes wrong */
Mat4MulMat4(cmat, base->object->obmat, imat); Mat4MulMat4(cmat, base->object->obmat, imat);
nu= cu->nurb.first; nu= cu->nurb.first;
@@ -3359,11 +3335,11 @@ void join_curve(int type)
Nurb *addNurbprim(int type, int stype, int newname) Nurb *addNurbprim(int type, int stype, int newname)
/* type: &8= 2D; 0=poly,1 bez, 4 nurb /* type: &8= 2D; 0=poly,1 bez, 4 nurb
* stype: 0: 2/4 punts curve * stype: 0: 2/4 points curve
* 1: 8 punts cirkel * 1: 8 points circle
* 2: 4x4 patch Nurb * 2: 4x4 patch Nurb
* 3: tube 4:sphere 5:donut * 3: tube 4:sphere 5:donut
* 6: 5 punts, 5e order rechte lijn (pad) alleen nurbspline! * 6: 5 points, 5th order straight line (for anim path)
*/ */
{ {
static int xzproj= 0; static int xzproj= 0;
@@ -3374,7 +3350,7 @@ Nurb *addNurbprim(int type, int stype, int newname)
float fac,cmat[3][3]; float fac,cmat[3][3];
int a, b; int a, b;
/* imat en centrum en afmeting */ /* imat and centre and size */
if(G.obedit) { if(G.obedit) {
Mat3CpyMat4(mat, G.obedit->obmat); Mat3CpyMat4(mat, G.obedit->obmat);
@@ -3467,13 +3443,13 @@ Nurb *addNurbprim(int type, int stype, int newname)
for(a=0;a<4;a++, bp++) Mat3MulVecfl(imat,bp->vec); for(a=0;a<4;a++, bp++) Mat3MulVecfl(imat,bp->vec);
if((type & 7)==4) { if((type & 7)==4) {
nu->knotsu= 0; /* makeknots alloceert */ nu->knotsu= 0; /* makeknots allocates */
makeknots(nu, 1, nu->flagu>>1); makeknots(nu, 1, nu->flagu>>1);
} }
} }
break; break;
case 6: /* 5 punts pad */ case 6: /* 5 point pad */
nu->pntsu= 5; nu->pntsu= 5;
nu->pntsv= 1; nu->pntsv= 1;
nu->orderu= 5; nu->orderu= 5;
@@ -3501,12 +3477,12 @@ Nurb *addNurbprim(int type, int stype, int newname)
for(a=0;a<5;a++, bp++) Mat3MulVecfl(imat,bp->vec); for(a=0;a<5;a++, bp++) Mat3MulVecfl(imat,bp->vec);
if((type & 7)==4) { if((type & 7)==4) {
nu->knotsu= 0; /* makeknots alloceert */ nu->knotsu= 0; /* makeknots allocates */
makeknots(nu, 1, nu->flagu>>1); makeknots(nu, 1, nu->flagu>>1);
} }
break; break;
case 1: /* cirkel */ case 1: /* circle */
if(newname) { if(newname) {
rename_id((ID *)G.obedit, "CurveCircle"); rename_id((ID *)G.obedit, "CurveCircle");
rename_id((ID *)G.obedit->data, "CurveCircle"); rename_id((ID *)G.obedit->data, "CurveCircle");
@@ -3628,10 +3604,10 @@ Nurb *addNurbprim(int type, int stype, int newname)
rename_id((ID *)G.obedit->data, "SurfTube"); rename_id((ID *)G.obedit->data, "SurfTube");
} }
nu= addNurbprim(4, 1, 0); /* cirkel */ nu= addNurbprim(4, 1, 0); /* circle */
nu->resolu= 32; nu->resolu= 32;
nu->flag= ME_SMOOTH; nu->flag= ME_SMOOTH;
BLI_addtail(&editNurb, nu); /* tijdelijk voor extrude en translate */ BLI_addtail(&editNurb, nu); /* temporal for extrude and translate */
vec[0]=vec[1]= 0.0; vec[0]=vec[1]= 0.0;
vec[2]= -G.vd->grid; vec[2]= -G.vd->grid;
Mat3MulVecfl(imat, vec); Mat3MulVecfl(imat, vec);
@@ -3682,7 +3658,7 @@ Nurb *addNurbprim(int type, int stype, int newname)
nu->flagu= 4; nu->flagu= 4;
makeknots(nu, 1, nu->flagu>>1); makeknots(nu, 1, nu->flagu>>1);
BLI_addtail(&editNurb, nu); /* tijdelijk voor spin */ BLI_addtail(&editNurb, nu); /* temporal for spin */
spinNurb(0, 0); spinNurb(0, 0);
makeknots(nu, 2, nu->flagv>>1); makeknots(nu, 2, nu->flagv>>1);
@@ -3704,12 +3680,12 @@ Nurb *addNurbprim(int type, int stype, int newname)
} }
xzproj= 1; xzproj= 1;
nu= addNurbprim(4, 1, 0); /* cirkel */ nu= addNurbprim(4, 1, 0); /* circle */
xzproj= 0; xzproj= 0;
nu->resolu= 24; nu->resolu= 24;
nu->resolv= 32; nu->resolv= 32;
nu->flag= ME_SMOOTH; nu->flag= ME_SMOOTH;
BLI_addtail(&editNurb, nu); /* tijdelijk voor extrude en translate */ BLI_addtail(&editNurb, nu); /* temporal for extrude and translate */
spinNurb(0, 0); spinNurb(0, 0);
BLI_remlink(&editNurb, nu); BLI_remlink(&editNurb, nu);
@@ -3725,7 +3701,7 @@ Nurb *addNurbprim(int type, int stype, int newname)
break; break;
} }
/* altijd doen: */ /* always do: */
nu->flag= ME_SMOOTH; nu->flag= ME_SMOOTH;
test2DNurb(nu); test2DNurb(nu);
@@ -3790,7 +3766,7 @@ void add_primitiveCurve(int stype)
check_editmode(OB_CURVE); check_editmode(OB_CURVE);
/* als geen obedit: nieuw object en in editmode gaan */ /* if no obedit: new object and enter editmode */
if(G.obedit==0) { if(G.obedit==0) {
add_object(OB_CURVE); add_object(OB_CURVE);
base_init_from_view3d(BASACT, G.vd); base_init_from_view3d(BASACT, G.vd);
@@ -3836,7 +3812,7 @@ void add_primitiveNurb(int type)
check_editmode(OB_SURF); check_editmode(OB_SURF);
/* als geen obedit: nieuw object en in editmode gaan */ /* if no obedit: new object and enter editmode */
if(G.obedit==0) { if(G.obedit==0) {
add_object(OB_SURF); add_object(OB_SURF);
base_init_from_view3d(BASACT, G.vd); base_init_from_view3d(BASACT, G.vd);