* 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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user