Old fixes, since 2009 and before! Related to Curve object editmode:

- normals are not being drawn for hidden curves anymore
- even worse: Blender also didn't hide the extrusions or bevels for hidden curves
- outside edit mode, it shows all (as for all other modes)
- (de)select-all now works when 1st (or any) handle was hidden.
This commit is contained in:
2013-01-15 15:42:12 +00:00
parent e20dfbca6d
commit 73c7c10c6e
4 changed files with 56 additions and 15 deletions

View File

@@ -2220,6 +2220,7 @@ void BKE_curve_bevelList_make(Object *ob)
struct bevelsort *sortdata, *sd, *sd1; struct bevelsort *sortdata, *sd, *sd1;
int a, b, nr, poly, resolu = 0, len = 0; int a, b, nr, poly, resolu = 0, len = 0;
int do_tilt, do_radius, do_weight; int do_tilt, do_radius, do_weight;
int is_editmode = 0;
/* this function needs an object, because of tflag and upflag */ /* this function needs an object, because of tflag and upflag */
cu = ob->data; cu = ob->data;
@@ -2233,12 +2234,17 @@ void BKE_curve_bevelList_make(Object *ob)
if (cu->editnurb && ob->type != OB_FONT) { if (cu->editnurb && ob->type != OB_FONT) {
ListBase *nurbs = BKE_curve_editNurbs_get(cu); ListBase *nurbs = BKE_curve_editNurbs_get(cu);
nu = nurbs->first; nu = nurbs->first;
is_editmode = 1;
} }
else { else {
nu = cu->nurb.first; nu = cu->nurb.first;
} }
while (nu) { for (; nu; nu = nu->next) {
if (nu->hide && is_editmode)
continue;
/* check if we will calculate tilt data */ /* check if we will calculate tilt data */
do_tilt = CU_DO_TILT(cu, nu); do_tilt = CU_DO_TILT(cu, nu);
do_radius = CU_DO_RADIUS(cu, nu); /* normal display uses the radius, better just to calculate them */ do_radius = CU_DO_RADIUS(cu, nu); /* normal display uses the radius, better just to calculate them */
@@ -2384,7 +2390,6 @@ void BKE_curve_bevelList_make(Object *ob)
} }
} }
} }
nu = nu->next;
} }
/* STEP 2: DOUBLE POINTS AND AUTOMATIC RESOLUTION, REDUCE DATABLOCKS */ /* STEP 2: DOUBLE POINTS AND AUTOMATIC RESOLUTION, REDUCE DATABLOCKS */

View File

@@ -309,10 +309,11 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase, i
BPoint *bp; BPoint *bp;
float *data; float *data;
int a, len, resolu; int a, len, resolu;
const int editmode = (!forRender && (cu->editnurb || cu->editfont));
nu = nubase->first; nu = nubase->first;
while (nu) { while (nu) {
if (nu->hide == 0) { if (nu->hide == 0 || editmode == 0) {
if (forRender && cu->resolu_ren != 0) if (forRender && cu->resolu_ren != 0)
resolu = cu->resolu_ren; resolu = cu->resolu_ren;
else else

View File

@@ -1279,8 +1279,24 @@ void CU_deselect_all(Object *obedit)
ListBase *editnurb = object_editcurve_get(obedit); ListBase *editnurb = object_editcurve_get(obedit);
if (editnurb) { if (editnurb) {
selectend_nurb(obedit, FIRST, 0, DESELECT); /* set first control points as unselected */ Nurb *nu;
select_adjacent_cp(editnurb, 1, 1, DESELECT); /* cascade selection */ int a;
for (nu = editnurb->first; nu; nu = nu->next) {
if (nu->bezt) {
BezTriple *bezt;
for (bezt = nu->bezt, a = 0; a < nu->pntsu; a++, bezt++) {
bezt->f1 &= ~SELECT;
bezt->f2 &= ~SELECT;
bezt->f3 &= ~SELECT;
}
}
else if (nu->bp) {
BPoint *bp;
for (bp = nu->bp, a = 0; a < nu->pntsu * nu->pntsv; a++, bp++) {
bp->f1 & ~SELECT;
}
}
}
} }
} }
@@ -1289,8 +1305,27 @@ void CU_select_all(Object *obedit)
ListBase *editnurb = object_editcurve_get(obedit); ListBase *editnurb = object_editcurve_get(obedit);
if (editnurb) { if (editnurb) {
selectend_nurb(obedit, FIRST, 0, SELECT); /* set first control points as unselected */ Nurb *nu;
select_adjacent_cp(editnurb, 1, 1, SELECT); /* cascade selection */ int a;
for (nu = editnurb->first; nu; nu = nu->next) {
if (nu->bezt) {
BezTriple *bezt;
for (bezt = nu->bezt, a = 0; a < nu->pntsu; a++, bezt++) {
if (bezt->hide == 0) {
bezt->f1 |= SELECT;
bezt->f2 |= SELECT;
bezt->f3 |= SELECT;
}
}
}
else if (nu->bp) {
BPoint *bp;
for (bp = nu->bp, a = 0; a < nu->pntsu * nu->pntsv; a++, bp++) {
if (bp->hide == 0)
bp->f1 |= SELECT;
}
}
}
} }
} }

