The overlapping curves/material indices problem got a bit out of control.

- For avoiding the 'overlapping character problem' in Text objects, I had
   changed the sorting code for filling nurbs to use nu->charidx (a new
   variable incremented with each new character) instead of nu->mat_nr
   (which used to work for material indices inside a 2D Curve).

 - This broke material indices in normal 2D Curves completely, thus:

 - nu->charidx is now not only used for seperating
   characters in text objects for filling, but also for normal 2D curves
   when they contain material indices. In fact, charidx is just set to
   the material index.

 - There's compatibility code in readfile.c that sets nu->charidx to nu->mat_nr
   when reading curves from files that are not text objects

 - So, the big conclusion: Instead of using material indices for creating
   'filling groups', filldisplist() now uses nu->charidx, which is set
   appropriately when reading old files and assigning/deleting material
   indices in curves.

 - This is all pretty obscure and hard to explain. If I haven't been clear,
   ask.

 - If it breaks anything, complain!
This commit is contained in:
Alexander Ewering
2005-06-25 22:51:51 +00:00
parent da76fc6e03
commit 08169d7fba
5 changed files with 9 additions and 5 deletions

View File

@@ -503,7 +503,7 @@ struct chartrans *text_to_curve(Object *ob, int mode)
}
if (ascii==32) wsfac = cu->wordspace; else wsfac = 1.0;
xof += (vfd->width[ascii]*wsfac*(1.0+(info->kern/20.0)) ) + xtrax;
xof += (vfd->width[ascii]*wsfac*(1.0+(info->kern/40.0)) ) + xtrax;
if (selboxes && (i>=selstart) && (i<=selend)) sb->w = (xof*cu->fsize) - sb->w;
}

View File

@@ -744,7 +744,10 @@ void delete_material_index()
nu= cu->nurb.first;
while(nu) {
if(nu->mat_nr && nu->mat_nr>=actcol-1) nu->mat_nr--;
if(nu->mat_nr && nu->mat_nr>=actcol-1) {
nu->mat_nr--;
if (ob->type == OB_CURVE) nu->charidx--;
}
nu= nu->next;
}
makeDispList(ob);

View File

@@ -1958,6 +1958,7 @@ static void direct_link_curve(FileData *fd, Curve *cu)
nu->bp= newdataadr(fd, nu->bp);
nu->knotsu= newdataadr(fd, nu->knotsu);
nu->knotsv= newdataadr(fd, nu->knotsv);
if (cu->vfont==0) nu->charidx= nu->mat_nr;
if(fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
switch_endian_knots(nu);

View File

@@ -475,7 +475,7 @@ void do_common_editbuts(unsigned short event) // old name, is a mix of object an
nu= editNurb.first;
while(nu) {
if( isNurbsel(nu) )
nu->mat_nr= G.obedit->actcol-1;
nu->mat_nr= nu->charidx= G.obedit->actcol-1;
nu= nu->next;
}
}

View File

@@ -700,7 +700,7 @@ void do_textedit(unsigned short event, short val, char _ascii)
else if (G.qual & LR_ALTKEY) {
kern = textbufinfo[cu->pos-1].kern;
kern += 1;
if (kern>10) kern = 10;
if (kern>20) kern = 20;
textbufinfo[cu->pos-1].kern = kern;
doit = 1;
}
@@ -720,7 +720,7 @@ void do_textedit(unsigned short event, short val, char _ascii)
else if (G.qual & LR_ALTKEY) {
kern = textbufinfo[cu->pos-1].kern;
kern -= 1;
if (kern<-10) kern = -10;
if (kern<-20) kern = -20;
textbufinfo[cu->pos-1].kern = kern;
doit = 1;
}