diff options
author | Matt Ebb <matt@mke3.net> | 2007-08-21 05:57:15 +0400 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2007-08-21 05:57:15 +0400 |
commit | 63a801c21d054381d4eccd186dfea0d96533cfb3 (patch) | |
tree | b30df51e4d46bfa3b9f20a885bfc499d38d8541b /source | |
parent | 798001556aed3dfec4b76c9525543560c7fbbbe0 (diff) |
* Curve tilt interpolation types
Just a quickie feature I needed here at work- the previous linear
interpolation of tilt in curves can give nasty pinching problems
when trying to do flowing curves like a ribbon. This commit lets
you choose the interpolation type, between Linear, Cardinal, and
BSpline. The code was already set up for it pretty easily, mainly
needed to make the choice visible to the user.
Example:
http://mke3.net/blender/devel/etc/tilt_interp_types.png
Works on selected curve 'lines', menu in 'curve tools' panel in
edit mode.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/curve.c | 2 | ||||
-rw-r--r-- | source/blender/include/butspace.h | 1 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_curve_types.h | 4 | ||||
-rw-r--r-- | source/blender/src/buttons_editing.c | 12 |
4 files changed, 17 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 769c31ad8a9..ece0a7f1d6c 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -1445,7 +1445,7 @@ static void alfa_bezpart(BezTriple *prevbezt, BezTriple *bezt, Nurb *nu, float * for(a=0; a<resolu; a++, fac+= dfac) { - set_four_ipo(fac, t, KEY_LINEAR); + set_four_ipo(fac, t, nu->tilt_interp); data_a[a]= t[0]*pprev->alfa + t[1]*prevbezt->alfa + t[2]*bezt->alfa + t[3]*next->alfa; } diff --git a/source/blender/include/butspace.h b/source/blender/include/butspace.h index 95ca38471a9..e1aeb4df1e4 100644 --- a/source/blender/include/butspace.h +++ b/source/blender/include/butspace.h @@ -453,6 +453,7 @@ void curvemap_buttons(struct uiBlock *block, struct CurveMapping *cumap, char la #define B_SETRESOLU 2121 #define B_SETW4 2122 #define B_SUBSURFTYPE 2123 +#define B_TILTINTERP 2124 /* *********************** */ #define B_FONTBUTS 2300 diff --git a/source/blender/makesdna/DNA_curve_types.h b/source/blender/makesdna/DNA_curve_types.h index 8dc284888d7..bd772bbeecb 100644 --- a/source/blender/makesdna/DNA_curve_types.h +++ b/source/blender/makesdna/DNA_curve_types.h @@ -116,9 +116,11 @@ typedef struct Nurb { float *knotsu, *knotsv; BPoint *bp; BezTriple *bezt; + + short tilt_interp; /* KEY_LINEAR, KEY_CARDINAL, KEY_BSPLINE */ + short pad; int charidx; - int pad; } Nurb; typedef struct CharInfo { diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c index 3c995c4d19a..6efc9ffba55 100644 --- a/source/blender/src/buttons_editing.c +++ b/source/blender/src/buttons_editing.c @@ -2794,6 +2794,10 @@ void do_curvebuts(unsigned short event) allqueue(REDRAWVIEW3D, 0); } break; + case B_TILTINTERP: + DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA); + allqueue(REDRAWVIEW3D, 0); + break; case B_SUBSURFTYPE: /* fallthrough */ case B_MAKEDISP: @@ -2904,6 +2908,14 @@ static void editing_panel_curve_tools(Object *ob, Curve *cu) nu= lastnu; if(nu==NULL) nu= editNurb.first; if(nu) { + if (ob->type==OB_CURVE) { + uiDefBut(block, LABEL, 0, "Tilt", + 467,87,72, 18, 0, 0, 0, 0, 0, ""); + /* KEY_LINEAR, KEY_CARDINAL, KEY_BSPLINE */ + uiDefButS(block, MENU, B_TILTINTERP, "Tilt Interpolation %t|Linear %x0|Cardinal %x1|BSpline %x2", + 467,67,72, 18, &(nu->tilt_interp), 0, 0, 0, 0, "Tilt interpolation"); + } + uiBlockBeginAlign(block); sp= &(nu->orderu); uiDefButS(block, NUM, B_SETORDER, "Order U:", 565,90,102, 19, sp, 2.0, 6.0, 0, 0, "Nurbs only; the amount of control points involved"); |