View File

@@ -4911,7 +4911,7 @@ static void ob_draw_RE_motion(float com[3], float rotscale[3][3], float itw, flo
/*place to add drawers */ /*place to add drawers */
static void tekenhandlesN(Nurb *nu, short sel, short hide_handles) static void drawhandlesN(Nurb *nu, short sel, short hide_handles)
{ {
BezTriple *bezt; BezTriple *bezt;
float *fp; float *fp;
@@ -4971,7 +4971,7 @@ static void tekenhandlesN(Nurb *nu, short sel, short hide_handles)
glEnd(); glEnd();
} }
static void tekenhandlesN_active(Nurb *nu) static void drawhandlesN_active(Nurb *nu)
{ {
BezTriple *bezt; BezTriple *bezt;
float *fp; float *fp;
@@ -5006,7 +5006,7 @@ static void tekenhandlesN_active(Nurb *nu)
glLineWidth(1); glLineWidth(1);
} }
static void tekenvertsN(Nurb *nu, short sel, short hide_handles, void *lastsel) static void drawvertsN(Nurb *nu, short sel, short hide_handles, void *lastsel)
{ {
BezTriple *bezt; BezTriple *bezt;
BPoint *bp; BPoint *bp;
@@ -5286,8 +5286,8 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
for (nu = nurb; nu; nu = nu->next) { for (nu = nurb; nu; nu = nu->next) {
if (nu->type == CU_BEZIER) { if (nu->type == CU_BEZIER) {
if (index == cu->actnu && !hide_handles) if (index == cu->actnu && !hide_handles)
tekenhandlesN_active(nu); drawhandlesN_active(nu);
tekenhandlesN(nu, 0, hide_handles); drawhandlesN(nu, 0, hide_handles);
} }
index++; index++;
} }
@@ -5296,8 +5296,8 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
/* selected handles */ /* selected handles */
for (nu = nurb; nu; nu = nu->next) { for (nu = nurb; nu; nu = nu->next) {
if (nu->type == CU_BEZIER && (cu->drawflag & CU_HIDE_HANDLES) == 0) if (nu->type == CU_BEZIER && (cu->drawflag & CU_HIDE_HANDLES) == 0)
tekenhandlesN(nu, 1, hide_handles); drawhandlesN(nu, 1, hide_handles);
tekenvertsN(nu, 0, hide_handles, NULL); drawvertsN(nu, 0, hide_handles, NULL);
} }
if (v3d->zbuf) glEnable(GL_DEPTH_TEST); if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
@@ -5348,7 +5348,7 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
if (v3d->zbuf) glDisable(GL_DEPTH_TEST); if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
for (nu = nurb; nu; nu = nu->next) { for (nu = nurb; nu; nu = nu->next) {
tekenvertsN(nu, 1, hide_handles, cu->lastsel); drawvertsN(nu, 1, hide_handles, cu->lastsel);
} }
if (v3d->zbuf) glEnable(GL_DEPTH_TEST); if (v3d->zbuf) glEnable(GL_DEPTH_TEST);