[Bf-committers] Text3d Patch

joeedh joeeagar at prodigy.net
Tue Mar 15 04:24:33 CET 2005


Use bf-python!

Johnny Matthews wrote:

>Here is a patch for the new Text3d python module that adds the
>following methods...
>
>
>getMode();
>setMode();
>getBevresol();
>setBevresol();
>getResolu();
>setResolu();
>getResolv();
>setResolv();
>getWidth();
>setWidth();
>getExt1();
>setExt1();
>getExt2();
>setExt2();
>getShear();
>setShear();
>getFsize();
>setFsize();
>getLinedist();
>setLinedist();
>getSpacing();
>setSpacing();
>getXof();
>setXof();
>getYof();
>setYof();
>getSpacemode();
>setSpacemode();
>
>  
>
>------------------------------------------------------------------------
>
>Index: blender/source/blender/python/api2_2x/Text3d.c
>===================================================================
>RCS file: /cvsroot/bf-blender/blender/source/blender/python/api2_2x/Text3d.c,v
>retrieving revision 1.3
>diff -u -r1.3 Text3d.c
>--- source/blender/python/api2_2x/Text3d.c	9 Mar 2005 19:45:55 -0000	1.3
>+++ source/blender/python/api2_2x/Text3d.c	15 Mar 2005 02:42:46 -0000
>@@ -26,6 +26,7 @@
>  * This is a new part of Blender.
>  *
>  * Contributor(s): Joilnen Leite
>+ *                 Johnny Matthews
>  *
>  * ***** END GPL/BL DUAL LICENSE BLOCK *****
>  */
>@@ -85,6 +86,36 @@
> static PyObject *Text3d_setName( BPy_Text3d * self, PyObject * args );
> static PyObject *Text3d_setText( BPy_Text3d * self, PyObject * args );
> static PyObject *Text3d_getText( BPy_Text3d * self );
>+static PyObject *Text3d_getMode( BPy_Text3d * self );
>+static PyObject *Text3d_setMode( BPy_Text3d * self, PyObject * args );
>+static PyObject *Text3d_getBevresol( BPy_Text3d * self );
>+static PyObject *Text3d_setBevresol( BPy_Text3d * self, PyObject * args );
>+static PyObject *Text3d_getResolu( BPy_Text3d * self );
>+static PyObject *Text3d_setResolu( BPy_Text3d * self, PyObject * args );
>+static PyObject *Text3d_getResolv( BPy_Text3d * self );
>+static PyObject *Text3d_setResolv( BPy_Text3d * self, PyObject * args );
>+static PyObject *Text3d_getWidth( BPy_Text3d * self );
>+static PyObject *Text3d_setWidth( BPy_Text3d * self, PyObject * args );
>+static PyObject *Text3d_getExt1( BPy_Text3d * self );
>+static PyObject *Text3d_setExt1( BPy_Text3d * self, PyObject * args );
>+static PyObject *Text3d_getExt2( BPy_Text3d * self );
>+static PyObject *Text3d_setExt2( BPy_Text3d * self, PyObject * args );
>+static PyObject *Text3d_getShear( BPy_Text3d * self );
>+static PyObject *Text3d_setShear( BPy_Text3d * self, PyObject * args );
>+static PyObject *Text3d_getFsize( BPy_Text3d * self );
>+static PyObject *Text3d_setFsize( BPy_Text3d * self, PyObject * args );
>+static PyObject *Text3d_getLinedist( BPy_Text3d * self );
>+static PyObject *Text3d_setLinedist( BPy_Text3d * self, PyObject * args );
>+static PyObject *Text3d_getSpacing( BPy_Text3d * self );
>+static PyObject *Text3d_setSpacing( BPy_Text3d * self, PyObject * args );
>+static PyObject *Text3d_getXof( BPy_Text3d * self );
>+static PyObject *Text3d_setXof( BPy_Text3d * self, PyObject * args );
>+static PyObject *Text3d_getYof( BPy_Text3d * self );
>+static PyObject *Text3d_setYof( BPy_Text3d * self, PyObject * args );
>+static PyObject *Text3d_getSpacemode( BPy_Text3d * self );
>+static PyObject *Text3d_setSpacemode( BPy_Text3d * self, PyObject * args );
>+
>+
> 
> /*****************************************************************************/
> /* Python BPy_Text3d methods table:                                            */
>@@ -99,7 +130,64 @@
> 	{"setText", ( PyCFunction ) Text3d_setText,
> 	 METH_VARARGS, "() - Sets Text3d Data"},
> 	{"getText", ( PyCFunction ) Text3d_getText,
>-	 METH_NOARGS, "() - Gets Text3d Data"},	
>+	 METH_NOARGS, "() - Gets Text3d Data"},		 
>+    {"getFlag", ( PyCFunction ) Text3d_getMode,
>+     METH_NOARGS, "() - Return flag (see the doc for semantic)"},
>+    {"setFlag", ( PyCFunction ) Text3d_setMode,
>+     METH_VARARGS, "(int) - Sets flag (see the doc for semantic)"},
>+    {"getBevresol", ( PyCFunction ) Text3d_getBevresol,
>+     METH_NOARGS, "() - Return bevel resolution"},
>+    {"setBevresol", ( PyCFunction ) Text3d_setBevresol,
>+     METH_VARARGS, "(int) - Sets bevel resolution"},
>+    {"getResolu", ( PyCFunction ) Text3d_getResolu,
>+     METH_NOARGS, "() - Return U resolution"},
>+    {"setResolu", ( PyCFunction ) Text3d_setResolu,
>+     METH_VARARGS, "(int) - Sets U resolution"},
>+    {"getResolv", ( PyCFunction ) Text3d_getResolv,
>+     METH_NOARGS, "() - Return V resolution"},
>+    {"setResolv", ( PyCFunction ) Text3d_setResolv,
>+     METH_VARARGS, "(int) - Sets V resolution"},
>+    {"getWidth", ( PyCFunction ) Text3d_getWidth,
>+     METH_NOARGS, "() - Return curve width"},
>+    {"setWidth", ( PyCFunction ) Text3d_setWidth,
>+     METH_VARARGS, "(int) - Sets curve width"},
>+    {"getExt1", ( PyCFunction ) Text3d_getExt1,
>+     METH_NOARGS, "() - Gets Text3d Ext1 Data"},
>+    {"setExt1", ( PyCFunction ) Text3d_setExt1,
>+     METH_VARARGS, "() - Sets Text3d Ext1 Data"},
>+    {"getExt2", ( PyCFunction ) Text3d_getExt2,
>+     METH_NOARGS, "() - Gets Text3d Ext2 Data"},
>+    {"setExt2", ( PyCFunction ) Text3d_setExt2,
>+     METH_VARARGS, "() - Sets Text3d Ext2 Data"},
>+    {"getShear", ( PyCFunction ) Text3d_getShear,
>+     METH_NOARGS, "() - Gets Text3d Shear Data"},
>+    {"setShear", ( PyCFunction ) Text3d_setShear,
>+     METH_VARARGS, "() - Sets Text3d Shear Data"},
>+     {"getFsize", ( PyCFunction ) Text3d_getFsize,
>+     METH_NOARGS, "() - Gets Text3d Fsize Data"},
>+    {"setFsize", ( PyCFunction ) Text3d_setFsize,
>+     METH_VARARGS, "() - Sets Text3d Fsize Data"},
>+     {"getLinedist", ( PyCFunction ) Text3d_getLinedist,
>+     METH_NOARGS, "() - Gets Text3d Linedist Data"},
>+    {"setLinedist", ( PyCFunction ) Text3d_setLinedist,
>+     METH_VARARGS, "() - Sets Text3d Linedist Data"},
>+     {"getSpacing", ( PyCFunction ) Text3d_getSpacing,
>+     METH_NOARGS, "() - Gets Text3d Spacing Data"},
>+    {"setSpacing", ( PyCFunction ) Text3d_setSpacing,
>+     METH_VARARGS, "() - Sets Text3d Spacing Data"},
>+     {"getXof", ( PyCFunction ) Text3d_getXof,
>+     METH_NOARGS, "() - Gets Text3d Xof Data"},
>+    {"setXof", ( PyCFunction ) Text3d_setXof,
>+     METH_VARARGS, "() - Sets Text3d Xof Data"},
>+     {"getYof", ( PyCFunction ) Text3d_getYof,
>+     METH_NOARGS, "() - Gets Text3d Yof Data"},
>+    {"setYof", ( PyCFunction ) Text3d_setYof,
>+     METH_VARARGS, "() - Sets Text3d Yof Data"},
>+     {"getSpacemode", ( PyCFunction ) Text3d_getSpacemode,
>+     METH_NOARGS, "() - Gets Text3d Spacemode Data"},
>+    {"setSpacemode", ( PyCFunction ) Text3d_setSpacemode,
>+     METH_VARARGS, "() - Sets Text3d Spacemode Data"},
>+
> 	 {NULL, NULL, 0, NULL}
> };
> 
>@@ -370,3 +458,309 @@
> 		return Py_None;
> }
> 
>+
>+
>+static PyObject *Text3d_getMode( BPy_Text3d * self )
>+{
>+       PyObject *attr = PyInt_FromLong( ( long ) self->curve->flag );
>+
>+       if( attr )
>+               return attr;
>+
>+       return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
>+                                       "couldn't get Curve.flag attribute" ) );
>+}
>+
>+static PyObject *Text3d_setMode( BPy_Text3d * self, PyObject * args )
>+{
>+
>+       if( !PyArg_ParseTuple( args, "i", &( self->curve->flag ) ) )
>+               return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
>+                                               "expected int argument" ) );
>+
>+       Py_INCREF( Py_None );
>+       return Py_None;
>+}
>+
>+static PyObject *Text3d_getBevresol( BPy_Text3d * self )
>+{
>+       PyObject *attr = PyInt_FromLong( ( long ) self->curve->bevresol );
>+
>+       if( attr )
>+               return attr;
>+
>+       return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
>+                                       "couldn't get Curve.bevresol attribute" ) );
>+}
>+
>+static PyObject *Text3d_setBevresol( BPy_Text3d * self, PyObject * args )
>+{
>+
>+       if( !PyArg_ParseTuple( args, "i", &( self->curve->bevresol ) ) )
>+               return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
>+                                               "expected int argument" ) );
>+
>+       Py_INCREF( Py_None );
>+       return Py_None;
>+}
>+
>+static PyObject *Text3d_getResolu( BPy_Text3d * self )
>+{
>+       PyObject *attr = PyInt_FromLong( ( long ) self->curve->resolu );
>+
>+       if( attr )
>+               return attr;
>+
>+       return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
>+                                       "couldn't get Curve.resolu attribute" ) );
>+}
>+
>+static PyObject *Text3d_setResolu( BPy_Text3d * self, PyObject * args )
>+{
>+
>+       if( !PyArg_ParseTuple( args, "i", &( self->curve->resolu ) ) )
>+               return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
>+                                               "expected int argument" ) );
>+
>+       Py_INCREF( Py_None );
>+       return Py_None;
>+}
>+
>+static PyObject *Text3d_getResolv( BPy_Text3d * self )
>+{
>+       PyObject *attr = PyInt_FromLong( ( long ) self->curve->resolv );
>+
>+       if( attr )
>+               return attr;
>+
>+       return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
>+                                       "couldn't get Curve.resolv attribute" ) );
>+}
>+
>+static PyObject *Text3d_setResolv( BPy_Text3d * self, PyObject * args )
>+{
>+
>+       if( !PyArg_ParseTuple( args, "i", &( self->curve->resolv ) ) )
>+               return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
>+                                               "expected int argument" ) );
>+
>+       Py_INCREF( Py_None );
>+       return Py_None;
>+}
>+
>+static PyObject *Text3d_getWidth( BPy_Text3d * self )
>+{
>+       PyObject *attr = PyFloat_FromDouble( ( double ) self->curve->width );
>+
>+       if( attr )
>+               return attr;
>+
>+       return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
>+                                       "couldn't get Curve.width attribute" ) );
>+}
>+
>+static PyObject *Text3d_setWidth( BPy_Text3d * self, PyObject * args )
>+{
>+
>+       if( !PyArg_ParseTuple( args, "f", &( self->curve->width ) ) )
>+               return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
>+                                               "expected float argument" ) );
>+
>+       Py_INCREF( Py_None );
>+       return Py_None;
>+}
>+static PyObject *Text3d_getExt1( BPy_Text3d * self )
>+{
>+       PyObject *attr = PyFloat_FromDouble( ( double ) self->curve->ext1 );
>+
>+       if( attr )
>+               return attr;
>+
>+       return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
>+                                       "couldn't get Curve.ext1 attribute" ) );
>+}
>+
>+static PyObject *Text3d_setExt1( BPy_Text3d * self, PyObject * args )
>+{
>+
>+       if( !PyArg_ParseTuple( args, "f", &( self->curve->ext1 ) ) )
>+               return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
>+                                               "expected float argument" ) );
>+
>+       Py_INCREF( Py_None );
>+       return Py_None;
>+}
>+
>+static PyObject *Text3d_getExt2( BPy_Text3d * self )
>+{
>+       PyObject *attr = PyFloat_FromDouble( ( double ) self->curve->ext2 );
>+
>+       if( attr )
>+               return attr;
>+
>+       return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
>+                                       "couldn't get Curve.ext2 attribute" ) );
>+}
>+
>+static PyObject *Text3d_setExt2( BPy_Text3d * self, PyObject * args )
>+{
>+
>+       if( !PyArg_ParseTuple( args, "f", &( self->curve->ext2 ) ) )
>+               return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
>+                                               "expected float argument" ) );
>+
>+       Py_INCREF( Py_None );
>+       return Py_None;
>+}
>+
>+static PyObject *Text3d_getShear( BPy_Text3d * self )
>+{
>+       PyObject *attr = PyFloat_FromDouble( ( double ) self->curve->shear );
>+
>+       if( attr )
>+               return attr;
>+
>+       return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
>+                                       "couldn't get Curve.shear attribute" ) );
>+}
>+
>+static PyObject *Text3d_setShear( BPy_Text3d * self, PyObject * args )
>+{
>+
>+       if( !PyArg_ParseTuple( args, "f", &( self->curve->shear ) ) )
>+               return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
>+                                               "expected float argument" ) );
>+
>+       Py_INCREF( Py_None );
>+       return Py_None;
>+}
>+
>+static PyObject *Text3d_getFsize( BPy_Text3d * self )
>+{
>+       PyObject *attr = PyFloat_FromDouble( ( double ) self->curve->fsize );
>+
>+       if( attr )
>+               return attr;
>+
>+       return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
>+                                       "couldn't get Curve.fsize attribute" ) );
>+}
>+
>+static PyObject *Text3d_setFsize( BPy_Text3d * self, PyObject * args )
>+{
>+
>+       if( !PyArg_ParseTuple( args, "f", &( self->curve->fsize ) ) )
>+               return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
>+                                               "expected float argument" ) );
>+
>+       Py_INCREF( Py_None );
>+       return Py_None;
>+}
>+
>+static PyObject *Text3d_getLinedist( BPy_Text3d * self )
>+{
>+       PyObject *attr = PyFloat_FromDouble( ( double ) self->curve->linedist );
>+
>+       if( attr )
>+               return attr;
>+
>+       return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
>+                                       "couldn't get Curve.linedist attribute" ) );
>+}
>+
>+static PyObject *Text3d_setLinedist( BPy_Text3d * self, PyObject * args )
>+{
>+
>+       if( !PyArg_ParseTuple( args, "f", &( self->curve->linedist ) ) )
>+               return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
>+                                               "expected float argument" ) );
>+
>+       Py_INCREF( Py_None );
>+       return Py_None;
>+}
>+
>+static PyObject *Text3d_getSpacing( BPy_Text3d * self )
>+{
>+       PyObject *attr = PyFloat_FromDouble( ( double ) self->curve->spacing );
>+
>+       if( attr )
>+               return attr;
>+
>+       return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
>+                                       "couldn't get Curve.spacing attribute" ) );
>+}
>+
>+static PyObject *Text3d_setSpacing( BPy_Text3d * self, PyObject * args )
>+{
>+
>+       if( !PyArg_ParseTuple( args, "f", &( self->curve->spacing ) ) )
>+               return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
>+                                               "expected float argument" ) );
>+
>+       Py_INCREF( Py_None );
>+       return Py_None;
>+}
>+static PyObject *Text3d_getXof( BPy_Text3d * self )
>+{
>+       PyObject *attr = PyFloat_FromDouble( ( double ) self->curve->xof );
>+
>+       if( attr )
>+               return attr;
>+
>+       return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
>+                                       "couldn't get Curve.xof attribute" ) );
>+}
>+
>+static PyObject *Text3d_setXof( BPy_Text3d * self, PyObject * args )
>+{
>+
>+       if( !PyArg_ParseTuple( args, "f", &( self->curve->xof ) ) )
>+               return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
>+                                               "expected float argument" ) );
>+
>+       Py_INCREF( Py_None );
>+       return Py_None;
>+}
>+
>+static PyObject *Text3d_getYof( BPy_Text3d * self )
>+{
>+       PyObject *attr = PyFloat_FromDouble( ( double ) self->curve->yof );
>+
>+       if( attr )
>+               return attr;
>+
>+       return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
>+                                       "couldn't get Curve.yof attribute" ) );
>+}
>+
>+static PyObject *Text3d_setYof( BPy_Text3d * self, PyObject * args )
>+{
>+
>+       if( !PyArg_ParseTuple( args, "f", &( self->curve->yof ) ) )
>+               return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
>+                                               "expected float argument" ) );
>+
>+       Py_INCREF( Py_None );
>+       return Py_None;
>+}
>+static PyObject *Text3d_getSpacemode( BPy_Text3d * self )
>+{
>+       PyObject *attr = PyInt_FromLong( ( long ) self->curve->spacemode );
>+
>+       if( attr )
>+               return attr;
>+
>+       return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
>+                                       "couldn't get Curve.yof attribute" ) );
>+}
>+
>+static PyObject *Text3d_setSpacemode( BPy_Text3d * self, PyObject * args )
>+{
>+
>+       if( !PyArg_ParseTuple( args, "i", &( self->curve->spacemode ) ) )
>+               return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
>+                                               "expected float argument" ) );
>+
>+       Py_INCREF( Py_None );
>+       return Py_None;
>+}
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Bf-committers mailing list
>Bf-committers at projects.blender.org
>http://projects.blender.org/mailman/listinfo/bf-committers
>  
>



More information about the Bf-committers mailing list