diff options
author | Campbell Barton <ideasman42@gmail.com> | 2008-10-26 11:06:48 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2008-10-26 11:06:48 +0300 |
commit | 0dc22dc65e1d31e867151572e8705c3a9448802b (patch) | |
tree | 7faa02e7f98f472688af8655da96dba91820acd3 /source/blender/python | |
parent | c11c299d593dd2a7b0f5cd464ea2a67ed0b34e55 (diff) |
fix for [#17895] Python-generated Curves can't be beveled
radius and weight's values were not initialized for nurbs curves
for 2.48a just use set radius from curve specials menu to work around this.
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/api2_2x/BezTriple.c | 1 | ||||
-rw-r--r-- | source/blender/python/api2_2x/CurNurb.c | 25 | ||||
-rw-r--r-- | source/blender/python/api2_2x/Curve.c | 2 |
3 files changed, 23 insertions, 5 deletions
diff --git a/source/blender/python/api2_2x/BezTriple.c b/source/blender/python/api2_2x/BezTriple.c index b7b94dc93e1..9e57994d2da 100644 --- a/source/blender/python/api2_2x/BezTriple.c +++ b/source/blender/python/api2_2x/BezTriple.c @@ -694,6 +694,7 @@ PyObject *newBezTriple( float *numbuf ) } bzt->h1 = HD_ALIGN; bzt->h2 = HD_ALIGN; + bzt->radius = 1.0; /* wrap it */ pyobj = BezTriple_CreatePyObject( bzt ); diff --git a/source/blender/python/api2_2x/CurNurb.c b/source/blender/python/api2_2x/CurNurb.c index b2120bd63c6..63a1dccbc50 100644 --- a/source/blender/python/api2_2x/CurNurb.c +++ b/source/blender/python/api2_2x/CurNurb.c @@ -522,7 +522,7 @@ PyObject *CurNurb_appendPointToNurb( Nurb * nurb, PyObject * value ) else if( PySequence_Check( value ) ) { size = PySequence_Size( value ); /* printf("\ndbg: got a sequence of size %d\n", size ); */ - if( size == 4 || size == 5 ) { + if( size == 4 || size == 5 || size == 6) { BPoint *tmp; tmp = nurb->bp; /* save old pts */ @@ -556,8 +556,8 @@ PyObject *CurNurb_appendPointToNurb( Nurb * nurb, PyObject * value ) Py_DECREF( item ); } - if (size == 5) { - PyObject *item = PySequence_GetItem( value, i ); + if (size >= 5) { + PyObject *item = PySequence_GetItem( value, 4 ); if (item == NULL) return NULL; @@ -568,18 +568,33 @@ PyObject *CurNurb_appendPointToNurb( Nurb * nurb, PyObject * value ) else { nurb->bp[npoints].alfa = 0.0f; } + + if (size == 6) { + PyObject *item = PySequence_GetItem( value, 5 ); + + if (item == NULL) + return NULL; + nurb->bp[npoints].radius = ( float ) PyFloat_AsDouble( item ); + Py_DECREF( item ); + } + else { + nurb->bp[npoints].radius = 1.0f; + } + + nurb->bp[npoints].weight = 0.0; /* softbody weight TODO - add access to this, is zero elsewhere but through blender is 1.0 by default */ + makeknots( nurb, 1, nurb->flagu >> 1 ); } else { return EXPP_ReturnPyObjError( PyExc_TypeError, - "expected a sequence of 4 or 5 floats" ); + "expected a sequence of 4 or 6 floats" ); } } else { /* bail with error */ return EXPP_ReturnPyObjError( PyExc_TypeError, - "expected a sequence of 4 or 5 floats" ); + "expected a sequence of 4 to 6 floats" ); } diff --git a/source/blender/python/api2_2x/Curve.c b/source/blender/python/api2_2x/Curve.c index 26208e600e6..d1abde19de9 100644 --- a/source/blender/python/api2_2x/Curve.c +++ b/source/blender/python/api2_2x/Curve.c @@ -822,6 +822,7 @@ static PyObject *Curve_appendNurb( BPy_Curve * self, PyObject * value ) new_nurb->bezt->f2 = SELECT; new_nurb->bezt->f3 = SELECT; new_nurb->bezt->hide = 0; + new_nurb->bezt->radius = 1.0; /* calchandlesNurb( new_nurb ); */ } else { /* set up bp */ new_nurb->pntsv = 1; @@ -831,6 +832,7 @@ static PyObject *Curve_appendNurb( BPy_Curve * self, PyObject * value ) new_nurb->flagv = 0; new_nurb->bp->f1 = 0; new_nurb->bp->hide = 0; + new_nurb->bp->radius = 1.0; new_nurb->knotsu = 0; /*makenots( new_nurb, 1, new_nurb->flagu >> 1); */ } |