diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-09-08 11:35:07 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-09-08 11:35:07 +0400 |
commit | 1d0a567023d89b4e397800eeb164512b40336184 (patch) | |
tree | f74e408485e26ad12428ab69d7a73621e59583c2 /source/blender/editors/space_view3d | |
parent | fab4bf0816834744664858cdcca96792a6225ca3 (diff) |
Curve/Surface Editing
- rename "Nurb" to "Spline" in RNA, eg. bpy.data.curves[0].splines[2].type == 'NURBS'
from a user perspective spline is a more generic term while Nurb is misleading when used for beziers and poly lines.
- added curve.active_spline property so the python UI can display the last selected curve.
- set the active spline when entering editmode (uses first selected spline)
- added back Hide Handles as a curve property (removed the global flag), access from the view panel in editmode.
- added hide normal option for curve, normal size access for curve and mesh display.
- changing orderU/V, endpoints, cyclic, bezierU/V now work in editmode and calls update functions.
- entering editmode was crashing with text objects
- curve.switch_direction() crashed (own fault from last commit)
- Tkey for tilt was overridden by Toolbar, made Tilt Ctrl+T.
- OBJECT_OT_mode_set check for compatible modes before running - so curves dont try go into paint mode with V key for eg.
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 28 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_select.c | 17 |
2 files changed, 27 insertions, 18 deletions
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 220952d190f..001021e8d4b 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -1397,7 +1397,8 @@ void nurbs_foreachScreenVert(ViewContext *vc, void (*func)(void *userData, Nurb BezTriple *bezt = &nu->bezt[i]; if(bezt->hide==0) { - if (G.f & G_HIDDENHANDLES) { + + if(cu->drawflag & CU_HIDE_HANDLES) { view3d_project_short_clip(vc->ar, bezt->vec[1], s); if (s[0] != IS_CLIPPED) func(userData, nu, NULL, bezt, 1, s[0], s[1]); @@ -2797,7 +2798,7 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas if(solid) { dl= lb->first; if(dl==NULL) return 1; - + if(dl->nors==0) addnormalsDispList(ob, lb); index3_nors_incr= 0; @@ -2838,7 +2839,7 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas } break; case OB_SURF: - + lb= &((Curve *)ob->data)->disp; if(solid) { @@ -3877,14 +3878,14 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, RegionView3D *rv3d, Obj unsigned int nurbcol[8]= { 0, 0x9090, 0x409030, 0x603080, 0, 0x40fff0, 0x40c033, 0xA090F0 }; -static void tekenhandlesN(Nurb *nu, short sel) +static void tekenhandlesN(Nurb *nu, short sel, short hide_handles) { BezTriple *bezt; float *fp; unsigned int *col; int a; - if(nu->hide || (G.f & G_HIDDENHANDLES)) return; + if(nu->hide || hide_handles) return; glBegin(GL_LINES); @@ -3928,7 +3929,7 @@ static void tekenhandlesN(Nurb *nu, short sel) glEnd(); } -static void tekenvertsN(Nurb *nu, short sel) +static void tekenvertsN(Nurb *nu, short sel, short hide_handles) { BezTriple *bezt; BPoint *bp; @@ -3951,7 +3952,7 @@ static void tekenvertsN(Nurb *nu, short sel) a= nu->pntsu; while(a--) { if(bezt->hide==0) { - if (G.f & G_HIDDENHANDLES) { + if (hide_handles) { if((bezt->f2 & SELECT)==sel) bglVertex3fv(bezt->vec[1]); } else { if((bezt->f1 & SELECT)==sel) bglVertex3fv(bezt->vec[0]); @@ -4083,6 +4084,7 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, Curve *cu = ob->data; Nurb *nu; BevList *bl; + short hide_handles = (cu->drawflag & CU_HIDE_HANDLES); // XXX retopo_matrix_update(v3d); @@ -4095,22 +4097,24 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, /* first non-selected handles */ for(nu=nurb; nu; nu=nu->next) { if(nu->type == CU_BEZIER) { - tekenhandlesN(nu, 0); + tekenhandlesN(nu, 0, hide_handles); } } draw_editnurb(ob, nurb, 0); draw_editnurb(ob, nurb, 1); /* selected handles */ for(nu=nurb; nu; nu=nu->next) { - if(nu->type == CU_BEZIER) tekenhandlesN(nu, 1); - tekenvertsN(nu, 0); + if(nu->type == CU_BEZIER && (cu->drawflag & CU_HIDE_HANDLES)==0) + tekenhandlesN(nu, 1, hide_handles); + tekenvertsN(nu, 0, hide_handles); } if(v3d->zbuf) glEnable(GL_DEPTH_TEST); /* direction vectors for 3d curve paths when at its lowest, dont render normals */ - if(cu->flag & CU_3D && ts->normalsize > 0.0015) { + if(cu->flag & CU_3D && ts->normalsize > 0.0015 && (cu->drawflag & CU_HIDE_NORMALS)==0) { + UI_ThemeColor(TH_WIRE); for (bl=cu->bev.first,nu=nurb; nu && bl; bl=bl->next,nu=nu->next) { BevPoint *bevp= (BevPoint *)(bl+1); @@ -4145,7 +4149,7 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, if(v3d->zbuf) glDisable(GL_DEPTH_TEST); for(nu=nurb; nu; nu=nu->next) { - tekenvertsN(nu, 1); + tekenvertsN(nu, 1, hide_handles); } if(v3d->zbuf) glEnable(GL_DEPTH_TEST); diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 42954e09060..a7696d9fe31 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -549,13 +549,15 @@ static void do_lasso_select_mesh_uv(short mcords[][2], short moves, short select static void do_lasso_select_curve__doSelect(void *userData, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, int x, int y) { - struct { short (*mcords)[2]; short moves; short select; } *data = userData; - + struct { ViewContext vc; short (*mcords)[2]; short moves; short select; } *data = userData; + if (lasso_inside(data->mcords, data->moves, x, y)) { if (bp) { bp->f1 = data->select?(bp->f1|SELECT):(bp->f1&~SELECT); } else { - if (G.f & G_HIDDENHANDLES) { + Curve *cu= data->vc.obedit->data; + + if (cu->drawflag & CU_HIDE_HANDLES) { /* can only be beztindex==0 here since handles are hidden */ bezt->f1 = bezt->f2 = bezt->f3 = data->select?(bezt->f2|SELECT):(bezt->f2&~SELECT); } else { @@ -573,9 +575,10 @@ static void do_lasso_select_curve__doSelect(void *userData, Nurb *nu, BPoint *bp static void do_lasso_select_curve(ViewContext *vc, short mcords[][2], short moves, short select) { - struct { short (*mcords)[2]; short moves; short select; } data; + struct { ViewContext vc; short (*mcords)[2]; short moves; short select; } data; /* set vc->editnurb */ + data.vc = *vc; data.mcords = mcords; data.moves = moves; data.select = select; @@ -1196,7 +1199,9 @@ static void do_nurbs_box_select__doSelect(void *userData, Nurb *nu, BPoint *bp, if (bp) { bp->f1 = data->select?(bp->f1|SELECT):(bp->f1&~SELECT); } else { - if (G.f & G_HIDDENHANDLES) { + Curve *cu= data->vc.obedit->data; + + if (cu->drawflag & CU_HIDE_HANDLES) { /* can only be beztindex==0 here since handles are hidden */ bezt->f1 = bezt->f2 = bezt->f3 = data->select?(bezt->f2|SELECT):(bezt->f2&~SELECT); } else { @@ -1215,7 +1220,7 @@ static void do_nurbs_box_select(ViewContext *vc, rcti *rect, int select) { struct { ViewContext vc; rcti *rect; int select; } data; - data.vc= *vc; + data.vc = *vc; data.rect = rect; data.select = select; |