2
* $Id: SurfNurb.c 14444 2008-04-16 22:40:48Z hos $
3
* ***** BEGIN GPL LICENSE BLOCK *****
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software Foundation,
17
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
20
* All rights reserved.
22
* This is a new part of Blender.
24
* Contributor(s): Stephen Swaney
26
* ***** END GPL LICENSE BLOCK *****
29
#include "SurfNurb.h" /*This must come first */
31
#include "BKE_curve.h"
32
#include "BDR_editcurve.h" /* for convertspline */
33
#include "MEM_guardedalloc.h"
34
#include "gen_utils.h"
35
#include "gen_library.h"
36
#include "BezTriple.h"
39
* forward declarations go here
42
static int SurfNurb_setPoint( BPy_SurfNurb * self, int index, PyObject * ob );
43
static int SurfNurb_length( PyInstanceObject * inst );
44
static PyObject *SurfNurb_getIter( BPy_SurfNurb * self );
45
static PyObject *SurfNurb_iterNext( BPy_SurfNurb * self );
46
static PyObject *SurfNurb_getKnotsU( BPy_SurfNurb * self );
47
static PyObject *SurfNurb_getKnotsV( BPy_SurfNurb * self );
48
PyObject *SurfNurb_append( BPy_SurfNurb * self, PyObject * args );
50
char M_SurfNurb_doc[] = "SurfNurb";
53
table of module methods
54
these are the equivalent of class or static methods.
55
you do not need an object instance to call one.
58
static PyMethodDef M_SurfNurb_methods[] = {
59
/* name, method, flags, doc_string */
60
/* {"Get", (PyCFunction) M_SurfNurb_method, METH_NOARGS, " () - doc string"}, */
61
/* {"method", (PyCFunction) M_SurfNurb_method, METH_NOARGS, " () - doc string"}, */
68
* table of instance methods
69
* these methods are invoked on an instance of the type.
72
static PyMethodDef BPy_SurfNurb_methods[] = {
74
{"append", ( PyCFunction ) SurfNurb_append, METH_VARARGS,
75
"( point ) - add a new point. arg is BezTriple or list of x,y,z,w floats"},
81
* SurfNurb_appendPointToNurb
82
* this is a non-bpy utility func to add a point to a given nurb.
83
* notice the first arg is Nurb*.
87
static PyObject *SurfNurb_appendPointToNurb( Nurb * nurb, PyObject * args )
93
int npoints = nurb->pntsu;
96
do we have a list of four floats or a BezTriple?
98
if( !PyArg_ParseTuple( args, "O", &pyOb ))
99
return EXPP_ReturnPyObjError
100
( PyExc_RuntimeError,
101
"Internal error parsing arguments" );
105
/* if curve is empty, adjust type depending on input type */
106
if (nurb->bezt==NULL && nurb->bp==NULL) {
107
if (BPy_BezTriple_Check( pyOb ))
108
nurb->type |= CU_BEZIER;
109
else if (PySequence_Check( pyOb ))
110
nurb->type |= CU_NURBS;
112
return( EXPP_ReturnPyObjError( PyExc_TypeError,
113
"Expected a BezTriple or a Sequence of 4 (or 5) floats" ) );
118
if ((nurb->type & 7)==CU_BEZIER) {
121
if( !BPy_BezTriple_Check( pyOb ) )
122
return( EXPP_ReturnPyObjError( PyExc_TypeError,
123
"Expected a BezTriple\n" ) );
125
/* printf("\ndbg: got a BezTriple\n"); */
126
tmp = nurb->bezt; /* save old points */
128
( BezTriple * ) MEM_mallocN( sizeof( BezTriple ) *
130
"SurfNurb_append2" );
133
return ( EXPP_ReturnPyObjError
134
( PyExc_MemoryError, "allocation failed" ) );
136
/* copy old points to new */
138
memmove( nurb->bezt, tmp, sizeof( BezTriple ) * npoints );
143
/* add new point to end of list */
144
memcpy( nurb->bezt + npoints,
145
BezTriple_FromPyObject( pyOb ), sizeof( BezTriple ) );
148
else if( PySequence_Check( pyOb ) ) {
149
size = PySequence_Size( pyOb );
150
/* printf("\ndbg: got a sequence of size %d\n", size ); */
151
if( size == 4 || size == 5 ) {
154
tmp = nurb->bp; /* save old pts */
157
( BPoint * ) MEM_mallocN( sizeof( BPoint ) *
159
"SurfNurb_append1" );
161
return ( EXPP_ReturnPyObjError
163
"allocation failed" ) );
165
memmove( nurb->bp, tmp, sizeof( BPoint ) * npoints );
170
/* initialize new BPoint from old */
171
memcpy( nurb->bp + npoints, nurb->bp,
174
for( i = 0; i < 4; ++i ) {
175
PyObject *item = PySequence_GetItem( pyOb, i );
181
nurb->bp[npoints].vec[i] = ( float ) PyFloat_AsDouble( item );
186
PyObject *item = PySequence_GetItem( pyOb, i );
191
nurb->bp[npoints].alfa = ( float ) PyFloat_AsDouble( item );
195
nurb->bp[npoints].alfa = 0.0f;
198
makeknots( nurb, 1, nurb->flagu >> 1 );
201
return EXPP_ReturnPyObjError( PyExc_TypeError,
202
"expected a sequence of 4 or 5 floats" );
206
/* bail with error */
207
return EXPP_ReturnPyObjError( PyExc_TypeError,
208
"expected a sequence of 4 or 5 floats" );
212
return ( EXPP_incr_ret( Py_None ) );
216
* SurfNurb_append( point )
217
* append a new point to a nurb curve.
218
* arg is BezTriple or list of xyzw floats
221
PyObject *SurfNurb_append( BPy_SurfNurb * self, PyObject * args )
223
Nurb *nurb = self->nurb;
225
return SurfNurb_appendPointToNurb( nurb, args );
231
* SurfNurb_getMatIndex
233
* returns index into material list
236
static PyObject *SurfNurb_getMatIndex( BPy_SurfNurb * self )
238
return PyInt_FromLong( ( long ) self->nurb->mat_nr );
242
* SurfNurb_setMatIndex
244
* set index into material list
247
static int SurfNurb_setMatIndex( BPy_SurfNurb * self, PyObject * args )
249
args = PyNumber_Int( args );
252
return EXPP_ReturnIntError( PyExc_TypeError,
253
"expected integer argument" );
255
/* fixme: some range checking would be nice! */
256
/* can't do range checking without knowing the "parent" curve! */
257
self->nurb->mat_nr = ( short )PyInt_AS_LONG( args );
265
* SurfNurb_getPointsU
267
* returns number of control points in U direction
270
static PyObject *SurfNurb_getPointsU( BPy_SurfNurb * self )
272
return PyInt_FromLong( ( long ) self->nurb->pntsu );
276
* SurfNurb_getPointsV
278
* returns number of control points in V direction
281
static PyObject *SurfNurb_getPointsV( BPy_SurfNurb * self )
283
return PyInt_FromLong( ( long ) self->nurb->pntsv );
289
* returns curve's flagu
292
static PyObject *SurfNurb_getFlagU( BPy_SurfNurb * self )
294
return PyInt_FromLong( ( long ) (self->nurb->flagu >> 1) );
300
* set curve's flagu and recalculate the knots
302
* Possible values: 0 - uniform, 2 - endpoints, 4 - bezier
303
* bit 0 controls CU_CYCLIC
306
static int SurfNurb_setFlagU( BPy_SurfNurb * self, PyObject * args )
310
args = PyNumber_Int( args );
312
return EXPP_ReturnIntError( PyExc_TypeError,
313
"expected integer argument" );
315
flagu = ( int )PyInt_AS_LONG( args );
318
if( flagu < 0 || flagu > 2 )
319
return EXPP_ReturnIntError( PyExc_AttributeError,
320
"expected integer argument in range [0,2]" );
322
flagu = (flagu << 1) | (self->nurb->flagu & CU_CYCLIC);
323
if( self->nurb->flagu != flagu ) {
324
self->nurb->flagu = (short)flagu;
325
makeknots( self->nurb, 1, self->nurb->flagu >> 1 );
334
* returns curve's flagu
337
static PyObject *SurfNurb_getFlagV( BPy_SurfNurb * self )
339
return PyInt_FromLong( ( long ) (self->nurb->flagv >> 1) );
345
* set curve's flagu and recalculate the knots
347
* Possible values: 0 - uniform, 1 - endpoints, 2 - bezier
350
static int SurfNurb_setFlagV( BPy_SurfNurb * self, PyObject * args )
354
args = PyNumber_Int( args );
356
return EXPP_ReturnIntError( PyExc_TypeError,
357
"expected integer argument" );
359
flagv = ( int )PyInt_AS_LONG( args );
362
if( flagv < 0 || flagv > 2 )
363
return EXPP_ReturnIntError( PyExc_AttributeError,
364
"expected integer argument in range [0,2]" );
366
flagv = (flagv << 1) | (self->nurb->flagv & CU_CYCLIC);
367
if( self->nurb->flagv != flagv ) {
368
self->nurb->flagv = (short)flagv;
369
makeknots( self->nurb, 2, self->nurb->flagv >> 1 );
378
* returns curve's order
381
static PyObject *SurfNurb_getOrderU( BPy_SurfNurb * self )
383
return PyInt_FromLong( ( long ) self->nurb->orderu );
386
static int SurfNurb_setOrderU( BPy_SurfNurb * self, PyObject * args )
390
args = PyNumber_Int( args );
392
return EXPP_ReturnIntError( PyExc_TypeError,
393
"expected integer argument" );
395
order = ( int )PyInt_AS_LONG( args );
398
if( order < 2 ) order = 2;
399
else if( order > 6 ) order = 6;
401
if( self->nurb->pntsu < order )
402
order = self->nurb->pntsu;
404
self->nurb->orderu = (short)order;
405
makeknots( self->nurb, 1, self->nurb->flagu >> 1 );
410
static PyObject *SurfNurb_getOrderV( BPy_SurfNurb * self )
412
return PyInt_FromLong( ( long ) self->nurb->orderv );
415
static int SurfNurb_setOrderV( BPy_SurfNurb * self, PyObject * args )
419
args = PyNumber_Int( args );
421
return EXPP_ReturnIntError( PyExc_TypeError,
422
"expected integer argument" );
424
order = ( int )PyInt_AS_LONG( args );
427
if( order < 2 ) order = 2;
428
else if( order > 6 ) order = 6;
430
if( self->nurb->pntsv < order )
431
order = self->nurb->pntsv;
433
self->nurb->orderv = (short)order;
434
makeknots( self->nurb, 2, self->nurb->flagv >> 1 );
439
* SurfNurb_getCyclic()
440
* test whether surface is cyclic (closed) or not (open)
443
static PyObject *SurfNurb_getCyclicU( BPy_SurfNurb * self )
445
if( self->nurb->flagu & CU_CYCLIC )
451
static PyObject *SurfNurb_getCyclicV( BPy_SurfNurb * self )
453
if( self->nurb->flagv & CU_CYCLIC )
459
static int SurfNurb_setCyclicU( BPy_SurfNurb * self, PyObject * value )
461
int param = PyObject_IsTrue( value );
463
return EXPP_ReturnIntError( PyExc_TypeError,
464
"expected True/False or 0/1" );
467
self->nurb->flagu |= CU_CYCLIC;
469
self->nurb->flagu &= ~CU_CYCLIC;
470
makeknots( self->nurb, 1, self->nurb->flagu >> 1 );
474
static int SurfNurb_setCyclicV( BPy_SurfNurb * self, PyObject * value )
476
int param = PyObject_IsTrue( value );
478
return EXPP_ReturnIntError( PyExc_TypeError,
479
"expected True/False or 0/1" );
482
self->nurb->flagv |= CU_CYCLIC;
484
self->nurb->flagv &= ~CU_CYCLIC;
485
makeknots( self->nurb, 2, self->nurb->flagu >> 1 );
492
* Returns surface's knotsU in a tuple. Empty tuple is returned if
493
* surface isn't Nurbs or it doesn't have knots in U
496
static PyObject *SurfNurb_getKnotsU( BPy_SurfNurb * self )
498
if(self->nurb->knotsu) {
499
int len = KNOTSU(self->nurb);
501
PyObject *knotsu = PyTuple_New(len);
503
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
504
"could not get SurfNurb.knotsU attribute" );
506
for(i = 0; i < len; ++i)
507
PyTuple_SetItem(knotsu, i,
508
PyFloat_FromDouble(self->nurb->knotsu[i]));
512
return PyTuple_New(0);
518
* Returns surface's knotsV in a tuple. Empty tuple is returned if
519
* curve doesn't have knots in V
522
static PyObject *SurfNurb_getKnotsV( BPy_SurfNurb * self )
524
if(self->nurb->knotsv) {
525
int len = KNOTSV(self->nurb);
527
PyObject *knotsv = PyTuple_New(len);
529
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
530
"could not get SurfNurb.knotsV index" );
532
for(i = 0; i < len; ++i)
533
PyTuple_SetItem(knotsv, i,
534
PyFloat_FromDouble(self->nurb->knotsv[i] ));
538
return PyTuple_New(0);
545
* create an iterator for our SurfNurb.
546
* this iterator returns the points for this SurfNurb.
549
static PyObject *SurfNurb_getIter( BPy_SurfNurb * self )
551
self->bp = self->nurb->bp;
552
self->bezt = self->nurb->bezt;
556
return ( PyObject * ) self;
559
static PyObject *SurfNurb_iterNext( BPy_SurfNurb * self )
561
Nurb *pnurb = self->nurb;
562
int npoints = pnurb->pntsu * pnurb->pntsv;
564
if( self->bp && self->nextPoint < npoints )
565
return SurfNurb_pointAtIndex( self->nurb, self->nextPoint++ );
567
return EXPP_ReturnPyObjError( PyExc_StopIteration,
573
* returns the number of points in a Nurb
574
* this is a tp_as_sequence method, not a regular instance method.
577
static int SurfNurb_length( PyInstanceObject * inst )
581
if( BPy_SurfNurb_Check( ( PyObject * ) inst ) ) {
582
nurb = ( ( BPy_SurfNurb * ) inst )->nurb;
583
return (int)(nurb->pntsu * nurb->pntsu);
586
return EXPP_ReturnIntError( PyExc_RuntimeError,
587
"arg is not a BPy_SurfNurb" );
593
* returns the Nth point in a Nurb
594
* this is one of the tp_as_sequence methods, hence the int N argument.
595
* it is called via the [] operator, not as a usual instance method.
598
PyObject *SurfNurb_getPoint( BPy_SurfNurb * self, int index )
606
npoints = myNurb->pntsu * myNurb->pntsv;
608
/* bail if no Nurbs in Curve */
610
return ( EXPP_ReturnPyObjError( PyExc_IndexError,
611
"no points in this SurfNurb" ) );
613
/* check index limits */
614
if( index >= npoints || index < 0 )
615
return ( EXPP_ReturnPyObjError( PyExc_IndexError,
616
"index out of range" ) );
618
return SurfNurb_pointAtIndex( myNurb, index );
623
* modifies the Nth point in a Nurb
624
* this is one of the tp_as_sequence methods, hence the int N argument.
625
* it is called via the [] = operator, not as a usual instance method.
627
static int SurfNurb_setPoint( BPy_SurfNurb * self, int index, PyObject * pyOb )
629
Nurb *nurb = self->nurb;
632
/* check index limits */
633
if( index < 0 || index >= nurb->pntsu * nurb->pntsv )
634
return EXPP_ReturnIntError( PyExc_IndexError,
635
"array assignment index out of range\n" );
637
/* branch by curve type */
639
if ((nurb->type & 7)==CU_BEZIER) { /* BEZIER */
640
/* check parameter type */
641
if( !BPy_BezTriple_Check( pyOb ) )
642
return EXPP_ReturnIntError( PyExc_TypeError,
643
"expected a BezTriple\n" );
645
/* copy bezier in array */
646
memcpy( nurb->bezt + index,
647
BezTriple_FromPyObject( pyOb ), sizeof( BezTriple ) );
649
return 0; /* finished correctly */
653
{ /* NURBS or POLY */
656
/* check parameter type */
657
if (!PySequence_Check( pyOb ))
658
return EXPP_ReturnIntError( PyExc_TypeError,
659
"expected a list of 4 (or optionaly 5 if the curve is 3D) floats\n" );
661
size = PySequence_Size( pyOb );
663
/* check sequence size */
664
if( size != 4 && size != 5 )
665
return EXPP_ReturnIntError( PyExc_TypeError,
666
"expected a list of 4 (or optionaly 5 if the curve is 3D) floats\n" );
668
/* copy x, y, z, w */
669
for( i = 0; i < 4; ++i ) {
670
PyObject *item = PySequence_GetItem( pyOb, i );
675
nurb->bp[index].vec[i] = ( float ) PyFloat_AsDouble( item );
679
if (size == 5) { /* set tilt, if present */
680
PyObject *item = PySequence_GetItem( pyOb, i );
685
nurb->bp[index].alfa = ( float ) PyFloat_AsDouble( item );
688
else { /* if not, set default */
689
nurb->bp[index].alfa = 0.0f;
692
return 0; /* finished correctly */
698
* this is an internal routine. not callable directly from python
701
PyObject *SurfNurb_pointAtIndex( Nurb * nurb, int index )
705
if( nurb->bp ) { /* we have a nurb curve */
708
/* add Tilt only if curve is 3D */
709
if (nurb->flag & CU_3D)
710
pyo = PyList_New( 5 );
712
pyo = PyList_New( 4 );
714
for( i = 0; i < 4; i++ ) {
715
PyList_SetItem( pyo, i,
716
PyFloat_FromDouble( nurb->bp[index].
720
/* add Tilt only if curve is 3D */
721
if (nurb->flag & CU_3D)
722
PyList_SetItem( pyo, 4, PyFloat_FromDouble( nurb->bp[index].alfa ) );
725
} else /* something is horribly wrong */
726
return EXPP_ReturnPyObjError( PyExc_SystemError,
727
"non-NURB surface found" );
731
* methods for SurfNurb as sequence
734
static PySequenceMethods SurfNurb_as_sequence = {
735
( inquiry ) SurfNurb_length, /* sq_length */
736
( binaryfunc ) 0, /* sq_concat */
737
( intargfunc ) 0, /* sq_repeat */
738
( intargfunc ) SurfNurb_getPoint, /* sq_item */
739
( intintargfunc ) 0, /* sq_slice */
740
( intobjargproc ) SurfNurb_setPoint, /* sq_ass_item */
741
0, /* sq_ass_slice */
742
( objobjproc ) 0, /* sq_contains */
747
static PyGetSetDef BPy_SurfNurb_getseters[] = {
750
(getter)SurfNurb_getMatIndex, (setter)SurfNurb_setMatIndex,
751
"material index", NULL},
754
(getter)SurfNurb_getPointsU, (setter)NULL,
755
"number of control points in U direction", NULL},
757
(getter)SurfNurb_getPointsV, (setter)NULL,
758
"number of control points in V direction", NULL},
760
(getter)SurfNurb_getFlagU, (setter)SurfNurb_setFlagU,
761
"knot flag for U direction", NULL},
763
(getter)SurfNurb_getFlagV, (setter)SurfNurb_setFlagV,
764
"knot flag for V direction", NULL},
766
(getter)SurfNurb_getCyclicU, (setter)SurfNurb_setCyclicU,
767
"cyclic setting for U direction", NULL},
769
(getter)SurfNurb_getCyclicV, (setter)SurfNurb_setCyclicV,
770
"cyclic setting for V direction", NULL},
772
(getter)SurfNurb_getOrderU, (setter)SurfNurb_setOrderU,
773
"order setting for U direction", NULL},
775
(getter)SurfNurb_getOrderV, (setter)SurfNurb_setOrderV,
776
"order setting for V direction", NULL},
778
(getter)SurfNurb_getKnotsU, (setter)NULL,
779
"The The knot vector in the U direction",
782
(getter)SurfNurb_getKnotsV, (setter)NULL,
783
"The The knot vector in the V direction",
786
{NULL,NULL,NULL,NULL,NULL} /* Sentinel */
791
* in this case, we consider two SurfNurbs equal, if they point to the same
794
static int SurfNurb_compare( BPy_SurfNurb * a, BPy_SurfNurb * b )
796
return ( a->nurb == b->nurb ) ? 0 : -1;
802
static PyObject *SurfNurb_repr( BPy_SurfNurb * self )
804
return PyString_FromFormat( "[SurfNurb \"%d\"]", self->nurb->type );
807
/*****************************************************************************/
808
/* Python SurfNurb_Type structure definition: */
809
/*****************************************************************************/
810
PyTypeObject SurfNurb_Type = {
811
PyObject_HEAD_INIT( NULL ) /* required py macro */
813
/* For printing, in format "<module>.<name>" */
814
"SurfNurb", /* char *tp_name; */
815
sizeof( BPy_SurfNurb ), /* int tp_basicsize; */
816
0, /* tp_itemsize; For allocation */
818
/* Methods to implement standard operations */
820
NULL, /* destructor tp_dealloc; */
821
NULL, /* printfunc tp_print; */
822
NULL, /* getattrfunc tp_getattr; */
823
NULL, /* setattrfunc tp_setattr; */
824
( cmpfunc ) SurfNurb_compare, /* cmpfunc tp_compare; */
825
( reprfunc ) SurfNurb_repr, /* reprfunc tp_repr; */
827
/* Method suites for standard classes */
829
NULL, /* PyNumberMethods *tp_as_number; */
830
&SurfNurb_as_sequence, /* PySequenceMethods *tp_as_sequence; */
831
NULL, /* PyMappingMethods *tp_as_mapping; */
833
/* More standard operations (here for binary compatibility) */
835
NULL, /* hashfunc tp_hash; */
836
NULL, /* ternaryfunc tp_call; */
837
NULL, /* reprfunc tp_str; */
838
NULL, /* getattrofunc tp_getattro; */
839
NULL, /* setattrofunc tp_setattro; */
841
/* Functions to access object as input/output buffer */
842
NULL, /* PyBufferProcs *tp_as_buffer; */
844
/*** Flags to define presence of optional/expanded features ***/
845
Py_TPFLAGS_DEFAULT, /* long tp_flags; */
847
NULL, /* char *tp_doc; Documentation string */
848
/*** Assigned meaning in release 2.0 ***/
849
/* call function for all accessible objects */
850
NULL, /* traverseproc tp_traverse; */
852
/* delete references to contained objects */
853
NULL, /* inquiry tp_clear; */
855
/*** Assigned meaning in release 2.1 ***/
856
/*** rich comparisons ***/
857
NULL, /* richcmpfunc tp_richcompare; */
859
/*** weak reference enabler ***/
860
0, /* long tp_weaklistoffset; */
862
/*** Added in release 2.2 ***/
864
( getiterfunc ) SurfNurb_getIter, /* getiterfunc tp_iter; */
865
( iternextfunc ) SurfNurb_iterNext, /* iternextfunc tp_iternext; */
867
/*** Attribute descriptor and subclassing stuff ***/
868
BPy_SurfNurb_methods, /* struct PyMethodDef *tp_methods; */
869
NULL, /* struct PyMemberDef *tp_members; */
870
BPy_SurfNurb_getseters, /* struct PyGetSetDef *tp_getset; */
871
NULL, /* struct _typeobject *tp_base; */
872
NULL, /* PyObject *tp_dict; */
873
NULL, /* descrgetfunc tp_descr_get; */
874
NULL, /* descrsetfunc tp_descr_set; */
875
0, /* long tp_dictoffset; */
876
NULL, /* initproc tp_init; */
877
NULL, /* allocfunc tp_alloc; */
878
NULL, /* newfunc tp_new; */
879
/* Low-level free-memory routine */
880
NULL, /* freefunc tp_free; */
881
/* For PyObject_IS_GC */
882
NULL, /* inquiry tp_is_gc; */
883
NULL, /* PyObject *tp_bases; */
884
/* method resolution order */
885
NULL, /* PyObject *tp_mro; */
886
NULL, /* PyObject *tp_cache; */
887
NULL, /* PyObject *tp_subclasses; */
888
NULL, /* PyObject *tp_weaklist; */
893
factory method to create a BPy_SurfNurb from a Blender Nurb
896
PyObject *SurfNurb_CreatePyObject( Nurb * blen_nurb )
898
BPy_SurfNurb *pyNurb;
900
pyNurb = ( BPy_SurfNurb * ) PyObject_NEW( BPy_SurfNurb, &SurfNurb_Type );
903
return EXPP_ReturnPyObjError( PyExc_MemoryError,
904
"could not create BPy_SurfNurb PyObject" );
906
pyNurb->nurb = blen_nurb;
907
return ( PyObject * ) pyNurb;
911
PyObject *SurfNurb_Init( void )
913
PyType_Ready( &SurfNurb_Type );
914
return Py_InitModule3( "Blender.SurfNurb", M_SurfNurb_methods,