For solid display of curves in editmode; found fix (thnx intrr :) that

hopefully prevents weird results in grabber... error was that the
editNurb was not used for triangulating.

Also; added drawing the wire as extra in solid display editing curves...
that for unfilled curves as well.
This commit is contained in:
Ton Roosendaal 2004-10-30 20:46:10 +00:00
parent 9968d2b5ba
commit d292541cac
5 changed files with 27 additions and 15 deletions

@ -116,7 +116,7 @@ extern DispList *find_displist_create(struct ListBase *lb, int type);
extern DispList *find_displist(struct ListBase *lb, int type); extern DispList *find_displist(struct ListBase *lb, int type);
extern void addnormalsDispList(struct Object *ob, struct ListBase *lb); extern void addnormalsDispList(struct Object *ob, struct ListBase *lb);
extern void count_displist(struct ListBase *lb, int *totvert, int *totface); extern void count_displist(struct ListBase *lb, int *totvert, int *totface);
extern void curve_to_filledpoly(struct Curve *cu, struct ListBase *dispbase); extern void curve_to_filledpoly(struct Curve *cu, struct ListBase *nurb, struct ListBase *dispbase);
extern void freedisplist(struct ListBase *lb); extern void freedisplist(struct ListBase *lb);
extern int displist_has_faces(struct ListBase *lb); extern int displist_has_faces(struct ListBase *lb);
extern float calc_taper(struct Object *taperobj, int cur, int tot); extern float calc_taper(struct Object *taperobj, int cur, int tot);

@ -1669,7 +1669,7 @@ static void bevels_to_filledpoly(Curve *cu, ListBase *dispbase)
} }
void curve_to_filledpoly(Curve *cu, ListBase *dispbase) void curve_to_filledpoly(Curve *cu, ListBase *nurb, ListBase *dispbase)
{ {
DispList *dl; DispList *dl;
Nurb *nu; Nurb *nu;
@ -1678,7 +1678,7 @@ void curve_to_filledpoly(Curve *cu, ListBase *dispbase)
if(cu->flag & CU_3D) return; if(cu->flag & CU_3D) return;
nu= cu->nurb.first; nu= nurb->first;
while(nu) { while(nu) {
if(nu->flagu & CU_CYCLIC) break; if(nu->flagu & CU_CYCLIC) break;
nu= nu->next; nu= nu->next;

@ -962,7 +962,7 @@ void nurbs_to_mesh(Object *ob)
/* rule: dl->type INDEX3 always as first in list */ /* rule: dl->type INDEX3 always as first in list */
dl= cu->disp.first; dl= cu->disp.first;
if(dl->type!=DL_INDEX3) { if(dl->type!=DL_INDEX3) {
curve_to_filledpoly(ob->data, &cu->disp); curve_to_filledpoly(ob->data, &cu->nurb, &cu->disp);
} }
} }

@ -2202,7 +2202,7 @@ static void init_render_curve(Object *ob)
if(cu->disp.first==0) return; if(cu->disp.first==0) return;
if(dl->type!=DL_INDEX3) { if(dl->type!=DL_INDEX3) {
curve_to_filledpoly(cu, &cu->disp); curve_to_filledpoly(cu, &cu->nurb, &cu->disp);
} }
if(cu->bev.first==0) makeBevelList(ob); if(cu->bev.first==0) makeBevelList(ob);

@ -2153,6 +2153,7 @@ static void drawDispList(Object *ob, int dt)
ListBase *lb=0; ListBase *lb=0;
DispList *dl; DispList *dl;
Mesh *me; Mesh *me;
Curve *cu;
int solid; int solid;
@ -2269,8 +2270,9 @@ static void drawDispList(Object *ob, int dt)
case OB_FONT: case OB_FONT:
case OB_CURVE: case OB_CURVE:
cu= ob->data;
lb= &((Curve *)ob->data)->disp; lb= &cu->disp;
if(lb->first==0) makeDispList(ob); if(lb->first==0) makeDispList(ob);
if(solid) { if(solid) {
@ -2279,7 +2281,9 @@ static void drawDispList(Object *ob, int dt)
/* rule: dl->type INDEX3 is always first in list */ /* rule: dl->type INDEX3 is always first in list */
if(dl->type!=DL_INDEX3) { if(dl->type!=DL_INDEX3) {
curve_to_filledpoly(ob->data, lb); if(ob==G.obedit) curve_to_filledpoly(ob->data, &editNurb, lb);
else curve_to_filledpoly(ob->data, &cu->nurb, lb);
dl= lb->first; dl= lb->first;
} }
if(dl->nors==0) addnormalsDispList(ob, lb); if(dl->nors==0) addnormalsDispList(ob, lb);
@ -2291,7 +2295,8 @@ static void drawDispList(Object *ob, int dt)
drawDispListwire(lb); drawDispListwire(lb);
draw_index_wire= 1; draw_index_wire= 1;
} }
else if(dt==OB_SHADED) { else {
if(dt==OB_SHADED) {
if(ob->disp.first==0) shadeDispList(ob); if(ob->disp.first==0) shadeDispList(ob);
drawDispListshaded(lb, ob); drawDispListshaded(lb, ob);
} }
@ -2300,6 +2305,13 @@ static void drawDispList(Object *ob, int dt)
two_sided(0); two_sided(0);
drawDispListsolid(lb, ob); drawDispListsolid(lb, ob);
} }
if(ob==G.obedit) {
cpack(0);
draw_index_wire= 0;
drawDispListwire(lb);
draw_index_wire= 1;
}
}
index3_nors_incr= 1; index3_nors_incr= 1;
} }
else { else {