diff options
author | Ken Hughes <khughes@pacific.edu> | 2005-12-17 07:57:48 +0300 |
---|---|---|
committer | Ken Hughes <khughes@pacific.edu> | 2005-12-17 07:57:48 +0300 |
commit | f73f226ed7338b8a0384bbada10ac80a3d5acbdd (patch) | |
tree | f3967c7879a7ff69583d0916482baac906802a9f /source/blender/python/api2_2x/BezTriple.c | |
parent | e76e78e78a9ab31b5e7c13fe76115f360ac8436b (diff) |
-- Bugfix #3617; addBezier() was not initializing all the attributes for
a the beztriple, so things like the hidden and handle select states were
set to random values. Added a beztriple.hide attribute so that the
hide attribute can be set/cleared from the BPy API.
Diffstat (limited to 'source/blender/python/api2_2x/BezTriple.c')
-rw-r--r-- | source/blender/python/api2_2x/BezTriple.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/source/blender/python/api2_2x/BezTriple.c b/source/blender/python/api2_2x/BezTriple.c index 324ba2958bb..98e53d2fef8 100644 --- a/source/blender/python/api2_2x/BezTriple.c +++ b/source/blender/python/api2_2x/BezTriple.c @@ -31,6 +31,7 @@ */ #include "BezTriple.h" /*This must come first */ +#include "DNA_ipo_types.h" #include "MEM_guardedalloc.h" #include "gen_utils.h" @@ -303,6 +304,8 @@ static PyObject *BezTripleGetAttr( BPy_BezTriple * self, char *name ) return BezTriple_getTriple( self ); else if( strcmp( name, "tilt" ) == 0 ) return PyFloat_FromDouble(self->beztriple->alfa); + else if( strcmp( name, "hide" ) == 0 ) + return PyFloat_FromDouble(self->beztriple->hide); else if( strcmp( name, "__members__" ) == 0 ) return Py_BuildValue( "[s,s,s]", "pt", "vec", "tilt" ); @@ -329,7 +332,17 @@ static int BezTripleSetAttr( BPy_BezTriple * self, char *name, PyObject * value return 0; /* normal exit */ #endif - if( strcmp( name, "tilt" ) == 0 ) { + if( !strcmp( name, "hide" ) ) { + int param; + if( !PyInt_CheckExact( value ) ) + return EXPP_ReturnIntError( PyExc_TypeError, + "expected int argument" ); + + param = (int)PyInt_AS_LONG( value ); + self->beztriple->hide = (param == 0) ? 0 : IPO_BEZ; + return 0; + } + if( !strcmp( name, "tilt" ) ) { if (!PyFloat_Check( value ) ) return EXPP_ReturnIntError( PyExc_TypeError, "expected a float" ); @@ -337,8 +350,8 @@ static int BezTripleSetAttr( BPy_BezTriple * self, char *name, PyObject * value return 0; } - return ( EXPP_ReturnIntError( PyExc_AttributeError, - "cannot set a read-only attribute" ) ); + return EXPP_ReturnIntError( PyExc_AttributeError, + "cannot set a read-only attribute" ); } /*****************************************************************************/ @@ -356,12 +369,11 @@ static PyObject *BezTripleRepr( BPy_BezTriple * self ) */ char str[1000]; sprintf( str, - "BezTriple %f %f %f %f %f %f %f %f %f %f\n %d %d %d %d %d %d\n", + "BezTriple (%f %f) (%f %f) (%f %f) %f\n (%d %d %d) (%d %d) %d\n", self->beztriple->vec[0][0], self->beztriple->vec[0][1], - self->beztriple->vec[0][2], self->beztriple->vec[1][0], - self->beztriple->vec[1][1], self->beztriple->vec[1][2], + self->beztriple->vec[1][0], self->beztriple->vec[1][1], self->beztriple->vec[2][0], self->beztriple->vec[2][1], - self->beztriple->vec[2][2], self->beztriple->alfa, + self->beztriple->alfa, self->beztriple->h1, self->beztriple->h2, self->beztriple->f1, self->beztriple->f2, self->beztriple->f3, self->beztriple->hide ); |