diff options
author | Ken Hughes <khughes@pacific.edu> | 2006-08-28 08:44:16 +0400 |
---|---|---|
committer | Ken Hughes <khughes@pacific.edu> | 2006-08-28 08:44:16 +0400 |
commit | 81d7cd967da72b7cc765ec3bfc3f3097237c8c70 (patch) | |
tree | 0b114c69d54cee9e7043131a6e0c2f2f8f7940ba /source/blender/python/api2_2x/Curve.c | |
parent | b880bffd320952efa48cb5e3419b8d3f634d1d28 (diff) |
===Python API===
New API for accessing surface data (SurbNurb type). Right now it's hooked in
through the Curve API, since Curve.Get() doesn't differentiate between curves
and surfaces. If the curve object is 2D (pntsv > 1), the SurfNurb object is
created.
It is similar to the CurNurb type but not identical. There are only
attributes and no methods yet, and the only methods which will be added are
the non-getStuff/setStuff kind. Read the documentation to see how it works
(sorry, no examples yet).
This is a work in progress. Don't be surprised if the API changes some more.
Diffstat (limited to 'source/blender/python/api2_2x/Curve.c')
-rw-r--r-- | source/blender/python/api2_2x/Curve.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/source/blender/python/api2_2x/Curve.c b/source/blender/python/api2_2x/Curve.c index 5fbb2ad15bc..7d7ba84e585 100644 --- a/source/blender/python/api2_2x/Curve.c +++ b/source/blender/python/api2_2x/Curve.c @@ -38,6 +38,7 @@ #include "BKE_curve.h" #include "MEM_guardedalloc.h" /* because we wil be mallocing memory */ #include "CurNurb.h" +#include "SurfNurb.h" #include "Material.h" #include "Object.h" #include "Key.h" @@ -1455,14 +1456,15 @@ static PyObject *Curve_iterNext( BPy_Curve * self ) if( self->iter_pointer ) { pnurb = self->iter_pointer; self->iter_pointer = pnurb->next; /* advance iterator */ - po = CurNurb_CreatePyObject( pnurb ); /* make a bpy_nurb */ - - return ( PyObject * ) po; + if( pnurb->pntsv == 1 ) + return CurNurb_CreatePyObject( pnurb ); /* make a bpy_curnurb */ + else + return SurfNurb_CreatePyObject( pnurb ); /* make a bpy_surfnurb */ } /* if iter_pointer was null, we are at end */ - return ( EXPP_ReturnPyObjError - ( PyExc_StopIteration, "iterator at end" ) ); + return EXPP_ReturnPyObjError( PyExc_StopIteration, + "iterator at end" ); } @@ -1517,9 +1519,10 @@ PyObject *Curve_getNurb( BPy_Curve * self, int n ) if( !pNurb ) /* we came to the end of the list */ return ( EXPP_ReturnPyObjError( PyExc_IndexError, "index out of range" ) ); - - pyo = CurNurb_CreatePyObject( pNurb ); /* make a bpy_curnurb */ - return ( PyObject * ) pyo; + if( pNurb->pntsv == 1 ) + return CurNurb_CreatePyObject( pNurb ); /* make a bpy_curnurb */ + else + return SurfNurb_CreatePyObject( pNurb ); /* make a bpy_surfnurb */ } |