Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2007-03-08 17:37:34 +0300
committerCampbell Barton <ideasman42@gmail.com>2007-03-08 17:37:34 +0300
commit5eaf9f90c1acc1b337a3fee38887f5db2a46ac81 (patch)
tree6c2608c7d77487761dfeefc0caf15be68dd64b0b /source/blender/python/api2_2x/Curve.c
parent51c16edabc18a13e91bee1a35cbe39eb1e911ea3 (diff)
BPython API
added a function - GenericLib_assignData for assigning blender data, to assign an ipo to a camera or world to a scene for instance. Using this function removed ~300 lines of code. also fixes user count error in some places that didnt check. also made it possible to clear the colorband by setting it to []
Diffstat (limited to 'source/blender/python/api2_2x/Curve.c')
-rw-r--r--source/blender/python/api2_2x/Curve.c43
1 files changed, 11 insertions, 32 deletions
diff --git a/source/blender/python/api2_2x/Curve.c b/source/blender/python/api2_2x/Curve.c
index f42b5959d14..f72851e115e 100644
--- a/source/blender/python/api2_2x/Curve.c
+++ b/source/blender/python/api2_2x/Curve.c
@@ -1037,22 +1037,12 @@ static PyObject *Curve_getBevOb( BPy_Curve * self)
/*****************************************************************************/
static int Curve_newsetBevOb( BPy_Curve * self, PyObject * args )
{
- BPy_Object *pybevobj = (BPy_Object *) args;
-
- if( args == Py_None ) { /* Accept None */
- self->curve->bevobj = (Object *)NULL;
- } else { /* Accept Object with type 'Curve' */
- if( !Object_CheckPyObject( args ) ||
- pybevobj->object->type != OB_CURVE )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected Curve object type or None argument" );
- if( pybevobj->object->data == self->curve )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "Can't bevel an object to itself" );
- self->curve->bevobj = Object_FromPyObject( args );
- }
-
- return 0;
+
+ if (Object_CheckPyObject( args ) && ((BPy_Object *)args)->object->data == self->curve )
+ return EXPP_ReturnIntError( PyExc_ValueError,
+ "Can't bevel an object to itself" );
+
+ return GenericLib_assignData(args, (void **) &self->curve->bevobj, 0, 0, ID_OB, OB_CURVE);
}
/*****************************************************************************/
@@ -1075,22 +1065,11 @@ static PyObject *Curve_getTaperOb( BPy_Curve * self)
static int Curve_newsetTaperOb( BPy_Curve * self, PyObject * args )
{
- BPy_Object *pytaperobj = (BPy_Object *) args;
-
- if( args == Py_None ) { /* Accept None */
- self->curve->taperobj = (Object *)NULL;
- } else { /* Accept Object with type 'Curve' */
- if( !Object_CheckPyObject( args ) ||
- pytaperobj->object->type != OB_CURVE )
- return EXPP_ReturnIntError( PyExc_TypeError,
- "expected Curve object type or None argument" );
- if( pytaperobj->object->data == self->curve )
- return EXPP_ReturnIntError( PyExc_ValueError,
- "Can't bevel an object to itself" );
- self->curve->taperobj = Object_FromPyObject( args );
- }
-
- return 0;
+ if (Object_CheckPyObject( args ) && ((BPy_Object *)args)->object->data == self->curve )
+ return EXPP_ReturnIntError( PyExc_ValueError,
+ "Can't taper an object to itself" );
+
+ return GenericLib_assignData(args, (void **) &self->curve->taperobj, 0, 0, ID_OB, OB_CURVE);
}
/*****************************************************************************/