phew... a whole bunch of old and nasty files translated, including the

central mesh editing one.
This commit is contained in:
2003-04-29 15:30:59 +00:00
parent a4f2249497
commit ceb3e8cc2a
11 changed files with 622 additions and 801 deletions

View File

@@ -269,7 +269,7 @@ void select_linked_tfaces()
while(doit) { while(doit) {
doit= 0; doit= 0;
/* select connected: array vullen */ /* select connected: fill array */
tface= me->tface; tface= me->tface;
mface= me->mface; mface= me->mface;
a= me->totface; a= me->totface;
@@ -286,7 +286,7 @@ void select_linked_tfaces()
tface++; mface++; tface++; mface++;
} }
/* omgekeerd: vanuit array vlakken selecteren */ /* reverse: using array select the faces */
tface= me->tface; tface= me->tface;
mface= me->mface; mface= me->mface;

View File

@@ -1,4 +1,10 @@
/** /**
* ------------------------------------------------------------
* This is the old 'Ika' system of Blender (until 2.14)
* it should be removed entirely from the tree, so I'll also leave comments
* not translated... (ton)
* ------------------------------------------------------------
*
* $Id$ * $Id$
* *
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****

View File

@@ -262,7 +262,7 @@ void winqreadimaselspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
case MOUSEX: case MOUSEX:
case MOUSEY: case MOUSEY:
getmouseco_areawin(mval); /* lokaal screen */ getmouseco_areawin(mval); /* local screen coordinates */
calc_hilite(simasel); calc_hilite(simasel);
if (simasel->mouse_move_redraw ){ if (simasel->mouse_move_redraw ){
simasel->mouse_move_redraw = 0; simasel->mouse_move_redraw = 0;

View File

@@ -30,6 +30,15 @@
* ***** END GPL/BL DUAL LICENSE BLOCK ***** * ***** END GPL/BL DUAL LICENSE BLOCK *****
*/ */
/* this code feels over-complex, mostly because I choose in the past to devise a system
that converts the Ipo blocks (linked to Object, Material, etc), into a copy of that
data which is being worked on; the 'editipo'.
The editipo then can have 'ipokey' data, which is optimized for editing curves as if
it were key positions. This is still a great feature to work with, which makes ipo editing
in Blender still valuable. However, getting this beast under control was hard, even
for me... (ton) */
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
@@ -554,7 +563,7 @@ void editipo_changed(SpaceIpo *si, int doredraw)
if(ei->icu) { if(ei->icu) {
/* 2 keer i.v.m. ittereren nieuwe autohandle */ /* twice because of ittererating new autohandle */
calchandles_ipocurve(ei->icu); calchandles_ipocurve(ei->icu);
calchandles_ipocurve(ei->icu); calchandles_ipocurve(ei->icu);
@@ -572,9 +581,8 @@ void editipo_changed(SpaceIpo *si, int doredraw)
} }
v2d= &(si->v2d); v2d= &(si->v2d);
// v2d = &G.v2d;
/* keylijnen? */ /* keylines? */
if(si->blocktype==ID_KE) { if(si->blocktype==ID_KE) {
key= (Key *)si->from; key= (Key *)si->from;
if(key && key->block.first) { if(key && key->block.first) {
@@ -586,7 +594,7 @@ void editipo_changed(SpaceIpo *si, int doredraw)
} }
/* is er geen curve? */ /* is there no curve? */
if(first) { if(first) {
v2d->tot.xmin= 0.0; v2d->tot.xmin= 0.0;
v2d->tot.xmax= EFRA; v2d->tot.xmax= EFRA;
@@ -604,13 +612,12 @@ void editipo_changed(SpaceIpo *si, int doredraw)
si->tot= v2d->tot; si->tot= v2d->tot;
if(doredraw) { if(doredraw) {
/* als do_ipo altijd wordt aangeroepen: problemen met insertkey, bijvoorbeeld /* if you always call do_ipo: you get problems with insertkey, for example
* als alleen een 'loc' wordt ge-insert wordt de 'ob->rot' veranderd. * when inserting only a 'loc' the 'ob->rot' value then is changed.
*/ */
if(si->blocktype==ID_OB) { if(si->blocktype==ID_OB) {
/* clear delta loc,rot,size (bij ipo vrijgeven/deleten) */ /* clear delta loc,rot,size (when free/delete ipo) */
clear_delta_obipo(si->ipo); clear_delta_obipo(si->ipo);
} }
@@ -658,7 +665,7 @@ void editipo_changed(SpaceIpo *si, int doredraw)
void scale_editipo() void scale_editipo()
{ {
/* komt uit buttons, scale met G.sipo->tot rect */ /* comes from buttons, scale with G.sipo->tot rect */
EditIpo *ei; EditIpo *ei;
BezTriple *bezt; BezTriple *bezt;
@@ -801,7 +808,7 @@ unsigned int ipo_rainbow(int cur, int tot)
dfac= (float)(1.0/( (float)tot+1.0)); dfac= (float)(1.0/( (float)tot+1.0));
/* deze berekening zorgt voor twee verschillende cycles regenboogkleuren */ /* this calculation makes 2 different cycles of rainbow colors */
if(cur< tot/2) fac= (float)(cur*2.0*dfac); if(cur< tot/2) fac= (float)(cur*2.0*dfac);
else fac= (float)((cur-tot/2)*2.0*dfac +dfac); else fac= (float)((cur-tot/2)*2.0*dfac +dfac);
@@ -973,7 +980,6 @@ void make_mat_editipo(SpaceIpo *si)
ei->adrcode |= texchannel_to_adrcode(si->channel); ei->adrcode |= texchannel_to_adrcode(si->channel);
} }
else { else {
/* dit was weggecommentaard. Waarom? */
if(ei->adrcode==MA_MODE) ei->disptype= IPO_DISPBITS; if(ei->adrcode==MA_MODE) ei->disptype= IPO_DISPBITS;
} }
@@ -1246,7 +1252,7 @@ void make_editipo()
if(G.sipo->editipo==0) return; if(G.sipo->editipo==0) return;
/* rowbut voor VISIBLE select */ /* rowbut for VISIBLE select */
G.sipo->rowbut= 0; G.sipo->rowbut= 0;
ei= G.sipo->editipo; ei= G.sipo->editipo;
for(a=0; a<G.sipo->totipo; a++, ei++) { for(a=0; a<G.sipo->totipo; a++, ei++) {
@@ -1357,7 +1363,7 @@ void get_status_editipo()
if(ei->flag & IPO_SELECT) totipo_sel++; if(ei->flag & IPO_SELECT) totipo_sel++;
if(G.sipo->showkey || (ei->flag & IPO_EDIT)) { if(G.sipo->showkey || (ei->flag & IPO_EDIT)) {
/* als showkey: wel de vertices tellen (voor grab) */ /* if showkey: do count the vertices (for grab) */
if(G.sipo->showkey==0) totipo_edit++; if(G.sipo->showkey==0) totipo_edit++;
if(ei->icu) { if(ei->icu) {
@@ -1439,7 +1445,7 @@ void set_editflag_editipo()
EditIpo *ei; EditIpo *ei;
int a; /* , tot= 0, ok= 0; */ int a; /* , tot= 0, ok= 0; */
/* van showkey direkt door naar editen geselecteerde punten */ /* after showkey immediately go to editing of selected points */
if(G.sipo->showkey) { if(G.sipo->showkey) {
G.sipo->showkey= 0; G.sipo->showkey= 0;
if(G.sipo->ipo) G.sipo->ipo->showkey= 0; if(G.sipo->ipo) G.sipo->ipo->showkey= 0;
@@ -1646,8 +1652,8 @@ void deselectall_editipo()
short findnearest_ipovert(IpoCurve **icu, BezTriple **bezt) short findnearest_ipovert(IpoCurve **icu, BezTriple **bezt)
{ {
/* selected krijgen een nadeel */ /* selected verts get a disadvantage */
/* in icu en (bezt of bp) wordt nearest weggeschreven */ /* in icu and (bezt or bp) the nearest is written */
/* return 0 1 2: handlepunt */ /* return 0 1 2: handlepunt */
EditIpo *ei; EditIpo *ei;
BezTriple *bezt1; BezTriple *bezt1;
@@ -1686,7 +1692,7 @@ short findnearest_ipovert(IpoCurve **icu, BezTriple **bezt)
} }
if(ei->disptype!=IPO_DISPBITS && ei->icu->ipo==IPO_BEZ) { if(ei->disptype!=IPO_DISPBITS && ei->icu->ipo==IPO_BEZ) {
/* middelste punten een klein voordeel */ /* middle points get an advantage */
temp= -3+abs(mval[0]- bezt1->s[0][0])+ abs(mval[1]- bezt1->s[0][1]); temp= -3+abs(mval[0]- bezt1->s[0][0])+ abs(mval[1]- bezt1->s[0][1]);
if( bezt1->f1 & 1) temp+=5; if( bezt1->f1 & 1) temp+=5;
if(temp<dist) { if(temp<dist) {
@@ -1788,13 +1794,13 @@ void do_ipo_selectbuttons()
if(G.sipo->showkey) return; if(G.sipo->showkey) return;
/* geen editipo toestaan: editipo's naar selected omzetten */ /* do not allow editipo here: convert editipos to selected */
get_status_editipo(); get_status_editipo();
if(totipo_edit) { if(totipo_edit) {
set_editflag_editipo(); set_editflag_editipo();
} }
/* welke */ /* which */
getmouseco_areawin(mval); getmouseco_areawin(mval);
nr= -(mval[1]-curarea->winy+30-G.sipo->butofs-IPOBUTY)/IPOBUTY; nr= -(mval[1]-curarea->winy+30-G.sipo->butofs-IPOBUTY)/IPOBUTY;
@@ -1970,8 +1976,8 @@ IpoCurve *get_ipocurve(ID *from, short type, int adrcode, Ipo *useipo)
Ipo *ipo= 0; Ipo *ipo= 0;
IpoCurve *icu=0; IpoCurve *icu=0;
/* return 0 als lib */ /* return 0 if lib */
/* ook testen of ipo en ipocurve bestaan */ /* also test if ipo and ipocurve exist */
if (useipo==NULL) { if (useipo==NULL) {
@@ -2036,7 +2042,7 @@ void insert_vert_ipo(IpoCurve *icu, float x, float y)
icu->totvert= 1; icu->totvert= 1;
} }
else { else {
/* alle vertices deselect */ /* all vertices deselect */
for(a=0; a<icu->totvert; a++, bezt++) { for(a=0; a<icu->totvert; a++, bezt++) {
bezt->f1= bezt->f2= bezt->f3= 0; bezt->f1= bezt->f2= bezt->f3= 0;
} }
@@ -2044,7 +2050,7 @@ void insert_vert_ipo(IpoCurve *icu, float x, float y)
bezt= icu->bezt; bezt= icu->bezt;
for(a=0; a<=icu->totvert; a++, bezt++) { for(a=0; a<=icu->totvert; a++, bezt++) {
/* geen dubbele punten */ /* no double points */
if(a<icu->totvert && (bezt->vec[1][0]>x-IPOTHRESH && bezt->vec[1][0]<x+IPOTHRESH)) { if(a<icu->totvert && (bezt->vec[1][0]>x-IPOTHRESH && bezt->vec[1][0]<x+IPOTHRESH)) {
*(bezt)= beztr; *(bezt)= beztr;
break; break;
@@ -2071,7 +2077,7 @@ void insert_vert_ipo(IpoCurve *icu, float x, float y)
calchandles_ipocurve(icu); calchandles_ipocurve(icu);
/* handletype goedzetten */ /* set handletype */
if(icu->totvert>2) { if(icu->totvert>2) {
h1= h2= HD_AUTO; h1= h2= HD_AUTO;
if(a>0) h1= (bezt-1)->h2; if(a>0) h1= (bezt-1)->h2;
@@ -2120,7 +2126,7 @@ void add_vert_ipo()
insert_vert_ipo(ei->icu, x, y); insert_vert_ipo(ei->icu, x, y);
/* voor zekerheid: als icu 0 was, of maar 1 curve visible */ /* to be sure: if icu was 0, or only 1 curve visible */
ei->flag |= IPO_SELECT; ei->flag |= IPO_SELECT;
ei->icu->flag= ei->flag; ei->icu->flag= ei->flag;
@@ -2144,7 +2150,7 @@ void add_duplicate_editipo()
if(G.sipo->showkey || (ei->flag & IPO_EDIT)) { if(G.sipo->showkey || (ei->flag & IPO_EDIT)) {
icu= ei->icu; icu= ei->icu;
/* hoeveel punten */ /* how many points */
tot= 0; tot= 0;
b= icu->totvert; b= icu->totvert;
bezt= icu->bezt; bezt= icu->bezt;
@@ -2199,7 +2205,7 @@ void remove_doubles_ipo()
for(a=0; a<G.sipo->totipo; a++, ei++) { for(a=0; a<G.sipo->totipo; a++, ei++) {
if ISPOIN3(ei, flag & IPO_VISIBLE, icu, icu->bezt) { if ISPOIN3(ei, flag & IPO_VISIBLE, icu, icu->bezt) {
/* OF de curve is selected OF in editmode OF in keymode */ /* OR the curve is selected OR in editmode OR in keymode */
mode= 0; mode= 0;
if(G.sipo->showkey || (ei->flag & IPO_EDIT)) mode= 1; if(G.sipo->showkey || (ei->flag & IPO_EDIT)) mode= 1;
else if(ei->flag & IPO_SELECT) mode= 2; else if(ei->flag & IPO_SELECT) mode= 2;
@@ -2212,16 +2218,16 @@ void remove_doubles_ipo()
bezt++; bezt++;
while(b--) { while(b--) {
/* mag er verwijderd worden? */ /* can we remove? */
if(mode==2 || (bezt->f2 & 1)) { if(mode==2 || (bezt->f2 & 1)) {
/* verschillen de punten? */ /* are the points different? */
if( fabs( bezt->vec[1][0]-newb->vec[1][0] ) > 0.9 ) { if( fabs( bezt->vec[1][0]-newb->vec[1][0] ) > 0.9 ) {
newb++; newb++;
*newb= *bezt; *newb= *bezt;
} }
else { else {
/* gemiddelde */ /* median */
VecMidf(newb->vec[0], newb->vec[0], bezt->vec[0]); VecMidf(newb->vec[0], newb->vec[0], bezt->vec[0]);
VecMidf(newb->vec[1], newb->vec[1], bezt->vec[1]); VecMidf(newb->vec[1], newb->vec[1], bezt->vec[1]);
VecMidf(newb->vec[2], newb->vec[2], bezt->vec[2]); VecMidf(newb->vec[2], newb->vec[2], bezt->vec[2]);
@@ -2247,9 +2253,9 @@ void remove_doubles_ipo()
} }
} }
editipo_changed(G.sipo, 1); /* maakt ook ipokeys opnieuw! */ editipo_changed(G.sipo, 1); /* makes ipokeys again! */
/* dubbele keys weg */ /* remove double keys */
if(G.sipo->showkey) { if(G.sipo->showkey) {
ik= G.sipo->ipokey.first; ik= G.sipo->ipokey.first;
ikn= ik->next; ikn= ik->next;
@@ -2270,7 +2276,7 @@ void remove_doubles_ipo()
} }
editipo_changed(G.sipo, 1); /* maakt ook ipokeys opnieuw! */ editipo_changed(G.sipo, 1); /* makes ipokeys agian! */
} }
deselectall_editipo(); deselectall_editipo();
@@ -2294,14 +2300,14 @@ void join_ipo()
} }
else if(mode!=1) return; else if(mode!=1) return;
/* eerst: meerdere geselecteerde verts in 1 curve */ /* first: multiple selected verts in 1 curve */
ei= G.sipo->editipo; ei= G.sipo->editipo;
for(a=0; a<G.sipo->totipo; a++, ei++) { for(a=0; a<G.sipo->totipo; a++, ei++) {
if ISPOIN3(ei, flag & IPO_VISIBLE, icu, icu->bezt) { if ISPOIN3(ei, flag & IPO_VISIBLE, icu, icu->bezt) {
if(G.sipo->showkey || (ei->flag & IPO_EDIT)) { if(G.sipo->showkey || (ei->flag & IPO_EDIT)) {
icu= ei->icu; icu= ei->icu;
/* hoeveel punten */ /* how many points */
tot= 0; tot= 0;
b= icu->totvert; b= icu->totvert;
bezt= icu->bezt; bezt= icu->bezt;
@@ -2315,7 +2321,7 @@ void join_ipo()
icu->totvert-= tot; icu->totvert-= tot;
newb= MEM_mallocN(icu->totvert*sizeof(BezTriple), "bezt"); newb= MEM_mallocN(icu->totvert*sizeof(BezTriple), "bezt");
/* het eerste punt wordt het nieuwe punt */ /* the first point is the new one */
beztn= newb+1; beztn= newb+1;
tot= 0; tot= 0;
@@ -2353,9 +2359,9 @@ void join_ipo()
} }
} }
/* dan: in keymode: meerdere geselecteerde keys samenvoegen */ /* next: in keymode: join multiple selected keys */
editipo_changed(G.sipo, 1); /* maakt ook ipokeys opnieuw! */ editipo_changed(G.sipo, 1); /* makes ipokeys again! */
if(G.sipo->showkey) { if(G.sipo->showkey) {
ik= G.sipo->ipokey.first; ik= G.sipo->ipokey.first;
@@ -2572,7 +2578,7 @@ void mouse_select_ipo()
getmouseco_areawin(mval); getmouseco_areawin(mval);
areamouseco_to_ipoco(G.v2d, mval, &x, &y); areamouseco_to_ipoco(G.v2d, mval, &x, &y);
/* hoeveel is 20 pixels? */ /* how much is 20 pixels? */
mindist= (float)(20.0*(G.v2d->cur.ymax-G.v2d->cur.ymin)/(float)curarea->winy); mindist= (float)(20.0*(G.v2d->cur.ymax-G.v2d->cur.ymin)/(float)curarea->winy);
kb= key->block.first; kb= key->block.first;
@@ -2591,25 +2597,12 @@ void mouse_select_ipo()
ok= okee("Copy Key after leaving EditMode"); ok= okee("Copy Key after leaving EditMode");
} }
if(ok) { if(ok) {
/* doet ook alle keypos */ /* also does all keypos */
deselectall_editipo(); deselectall_editipo();
/* oldflag= actkb->flag; */ actkb->flag |= 1;
/* if(G.qual & LR_SHIFTKEY); */ /* calc keypos */
/* else { */
/* deselectall_key(); */
/* } */
/* if(G.qual & LR_SHIFTKEY) { */
/* if(oldflag & 1) actkb->flag &= ~1; */
/* else actkb->flag |= 1; */
/* } */
/* else { */
actkb->flag |= 1;
/* } */
/* bereken keypos */
showkeypos((Key *)G.sipo->from, actkb); showkeypos((Key *)G.sipo->from, actkb);
} }
} }
@@ -2795,6 +2788,7 @@ int selected_bezier_loop(int (*looptest)(EditIpo *),
ipocurve_function(ei->icu); ipocurve_function(ei->icu);
} }
/* nufte flourdje zim ploopydu <-- random dutch looking comment ;) */ /* nufte flourdje zim ploopydu <-- random dutch looking comment ;) */
/* looks more like russian to me! (ton) */
} }
return 0; return 0;
@@ -3330,7 +3324,7 @@ void paste_editipo()
error("Incompatible paste"); error("Incompatible paste");
} }
else { else {
/* problemen voorkomen: andere splines visible dan select */ /* prevent problems: splines visible that are not selected */
if(totipo_vis==totipo_sel) totipo_vis= 0; if(totipo_vis==totipo_sel) totipo_vis= 0;
icu= ipocopybuf.first; icu= ipocopybuf.first;
@@ -3376,7 +3370,7 @@ void set_exprap_ipo(int mode)
int a; int a;
if(G.sipo->ipo && G.sipo->ipo->id.lib) return; if(G.sipo->ipo && G.sipo->ipo->id.lib) return;
/* in geval van keys: altijd ok */ /* in case of keys: always ok */
ei= G.sipo->editipo; ei= G.sipo->editipo;
for(a=0; a<G.sipo->totipo; a++, ei++) { for(a=0; a<G.sipo->totipo; a++, ei++) {
@@ -3425,7 +3419,7 @@ void set_speed_editipo(float speed)
if(G.sipo->ipo && G.sipo->ipo->id.lib) return; if(G.sipo->ipo && G.sipo->ipo->id.lib) return;
/* uitgaande van 1 visible curve, selected punt, bijhorende punten: lencorr! */ /* starting with 1 visible curve, selected point, associated points: do lencorr! */
ei= G.sipo->editipo; ei= G.sipo->editipo;
for(a=0; a<G.sipo->totipo; a++, ei++) { for(a=0; a<G.sipo->totipo; a++, ei++) {
@@ -3514,7 +3508,7 @@ void insertkey(ID *id, int adrcode)
if( GS(id->name)==ID_OB ) { if( GS(id->name)==ID_OB ) {
ob= (Object *)id; ob= (Object *)id;
if(ob->sf!=0.0 && (ob->ipoflag & OB_OFFS_OB) ) { if(ob->sf!=0.0 && (ob->ipoflag & OB_OFFS_OB) ) {
/* eigenlijk frametofloat overniew berekenen! daarvoor CFRA als float door kunnen geven */ /* actually frametofloat calc again! */
cfra-= ob->sf*G.scene->r.framelen; cfra-= ob->sf*G.scene->r.framelen;
} }
} }
@@ -3550,7 +3544,7 @@ void insertkey_editipo()
else if(ei->flag & IPO_SELECT) ok= 1; else if(ei->flag & IPO_SELECT) ok= 1;
if(ok) { if(ok) {
/* aantal tellen */ /* count amount */
if(event==1) tot= 1; if(event==1) tot= 1;
else { else {
ik= G.sipo->ipokey.first; ik= G.sipo->ipokey.first;
@@ -3562,7 +3556,7 @@ void insertkey_editipo()
} }
if(tot) { if(tot) {
/* correctie voor ob timeoffs */ /* correction for ob timeoffs */
cfra= frame_to_float(CFRA); cfra= frame_to_float(CFRA);
id= G.sipo->from; id= G.sipo->from;
if(id && GS(id->name)==ID_OB ) { if(id && GS(id->name)==ID_OB ) {
@@ -3580,7 +3574,7 @@ void insertkey_editipo()
} }
insertvals= MEM_mallocN(sizeof(float)*2*tot, "insertkey_editipo"); insertvals= MEM_mallocN(sizeof(float)*2*tot, "insertkey_editipo");
/* zeker zijn dat icu->curval klopt */ /* make sure icu->curval is correct */
calc_ipo(G.sipo->ipo, cfra); calc_ipo(G.sipo->ipo, cfra);
if(event==1) { if(event==1) {
@@ -3939,7 +3933,7 @@ void common_insertkey()
if TESTBASELIB(base) { if TESTBASELIB(base) {
id= (ID *)(base->object); id= (ID *)(base->object);
/* alle curves in ipo deselect */ /* all curves in ipo deselect */
if(base->object->ipo) { if(base->object->ipo) {
icu= base->object->ipo->curve.first; icu= base->object->ipo->curve.first;
while(icu) { while(icu) {
@@ -3965,14 +3959,14 @@ void common_insertkey()
insertkey(id, OB_SIZE_Z); insertkey(id, OB_SIZE_Z);
} }
if(event==5) { if(event==5) {
/* localview weghalen */ /* remove localview */
tlay= base->object->lay; tlay= base->object->lay;
base->object->lay &= 0xFFFFFF; base->object->lay &= 0xFFFFFF;
insertkey(id, OB_LAY); insertkey(id, OB_LAY);
base->object->lay= tlay; base->object->lay= tlay;
} }
if(event==8) { if(event==8) {
/* deze patch moet omdat duplicators de positie van effg veranderen */ /* a patch, can be removed (old ika) */
Ika *ika= ob->data; Ika *ika= ob->data;
VecMat4MulVecfl(ika->effg, ob->obmat, ika->effn); VecMat4MulVecfl(ika->effg, ob->obmat, ika->effn);
@@ -3998,10 +3992,10 @@ void common_insertkey()
/* IPOKEY: /* IPOKEY:
* *
* er zijn drie manieren om hiermee om te gaan: * there are three ways to use this system:
* 1. hieronder: voor tekenen en editen in Ipo window * 1. below: for drawing and editing in Ipo window
* 2. voor tekenen keys in View3D (zie ipo.c en drawobject.c) * 2. for drawing key positions in View3D (see ipo.c and drawobject.c)
* 3. voor editen keys in View3D (hieronder en editobject.c) * 3. editing keys in View3D (below and in editobject.c)
* *
*/ */
@@ -4027,7 +4021,7 @@ void add_to_ipokey(ListBase *lb, BezTriple *bezt, int nr, int len)
while(ik) { while(ik) {
if( ik->val==bezt->vec[1][0] ) { if( ik->val==bezt->vec[1][0] ) {
if(ik->data[nr]==0) { /* dubbele punten! */ if(ik->data[nr]==0) { /* double points! */
ik->data[nr]= bezt; ik->data[nr]= bezt;
if(bezt->f2 & 1) ik->flag= 1; if(bezt->f2 & 1) ik->flag= 1;
return; return;
@@ -4077,7 +4071,7 @@ void make_ipokey(void)
} }
} }
/* selectflags testen */ /* test selectflags */
ik= lb->first; ik= lb->first;
while(ik) { while(ik) {
sel= desel= 0; sel= desel= 0;
@@ -4121,7 +4115,7 @@ void make_ipokey_transform(Object *ob, ListBase *lb, int sel)
if(ob->ipo==0) return; if(ob->ipo==0) return;
if(ob->ipo->showkey==0) return; if(ob->ipo->showkey==0) return;
/* testen: zijn er delta curves? */ /* test: are there delta curves? */
icu= ob->ipo->curve.first; icu= ob->ipo->curve.first;
while(icu) { while(icu) {
if(icu->flag & IPO_VISIBLE) { if(icu->flag & IPO_VISIBLE) {
@@ -4202,7 +4196,7 @@ void make_ipokey_transform(Object *ob, ListBase *lb, int sel)
} }
} }
void update_ipokey_val() /* na verplaatsen vertices */ void update_ipokey_val() /* after moving vertices */
{ {
IpoKey *ik; IpoKey *ik;
int a; int a;
@@ -4276,17 +4270,17 @@ void set_ipo_pointers_transob(IpoKey *ik, TransOb *tob)
} }
} }
/* oldvals voor o.a. undo */ /* oldvals for e.g. undo */
if(tob->locx) set_tob_old(tob->oldloc, tob->locx); if(tob->locx) set_tob_old(tob->oldloc, tob->locx);
if(tob->locy) set_tob_old(tob->oldloc+1, tob->locy); if(tob->locy) set_tob_old(tob->oldloc+1, tob->locy);
if(tob->locz) set_tob_old(tob->oldloc+2, tob->locz); if(tob->locz) set_tob_old(tob->oldloc+2, tob->locz);
/* bewaar de eerste oldrot, ivm mapping curves ('1'=10 graden) en correcte berekening */ /* store first oldrot, for mapping curves ('1'=10 degrees) and correct calculation */
if(tob->rotx) set_tob_old(tob->oldrot+3, tob->rotx); if(tob->rotx) set_tob_old(tob->oldrot+3, tob->rotx);
if(tob->roty) set_tob_old(tob->oldrot+4, tob->roty); if(tob->roty) set_tob_old(tob->oldrot+4, tob->roty);
if(tob->rotz) set_tob_old(tob->oldrot+5, tob->rotz); if(tob->rotz) set_tob_old(tob->oldrot+5, tob->rotz);
/* bewaar de eerste oldsize, dit mag niet de dsize zijn! */ /* store the first oldsize, this is not allowed to be dsize! */
if(tob->sizex) set_tob_old(tob->oldsize+3, tob->sizex); if(tob->sizex) set_tob_old(tob->oldsize+3, tob->sizex);
if(tob->sizey) set_tob_old(tob->oldsize+4, tob->sizey); if(tob->sizey) set_tob_old(tob->oldsize+4, tob->sizey);
if(tob->sizez) set_tob_old(tob->oldsize+5, tob->sizez); if(tob->sizez) set_tob_old(tob->oldsize+5, tob->sizez);
@@ -4326,7 +4320,7 @@ void nextkey(ListBase *elems, int dir)
else if(ik==0) previk->flag= 0; else if(ik==0) previk->flag= 0;
} }
/* als geen een key select: */ /* when no key select: */
if(totsel==0) { if(totsel==0) {
if(dir==1) ik= elems->first; if(dir==1) ik= elems->first;
else ik= elems->last; else ik= elems->last;
@@ -4344,7 +4338,7 @@ static int float_to_frame (float frame)
return to; return to;
} }
void movekey_ipo(int dir) /* alleen extern aanroepen vanuit view3d queue */ void movekey_ipo(int dir) /* only call external from view3d queue */
{ {
IpoKey *ik; IpoKey *ik;
float toframe = 0.0; float toframe = 0.0;
@@ -4381,7 +4375,7 @@ void movekey_ipo(int dir) /* alleen extern aanroepen vanuit view3d queue */
} }
void movekey_obipo(int dir) /* alleen extern aanroepen vanuit view3d queue */ void movekey_obipo(int dir) /* only call external from view3d queue */
{ {
Base *base; Base *base;
Object *ob; Object *ob;
@@ -4436,7 +4430,7 @@ void movekey_obipo(int dir) /* alleen extern aanroepen vanuit view3d queue */
} }
void nextkey_ipo(int dir) /* aanroepen vanuit ipo queue */ void nextkey_ipo(int dir) /* call from ipo queue */
{ {
IpoKey *ik; IpoKey *ik;
int a; int a;
@@ -4445,7 +4439,7 @@ void nextkey_ipo(int dir) /* aanroepen vanuit ipo queue */
nextkey(&G.sipo->ipokey, dir); nextkey(&G.sipo->ipokey, dir);
/* kopieeren naar beziers */ /* copy to beziers */
ik= G.sipo->ipokey.first; ik= G.sipo->ipokey.first;
while(ik) { while(ik) {
for(a=0; a<G.sipo->totipo; a++) { for(a=0; a<G.sipo->totipo; a++) {
@@ -4460,7 +4454,7 @@ void nextkey_ipo(int dir) /* aanroepen vanuit ipo queue */
if(G.sipo->blocktype == ID_OB) allqueue(REDRAWVIEW3D, 0); if(G.sipo->blocktype == ID_OB) allqueue(REDRAWVIEW3D, 0);
} }
void nextkey_obipo(int dir) /* alleen extern aanroepen vanuit view3d queue */ void nextkey_obipo(int dir) /* only call external from view3d queue */
{ {
Base *base; Base *base;
Object *ob; Object *ob;
@@ -4482,7 +4476,7 @@ void nextkey_obipo(int dir) /* alleen extern aanroepen vanuit view3d queue */
nextkey(&elems, dir); nextkey(&elems, dir);
/* kopieeren naar beziers */ /* copy to beziers */
ik= elems.first; ik= elems.first;
while(ik) { while(ik) {
for(a=0; a<OB_TOTIPO; a++) { for(a=0; a<OB_TOTIPO; a++) {
@@ -4584,11 +4578,11 @@ void transform_ipo(int mode)
if(G.sipo->ipo && G.sipo->ipo->id.lib) return; if(G.sipo->ipo && G.sipo->ipo->id.lib) return;
if(G.sipo->editipo==0) return; if(G.sipo->editipo==0) return;
if(mode=='r') return; /* vanuit gesture */ if(mode=='r') return; /* from gesture */
INIT_MINMAX(min, max); INIT_MINMAX(min, max);
/* welke vertices doen mee */ /* which vertices are involved */
get_status_editipo(); get_status_editipo();
if(totipo_vertsel) { if(totipo_vertsel) {
tot= totipo_vertsel; tot= totipo_vertsel;
@@ -4611,7 +4605,7 @@ void transform_ipo(int mode)
VECCOPY(tv->oldloc, tv->loc); VECCOPY(tv->oldloc, tv->loc);
if(ei->disptype==IPO_DISPBITS) tv->flag= 1; if(ei->disptype==IPO_DISPBITS) tv->flag= 1;
/* let op: we nemen middelste vertex */ /* we take the middle vertex */
DO_MINMAX2(bezt->vec[1], min, max); DO_MINMAX2(bezt->vec[1], min, max);
tv++; tv++;
@@ -4621,7 +4615,7 @@ void transform_ipo(int mode)
VECCOPY(tv->oldloc, tv->loc); VECCOPY(tv->oldloc, tv->loc);
if(ei->disptype==IPO_DISPBITS) tv->flag= 1; if(ei->disptype==IPO_DISPBITS) tv->flag= 1;
/* let op: we nemen middelste vertex */ /* we take the middle vertex */
DO_MINMAX2(bezt->vec[1], min, max); DO_MINMAX2(bezt->vec[1], min, max);
tv++; tv++;
@@ -4732,7 +4726,7 @@ void transform_ipo(int mode)
if(midtog) dvec[proj]= 0.0; if(midtog) dvec[proj]= 0.0;
/* vec wordt verderop nog gebruikt: remake_ipo_transverts */ /* vec is reused below: remake_ipo_transverts */
vec[0]= dvec[0]; vec[0]= dvec[0];
vec[1]= dvec[1]; vec[1]= dvec[1];
@@ -4780,7 +4774,7 @@ void transform_ipo(int mode)
for(a=0; a<G.sipo->totipo; a++, ei++) { for(a=0; a<G.sipo->totipo; a++, ei++) {
if ISPOIN(ei, flag & IPO_VISIBLE, icu) { if ISPOIN(ei, flag & IPO_VISIBLE, icu) {
/* let op: als de tijd verkeerd is: niet de handles corrigeren */ /* watch it: if the time is wrong: do not correct handles */
if (test_time_ipocurve(ei->icu) ) dosort++; if (test_time_ipocurve(ei->icu) ) dosort++;
else testhandles_ipocurve(ei->icu); else testhandles_ipocurve(ei->icu);
} }
@@ -4924,7 +4918,7 @@ void clever_numbuts_ipo()
if(G.sipo->ipo && G.sipo->ipo->id.lib) return; if(G.sipo->ipo && G.sipo->ipo->id.lib) return;
if(G.sipo->editipo==0) return; if(G.sipo->editipo==0) return;
/* welke vertices doen mee */ /* which vertices are involved */
get_status_editipo(); get_status_editipo();
if(G.qual & LR_SHIFTKEY) totbut= 1; if(G.qual & LR_SHIFTKEY) totbut= 1;
@@ -5074,7 +5068,7 @@ void sampledata_to_ipocurve(float *data, int sfra, int efra, IpoCurve *icu)
if(icu->bezt) MEM_freeN(icu->bezt); if(icu->bezt) MEM_freeN(icu->bezt);
icu->bezt= 0; icu->bezt= 0;
tot= 1; /* eerste punt */ tot= 1; /* first point */
da= data+1; da= data+1;
for(a=sfra+1; a<efra; a++, da++) { for(a=sfra+1; a<efra; a++, da++) {
if( IS_EQ(da[0], da[1])==0 && IS_EQ(da[1], da[2])==0 ) tot++; if( IS_EQ(da[0], da[1])==0 && IS_EQ(da[1], da[2])==0 ) tot++;
@@ -5097,12 +5091,12 @@ void sampledata_to_ipocurve(float *data, int sfra, int efra, IpoCurve *icu)
void ipo_record() void ipo_record()
{ {
/* 1 of 2 aktieve curves /* only 1 or 2 active curves
* kopie maken (ESC) * make a copy (ESC)
* *
* nulpunt is de huidige stand (of 0) * reference point is the current situation (or 0)
* dx (dy identiek) is de hoogteverhouding * dx (dy) is the height correction factor
* CTRL start record * CTRL: start record
*/ */
extern double tottime; extern double tottime;
EditIpo *ei, *ei1=0, *ei2=0; EditIpo *ei, *ei1=0, *ei2=0;
@@ -5147,7 +5141,7 @@ void ipo_record()
return; return;
} }
/* curves gereedmaken, startwaardes */ /* make curves ready, start values */
if(ei1->icu==0) ei1->icu= get_ipocurve(G.sipo->from, G.sipo->blocktype, ei1->adrcode, 0); if(ei1->icu==0) ei1->icu= get_ipocurve(G.sipo->from, G.sipo->blocktype, ei1->adrcode, 0);
if(ei1->icu==0) return; if(ei1->icu==0) return;
poin= get_ipo_poin(G.sipo->from, ei1->icu, &type); poin= get_ipo_poin(G.sipo->from, ei1->icu, &type);
@@ -5167,7 +5161,7 @@ void ipo_record()
fac= G.v2d->cur.ymax - G.v2d->cur.ymin; fac= G.v2d->cur.ymax - G.v2d->cur.ymin;
fac/= (float)curarea->winy; fac/= (float)curarea->winy;
/* welke area */ /* which area */
oldarea= curarea; oldarea= curarea;
sa= G.curscreen->areabase.first; sa= G.curscreen->areabase.first;
while(sa) { while(sa) {
@@ -5183,7 +5177,7 @@ void ipo_record()
} }
if(sa) areawinset(sa->win); if(sa) areawinset(sa->win);
/* kandie? */ /* can we? */
while(get_mbut()&L_MOUSE) BIF_wait_for_statechange(); while(get_mbut()&L_MOUSE) BIF_wait_for_statechange();
data1= MEM_callocN(sizeof(float)*(EFRA-SFRA+1), "data1"); data1= MEM_callocN(sizeof(float)*(EFRA-SFRA+1), "data1");
data2= MEM_callocN(sizeof(float)*(EFRA-SFRA+1), "data2"); data2= MEM_callocN(sizeof(float)*(EFRA-SFRA+1), "data2");
@@ -5208,7 +5202,7 @@ void ipo_record()
set_timecursor(cfra); set_timecursor(cfra);
/* ipo doen: eerst alles daarna de specifieke */ /* do ipo: first all, then the specific ones */
if(anim==2) { if(anim==2) {
do_all_ipos(); do_all_ipos();
do_all_keys(); do_all_keys();
@@ -5236,7 +5230,7 @@ void ipo_record()
if(sa) scrarea_do_windraw(sa); if(sa) scrarea_do_windraw(sa);
/* minimaal swaptime laten voorbijgaan */ /* minimal wait swaptime */
tottime -= swaptime; tottime -= swaptime;
while (update_time()) PIL_sleep_ms(1); while (update_time()) PIL_sleep_ms(1);
@@ -5270,14 +5264,14 @@ void ipo_record()
sampledata_to_ipocurve(data1+sfra-SFRA, sfra, efra, ei1->icu); sampledata_to_ipocurve(data1+sfra-SFRA, sfra, efra, ei1->icu);
if(ei2) sampledata_to_ipocurve(data2+sfra-SFRA, sfra, efra, ei2->icu); if(ei2) sampledata_to_ipocurve(data2+sfra-SFRA, sfra, efra, ei2->icu);
/* vervelend als dat aanstaat */ /* not nice when this is on */
if(G.sipo->showkey) { if(G.sipo->showkey) {
G.sipo->showkey= 0; G.sipo->showkey= 0;
free_ipokey(&G.sipo->ipokey); free_ipokey(&G.sipo->ipokey);
} }
} }
else { else {
/* undo: startwaardes */ /* undo: start values */
poin= get_ipo_poin(G.sipo->from, ei1->icu, &type); poin= get_ipo_poin(G.sipo->from, ei1->icu, &type);
if(poin) write_ipo_poin(poin, type, or1); if(poin) write_ipo_poin(poin, type, or1);
if(ei1->icu->bezt==0) { if(ei1->icu->bezt==0) {
@@ -5307,7 +5301,7 @@ void ipo_record()
scrarea_queue_redraw(oldarea); scrarea_queue_redraw(oldarea);
CFRA= cfrao; CFRA= cfrao;
/* vooropig? */ /* for the time being? */
update_for_newframe(); update_for_newframe();
MEM_freeN(data1); MEM_freeN(data1);

View File

@@ -192,7 +192,7 @@ void insert_meshkey(Mesh *me)
sort_keys(me->key); sort_keys(me->key);
/* curent actief: */ /* curent active: */
kkb= key->block.first; kkb= key->block.first;
while(kkb) { while(kkb) {
kkb->flag &= ~SELECT; kkb->flag &= ~SELECT;
@@ -272,7 +272,7 @@ void insert_lattkey(Lattice *lt)
sort_keys(lt->key); sort_keys(lt->key);
/* curent actief: */ /* curent active: */
kkb= key->block.first; kkb= key->block.first;
while(kkb) { while(kkb) {
kkb->flag &= ~SELECT; kkb->flag &= ~SELECT;
@@ -292,7 +292,7 @@ void curve_to_key(Curve *cu, KeyBlock *kb, ListBase *nurb)
float *fp; float *fp;
int a, tot; int a, tot;
/* tellen */ /* count */
tot= count_curveverts(nurb); tot= count_curveverts(nurb);
if(tot==0) return; if(tot==0) return;
@@ -315,7 +315,7 @@ void curve_to_key(Curve *cu, KeyBlock *kb, ListBase *nurb)
fp+= 3; fp+= 3;
VECCOPY(fp, bezt->vec[2]); VECCOPY(fp, bezt->vec[2]);
fp+= 3; fp+= 3;
fp+= 3; /* alfa's */ fp+= 3; /* alphas */
bezt++; bezt++;
} }
} }
@@ -361,7 +361,7 @@ void key_to_curve(KeyBlock *kb, Curve *cu, ListBase *nurb)
fp+= 3; fp+= 3;
VECCOPY(bezt->vec[2], fp); VECCOPY(bezt->vec[2], fp);
fp+= 3; fp+= 3;
fp+= 3; /* alfa's */ fp+= 3; /* alphas */
tot-= 3; tot-= 3;
bezt++; bezt++;
@@ -415,7 +415,7 @@ void insert_curvekey(Curve *cu)
sort_keys(cu->key); sort_keys(cu->key);
/* curent actief: */ /* curent active: */
kkb= key->block.first; kkb= key->block.first;
while(kkb) { while(kkb) {
kkb->flag &= ~SELECT; kkb->flag &= ~SELECT;
@@ -457,7 +457,7 @@ void showkeypos(Key *key, KeyBlock *kb)
Curve *cu; Curve *cu;
int tot; int tot;
/* vanuit ipo */ /* from ipo */
ob= OBACT; ob= OBACT;
if(ob==0) return; if(ob==0) return;
@@ -483,7 +483,6 @@ void showkeypos(Key *key, KeyBlock *kb)
tot= count_curveverts(&cu->nurb); tot= count_curveverts(&cu->nurb);
cp_cu_key(cu, kb, 0, tot); cp_cu_key(cu, kb, 0, tot);
/* make_displists_by_obdata(me); */
make_displists_by_obdata(cu); make_displists_by_obdata(cu);
} }
@@ -541,7 +540,7 @@ void delete_key(void)
else if(GS(key->from->name)==ID_LT) ((Lattice *)key->from)->key= 0; else if(GS(key->from->name)==ID_LT) ((Lattice *)key->from)->key= 0;
free_libblock_us(&(G.main->key), key); free_libblock_us(&(G.main->key), key);
scrarea_queue_headredraw(curarea); /* ipo ook weg */ scrarea_queue_headredraw(curarea); /* ipo remove too */
} }
else do_spec_key(key); else do_spec_key(key);
@@ -568,7 +567,7 @@ void move_keys(void)
key= (Key *)G.sipo->from; key= (Key *)G.sipo->from;
if(key==0) return; if(key==0) return;
/* welke keys doen mee */ /* which keys are involved */
kb= key->block.first; kb= key->block.first;
while(kb) { while(kb) {
if(kb->flag & SELECT) tot++; if(kb->flag & SELECT) tot++;
@@ -650,7 +649,7 @@ void move_keys(void)
sort_keys(key); sort_keys(key);
do_spec_key(key); do_spec_key(key);
/* voor boundbox */ /* for boundbox */
editipo_changed(G.sipo, 0); editipo_changed(G.sipo, 0);
MEM_freeN(transmain); MEM_freeN(transmain);

View File

@@ -178,7 +178,7 @@ void load_editLatt(void)
lt= G.obedit->data; lt= G.obedit->data;
/* zijn er keys? */ /* are there keys? */
if(lt->key) { if(lt->key) {
actkey= lt->key->block.first; actkey= lt->key->block.first;
while(actkey) { while(actkey) {
@@ -188,7 +188,7 @@ void load_editLatt(void)
} }
if(actkey) { if(actkey) {
/* aktieve key: vertices */ /* active key: vertices */
tot= editLatt->pntsu*editLatt->pntsv*editLatt->pntsw; tot= editLatt->pntsu*editLatt->pntsv*editLatt->pntsw;
if(actkey->data) MEM_freeN(actkey->data); if(actkey->data) MEM_freeN(actkey->data);
@@ -259,14 +259,14 @@ void deselectall_Latt(void)
static BPoint *findnearestLattvert(int sel) static BPoint *findnearestLattvert(int sel)
{ {
/* sel==1: selected krijgen een nadeel */ /* sel==1: selected get a disadvantage */
/* in bp wordt nearest weggeschreven */ /* in bp nearest is written */
BPoint *bp1, *bp; BPoint *bp1, *bp;
short dist= 100, temp, mval[2], a; short dist= 100, temp, mval[2], a;
bp= 0; bp= 0;
/* projektie doen */ /* do projection */
calc_lattverts_ext(); /* drawobject.c */ calc_lattverts_ext(); /* drawobject.c */
getmouseco_areawin(mval); getmouseco_areawin(mval);

View File

@@ -131,7 +131,7 @@ void add_primitiveMball(int dummy_argument)
check_editmode(OB_MBALL); check_editmode(OB_MBALL);
/* 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_MBALL); add_object(OB_MBALL);
base_init_from_view3d(BASACT, G.vd); base_init_from_view3d(BASACT, G.vd);
@@ -143,14 +143,14 @@ void add_primitiveMball(int dummy_argument)
setcursor_space(SPACE_VIEW3D, CURSOR_EDIT); setcursor_space(SPACE_VIEW3D, CURSOR_EDIT);
} }
/* deselecteren */ /* deselect */
ml= editelems.first; ml= editelems.first;
while(ml) { while(ml) {
ml->flag &= ~SELECT; ml->flag &= ~SELECT;
ml= ml->next; ml= ml->next;
} }
/* imat en centrum en afmeting */ /* imat and centre and size */
Mat3CpyMat4(mat, G.obedit->obmat); Mat3CpyMat4(mat, G.obedit->obmat);
curs= give_cursor(); curs= give_cursor();
@@ -218,7 +218,7 @@ void mouse_mball()
hits= selectprojektie(buffer, 0, 0, 0, 0); hits= selectprojektie(buffer, 0, 0, 0, 0);
/* bestaat startelem? */ /* does startelem exist? */
ml= editelems.first; ml= editelems.first;
while(ml) { while(ml) {
if(ml==startelem) break; if(ml==startelem) break;

File diff suppressed because it is too large Load Diff

View File

@@ -182,7 +182,7 @@ float prop_cent[3];
float centre[3], centroid[3]; float centre[3], centroid[3];
void add_object_draw(int type) /* voor toolbox */ void add_object_draw(int type) /* for toolbox */
{ {
Object *ob; Object *ob;
@@ -215,7 +215,7 @@ void add_object_draw(int type) /* voor toolbox */
allqueue(REDRAWNLA, 0); allqueue(REDRAWNLA, 0);
deselect_all_area_oops(); deselect_all_area_oops();
set_select_flag_oops(); set_select_flag_oops();
allqueue(REDRAWINFO, 1); /* 1, want header->win==0! */ allqueue(REDRAWINFO, 1); /* 1, because header->win==0! */
} }
@@ -280,6 +280,8 @@ void make_track(void)
/* Not yet */ /* Not yet */
notice ("Make Track no longer supported. Use constraints instead."); notice ("Make Track no longer supported. Use constraints instead.");
return; return;
/* hrms, i would suppose then just to add a constraint for the user. be nice! (ton) */
#endif #endif
if(okee("Make Track")==0) return; if(okee("Make Track")==0) return;
@@ -475,7 +477,7 @@ void clear_object(char mode)
void reset_slowparents(void) void reset_slowparents(void)
{ {
/* terug op correcte plek */ /* back to original locations */
Base *base; Base *base;
base= FIRSTBASE; base= FIRSTBASE;
@@ -517,7 +519,7 @@ void make_vertex_parent(void)
Object *par, *ob; Object *par, *ob;
int a, v1=0, v2=0, v3=0, nr=1; int a, v1=0, v2=0, v3=0, nr=1;
/* er moet 1 of 3 vertices select zijn */ /* we need 1 ot 3 selected vertices */
if(G.obedit->type==OB_MESH) { if(G.obedit->type==OB_MESH) {
eve= G.edve.first; eve= G.edve.first;
@@ -597,7 +599,7 @@ void make_vertex_parent(void)
ob->par2= v2-1; ob->par2= v2-1;
ob->par3= v3-1; ob->par3= v3-1;
/* inverse parent matrix berekenen */ /* inverse parent matrix */
what_does_parent(ob); what_does_parent(ob);
Mat4Invert(ob->parentinv, workob.obmat); Mat4Invert(ob->parentinv, workob.obmat);
clear_workob(); clear_workob();
@@ -606,7 +608,7 @@ void make_vertex_parent(void)
ob->partype= PARVERT1; ob->partype= PARVERT1;
ob->par1= v1-1; ob->par1= v1-1;
/* inverse parent matrix berekenen */ /* inverse parent matrix */
what_does_parent(ob); what_does_parent(ob);
Mat4Invert(ob->parentinv, workob.obmat); Mat4Invert(ob->parentinv, workob.obmat);
clear_workob(); clear_workob();
@@ -771,7 +773,7 @@ void make_parent(void)
base= base->next; base= base->next;
} }
/* nu gaan we alle objecten clearparentandkeeptransformen */ /* now we'll clearparentandkeeptransform all objects */
base= FIRSTBASE; base= FIRSTBASE;
while(base) { while(base) {
if TESTBASELIB(base) { if TESTBASELIB(base) {
@@ -843,9 +845,9 @@ void make_parent(void)
base->object->parent= par; base->object->parent= par;
/* inverse parent matrix berekenen? */ /* calculate inverse parent matrix? */
if( (qual & LR_SHIFTKEY) ) { if( (qual & LR_SHIFTKEY) ) {
/* niet dus... */ /* not... */
Mat4One(base->object->parentinv); Mat4One(base->object->parentinv);
memset(base->object->loc, 0, 3*sizeof(float)); memset(base->object->loc, 0, 3*sizeof(float));
} }
@@ -936,7 +938,7 @@ void enter_editmode(void)
make_editArmature(); make_editArmature();
allqueue (REDRAWVIEW3D,0); allqueue (REDRAWVIEW3D,0);
} }
else if(ob->type==OB_IKA) { /* grabtype */ else if(ob->type==OB_IKA) { /* grab type */
base= FIRSTBASE; base= FIRSTBASE;
while(base) { while(base) {
if TESTBASE(base) { if TESTBASE(base) {
@@ -993,7 +995,7 @@ void make_displists_by_parent(Object *ob) {
makeDispList(base->object); makeDispList(base->object);
} }
void exit_editmode(int freedata) /* freedata==0 bij render */ void exit_editmode(int freedata) /* freedata==0 at render */
{ {
Base *base; Base *base;
Object *ob; Object *ob;
@@ -1003,7 +1005,7 @@ void exit_editmode(int freedata) /* freedata==0 bij render */
if(G.obedit->type==OB_MESH) { if(G.obedit->type==OB_MESH) {
/* tijdelijk */ /* temporal */
countall(); countall();
if(G.totvert>65000) { if(G.totvert>65000) {
error("too many vertices"); error("too many vertices");
@@ -1038,17 +1040,17 @@ void exit_editmode(int freedata) /* freedata==0 bij render */
ob= G.obedit; ob= G.obedit;
/* obedit moet 0 zijn voor curve-extrude, niet voor smeshes */ /* obedit has to be 0 for curve-extrude, not for smeshes */
if(ob->type==OB_CURVE) G.obedit= 0; if(ob->type==OB_CURVE) G.obedit= 0;
G.obedit= 0; G.obedit= 0;
makeDispList(ob); makeDispList(ob);
/* heeft dit nog invloed op andere bases? */ /* has this influence at other objects? */
if(ob->type==OB_CURVE) { if(ob->type==OB_CURVE) {
/* test of ob als bevelcurve of textoncurve wordt gebruikt */ /* test if ob is use as bevelcurve r textoncurve */
base= FIRSTBASE; base= FIRSTBASE;
while(base) { while(base) {
if ELEM(base->object->type, OB_CURVE, OB_FONT) { if ELEM(base->object->type, OB_CURVE, OB_FONT) {
@@ -1133,7 +1135,7 @@ void docentre(void)
} }
} }
/* vlaggen resetten */ /* reset flags */
base= FIRSTBASE; base= FIRSTBASE;
while(base) { while(base) {
if TESTBASELIB(base) { if TESTBASELIB(base) {
@@ -1194,7 +1196,7 @@ void docentre(void)
base->object->loc[1]+= centn[1]; base->object->loc[1]+= centn[1];
base->object->loc[2]+= centn[2]; base->object->loc[2]+= centn[2];
/* andere users? */ /* other users? */
ob= G.main->object.first; ob= G.main->object.first;
while(ob) { while(ob) {
if((ob->flag & OB_DONE)==0) { if((ob->flag & OB_DONE)==0) {
@@ -1225,10 +1227,10 @@ void docentre(void)
} }
} }
/* displisten van alle users, ook deze base */ /* displist of all users, also this one */
makeDispList(base->object); makeDispList(base->object);
/* DOEN: alle users aflopen... */ /* DO: check all users... */
tex_space_mesh(me); tex_space_mesh(me);
} }
@@ -1301,15 +1303,15 @@ void docentre(void)
} }
else if(base->object->type==OB_FONT) { else if(base->object->type==OB_FONT) {
/* uit de bb halen */ /* get from bb */
cu= base->object->data; cu= base->object->data;
if(cu->bb==0) return; if(cu->bb==0) return;
cu->xof= -0.5*( cu->bb->vec[4][0] - cu->bb->vec[0][0]); cu->xof= -0.5*( cu->bb->vec[4][0] - cu->bb->vec[0][0]);
cu->yof= -0.5 -0.5*( cu->bb->vec[0][1] - cu->bb->vec[2][1]); /* extra 0.5 is de hoogte van de bovenste regel */ cu->yof= -0.5 -0.5*( cu->bb->vec[0][1] - cu->bb->vec[2][1]); /* extra 0.5 is the height of above line */
/* klopt niet helemaal, een keer goed doen! */ /* not really ok, do this better once! */
cu->xof /= cu->fsize; cu->xof /= cu->fsize;
cu->yof /= cu->fsize; cu->yof /= cu->fsize;
@@ -1545,18 +1547,8 @@ void special_editmenu(void)
if(nr>0) waitcursor(0); if(nr>0) waitcursor(0);
} }
/* else if (G.obedit->type==OB_ARMATURE){
nr= pupmenu("Specials%t|");
if (nr>0) waitcursor (1);
switch (nr){
case 1:
}
if (nr>0) waitcursor (0);
}
*/
else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) { else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
/* nr= pupmenu("Specials%t|Subdivide%x1|Hide%x5|Reveal%x6|Select swap%x7"); */
nr= pupmenu("Specials%t|Subdivide%x1|Switch Direction%x2"); nr= pupmenu("Specials%t|Subdivide%x1|Switch Direction%x2");
switch(nr) { switch(nr) {
@@ -1617,9 +1609,9 @@ void convertmenu(void)
} }
if(ok==0) return; if(ok==0) return;
/* denk aan meerdere users! */ /* don't forget multiple users! */
/* vlaggen resetten */ /* reset flags */
base= FIRSTBASE; base= FIRSTBASE;
while(base) { while(base) {
if TESTBASELIB(base) { if TESTBASELIB(base) {
@@ -1645,7 +1637,7 @@ void convertmenu(void)
basen= MEM_mallocN(sizeof(Base), "duplibase"); basen= MEM_mallocN(sizeof(Base), "duplibase");
*basen= *base; *basen= *base;
BLI_addhead(&G.scene->base, basen); /* addhead: anders oneindige lus */ BLI_addhead(&G.scene->base, basen); /* addhead: otherwise eternal loop */
basen->object= ob1; basen->object= ob1;
basen->flag &= ~SELECT; basen->flag &= ~SELECT;
@@ -1680,7 +1672,7 @@ void convertmenu(void)
cu->vfont->id.us--; cu->vfont->id.us--;
cu->vfont= 0; cu->vfont= 0;
} }
/* andere users */ /* other users */
if(cu->id.us>1) { if(cu->id.us>1) {
ob1= G.main->object.first; ob1= G.main->object.first;
while(ob1) { while(ob1) {
@@ -1699,9 +1691,9 @@ void convertmenu(void)
dl= cu->disp.first; dl= cu->disp.first;
if(dl==0) makeDispList(ob); if(dl==0) makeDispList(ob);
nurbs_to_mesh(ob); /* doet ook users */ nurbs_to_mesh(ob); /* also does users */
/* texspace en normalen */ /* texspace and normals */
BASACT= base; BASACT= base;
enter_editmode(); enter_editmode();
exit_editmode(1); exit_editmode(1);
@@ -1721,7 +1713,7 @@ void convertmenu(void)
basen= MEM_mallocN(sizeof(Base), "duplibase"); basen= MEM_mallocN(sizeof(Base), "duplibase");
*basen= *base; *basen= *base;
BLI_addhead(&G.scene->base, basen); /* addhead: anders oneindige lus */ BLI_addhead(&G.scene->base, basen); /* addhead: othwise eternal loop */
basen->object= ob1; basen->object= ob1;
basen->flag &= ~SELECT; basen->flag &= ~SELECT;
@@ -2148,7 +2140,7 @@ void linkmenu()
} }
if(sce==0 || sce->id.lib) return; if(sce==0 || sce->id.lib) return;
/* denk eraan: is verderop nog nodig */ /* remember: is needed below */
event= 1; event= 1;
} }
} }
@@ -2163,13 +2155,13 @@ void linkmenu()
if(event==1) { /* to scene */ if(event==1) { /* to scene */
/* testen of het soms al gelinkt is */ /* test if already linked */
sbase= sce->base.first; sbase= sce->base.first;
while(sbase) { while(sbase) {
if(sbase->object==base->object) break; if(sbase->object==base->object) break;
sbase= sbase->next; sbase= sbase->next;
} }
if(sbase) { /* eruit */ if(sbase) { /* remove */
base= base->next; base= base->next;
continue; continue;
} }
@@ -2191,7 +2183,7 @@ void linkmenu()
id_us_plus(id); id_us_plus(id);
obt->data= id; obt->data= id;
/* als aantal mat indices veranderd zijn: */ /* if amount of material indices changed: */
test_object_materials(obt->data); test_object_materials(obt->data);
} }
} }
@@ -2205,17 +2197,17 @@ void linkmenu()
} }
else if(event==3) { /* materials */ else if(event==3) { /* materials */
/* alleen als obt geen materiaal heeft: arrays maken */ /* only if obt has no material: make arrays */
/* van ob naar obt! */ /* from ob to obt! */
obmatarar= give_matarar(ob); obmatarar= give_matarar(ob);
matarar= give_matarar(obt); matarar= give_matarar(obt);
totcolp= give_totcolp(obt); totcolp= give_totcolp(obt);
/* als 1 van de 2 nul is: geen renderbaar object */ /* if one of the two is zero: no render-able object */
if( matarar && obmatarar) { if( matarar && obmatarar) {
/* voorzichtig met users! Dus eerst kopie orig: */ /* take care of users! so first a copy of original: */
if(ob->totcol) { if(ob->totcol) {
matar1= MEM_dupallocN(ob->mat); matar1= MEM_dupallocN(ob->mat);
@@ -2225,23 +2217,23 @@ void linkmenu()
matar1= matar2= 0; matar1= matar2= 0;
} }
/* alles van obt los linken */ /* remove links from obt */
for(a=0; a<obt->totcol; a++) { for(a=0; a<obt->totcol; a++) {
if(obt->mat[a]) obt->mat[a]->id.us--; if(obt->mat[a]) obt->mat[a]->id.us--;
if( (*matarar)[a]) (*matarar)[a]->id.us--; if( (*matarar)[a]) (*matarar)[a]->id.us--;
} }
/* vrijgeven */ /* free */
if(obt->mat) MEM_freeN(obt->mat); if(obt->mat) MEM_freeN(obt->mat);
if(*matarar) MEM_freeN(*matarar); if(*matarar) MEM_freeN(*matarar);
/* hangen kopie er aan */ /* connect a copy */
obt->mat= matar1; obt->mat= matar1;
*matarar= matar2; *matarar= matar2;
obt->totcol= ob->totcol; obt->totcol= ob->totcol;
*totcolp= ob->totcol; *totcolp= ob->totcol;
/* users ophogen */ /* increase users */
for(a=0; a<obt->totcol; a++) { for(a=0; a<obt->totcol; a++) {
if(obt->mat[a]) id_us_plus((ID *)obt->mat[a]); if(obt->mat[a]) id_us_plus((ID *)obt->mat[a]);
if( (*matarar)[a]) id_us_plus((ID *)(*matarar)[a]); if( (*matarar)[a]) id_us_plus((ID *)(*matarar)[a]);
@@ -2249,7 +2241,7 @@ void linkmenu()
obt->colbits= ob->colbits; obt->colbits= ob->colbits;
/* als aantal mat indices veranderd zijn: */ /* if amount of material indices changed: */
test_object_materials(obt->data); test_object_materials(obt->data);
} }
} }
@@ -2281,15 +2273,15 @@ void make_duplilist_real()
ob= duplilist.first; ob= duplilist.first;
while(ob) { while(ob) {
/* font dupli's kunnen totcol hebben zonder mat, halen ze van parent af /* font duplis can have a totcol without material, we get them from parent
* dit zou netter moeten * should be implemented better...
*/ */
if(ob->mat==0) ob->totcol= 0; if(ob->mat==0) ob->totcol= 0;
basen= MEM_dupallocN(base); basen= MEM_dupallocN(base);
basen->flag &= ~OB_FROMDUPLI; basen->flag &= ~OB_FROMDUPLI;
BLI_addhead(&G.scene->base, basen); /* addhead: anders oneindige lus */ BLI_addhead(&G.scene->base, basen); /* addhead: othwise eternal loop */
ob->ipo= 0; /* zeker weten dat de apply werkt */ ob->ipo= 0; /* make sure apply works */
ob->parent= ob->track= 0; ob->parent= ob->track= 0;
ob->disp.first= ob->disp.last= 0; ob->disp.first= ob->disp.last= 0;
ob->transflag &= ~OB_DUPLI; ob->transflag &= ~OB_DUPLI;
@@ -2368,7 +2360,7 @@ void apply_object()
where_is_object(ob); where_is_object(ob);
/* texspace en normalen */ /* texspace and normals */
BASACT= base; BASACT= base;
enter_editmode(); enter_editmode();
exit_editmode(1); exit_editmode(1);
@@ -2435,7 +2427,7 @@ void apply_object()
where_is_object(ob); where_is_object(ob);
/* texspace en normalen */ /* texspace and normals */
BASACT= base; BASACT= base;
enter_editmode(); enter_editmode();
exit_editmode(1); exit_editmode(1);
@@ -2450,7 +2442,7 @@ void apply_object()
/* ************ ALGEMENE *************** */ /* ************ GENERAL *************** */
static Object *is_a_parent_selected_int(Object *startob, Object *ob, GHash *done_hash) { static Object *is_a_parent_selected_int(Object *startob, Object *ob, GHash *done_hash) {
if (ob!=startob && TESTBASE(ob)) if (ob!=startob && TESTBASE(ob))
@@ -2527,7 +2519,7 @@ static void setbaseflags_for_editing(int mode) /* 0,'g','r','s' */
Object *ob= base->object; Object *ob= base->object;
Object *parsel= is_a_parent_selected(ob); Object *parsel= is_a_parent_selected(ob);
/* hier ook parentkey? */ /* parentkey here? */
if(parsel) { if(parsel) {
if(base->flag & SELECT) { if(base->flag & SELECT) {
@@ -2543,7 +2535,6 @@ static void setbaseflags_for_editing(int mode) /* 0,'g','r','s' */
} }
/* updates? */ /* updates? */
/* ivm automatische portals */
if(ob->type==OB_IKA) { if(ob->type==OB_IKA) {
Ika *ika= ob->data; Ika *ika= ob->data;
if(ika->parent && parsel) base->flag |= BA_WHERE_UPDATE; if(ika->parent && parsel) base->flag |= BA_WHERE_UPDATE;
@@ -2643,13 +2634,13 @@ void ob_to_transob(Object *ob, TransOb *tob)
VECCOPY(tob->olddsize, ob->dsize); VECCOPY(tob->olddsize, ob->dsize);
/* alleen object, geen parent */ /* only object, not parent */
object_to_mat3(ob, tob->obmat); object_to_mat3(ob, tob->obmat);
Mat3Inv(tob->obinv, tob->obmat); Mat3Inv(tob->obinv, tob->obmat);
Mat3CpyMat4(totmat, ob->obmat); Mat3CpyMat4(totmat, ob->obmat);
/* dit is totmat zonder obmat: dus parmat */ /* this is totmat without obmat: so a parmat */
Mat3MulMat3(tob->parmat, totmat, tob->obinv); Mat3MulMat3(tob->parmat, totmat, tob->obinv);
Mat3Inv(tob->parinv, tob->parmat); Mat3Inv(tob->parinv, tob->parmat);
@@ -2681,11 +2672,9 @@ void ob_to_transob(Object *ob, TransOb *tob)
VECCOPY(tob->oldeff, tob->eff); VECCOPY(tob->oldeff, tob->eff);
tob->flag |= TOB_IKA; tob->flag |= TOB_IKA;
/* zodat alleen eff update wordt */
tob->loc= 0; tob->loc= 0;
} }
/* set_ika_undo_vals(); */
} }
} }
@@ -2742,7 +2731,7 @@ void make_trans_objects()
INIT_MINMAX(min, max); INIT_MINMAX(min, max);
centroid[0]=centroid[1]=centroid[2]= 0.0; centroid[0]=centroid[1]=centroid[2]= 0.0;
/* aantal tellen */ /* count */
base= FIRSTBASE; base= FIRSTBASE;
while(base) { while(base) {
if TESTBASELIB(base) { if TESTBASELIB(base) {
@@ -2754,7 +2743,7 @@ void make_trans_objects()
else { else {
if(ob->ipo && ob->ipo->showkey && (ob->ipoflag & OB_DRAWKEY)) { if(ob->ipo && ob->ipo->showkey && (ob->ipoflag & OB_DRAWKEY)) {
elems.first= elems.last= 0; elems.first= elems.last= 0;
make_ipokey_transform(ob, &elems, 1); /* '1' alleen selected keys */ make_ipokey_transform(ob, &elems, 1); /* '1' only selected keys */
pushdata(&elems, sizeof(ListBase)); pushdata(&elems, sizeof(ListBase));
@@ -2776,7 +2765,7 @@ void make_trans_objects()
reset_slowparents(); reset_slowparents();
/* dit hieronder wel doen als tottrans==0, i.v.m. vrijgeven pushpop en ipokeys */ /*also do this below when tottrans==0, because of freeing pushpop and ipokeys */
base= FIRSTBASE; base= FIRSTBASE;
while(base) { while(base) {
@@ -2795,7 +2784,7 @@ void make_trans_objects()
} }
else { else {
/* van belang! (o.a. bevobj) */ /* is needed! (bevobj) */
if(base->flag & SELECT) ob->flag|= SELECT; else ob->flag &= ~SELECT; if(base->flag & SELECT) ob->flag|= SELECT; else ob->flag &= ~SELECT;
if(ob->ipo && ob->ipo->showkey && (ob->ipoflag & OB_DRAWKEY)) { if(ob->ipo && ob->ipo->showkey && (ob->ipoflag & OB_DRAWKEY)) {
@@ -2824,7 +2813,7 @@ void make_trans_objects()
ob_to_transob(ob, tob); ob_to_transob(ob, tob);
DO_MINMAX(tob->obvec, min, max); DO_MINMAX(tob->obvec, min, max);
/* doet ook tob->flag en oldvals, moet NA ob_to_transob()! */ /* also does tob->flag and oldvals, needs to be after ob_to_transob()! */
set_ipo_pointers_transob(ik, tob); set_ipo_pointers_transob(ik, tob);
tob++; tob++;
@@ -2861,7 +2850,7 @@ void make_trans_objects()
base= base->next; base= base->next;
} }
pushpop_test(); /* alleen voor debug & zekerheid */ pushpop_test(); /* only for debug & to be sure */
if(tottrans==0) return; if(tottrans==0) return;
@@ -3036,7 +3025,7 @@ void make_trans_verts(float *min, float *max, int mode)
} }
} }
/* cent enz berekenen */ /* cent etc */
tv= transvmain; tv= transvmain;
for(a=0; a<tottrans; a++, tv++) { for(a=0; a<tottrans; a++, tv++) {
if(tv->flag) { if(tv->flag) {
@@ -3239,7 +3228,7 @@ void special_aftertrans_update(char mode, int flip, short canceled, int keyflags
int doit,redrawipo=0; int doit,redrawipo=0;
/* displaylisten e.d. */ /* displaylists etc. */
if(G.obedit) { if(G.obedit) {
if(G.obedit->type==OB_MBALL) { if(G.obedit->type==OB_MBALL) {
@@ -3307,7 +3296,6 @@ void special_aftertrans_update(char mode, int flip, short canceled, int keyflags
if(ob->type==OB_IKA) { if(ob->type==OB_IKA) {
ika= ob->data; ika= ob->data;
/* vooral voor ika NIET in GRABEFF mode, updaten van globale effector */
VecMat4MulVecfl(ika->effg, ob->obmat, ika->eff); VecMat4MulVecfl(ika->effg, ob->obmat, ika->eff);
itterate_ika(ob); itterate_ika(ob);
} }
@@ -3344,7 +3332,7 @@ void special_aftertrans_update(char mode, int flip, short canceled, int keyflags
makeDispList(ob); makeDispList(ob);
} }
where_is_object(ob); /* altijd ivm track eytc */ where_is_object(ob); /* always do, for track etc. */
/* Set autokey if necessary */ /* Set autokey if necessary */
if ((U.uiflag & KEYINSERTOBJ) && (!canceled) && (base->flag & SELECT)){ if ((U.uiflag & KEYINSERTOBJ) && (!canceled) && (base->flag & SELECT)){
@@ -3396,7 +3384,7 @@ void calc_trans_verts(void)
Nurb *nu= editNurb.first; Nurb *nu= editNurb.first;
while(nu) { while(nu) {
test2DNurb(nu); test2DNurb(nu);
testhandlesNurb(nu); /* test ook op bezier */ testhandlesNurb(nu); /* test for bezier too */
nu= nu->next; nu= nu->next;
} }
makeDispList(G.obedit); makeDispList(G.obedit);
@@ -3408,7 +3396,7 @@ static int test_midtog_proj(short xn, short yn, short *mval)
{ {
float x,y,z; float x,y,z;
/* welke beweging is het grootst? die wordt het */ /* which movement is the largest? that'll be the one */
xn= (xn-mval[0]); xn= (xn-mval[0]);
yn= (yn-mval[1]); yn= (yn-mval[1]);
x = fabs(G.vd->persinv[0][0]*xn + G.vd->persinv[1][0]*yn); x = fabs(G.vd->persinv[0][0]*xn + G.vd->persinv[1][0]*yn);
@@ -3422,7 +3410,7 @@ static int test_midtog_proj(short xn, short yn, short *mval)
void apply_keyb_grid(float *val, float fac1, float fac2, float fac3, int invert) void apply_keyb_grid(float *val, float fac1, float fac2, float fac3, int invert)
{ {
/* fac1 is voor 'niets', fac2 voor CTRL fac3 voor SHIFT */ /* fac1 is for 'nothing', fac2 for CTRL, fac3 for SHIFT */
int ctrl; int ctrl;
if(invert) { if(invert) {
@@ -3448,16 +3436,12 @@ void compatible_eul(float *eul, float *oldrot)
{ {
float dx, dy, dz; float dx, dy, dz;
/* verschillen van ong 360 graden eerst corrigeren */ /* correct differences of about 360 degrees first */
dx= eul[0] - oldrot[0]; dx= eul[0] - oldrot[0];
dy= eul[1] - oldrot[1]; dy= eul[1] - oldrot[1];
dz= eul[2] - oldrot[2]; dz= eul[2] - oldrot[2];
/* printf("komt binnen: \n"); */
/* PRINT3(f, f, f, eul[0], eul[1], eul[2]); */
/* PRINT3(f, f, f, dx, dy, dz); */
while( fabs(dx) > 5.1) { while( fabs(dx) > 5.1) {
if(dx > 0.0) eul[0] -= 2.0*M_PI; else eul[0]+= 2.0*M_PI; if(dx > 0.0) eul[0] -= 2.0*M_PI; else eul[0]+= 2.0*M_PI;
dx= eul[0] - oldrot[0]; dx= eul[0] - oldrot[0];
@@ -3471,10 +3455,7 @@ void compatible_eul(float *eul, float *oldrot)
dz= eul[2] - oldrot[2]; dz= eul[2] - oldrot[2];
} }
/* PRINT3(f, f, f, oldrot[0], oldrot[1], oldrot[2]); */ /* is 1 of the axis rotations larger than 180 degrees and the other small? NO ELSE IF!! */
/* is 1 van de asrotaties groter dan 180 graden en de andere klein? GEEN ELSEIF!! */
if( fabs(dx) > 3.2 && fabs(dy)<1.6 && fabs(dz)<1.6 ) { if( fabs(dx) > 3.2 && fabs(dy)<1.6 && fabs(dz)<1.6 ) {
if(dx > 0.0) eul[0] -= 2.0*M_PI; else eul[0]+= 2.0*M_PI; if(dx > 0.0) eul[0] -= 2.0*M_PI; else eul[0]+= 2.0*M_PI;
} }
@@ -3484,14 +3465,15 @@ void compatible_eul(float *eul, float *oldrot)
if( fabs(dz) > 3.2 && fabs(dx)<1.6 && fabs(dy)<1.6 ) { if( fabs(dz) > 3.2 && fabs(dx)<1.6 && fabs(dy)<1.6 ) {
if(dz > 0.0) eul[2] -= 2.0*M_PI; else eul[2]+= 2.0*M_PI; if(dz > 0.0) eul[2] -= 2.0*M_PI; else eul[2]+= 2.0*M_PI;
} }
return; /* <- intersting to find out who did that! */
return; /* calc again */
/* opnieuw berekenen */
dx= eul[0] - oldrot[0]; dx= eul[0] - oldrot[0];
dy= eul[1] - oldrot[1]; dy= eul[1] - oldrot[1];
dz= eul[2] - oldrot[2]; dz= eul[2] - oldrot[2];
/* dit is een bijzonder geval, voor x-z getest */ /* special case, tested for x-z */
if( (fabs(dx) > 3.1 && fabs(dz) > 1.5 ) || ( fabs(dx) > 1.5 && fabs(dz) > 3.1 ) ) { if( (fabs(dx) > 3.1 && fabs(dz) > 1.5 ) || ( fabs(dx) > 1.5 && fabs(dz) > 3.1 ) ) {
if(dx > 0.0) eul[0] -= M_PI; else eul[0]+= M_PI; if(dx > 0.0) eul[0] -= M_PI; else eul[0]+= M_PI;
@@ -3510,8 +3492,6 @@ return;
if(dz > 0.0) eul[2] -= M_PI; else eul[2]+= M_PI; if(dz > 0.0) eul[2] -= M_PI; else eul[2]+= M_PI;
} }
/* PRINT3(f, f, f, eul[0], eul[1], eul[2]); */
/* printf("\n"); */
} }
void headerprint(char *str) void headerprint(char *str)
@@ -3582,9 +3562,7 @@ int cylinder_intersect_test(void)
VecSubf(rc, oldloc, base); VecSubf(rc, oldloc, base);
/* als we nou speed normaliseren (kan van te voren! */ /* the axis */
/* en de axis ook alvast */
len2= Normalise(axis); len2= Normalise(axis);
Crossf(n, speed, axis); Crossf(n, speed, axis);
@@ -3604,12 +3582,12 @@ int cylinder_intersect_test(void)
labdacor= t-s; labdacor= t-s;
labda= t+s; labda= t+s;
/* twee gevallen waarbij geen snijpunt is */ /* two cases with no intersection point */
if(labdacor>=1.0 && labda>=1.0) return 0; if(labdacor>=1.0 && labda>=1.0) return 0;
if(labdacor<=0.0 && labda<=0.0) return 0; if(labdacor<=0.0 && labda<=0.0) return 0;
/* normaalvector berekenen */ /* calc normal */
/* snijpunt: */ /* intersection: */
rc[0]= oldloc[0] + labdacor*speed[0] - base[0]; rc[0]= oldloc[0] + labdacor*speed[0] - base[0];
rc[1]= oldloc[1] + labdacor*speed[1] - base[1]; rc[1]= oldloc[1] + labdacor*speed[1] - base[1];
@@ -3655,14 +3633,14 @@ int sphere_intersect_test(void)
if(disc>=0.0) { if(disc>=0.0) {
disc= sqrt(disc); disc= sqrt(disc);
labdacor= (-bsq - disc)/len; /* intrede */ labdacor= (-bsq - disc)/len; /* entry point */
labda= (-bsq + disc)/len; labda= (-bsq + disc)/len;
printf("var1: %f, var2: %f, var3: %f\n", labdacor, labda, editbutsize); printf("var1: %f, var2: %f, var3: %f\n", labdacor, labda, editbutsize);
} }
else return 0; else return 0;
/* snijpunt en normaal */ /* intersection and normal */
rc[0]= oldloc[0] + labdacor*speed[0] - base[0]; rc[0]= oldloc[0] + labdacor*speed[0] - base[0];
rc[1]= oldloc[1] + labdacor*speed[1] - base[1]; rc[1]= oldloc[1] + labdacor*speed[1] - base[1];
rc[2]= oldloc[2] + labdacor*speed[2] - base[2]; rc[2]= oldloc[2] + labdacor*speed[2] - base[2];
@@ -3777,7 +3755,7 @@ void transform(int mode) /* 'g' 'G' 'r' 'R' 's' 'S' 't' or 'w' 'N' */
/* form duplicate routines */ /* form duplicate routines */
if(mode=='d') mode= 'g'; if(mode=='d') mode= 'g';
/* kan floating exception veroorzaken op alpha */ /* this can cause floating exception at dec alpha */
d_dvec[0]= d_dvec[1]= d_dvec[2]= 0.0; d_dvec[0]= d_dvec[1]= d_dvec[2]= 0.0;
dvec[0]= dvec[1]= dvec[2]= 0.0; dvec[0]= dvec[1]= dvec[2]= 0.0;
@@ -3788,11 +3766,11 @@ void transform(int mode) /* 'g' 'G' 'r' 'R' 's' 'S' 't' or 'w' 'N' */
} }
if(mode=='w' && G.obedit==0) return; if(mode=='w' && G.obedit==0) return;
/* welke data wordt behandeld? */ /* what data will be involved? */
if(G.obedit) { if(G.obedit) {
if(mode=='N') vertexnormals(0); if(mode=='N') vertexnormals(0);
/* min en max zijn nodig voor de warp */ /* min en max needed for warp */
if(mode=='G' || mode=='R' || mode=='C') make_trans_verts(min, max, 1); if(mode=='G' || mode=='R' || mode=='C') make_trans_verts(min, max, 1);
else make_trans_verts(min, max, 0); else make_trans_verts(min, max, 0);
} }
@@ -3849,13 +3827,13 @@ void transform(int mode) /* 'g' 'G' 'r' 'R' 's' 'S' 't' or 'w' 'N' */
VECCOPY (centre, centroid); VECCOPY (centre, centroid);
} }
/* moving: onderscheid i.v.m. drawobj */ /* moving: is shown in drawobject() */
if(G.obedit) G.moving= 2; if(G.obedit) G.moving= 2;
else G.moving= 1; else G.moving= 1;
areawinset(curarea->win); areawinset(curarea->win);
/* de persinv is vervuild met translatie, niet gebruiken!! */ /* the persinv is polluted with translation, do not use!! */
Mat3CpyMat4(persmat, G.vd->persmat); Mat3CpyMat4(persmat, G.vd->persmat);
Mat3Inv(persinv, persmat); Mat3Inv(persinv, persmat);
@@ -3877,9 +3855,9 @@ void transform(int mode) /* 'g' 'G' 'r' 'R' 's' 'S' 't' or 'w' 'N' */
project_short_noclip(vec, mval); project_short_noclip(vec, mval);
} }
else { else {
/* voor pannen vanuit cameraview */ /* voor panning from cameraview */
if( G.vd->camera==OBACT && G.vd->persp>1) { if( G.vd->camera==OBACT && G.vd->persp>1) {
/* 6.0 = 6 grideenheden */ /* 6.0 = 6 grid units */
centre[0]+= -6.0*rot2[0]; centre[0]+= -6.0*rot2[0];
centre[1]+= -6.0*rot2[1]; centre[1]+= -6.0*rot2[1];
centre[2]+= -6.0*rot2[2]; centre[2]+= -6.0*rot2[2];
@@ -3939,7 +3917,7 @@ void transform(int mode) /* 'g' 'G' 'r' 'R' 's' 'S' 't' or 'w' 'N' */
centre[1]= (min[1]+max[1])/2.0; centre[1]= (min[1]+max[1])/2.0;
centre[2]= (min[2]+max[2])/2.0; centre[2]= (min[2]+max[2])/2.0;
/* middelpunt is cursor */ /* cursor is centre */
curs= give_cursor(); curs= give_cursor();
VECCOPY(axis, curs); VECCOPY(axis, curs);
Mat4MulVecfl(G.vd->viewmat, axis); Mat4MulVecfl(G.vd->viewmat, axis);
@@ -3967,7 +3945,7 @@ void transform(int mode) /* 'g' 'G' 'r' 'R' 's' 'S' 't' or 'w' 'N' */
if(mval[0]!=xo || mval[1]!=yo || firsttime) { if(mval[0]!=xo || mval[1]!=yo || firsttime) {
if(firsttime) { if(firsttime) {
/* niet zo netjes, maar toch! */ /* not really nice, but who cares! */
oldval[0]= oldval[1]= oldval[2]= MAXFLOAT; oldval[0]= oldval[1]= oldval[2]= MAXFLOAT;
/* proportional precalc */ /* proportional precalc */
@@ -3985,7 +3963,6 @@ void transform(int mode) /* 'g' 'G' 'r' 'R' 's' 'S' 't' or 'w' 'N' */
if(mode=='g' || mode=='G') { if(mode=='g' || mode=='G') {
keyflags |= KEYFLAG_LOC; keyflags |= KEYFLAG_LOC;
/* if(G.edve.first) sphere_intersect_test(); */
if(midtog) { if(midtog) {
if(cameragrab) { if(cameragrab) {
@@ -3993,7 +3970,7 @@ void transform(int mode) /* 'g' 'G' 'r' 'R' 's' 'S' 't' or 'w' 'N' */
dvec[0]-= dx1*G.vd->viewinv[2][0]; dvec[0]-= dx1*G.vd->viewinv[2][0];
dvec[1]-= dx1*G.vd->viewinv[2][1]; dvec[1]-= dx1*G.vd->viewinv[2][1];
dvec[2]-= dx1*G.vd->viewinv[2][2]; dvec[2]-= dx1*G.vd->viewinv[2][2];
firsttime= 1; /* blijftie lopen */ firsttime= 1; /* so it keeps going */
} }
else { else {
window_to_3d(dvec, mval[0]-xn, mval[1]-yn); window_to_3d(dvec, mval[0]-xn, mval[1]-yn);
@@ -4142,10 +4119,10 @@ void transform(int mode) /* 'g' 'G' 'r' 'R' 's' 'S' 't' or 'w' 'N' */
for(a=0; a<tottrans; a++, tob++, tv++) { for(a=0; a<tottrans; a++, tob++, tv++) {
if(transmain) { if(transmain) {
/* rotatie in drie stappen: /* rotation in three steps:
* 1. editrot corrigeren voor parent * 1. editrot correction for parent
* 2. hier de euler uit destilleren. Deze stap moet omdat de MatToEul nogal zwak is * 2. distill from this the euler. Always do this step because MatToEul is pretty weak
* 3. deze vermenigvuldigen met eigen rot, euler berekenen. * 3. multiply with its own rotation, calculate euler.
*/ */
/* Roll around local axis */ /* Roll around local axis */
@@ -4180,11 +4157,11 @@ void transform(int mode) /* 'g' 'G' 'r' 'R' 's' 'S' 't' or 'w' 'N' */
} }
/* 3 */ /* 3 */
/* we werken even met de rot+drot */ /* we now work with rot+drot */
if(tob->ob->transflag & OB_QUAT || !tob->rot) if(tob->ob->transflag & OB_QUAT || !tob->rot)
{ {
/* drot+rot NOG DOEN! */ /* drot+rot TO DO! */
Mat3ToQuat(smat, quat); // Original Mat3ToQuat(smat, quat); // Original
QuatMul(tob->quat, quat, tob->oldquat); QuatMul(tob->quat, quat, tob->oldquat);
@@ -4195,7 +4172,6 @@ void transform(int mode) /* 'g' 'G' 'r' 'R' 's' 'S' 't' or 'w' 'N' */
} }
else { else {
/* VecSubf(rot, eul, tob->olddrot); */ /* VecSubf(rot, eul, tob->olddrot); */
// VecSubf(rot, eul, tob->olddrot);
} }
/* VecMulf(rot, 9.0/M_PI_2); */ /* VecMulf(rot, 9.0/M_PI_2); */
@@ -4208,7 +4184,6 @@ void transform(int mode) /* 'g' 'G' 'r' 'R' 's' 'S' 't' or 'w' 'N' */
} }
else { else {
/* QuatSub(tob->quat, quat, tob->oldquat); */ /* QuatSub(tob->quat, quat, tob->oldquat); */
// QuatSub(tob->quat, quat, tob->oldquat);
} }
} }
else { else {
@@ -4219,8 +4194,8 @@ void transform(int mode) /* 'g' 'G' 'r' 'R' 's' 'S' 't' or 'w' 'N' */
Mat3ToEul(totmat, eul); Mat3ToEul(totmat, eul);
/* Eul mag niet te gek afwijken van oude eul. /* Eul is not allowed to differ too much from old eul.
* Dit is alleen nog maar getest voor dx && dz * This has only been tested for dx && dz
*/ */
compatible_eul(eul, tob->oldrot); compatible_eul(eul, tob->oldrot);
@@ -4255,11 +4230,11 @@ void transform(int mode) /* 'g' 'G' 'r' 'R' 's' 'S' 't' or 'w' 'N' */
} }
if(G.vd->around!=V3D_LOCAL && (!G.obpose)) { if(G.vd->around!=V3D_LOCAL && (!G.obpose)) {
/* translatie */ /* translation */
VecSubf(vec, tob->obvec, centre); VecSubf(vec, tob->obvec, centre);
Mat3MulVecfl(mat, vec); Mat3MulVecfl(mat, vec);
VecAddf(vec, vec, centre); VecAddf(vec, vec, centre);
/* vec is nu de plek waar het object moet komen */ /* vec now is the location where the object has to be */
VecSubf(vec, vec, tob->obvec); VecSubf(vec, vec, tob->obvec);
Mat3MulVecfl(tob->parinv, vec); Mat3MulVecfl(tob->parinv, vec);
@@ -4348,7 +4323,7 @@ void transform(int mode) /* 'g' 'G' 'r' 'R' 's' 'S' 't' or 'w' 'N' */
if(proj==2) size[1]=size[0]= 1.0; if(proj==2) size[1]=size[0]= 1.0;
} }
/* X en Y flip, twee methodes: bij |**| commentaar weghalen maakt flips lokaal */ /* X en Y flip, there are 2 methods: at |**| removing comments makes flips local */
/**/ /* if(transvmain) { */ /**/ /* if(transvmain) { */
@@ -4384,14 +4359,12 @@ void transform(int mode) /* 'g' 'G' 'r' 'R' 's' 'S' 't' or 'w' 'N' */
for(a=0; a<tottrans; a++, tob++, tv++) { for(a=0; a<tottrans; a++, tob++, tv++) {
if(transmain) { if(transmain) {
/* size moet lokaal t.o.v. ouder EN van eigen rotatie */ /* size local with respect to parent AND own rotation */
/* lokaal tov. ouder: */ /* local wrt parent: */
Mat3MulSerie(smat, tob->parmat, mat, tob->parinv, 0, 0,0 ,0, 0); Mat3MulSerie(smat, tob->parmat, mat, tob->parinv, 0, 0,0 ,0, 0);
/* lokaal tov. eigen rot: */ /* local wrt own rotation: */
Mat3MulSerie(totmat, tob->obmat, smat, tob->obinv, 0, 0, 0,0 ,0); Mat3MulSerie(totmat, tob->obmat, smat, tob->obinv, 0, 0, 0,0 ,0);
/* XXX this can yield garbage in case of inverted sizes (< 0.0) /* XXX this can yield garbage in case of inverted sizes (< 0.0)
@@ -4401,7 +4374,7 @@ void transform(int mode) /* 'g' 'G' 'r' 'R' 's' 'S' 't' or 'w' 'N' */
sizelo[1]= size[1]; sizelo[1]= size[1];
sizelo[2]= size[2]; sizelo[2]= size[2];
} else { } else {
/* dan klopt de vorige berekening van de juiste size niet meer precies */ /* in this case the previous calculation of the size is wrong */
sizelo[0]= totmat[0][0]; sizelo[0]= totmat[0][0];
sizelo[1]= totmat[1][1]; sizelo[1]= totmat[1][1];
sizelo[2]= totmat[2][2]; sizelo[2]= totmat[2][2];
@@ -4419,9 +4392,9 @@ void transform(int mode) /* 'g' 'G' 'r' 'R' 's' 'S' 't' or 'w' 'N' */
/* what you see is what you want; not what you get! */ /* what you see is what you want; not what you get! */
/* correctie voor delta size */ /* correction for delta size */
if(tob->flag & TOB_IPO) { if(tob->flag & TOB_IPO) {
/* deltasize berekenen (gelijk voor size en dsize) */ /* calculate delta size (equal for size and dsize) */
vec[0]= (tob->oldsize[0]+tob->olddsize[0])*(sizelo[0] -1.0); vec[0]= (tob->oldsize[0]+tob->olddsize[0])*(sizelo[0] -1.0);
vec[1]= (tob->oldsize[1]+tob->olddsize[1])*(sizelo[1] -1.0); vec[1]= (tob->oldsize[1]+tob->olddsize[1])*(sizelo[1] -1.0);
@@ -4439,11 +4412,11 @@ void transform(int mode) /* 'g' 'G' 'r' 'R' 's' 'S' 't' or 'w' 'N' */
} }
if(G.vd->around!=V3D_LOCAL && !G.obpose) { if(G.vd->around!=V3D_LOCAL && !G.obpose) {
/* translatie */ /* translation */
VecSubf(vec, tob->obvec, centre); VecSubf(vec, tob->obvec, centre);
Mat3MulVecfl(mat, vec); Mat3MulVecfl(mat, vec);
VecAddf(vec, vec, centre); VecAddf(vec, vec, centre);
/* vec is nu de plek waar het object moet komen */ /* vec is the location where the object has to be */
VecSubf(vec, vec, tob->obvec); VecSubf(vec, vec, tob->obvec);
Mat3MulVecfl(tob->parinv, vec); Mat3MulVecfl(tob->parinv, vec);
@@ -4535,7 +4508,7 @@ void transform(int mode) /* 'g' 'G' 'r' 'R' 's' 'S' 't' or 'w' 'N' */
omtrekfac= startomtrekfac+ 0.05*( mval[1] - yn)*Normalise(dvec); omtrekfac= startomtrekfac+ 0.05*( mval[1] - yn)*Normalise(dvec);
/* berekenen hoek voor print */ /* calc angle for print */
dist= max[0]-centre[0]; dist= max[0]-centre[0];
phi0= 360*omtrekfac*dist/(rad*M_PI); phi0= 360*omtrekfac*dist/(rad*M_PI);
@@ -4548,14 +4521,14 @@ void transform(int mode) /* 'g' 'G' 'r' 'R' 's' 'S' 't' or 'w' 'N' */
sprintf(str, "Warp %3.3f", phi0); sprintf(str, "Warp %3.3f", phi0);
headerprint(str); headerprint(str);
/* elke vertex moet apart geroteerd */ /* each vertex transform individually */
tob= transmain; tob= transmain;
tv= transvmain; tv= transvmain;
for(a=0; a<tottrans; a++, tob++, tv++) { for(a=0; a<tottrans; a++, tob++, tv++) {
if(transvmain) { if(transvmain) {
/* punt transleren naar centre, zodanig roteren dat omtrekafstand==afstand */ /* translate point to centre, rotate in such a way that outline==distance */
VECCOPY(vec, tv->oldloc); VECCOPY(vec, tv->oldloc);
Mat4MulVecfl(G.obedit->obmat, vec); Mat4MulVecfl(G.obedit->obmat, vec);
@@ -4812,14 +4785,14 @@ void rightmouse_transform(void)
void single_object_users(int flag) void single_object_users(int flag)
/* hierna wel clear_id_newpoins() aanroepen */ /* after this call clear_id_newpoins() */
{ {
Base *base; Base *base;
Object *ob, *obn; Object *ob, *obn;
clear_sca_new_poins(); /* sensor/contr/act */ clear_sca_new_poins(); /* sensor/contr/act */
/* dupliceren */ /* duplicate */
base= FIRSTBASE; base= FIRSTBASE;
while(base) { while(base) {
ob= base->object; ob= base->object;
@@ -4839,7 +4812,7 @@ void single_object_users(int flag)
ID_NEW(G.scene->camera); ID_NEW(G.scene->camera);
if(G.vd) ID_NEW(G.vd->camera); if(G.vd) ID_NEW(G.vd->camera);
/* evt object pointers */ /* object pointers */
base= FIRSTBASE; base= FIRSTBASE;
while(base) { while(base) {
ob= base->object; ob= base->object;
@@ -5021,7 +4994,7 @@ void single_mat_users(int flag)
for(a=1; a<=ob->totcol; a++) { for(a=1; a<=ob->totcol; a++) {
ma= give_current_material(ob, a); ma= give_current_material(ob, a);
if(ma) { if(ma) {
/* hier niet LIB_NEW testen: deze fie geeft gegarandeerde single_users! */ /* do not test for LIB_NEW: this functions guaranteed delivers single_users! */
if(ma->id.us>1) { if(ma->id.us>1) {
man= copy_material(ma); man= copy_material(ma);
@@ -5075,7 +5048,7 @@ void do_single_tex_user(Tex **from)
void single_tex_users_expand() void single_tex_users_expand()
{ {
/* alleen als 'ouder' blokken LIB_NEW zijn */ /* only when 'parent' blocks are LIB_NEW */
Material *ma; Material *ma;
Lamp *la; Lamp *la;
World *wo; World *wo;
@@ -5119,7 +5092,7 @@ void single_tex_users_expand()
void single_mat_users_expand(void) void single_mat_users_expand(void)
{ {
/* alleen als 'ouder' blokken LIB_NEW zijn */ /* only when 'parent' blocks are LIB_NEW */
Object *ob; Object *ob;
Mesh *me; Mesh *me;
@@ -5192,7 +5165,7 @@ void single_user(void)
else if(nr==3) { else if(nr==3) {
single_object_users(1); single_object_users(1);
single_obdata_users(1); single_obdata_users(1);
single_mat_users(1); /* ook tex */ single_mat_users(1); /* also tex */
} }
else if(nr==4) { else if(nr==4) {
@@ -5219,7 +5192,7 @@ void make_local(void)
ID *id; ID *id;
int a, b, mode; int a, b, mode;
/* LETOP: de functie new_id(..) voegt het id blok opnieuw in!!! */ /* WATCH: the function new_id(..) re-inserts the id block!!! */
if(G.scene->id.lib) return; if(G.scene->id.lib) return;
@@ -5245,7 +5218,7 @@ void make_local(void)
base= base->next; base= base->next;
} }
/* evt object pointers */ /* maybe object pointers */
base= FIRSTBASE; base= FIRSTBASE;
while(base) { while(base) {
ob= base->object; ob= base->object;
@@ -5398,14 +5371,14 @@ void adduplicate(float *dtrans)
basen= MEM_mallocN(sizeof(Base), "duplibase"); basen= MEM_mallocN(sizeof(Base), "duplibase");
*basen= *base; *basen= *base;
BLI_addhead(&G.scene->base, basen); /* addhead: anders oneindige lus */ BLI_addhead(&G.scene->base, basen); /* addhead: prevent eternal loop */
basen->object= obn; basen->object= obn;
base->flag &= ~SELECT; base->flag &= ~SELECT;
basen->flag &= ~OB_FROMGROUP; basen->flag &= ~OB_FROMGROUP;
if(BASACT==base) BASACT= basen; if(BASACT==base) BASACT= basen;
/* duplicates ahv userflags */ /* duplicates using userflags */
if(dupflag & DUPIPO) { if(dupflag & DUPIPO) {
id= (ID *)obn->ipo; id= (ID *)obn->ipo;
@@ -5559,7 +5532,7 @@ void adduplicate(float *dtrans)
base= base->next; base= base->next;
} }
/* evt object pointers */ /* check object pointers */
base= FIRSTBASE; base= FIRSTBASE;
while(base) { while(base) {
if TESTBASELIB(base) { if TESTBASELIB(base) {
@@ -5592,7 +5565,7 @@ void adduplicate(float *dtrans)
base= base->next; base= base->next;
} }
/* materialen */ /* materials */
if( dupflag & DUPMAT) { if( dupflag & DUPMAT) {
mao= G.main->mat.first; mao= G.main->mat.first;
while(mao) { while(mao) {
@@ -5634,8 +5607,8 @@ void adduplicate(float *dtrans)
set_active_base(BASACT); set_active_base(BASACT);
allqueue(REDRAWNLA, 0); allqueue(REDRAWNLA, 0);
allqueue(REDRAWACTION, 0); /* ook oops */ allqueue(REDRAWACTION, 0); /* also oops */
allqueue(REDRAWIPO, 0); /* ook oops */ allqueue(REDRAWIPO, 0); /* also oops */
} }
@@ -5708,7 +5681,7 @@ void selectlinks(void)
void image_aspect(void) void image_aspect(void)
{ {
/* alle geselecteerde objecten die imap hebben: scalen in ima verhouding */ /* all selected objects with an image map: scale in image aspect */
Base *base; Base *base;
Object *ob; Object *ob;
Material *ma; Material *ma;
@@ -5914,7 +5887,7 @@ void auto_timeoffs(void)
if(BASACT==0) return; if(BASACT==0) return;
if(button(&offset, 0, 1000,"Total time")==0) return; if(button(&offset, 0, 1000,"Total time")==0) return;
/* maak array van alle bases, xco yco (scherm) */ /* make array of all bases, xco yco (screen) */
base= FIRSTBASE; base= FIRSTBASE;
while(base) { while(base) {
if(TESTBASELIB(base)) { if(TESTBASELIB(base)) {
@@ -5957,8 +5930,8 @@ void texspace_edit(void)
Base *base; Base *base;
int nr=0; int nr=0;
/* eerst testen of van de zichtbare en geselecteerde ob's /* first test if from visible and selected objects
* wel de texspacedraw aanstaat: * texspacedraw is set:
*/ */
if(G.obedit) return; if(G.obedit) return;
@@ -5975,7 +5948,6 @@ void texspace_edit(void)
return; return;
} }
/* nr= pupmenu("Texture space %t|Grabber%x1|Size%x2|Rotate%x3"); */
nr= pupmenu("Texture space %t|Grabber%x1|Size%x2"); nr= pupmenu("Texture space %t|Grabber%x1|Size%x2");
if(nr<1) return; if(nr<1) return;
@@ -5999,7 +5971,7 @@ void texspace_edit(void)
void first_base(void) void first_base(void)
{ {
/* maakt de select bases los en insert ze aan begin */ /* inserts selected Bases in beginning of list, sometimes useful for operation order */
Base *base, *next; Base *base, *next;
if(okee("make first base")==0) return; if(okee("make first base")==0) return;

View File

@@ -146,7 +146,7 @@ void swap_select_all_oops(void)
oops= oops->next; oops= oops->next;
} }
oops_to_select_objects(); /* ook redr */ oops_to_select_objects(); /* also redraw */
G.soops->lockpoin= 0; G.soops->lockpoin= 0;
} }
@@ -170,7 +170,7 @@ static void deselect_all_oops(void)
G.soops->lockpoin= 0; G.soops->lockpoin= 0;
} }
void set_select_flag_oops(void) /* alle areas */ void set_select_flag_oops(void) /* all areas */
{ {
SpaceOops *so; SpaceOops *so;
ScrArea *sa; ScrArea *sa;
@@ -186,7 +186,7 @@ void set_select_flag_oops(void) /* alle areas */
if(G.soops) G.soops->lockpoin= 0; if(G.soops) G.soops->lockpoin= 0;
} }
void deselect_all_area_oops(void) /* alle areas */ void deselect_all_area_oops(void) /* all areas */
{ {
SpaceOops *so; SpaceOops *so;
Oops *oops; Oops *oops;
@@ -223,7 +223,7 @@ void transform_oops(int mode)
if(G.soops==0) return; if(G.soops==0) return;
/* welke oopsen doen mee */ /* which oopses... */
oops= G.soops->oops.first; oops= G.soops->oops.first;
while(oops) { while(oops) {
if(oops->hide==0) { if(oops->hide==0) {
@@ -433,7 +433,7 @@ void mouse_select_oops(void)
if(G.soops==0) return; if(G.soops==0) return;
/* welke oopsen doen mee */ /* which oopses... */
oops= G.soops->oops.first; oops= G.soops->oops.first;
oops= find_nearest_oops(); oops= find_nearest_oops();
@@ -463,7 +463,7 @@ void mouse_select_oops(void)
G.soops->lockpoin= oops; G.soops->lockpoin= oops;
} }
oops_to_select_objects(); /* ook redr */ oops_to_select_objects(); /* also redraw */
scrarea_queue_headredraw(curarea); scrarea_queue_headredraw(curarea);
force_draw(); force_draw();
@@ -512,7 +512,7 @@ void borderselect_oops(void)
oops= oops->next; oops= oops->next;
} }
oops_to_select_objects(); /* ook redr */ oops_to_select_objects(); /* also redraw */
} }
} }
@@ -562,7 +562,7 @@ void select_linked_oops(void)
oops= oops->next; oops= oops->next;
} }
oops_to_select_objects(); /* ook redr */ oops_to_select_objects(); /* also redraw */
} }
@@ -600,7 +600,7 @@ void select_backlinked_oops(void)
oops= oops->next; oops= oops->next;
} }
oops_to_select_objects(); /* ook redr */ oops_to_select_objects(); /* also redraw */
} }

View File

@@ -105,10 +105,10 @@
/* TIPS: /* TIPS:
* *
* - LET OP DE EDGES, VERTICES ERVAN MOETEN IN VOLGORDE * - WATCH THE EDGES, VERTICES HAVE TO BE IN ORDER...
(laagste pointer eerst). Anders onvoorspelbare effecten! (lowest pointer first). Otherwise unpredictable effects!
* - probleem: flags zijn nog niet echt netjes. Altijd na gebruik * - problem: flags here are not nicely implemented. After usage
op nul zetten. always reset to zero.
*/ */
static void testareas(void); static void testareas(void);
@@ -184,12 +184,12 @@ void setcursor_space(int spacetype, short cur)
/* ********* IN/OUT ************* */ /* ********* IN/OUT ************* */
void getmouseco_sc(short *mval) /* screen coordinaten */ void getmouseco_sc(short *mval) /* screen coordinates */
{ {
getmouse(mval); getmouse(mval);
} }
void getmouseco_areawin(short *mval) /* interne area coordinaten */ void getmouseco_areawin(short *mval) /* internal area coordinates */
{ {
getmouseco_sc(mval); getmouseco_sc(mval);
@@ -199,7 +199,7 @@ void getmouseco_areawin(short *mval) /* interne area coordinaten */
} }
} }
void getmouseco_headwin(short *mval) /* interne area coordinaten */ void getmouseco_headwin(short *mval) /* internal area coordinates */
{ {
getmouseco_sc(mval); getmouseco_sc(mval);
@@ -470,11 +470,11 @@ static void scrarea_dispatch_header_events(ScrArea *sa)
} }
} }
/* test: bestaat window nog */ /* test: does window still exist? */
tempsa= areawinar[sa->headwin]; tempsa= areawinar[sa->headwin];
if(tempsa==0) return; if(tempsa==0) return;
/* dit onderscheid loopt niet lekker... */ /* this functional separation does not work as well as i expected... */
if(do_change) scrarea_do_headchange(sa); if(do_change) scrarea_do_headchange(sa);
if(do_redraw) scrarea_do_headdraw(sa); if(do_redraw) scrarea_do_headdraw(sa);
} }
@@ -503,7 +503,7 @@ static void scrarea_dispatch_events(ScrArea *sa)
if(winqueue_break) return; if(winqueue_break) return;
} }
/* test: bestaat window nog */ /* test: does window still exist */
tempsa= areawinar[sa->win]; tempsa= areawinar[sa->win];
if(tempsa==0) return; if(tempsa==0) return;
@@ -534,8 +534,8 @@ void markdirty_all()
int is_allowed_to_change_screen(bScreen *new) int is_allowed_to_change_screen(bScreen *new)
{ {
/* niet als curscreen is full /* not when curscreen is full
* niet als obedit && old->scene!=new->scene * not when obedit && old->scene!=new->scene
*/ */
if(new==0) return 0; if(new==0) return 0;
@@ -806,7 +806,7 @@ unsigned short screen_qread(short *val, char *ascii)
unsigned short extern_qread_ext(short *val, char *ascii) unsigned short extern_qread_ext(short *val, char *ascii)
{ {
/* bewaart de laatste INPUTCHANGE en de laatste REDRAW */ /* stores last INPUTCHANGE and last REDRAW */
unsigned short event; unsigned short event;
event= screen_qread(val, ascii); event= screen_qread(val, ascii);
@@ -863,7 +863,7 @@ static void screen_dispatch_events(void) {
winqueue_break= 0; winqueue_break= 0;
for (sa= G.curscreen->areabase.first; sa; sa= sa->next) { for (sa= G.curscreen->areabase.first; sa; sa= sa->next) {
/* bewust eerst header afhandelen, dan rest. Header is soms init */ /* first check header, then rest. Header sometimes has initialization code */
if (sa->headwin && bwin_qtest(sa->headwin)) { if (sa->headwin && bwin_qtest(sa->headwin)) {
scrarea_dispatch_header_events(sa); scrarea_dispatch_header_events(sa);
events_remaining= 1; events_remaining= 1;
@@ -1219,12 +1219,12 @@ static void removedouble_scrverts(void)
verg= verg->next; verg= verg->next;
} }
/* vervang pointers in edges en vlakken */ /* replace pointers in edges and faces */
se= G.curscreen->edgebase.first; se= G.curscreen->edgebase.first;
while(se) { while(se) {
if(se->v1->newv) se->v1= se->v1->newv; if(se->v1->newv) se->v1= se->v1->newv;
if(se->v2->newv) se->v2= se->v2->newv; if(se->v2->newv) se->v2= se->v2->newv;
/* edges zijn veranderd: dus.... */ /* edges changed: so.... */
sortscrvert(&(se->v1), &(se->v2)); sortscrvert(&(se->v1), &(se->v2));
se= se->next; se= se->next;
} }
@@ -1237,7 +1237,7 @@ static void removedouble_scrverts(void)
sa= sa->next; sa= sa->next;
} }
/* verwijderen */ /* remove */
verg= G.curscreen->vertbase.first; verg= G.curscreen->vertbase.first;
while(verg) { while(verg) {
v1= verg->next; v1= verg->next;
@@ -1255,7 +1255,7 @@ static void removenotused_scrverts(void)
ScrVert *sv, *svn; ScrVert *sv, *svn;
ScrEdge *se; ScrEdge *se;
/* ga ervan uit dat de edges goed zijn */ /* we assume edges are ok */
se= G.curscreen->edgebase.first; se= G.curscreen->edgebase.first;
while(se) { while(se) {
@@ -1280,7 +1280,7 @@ static void removedouble_scredges(void)
{ {
ScrEdge *verg, *se, *sn; ScrEdge *verg, *se, *sn;
/* vergelijken */ /* compare */
verg= G.curscreen->edgebase.first; verg= G.curscreen->edgebase.first;
while(verg) { while(verg) {
se= verg->next; se= verg->next;
@@ -1302,7 +1302,7 @@ static void removenotused_scredges(void)
ScrArea *sa; ScrArea *sa;
int a=0; int a=0;
/* zet flag als edge gebruikt wordt in area */ /* sets flags when edge is used in area */
sa= G.curscreen->areabase.first; sa= G.curscreen->areabase.first;
while(sa) { while(sa) {
se= screen_findedge(G.curscreen, sa->v1, sa->v2); se= screen_findedge(G.curscreen, sa->v1, sa->v2);
@@ -1359,7 +1359,7 @@ void calc_arearcts(ScrArea *sa)
} }
if(sa->winrct.ymin>sa->winrct.ymax) sa->winrct.ymin= sa->winrct.ymax; if(sa->winrct.ymin>sa->winrct.ymax) sa->winrct.ymin= sa->winrct.ymax;
/* als speedup voor berekeningen */ /* for speedup */
sa->winx= sa->winrct.xmax-sa->winrct.xmin+1; sa->winx= sa->winrct.xmax-sa->winrct.xmin+1;
sa->winy= sa->winrct.ymax-sa->winrct.ymin+1; sa->winy= sa->winrct.ymax-sa->winrct.ymin+1;
} }
@@ -1371,7 +1371,7 @@ static void openheadwin(ScrArea *sa)
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
areawinar[sa->headwin]= sa; /* anders doet addqueue het niet */ areawinar[sa->headwin]= sa; /* oterwise addqueue does not work */
addqueue(sa->headwin, CHANGED, 1); addqueue(sa->headwin, CHANGED, 1);
} }
@@ -1380,7 +1380,7 @@ static void openareawin(ScrArea *sa)
sa->win= myswinopen(G.curscreen->mainwin, sa->win= myswinopen(G.curscreen->mainwin,
sa->winrct.xmin, sa->winrct.xmax, sa->winrct.ymin, sa->winrct.ymax); sa->winrct.xmin, sa->winrct.xmax, sa->winrct.ymin, sa->winrct.ymax);
areawinar[sa->win]= sa; /* anders doet addqueue het niet */ areawinar[sa->win]= sa; /* otherwise addqueue does not work */
addqueue(sa->win, CHANGED, 1); addqueue(sa->win, CHANGED, 1);
} }
@@ -1451,8 +1451,8 @@ static void testareas(void)
{ {
ScrArea *sa; ScrArea *sa;
/* testen of header er moet zijn, of weg moet, of verplaatst */ /* test for header, if removed, or moved */
/* testen of window er moet zijn, of weg moet, of verplaatst */ /* testen for window, if removed, or moved */
for (sa= G.curscreen->areabase.first; sa; sa= sa->next) { for (sa= G.curscreen->areabase.first; sa; sa= sa->next) {
rcti oldhr= sa->headrct; rcti oldhr= sa->headrct;
@@ -1490,14 +1490,14 @@ static void testareas(void)
areawinar[sa->win]= sa; areawinar[sa->win]= sa;
} }
/* test of winakt in orde is */ /* test if winakt is OK */
if( areawinar[G.curscreen->winakt]==0) G.curscreen->winakt= 0; if( areawinar[G.curscreen->winakt]==0) G.curscreen->winakt= 0;
} }
static ScrArea *test_edge_area(ScrArea *sa, ScrEdge *se) static ScrArea *test_edge_area(ScrArea *sa, ScrEdge *se)
{ {
/* test of edge in area ligt, zo niet, /* test if edge is in area, if not,
vind een area die 'm wel heeft */ then find an area that has it */
ScrEdge *se1=0, *se2=0, *se3=0, *se4=0; ScrEdge *se1=0, *se2=0, *se3=0, *se4=0;
@@ -1511,7 +1511,7 @@ static ScrArea *test_edge_area(ScrArea *sa, ScrEdge *se)
sa= G.curscreen->areabase.first; sa= G.curscreen->areabase.first;
while(sa) { while(sa) {
/* een beetje optimaliseren? */ /* a bit optimise? */
if(se->v1==sa->v1 || se->v1==sa->v2 || se->v1==sa->v3 || se->v1==sa->v4) { if(se->v1==sa->v1 || se->v1==sa->v2 || se->v1==sa->v3 || se->v1==sa->v4) {
se1= screen_findedge(G.curscreen, sa->v1, sa->v2); se1= screen_findedge(G.curscreen, sa->v1, sa->v2);
se2= screen_findedge(G.curscreen, sa->v2, sa->v3); se2= screen_findedge(G.curscreen, sa->v2, sa->v3);
@@ -1523,7 +1523,7 @@ static ScrArea *test_edge_area(ScrArea *sa, ScrEdge *se)
} }
} }
return sa; /* is keurig 0 als niet gevonden */ return sa; /* is null when not find */
} }
ScrArea *closest_bigger_area(void) ScrArea *closest_bigger_area(void)
@@ -1543,7 +1543,7 @@ ScrArea *closest_bigger_area(void)
if(sa!=curarea) { if(sa!=curarea) {
if(sa->winy>=curarea->winy) { if(sa->winy>=curarea->winy) {
/* mimimum van vier hoekpunten */ /* mimimum of the 4 corners */
vec[0]= sa->v1->vec.x; vec[1]= sa->v1->vec.y; vec[0]= sa->v1->vec.x; vec[1]= sa->v1->vec.y;
len= VecLenf(vec, cent); len= VecLenf(vec, cent);
vec[0]= sa->v2->vec.x; vec[1]= sa->v2->vec.y; vec[0]= sa->v2->vec.x; vec[1]= sa->v2->vec.y;
@@ -1555,13 +1555,13 @@ ScrArea *closest_bigger_area(void)
len= MIN4(len, len1, len2, len3); len= MIN4(len, len1, len2, len3);
/* plus centrum */ /* plus centre */
vec[0]= (sa->v2->vec.x+sa->v3->vec.x)/2; vec[0]= (sa->v2->vec.x+sa->v3->vec.x)/2;
vec[1]= (sa->v1->vec.y+sa->v2->vec.y)/2; vec[1]= (sa->v1->vec.y+sa->v2->vec.y)/2;
len+= 0.5*VecLenf(vec, cent); len+= 0.5*VecLenf(vec, cent);
/* min afmeting */ /* min size */
len-= sa->winy+sa->winx; len-= sa->winy+sa->winx;
if(len<dist) { if(len<dist) {
@@ -1577,7 +1577,7 @@ ScrArea *closest_bigger_area(void)
else return curarea; else return curarea;
} }
/* ************ SCREENBEHEER ************** */ /* ************ SCREEN MANAGEMENT ************** */
static int statechanged= 0; static int statechanged= 0;
void BIF_wait_for_statechange(void) void BIF_wait_for_statechange(void)
@@ -1644,10 +1644,10 @@ void add_to_mainqueue(Window *win, void *user_data, short evt, short val, char a
mainqenter_ext(evt, val, ascii); mainqenter_ext(evt, val, ascii);
} }
static bScreen *addscreen(char *name) /* gebruik de setprefsize() als je anders dan fullscreen wilt */ static bScreen *addscreen(char *name) /* use setprefsize() if you want something else than a full windpw */
{ {
/* deze functie zet de variabele G.curscreen /* this function sets variabele G.curscreen,
* omdat alle hulpfuncties moeten weten welk screen * that global is about used everywhere!
*/ */
bScreen *sc; bScreen *sc;
ScrVert *sv1, *sv2, *sv3, *sv4; ScrVert *sv1, *sv2, *sv3, *sv4;
@@ -1726,7 +1726,7 @@ void setscreen(bScreen *sc)
ScrArea *sa; ScrArea *sa;
short mval[2]; short mval[2];
if(sc->full) { /* vind de bijhorende full */ if(sc->full) { /* find associated full */
sc1= G.main->screen.first; sc1= G.main->screen.first;
while(sc1) { while(sc1) {
sa= sc1->areabase.first; sa= sc1->areabase.first;
@@ -1739,7 +1739,7 @@ void setscreen(bScreen *sc)
if(sc1==0) printf("setscreen error\n"); if(sc1==0) printf("setscreen error\n");
} }
/* G.curscreen de-activeren */ /* de-activate G.curscreen */
if (G.curscreen && G.curscreen != sc) { if (G.curscreen && G.curscreen != sc) {
sa= G.curscreen->areabase.first; sa= G.curscreen->areabase.first;
while(sa) { while(sa) {
@@ -1785,7 +1785,7 @@ void setscreen(bScreen *sc)
if (sl->spacetype==SPACE_OOPS) { if (sl->spacetype==SPACE_OOPS) {
SpaceOops *soops= (SpaceOops*) sl; SpaceOops *soops= (SpaceOops*) sl;
/* patch als deze in oude files zit */ /* patch for old files */
if (soops->v2d.cur.xmin==soops->v2d.cur.xmax) { if (soops->v2d.cur.xmin==soops->v2d.cur.xmax) {
extern void init_v2d_oops(View2D*); extern void init_v2d_oops(View2D*);
init_v2d_oops(&soops->v2d); init_v2d_oops(&soops->v2d);
@@ -1805,20 +1805,20 @@ void setscreen(bScreen *sc)
mainqenter(DRAWEDGES, 1); mainqenter(DRAWEDGES, 1);
dodrawscreen= 1; /* patch! even gets lost,,,? */ dodrawscreen= 1; /* patch! even gets lost,,,? */
winqueue_break= 1; /* overal uit de queue's gaan */ winqueue_break= 1; /* means leave queue everywhere */
} }
static void splitarea(ScrArea *sa, char dir, float fac); static void splitarea(ScrArea *sa, char dir, float fac);
void area_fullscreen(void) /* met curarea */ void area_fullscreen(void) /* with curarea */
{ {
/* deze funktie toggelt: als area full is wordt de parent weer zichtbaar */ /* this function toggles: if area is full then the parent will be restored */
bScreen *sc, *oldscreen; bScreen *sc, *oldscreen;
ScrArea *newa, *old; ScrArea *newa, *old;
short headertype, fulltype; short headertype, fulltype;
if(curarea->full) { if(curarea->full) {
sc= curarea->full; /* de oude screen */ sc= curarea->full; /* the old screen */
fulltype = sc->full; fulltype = sc->full;
// refuse to go out of SCREENAUTOPLAY as long as G_FLAGS_AUTOPLAY // refuse to go out of SCREENAUTOPLAY as long as G_FLAGS_AUTOPLAY
@@ -1827,7 +1827,7 @@ void area_fullscreen(void) /* met curarea */
if (fulltype != SCREENAUTOPLAY || (G.flags & G_FLAGS_AUTOPLAY) == 0) { if (fulltype != SCREENAUTOPLAY || (G.flags & G_FLAGS_AUTOPLAY) == 0) {
sc->full= 0; sc->full= 0;
/* vind oude area */ /* find old area */
old= sc->areabase.first; old= sc->areabase.first;
while(old) { while(old) {
if(old->full) break; if(old->full) break;
@@ -1858,7 +1858,7 @@ void area_fullscreen(void) /* met curarea */
} }
else { else {
/* is er maar 1 area? */ /* is there only 1 area? */
if(G.curscreen->areabase.first==G.curscreen->areabase.last) return; if(G.curscreen->areabase.first==G.curscreen->areabase.last) return;
if(curarea->spacetype==SPACE_INFO) return; if(curarea->spacetype==SPACE_INFO) return;
@@ -1866,16 +1866,16 @@ void area_fullscreen(void) /* met curarea */
old= curarea; old= curarea;
oldscreen= G.curscreen; oldscreen= G.curscreen;
sc= addscreen("temp"); /* deze zet G.curscreen */ sc= addscreen("temp"); /* this sets G.curscreen */
splitarea( (ScrArea *)sc->areabase.first, 'h', 0.99); splitarea( (ScrArea *)sc->areabase.first, 'h', 0.99);
newa= sc->areabase.first; newa= sc->areabase.first;
newspace(newa->next, SPACE_INFO); newspace(newa->next, SPACE_INFO);
curarea= old; curarea= old;
G.curscreen= oldscreen; /* moet voor setscreen */ G.curscreen= oldscreen; /* needed because of setscreen */
/* area kopieeren */ /* vopy area */
copy_areadata(newa, curarea); copy_areadata(newa, curarea);
curarea->full= oldscreen; curarea->full= oldscreen;
@@ -1911,12 +1911,12 @@ static void area_autoplayscreen(void)
old= curarea; old= curarea;
oldscreen= G.curscreen; oldscreen= G.curscreen;
sc= addscreen("temp"); /* deze zet G.curscreen */ sc= addscreen("temp"); /* this sets G.curscreen */
newa= sc->areabase.first; newa= sc->areabase.first;
curarea= old; curarea= old;
G.curscreen= oldscreen; /* moet voor setscreen */ G.curscreen= oldscreen; /* because of setscreen */
/* copy area settings */ /* copy area settings */
copy_areadata(newa, curarea); copy_areadata(newa, curarea);
@@ -1937,10 +1937,10 @@ static void copy_screen(bScreen *to, bScreen *from)
ScrEdge *se; ScrEdge *se;
ScrArea *sa; ScrArea *sa;
ListBase lbase; ListBase lbase;
/* alles van to vrijgeven */ /* free 'to' */
free_screen(to); free_screen(to);
winqueue_break= 1; /* overal uit queue's gaan */ winqueue_break= 1; /* leave queues everywhere */
duplicatelist(&to->vertbase, &from->vertbase); duplicatelist(&to->vertbase, &from->vertbase);
duplicatelist(&to->edgebase, &from->edgebase); duplicatelist(&to->edgebase, &from->edgebase);
@@ -1978,7 +1978,7 @@ static void copy_screen(bScreen *to, bScreen *from)
sa= sa->next; sa= sa->next;
} }
/* op nul zetten (nodig?) */ /* put at zero (needed?) */
s1= from->vertbase.first; s1= from->vertbase.first;
while(s1) { while(s1) {
s1->newv= 0; s1->newv= 0;
@@ -1992,10 +1992,10 @@ void duplicate_screen(void)
if(G.curscreen->full != SCREENNORMAL) return; if(G.curscreen->full != SCREENNORMAL) return;
/* nieuw screen maken: */ /* make new screen: */
oldscreen= G.curscreen; oldscreen= G.curscreen;
sc= addscreen(oldscreen->id.name+2); /* deze zet G.curscreen */ sc= addscreen(oldscreen->id.name+2); /* this sets G.curscreen */
copy_screen(sc, oldscreen); copy_screen(sc, oldscreen);
G.curscreen= oldscreen; G.curscreen= oldscreen;
@@ -2004,7 +2004,7 @@ void duplicate_screen(void)
} }
/* ************ END SCREENBEHEER ************** */ /* ************ END SCREEN MANAGEMENT ************** */
/* ************ JOIN/SPLIT/MOVE ************** */ /* ************ JOIN/SPLIT/MOVE ************** */
static void joinarea(ScrArea *sa, ScrEdge *onedge) static void joinarea(ScrArea *sa, ScrEdge *onedge)
@@ -2017,8 +2017,8 @@ static void joinarea(ScrArea *sa, ScrEdge *onedge)
sa= test_edge_area(sa, onedge); sa= test_edge_area(sa, onedge);
if (sa==0) return; if (sa==0) return;
/* welke edges kunnen ermee? */ /* which edges? */
/* vind richtingen met zelfde edge */ /* find directions with same edge */
sa2= G.curscreen->areabase.first; sa2= G.curscreen->areabase.first;
while(sa2) { while(sa2) {
if(sa2 != sa) { if(sa2 != sa) {
@@ -2052,7 +2052,7 @@ static void joinarea(ScrArea *sa, ScrEdge *onedge)
if(sa2) { if(sa2) {
/* nieuwe area is oude sa */ /* new area is old sa */
if(sa2==left) { if(sa2==left) {
sa->v1= sa2->v1; sa->v1= sa2->v1;
sa->v2= sa2->v2; sa->v2= sa2->v2;
@@ -2078,7 +2078,7 @@ static void joinarea(ScrArea *sa, ScrEdge *onedge)
screen_addedge(G.curscreen, sa->v3, sa->v4); screen_addedge(G.curscreen, sa->v3, sa->v4);
} }
/* edge en area weg */ /* remove edge and area */
/* remlink(&G.curscreen->edgebase, setest); */ /* remlink(&G.curscreen->edgebase, setest); */
/* freeN(setest); */ /* freeN(setest); */
del_area(sa2); del_area(sa2);
@@ -2087,7 +2087,7 @@ static void joinarea(ScrArea *sa, ScrEdge *onedge)
removedouble_scredges(); removedouble_scredges();
removenotused_scredges(); removenotused_scredges();
removenotused_scrverts(); /* moet als laatste */ removenotused_scrverts(); /* as last */
testareas(); testareas();
mainqenter(DRAWEDGES, 1); mainqenter(DRAWEDGES, 1);
@@ -2097,16 +2097,16 @@ static void joinarea(ScrArea *sa, ScrEdge *onedge)
} }
static short testsplitpoint(ScrArea *sa, char dir, float fac) static short testsplitpoint(ScrArea *sa, char dir, float fac)
/* return 0: geen split mogelijk */ /* return 0: no split possible */
/* else return (integer) screencoordinaat splitpunt */ /* else return (integer) screencoordinate split point */
{ {
short x, y; short x, y;
/* area groot genoeg? */ /* area big enough? */
if(sa->v4->vec.x- sa->v1->vec.x <= 2*AREAMINX) return 0; if(sa->v4->vec.x- sa->v1->vec.x <= 2*AREAMINX) return 0;
if(sa->v2->vec.y- sa->v1->vec.y <= 2*AREAMINY) return 0; if(sa->v2->vec.y- sa->v1->vec.y <= 2*AREAMINY) return 0;
/* voor zekerheid */ /* to be sure */
if(fac<0.0) fac= 0.0; if(fac<0.0) fac= 0.0;
if(fac>1.0) fac= 1.0; if(fac>1.0) fac= 1.0;
@@ -2152,54 +2152,54 @@ static void splitarea(ScrArea *sa, char dir, float fac)
areawinset(sa->win); areawinset(sa->win);
if(dir=='h') { if(dir=='h') {
/* nieuwe vertices */ /* new vertices */
sv1= screen_addvert(sc, sa->v1->vec.x, split); sv1= screen_addvert(sc, sa->v1->vec.x, split);
sv2= screen_addvert(sc, sa->v4->vec.x, split); sv2= screen_addvert(sc, sa->v4->vec.x, split);
/* nieuwe edges */ /* new edges */
screen_addedge(sc, sa->v1, sv1); screen_addedge(sc, sa->v1, sv1);
screen_addedge(sc, sv1, sa->v2); screen_addedge(sc, sv1, sa->v2);
screen_addedge(sc, sa->v3, sv2); screen_addedge(sc, sa->v3, sv2);
screen_addedge(sc, sv2, sa->v4); screen_addedge(sc, sv2, sa->v4);
screen_addedge(sc, sv1, sv2); screen_addedge(sc, sv1, sv2);
/* nieuwe areas: boven */ /* new areas: top */
newa= screen_addarea(sc, sv1, sa->v2, sa->v3, sv2, sa->headertype, sa->spacetype); newa= screen_addarea(sc, sv1, sa->v2, sa->v3, sv2, sa->headertype, sa->spacetype);
copy_areadata(newa, sa); copy_areadata(newa, sa);
/* area onder */ /* area below */
sa->v2= sv1; sa->v2= sv1;
sa->v3= sv2; sa->v3= sv2;
} }
else { else {
/* nieuwe vertices */ /* new vertices */
sv1= screen_addvert(sc, split, sa->v1->vec.y); sv1= screen_addvert(sc, split, sa->v1->vec.y);
sv2= screen_addvert(sc, split, sa->v2->vec.y); sv2= screen_addvert(sc, split, sa->v2->vec.y);
/* nieuwe edges */ /* new edges */
screen_addedge(sc, sa->v1, sv1); screen_addedge(sc, sa->v1, sv1);
screen_addedge(sc, sv1, sa->v4); screen_addedge(sc, sv1, sa->v4);
screen_addedge(sc, sa->v2, sv2); screen_addedge(sc, sa->v2, sv2);
screen_addedge(sc, sv2, sa->v3); screen_addedge(sc, sv2, sa->v3);
screen_addedge(sc, sv1, sv2); screen_addedge(sc, sv1, sv2);
/* nieuwe areas: links */ /* new areas: left */
newa= screen_addarea(sc, sa->v1, sa->v2, sv2, sv1, sa->headertype, sa->spacetype); newa= screen_addarea(sc, sa->v1, sa->v2, sv2, sv1, sa->headertype, sa->spacetype);
copy_areadata(newa, sa); copy_areadata(newa, sa);
/* area rechts */ /* area right */
sa->v1= sv1; sa->v1= sv1;
sa->v2= sv2; sa->v2= sv2;
} }
/* dubbele vertices en edges verwijderen */ /* remove double vertices en edges */
removedouble_scrverts(); removedouble_scrverts();
removedouble_scredges(); removedouble_scredges();
removenotused_scredges(); removenotused_scredges();
mainqenter(DRAWEDGES, 1); mainqenter(DRAWEDGES, 1);
dodrawscreen= 1; /* patch! even gets lost,,,? */ dodrawscreen= 1; /* patch! event gets lost,,,? */
testareas(); testareas();
} }
@@ -2232,9 +2232,9 @@ static void splitarea_interactive(ScrArea *area, ScrEdge *onedge)
dir= scredge_is_horizontal(onedge)?'v':'h'; dir= scredge_is_horizontal(onedge)?'v':'h';
mywinset(G.curscreen->mainwin); mywinset(G.curscreen->mainwin);
/* hoort al goede matrix te hebben */ /* should already have a good matrix */
/* rekening houden met grid en minsize */ /* keep track of grid and minsize */
while(ok==0) { while(ok==0) {
getmouseco_sc(mval); getmouseco_sc(mval);
@@ -2287,7 +2287,7 @@ static void splitarea_interactive(ScrArea *area, ScrEdge *onedge)
if(ok==1) { if(ok==1) {
splitarea(sa, dir, fac); splitarea(sa, dir, fac);
mainqenter(DRAWEDGES, 1); mainqenter(DRAWEDGES, 1);
dodrawscreen= 1; /* patch! even gets lost,,,? */ dodrawscreen= 1; /* patch! event gets lost,,,? */
} }
} }
@@ -2335,8 +2335,8 @@ static void select_connected_scredge(bScreen *sc, ScrEdge *edge)
int oneselected; int oneselected;
char dir; char dir;
/* select connected, alleen in de juiste richting */ /* select connected, only in the right direction */
/* 'dir' is de richting van de EDGE */ /* 'dir' is the direction of EDGE */
if(edge->v1->vec.x==edge->v2->vec.x) dir= 'v'; if(edge->v1->vec.x==edge->v2->vec.x) dir= 'v';
else dir= 'h'; else dir= 'h';
@@ -2371,8 +2371,8 @@ static void select_connected_scredge(bScreen *sc, ScrEdge *edge)
} }
void test_scale_screen(bScreen *sc) void test_scale_screen(bScreen *sc)
/* testen of screenvertices vergroot/verkleind moeten worden */ /* test if screen vertices should be scaled */
/* testen of offset nog klopt */ /* also check offset */
{ {
ScrVert *sv=0; ScrVert *sv=0;
ScrEdge *se; ScrEdge *se;
@@ -2523,12 +2523,12 @@ static void moveareas(ScrEdge *edge)
} }
} }
/* nu zijn alle vertices met 'flag==1' degene die verplaatst kunnen worden. */ /* now all verices with 'flag==1' are the ones that can be moved. */
/* we lopen de areas af en testen vrije ruimte met MINSIZE */ /* we check all areas and test for free space with MINSIZE */
bigger= smaller= 10000; bigger= smaller= 10000;
sa= G.curscreen->areabase.first; sa= G.curscreen->areabase.first;
while(sa) { while(sa) {
if(dir=='h') { /* als top of down edge select, test hoogte */ if(dir=='h') { /* if top or down edge selected, test height */
if(sa->headertype) { if(sa->headertype) {
headery= HEADERY; headery= HEADERY;
areaminy= AREAMINY; areaminy= AREAMINY;
@@ -2540,7 +2540,7 @@ static void moveareas(ScrEdge *edge)
if(sa->v1->flag && sa->v4->flag) { if(sa->v1->flag && sa->v4->flag) {
int y1; int y1;
if(sa->v2->vec.y==G.curscreen->sizey-1) /* bovenste edge */ if(sa->v2->vec.y==G.curscreen->sizey-1) /* top edge */
y1= sa->v2->vec.y - sa->v1->vec.y-headery-EDGEWIDTH; y1= sa->v2->vec.y - sa->v1->vec.y-headery-EDGEWIDTH;
else else
y1= sa->v2->vec.y - sa->v1->vec.y-areaminy; y1= sa->v2->vec.y - sa->v1->vec.y-areaminy;
@@ -2548,14 +2548,14 @@ static void moveareas(ScrEdge *edge)
} }
else if(sa->v2->flag && sa->v3->flag) { else if(sa->v2->flag && sa->v3->flag) {
int y1; int y1;
if(sa->v1->vec.y==0) /* onderste edge */ if(sa->v1->vec.y==0) /* bottom edge */
y1= sa->v2->vec.y - sa->v1->vec.y-headery-EDGEWIDTH; y1= sa->v2->vec.y - sa->v1->vec.y-headery-EDGEWIDTH;
else else
y1= sa->v2->vec.y - sa->v1->vec.y-areaminy; y1= sa->v2->vec.y - sa->v1->vec.y-areaminy;
smaller= MIN2(smaller, y1); smaller= MIN2(smaller, y1);
} }
} }
else { /* als left of right edge select, test breedte */ else { /* if left or right edge selected, test width */
if(sa->v1->flag && sa->v2->flag) { if(sa->v1->flag && sa->v2->flag) {
int x1= sa->v4->vec.x - sa->v1->vec.x-AREAMINX; int x1= sa->v4->vec.x - sa->v1->vec.x-AREAMINX;
bigger= MIN2(bigger, x1); bigger= MIN2(bigger, x1);
@@ -2602,7 +2602,7 @@ static void moveareas(ScrEdge *edge)
if (doit==1) { if (doit==1) {
for (v1= G.curscreen->vertbase.first; v1; v1= v1->next) { for (v1= G.curscreen->vertbase.first; v1; v1= v1->next) {
if (v1->flag) { if (v1->flag) {
/* zo is AREAGRID netjes */ /* that way a nice AREAGRID */
if((dir=='v') && v1->vec.x>0 && v1->vec.x<G.curscreen->sizex-1) { if((dir=='v') && v1->vec.x>0 && v1->vec.x<G.curscreen->sizex-1) {
v1->vec.x+= delta; v1->vec.x+= delta;
if(delta != bigger && delta != -smaller) v1->vec.x-= (v1->vec.x % AREAGRID); if(delta != bigger && delta != -smaller) v1->vec.x-= (v1->vec.x % AREAGRID);
@@ -2628,7 +2628,7 @@ static void moveareas(ScrEdge *edge)
glDrawBuffer(GL_BACK); glDrawBuffer(GL_BACK);
mainqenter(DRAWEDGES, 1); mainqenter(DRAWEDGES, 1);
dodrawscreen= 1; /* patch! even gets lost,,,? */ dodrawscreen= 1; /* patch! event gets lost,,,? */
} }
static void scrollheader(ScrArea *area) static void scrollheader(ScrArea *area)
@@ -2666,8 +2666,8 @@ static void scrollheader(ScrArea *area)
int select_area(int spacetype) int select_area(int spacetype)
{ {
/* vanuit editroutines aanroepen, als er meer area's /* call from edit routines, when there are more areas
* zijn van type 'spacetype' kan er een area aangegeven worden * of type 'spacetype', you can indicate an area manually
*/ */
ScrArea *sa, *sact = NULL; ScrArea *sa, *sact = NULL;
int tot=0; int tot=0;
@@ -2789,9 +2789,9 @@ static void drawscredge(ScrEdge *se)
v1= &(se->v1->vec); v1= &(se->v1->vec);
v2= &(se->v2->vec); v2= &(se->v2->vec);
/* borders screen niet tekenen */ /* do not draw borders screen<EFBFBD> */
/* vanwege resolutie verschillen (PC/SGI files) de linit een /* bcause of different framebuffer resoltions (PC/SGI etc files)
* beetje afronden? * a bit rounding here? should be looked at further...
*/ */
se->border= 1; se->border= 1;
if(v1->x<=1 && v2->x<=1) return; if(v1->x<=1 && v2->x<=1) return;