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.
This commit is contained in:
parent
c11c299d59
commit
0dc22dc65e
@ -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 );
|
||||
|
@ -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" );
|
||||
|
||||
}
|
||||
|
||||
|
@ -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); */
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user