2008-07-21 21:24:37 +00:00
# include "StrokeAttribute.h"
# include "Convert.h"
# ifdef __cplusplus
extern " C " {
# endif
///////////////////////////////////////////////////////////////////////////////////////////
/*--------------- Python API function prototypes for StrokeAttribute instance -----------*/
static int StrokeAttribute___init__ ( BPy_StrokeAttribute * self , PyObject * args , PyObject * kwds ) ;
static void StrokeAttribute___dealloc__ ( BPy_StrokeAttribute * self ) ;
static PyObject * StrokeAttribute___repr__ ( BPy_StrokeAttribute * self ) ;
static PyObject * StrokeAttribute_getColorR ( BPy_StrokeAttribute * self ) ;
static PyObject * StrokeAttribute_getColorG ( BPy_StrokeAttribute * self ) ;
static PyObject * StrokeAttribute_getColorB ( BPy_StrokeAttribute * self ) ;
static PyObject * StrokeAttribute_getColorRGB ( BPy_StrokeAttribute * self ) ;
static PyObject * StrokeAttribute_getAlpha ( BPy_StrokeAttribute * self ) ;
static PyObject * StrokeAttribute_getThicknessR ( BPy_StrokeAttribute * self ) ;
static PyObject * StrokeAttribute_getThicknessL ( BPy_StrokeAttribute * self ) ;
static PyObject * StrokeAttribute_getThicknessRL ( BPy_StrokeAttribute * self ) ;
static PyObject * StrokeAttribute_isVisible ( BPy_StrokeAttribute * self ) ;
static PyObject * StrokeAttribute_getAttributeReal ( BPy_StrokeAttribute * self , PyObject * args ) ;
static PyObject * StrokeAttribute_getAttributeVec2f ( BPy_StrokeAttribute * self , PyObject * args ) ;
static PyObject * StrokeAttribute_getAttributeVec3f ( BPy_StrokeAttribute * self , PyObject * args ) ;
static PyObject * StrokeAttribute_isAttributeAvailableReal ( BPy_StrokeAttribute * self , PyObject * args ) ;
static PyObject * StrokeAttribute_isAttributeAvailableVec2f ( BPy_StrokeAttribute * self , PyObject * args ) ;
static PyObject * StrokeAttribute_isAttributeAvailableVec3f ( BPy_StrokeAttribute * self , PyObject * args ) ;
2008-07-22 00:27:40 +00:00
static PyObject * StrokeAttribute_setColor ( BPy_StrokeAttribute * self , PyObject * args ) ;
static PyObject * StrokeAttribute_setAlpha ( BPy_StrokeAttribute * self , PyObject * args ) ;
static PyObject * StrokeAttribute_setThickness ( BPy_StrokeAttribute * self , PyObject * args ) ;
static PyObject * StrokeAttribute_setVisible ( BPy_StrokeAttribute * self , PyObject * args ) ;
static PyObject * StrokeAttribute_setAttributeReal ( BPy_StrokeAttribute * self , PyObject * args ) ;
static PyObject * StrokeAttribute_setAttributeVec2f ( BPy_StrokeAttribute * self , PyObject * args ) ;
static PyObject * StrokeAttribute_setAttributeVec3f ( BPy_StrokeAttribute * self , PyObject * args ) ;
2008-07-21 21:24:37 +00:00
/*----------------------StrokeAttribute instance definitions ----------------------------*/
static PyMethodDef BPy_StrokeAttribute_methods [ ] = {
{ " getColorR " , ( PyCFunction ) StrokeAttribute_getColorR , METH_NOARGS , " Returns the R color component. " } ,
{ " getColorG " , ( PyCFunction ) StrokeAttribute_getColorG , METH_NOARGS , " Returns the G color component. " } ,
{ " getColorB " , ( PyCFunction ) StrokeAttribute_getColorB , METH_NOARGS , " Returns the B color component. " } ,
{ " getColorRGB " , ( PyCFunction ) StrokeAttribute_getColorRGB , METH_NOARGS , " Returns the RGB color components. " } ,
{ " getAlpha " , ( PyCFunction ) StrokeAttribute_getAlpha , METH_NOARGS , " Returns the alpha color component. " } ,
{ " getThicknessR " , ( PyCFunction ) StrokeAttribute_getThicknessR , METH_NOARGS , " Returns the thickness on the right of the vertex when following the stroke. " } ,
{ " getThicknessL " , ( PyCFunction ) StrokeAttribute_getThicknessL , METH_NOARGS , " Returns the thickness on the left of the vertex when following the stroke. " } ,
{ " getThicknessRL " , ( PyCFunction ) StrokeAttribute_getThicknessRL , METH_NOARGS , " Returns the thickness on the right and on the left of the vertex when following the stroke. " } ,
{ " isVisible " , ( PyCFunction ) StrokeAttribute_isVisible , METH_NOARGS , " Returns true if the strokevertex is visible, false otherwise " } ,
{ " getAttributeReal " , ( PyCFunction ) StrokeAttribute_getAttributeReal , METH_VARARGS , " (name) Returns an attribute of type real specified by name. " } ,
{ " getAttributeVec2f " , ( PyCFunction ) StrokeAttribute_getAttributeVec2f , METH_VARARGS , " (name) Returns an attribute of type Vec2f specified by name. " } ,
{ " getAttributeVec3f " , ( PyCFunction ) StrokeAttribute_getAttributeVec3f , METH_VARARGS , " (name) Returns an attribute of type Vec3f specified by name. " } ,
{ " isAttributeAvailableReal " , ( PyCFunction ) StrokeAttribute_isAttributeAvailableReal , METH_VARARGS , " (name) Checks whether the real attribute specified by name is available " } ,
{ " isAttributeAvailableVec2f " , ( PyCFunction ) StrokeAttribute_isAttributeAvailableVec2f , METH_VARARGS , " (name) Checks whether the Vec2f attribute specified by name is available " } ,
{ " isAttributeAvailableVec3f " , ( PyCFunction ) StrokeAttribute_isAttributeAvailableVec3f , METH_VARARGS , " (name) Checks whether the Vec3f attribute specified by name is available " } ,
{ " setColor " , ( PyCFunction ) StrokeAttribute_setColor , METH_VARARGS , " (float a)Sets the attribute's alpha value. " } ,
{ " setAlpha " , ( PyCFunction ) StrokeAttribute_setAlpha , METH_VARARGS , " (float a) Sets the attribute's alpha value. " } ,
{ " setThickness " , ( PyCFunction ) StrokeAttribute_setThickness , METH_VARARGS , " " } ,
{ " setVisible " , ( PyCFunction ) StrokeAttribute_setVisible , METH_VARARGS , " " } ,
{ " setAttributeReal " , ( PyCFunction ) StrokeAttribute_setAttributeReal , METH_VARARGS , " (name, float att) Adds a user defined attribute of type real. If there is no attribute of specified by name, it is added. Otherwise, the new value replaces the old one. " } ,
{ " setAttributeVec2f " , ( PyCFunction ) StrokeAttribute_setAttributeVec2f , METH_VARARGS , " (name, float att) Adds a user defined attribute of type Vec2f. If there is no attribute of specified by name, it is added. Otherwise, the new value replaces the old one. " } ,
{ " setAttributeVec3f " , ( PyCFunction ) StrokeAttribute_setAttributeVec3f , METH_VARARGS , " (name, float att) Adds a user defined attribute of type Vec4f. If there is no attribute of specified by name, it is added. Otherwise, the new value replaces the old one. " } ,
{ NULL , NULL , 0 , NULL }
} ;
2008-07-22 00:27:40 +00:00
2008-07-21 21:24:37 +00:00
/*-----------------------BPy_StrokeAttribute type definition ------------------------------*/
PyTypeObject StrokeAttribute_Type = {
PyObject_HEAD_INIT ( NULL )
0 , /* ob_size */
" StrokeAttribute " , /* tp_name */
sizeof ( BPy_StrokeAttribute ) , /* tp_basicsize */
0 , /* tp_itemsize */
/* methods */
( destructor ) StrokeAttribute___dealloc__ , /* tp_dealloc */
NULL , /* printfunc tp_print; */
NULL , /* getattrfunc tp_getattr; */
NULL , /* setattrfunc tp_setattr; */
NULL , /* tp_compare */
( reprfunc ) StrokeAttribute___repr__ , /* tp_repr */
/* Method suites for standard classes */
NULL , /* PyNumberMethods *tp_as_number; */
NULL , /* PySequenceMethods *tp_as_sequence; */
NULL , /* PyMappingMethods *tp_as_mapping; */
/* More standard operations (here for binary compatibility) */
NULL , /* hashfunc tp_hash; */
NULL , /* ternaryfunc tp_call; */
NULL , /* reprfunc tp_str; */
NULL , /* getattrofunc tp_getattro; */
NULL , /* setattrofunc tp_setattro; */
/* Functions to access object as input/output buffer */
NULL , /* PyBufferProcs *tp_as_buffer; */
/*** Flags to define presence of optional/expanded features ***/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE , /* long tp_flags; */
NULL , /* char *tp_doc; Documentation string */
/*** Assigned meaning in release 2.0 ***/
/* call function for all accessible objects */
NULL , /* traverseproc tp_traverse; */
/* delete references to contained objects */
NULL , /* inquiry tp_clear; */
/*** Assigned meaning in release 2.1 ***/
/*** rich comparisons ***/
NULL , /* richcmpfunc tp_richcompare; */
/*** weak reference enabler ***/
0 , /* long tp_weaklistoffset; */
/*** Added in release 2.2 ***/
/* Iterators */
NULL , /* getiterfunc tp_iter; */
NULL , /* iternextfunc tp_iternext; */
/*** Attribute descriptor and subclassing stuff ***/
BPy_StrokeAttribute_methods , /* struct PyMethodDef *tp_methods; */
NULL , /* struct PyMemberDef *tp_members; */
2008-07-22 00:27:40 +00:00
NULL , /* struct PyGetSetDef *tp_getset; */
2008-07-21 21:24:37 +00:00
NULL , /* struct _typeobject *tp_base; */
NULL , /* PyObject *tp_dict; */
NULL , /* descrgetfunc tp_descr_get; */
NULL , /* descrsetfunc tp_descr_set; */
0 , /* long tp_dictoffset; */
( initproc ) StrokeAttribute___init__ , /* initproc tp_init; */
NULL , /* allocfunc tp_alloc; */
PyType_GenericNew , /* newfunc tp_new; */
/* Low-level free-memory routine */
NULL , /* freefunc tp_free; */
/* For PyObject_IS_GC */
NULL , /* inquiry tp_is_gc; */
NULL , /* PyObject *tp_bases; */
/* method resolution order */
NULL , /* PyObject *tp_mro; */
NULL , /* PyObject *tp_cache; */
NULL , /* PyObject *tp_subclasses; */
NULL , /* PyObject *tp_weaklist; */
NULL
} ;
//-------------------MODULE INITIALIZATION--------------------------------
PyMODINIT_FUNC StrokeAttribute_Init ( PyObject * module )
{
if ( module = = NULL )
return ;
if ( PyType_Ready ( & StrokeAttribute_Type ) < 0 )
return ;
Py_INCREF ( & StrokeAttribute_Type ) ;
PyModule_AddObject ( module , " StrokeAttribute " , ( PyObject * ) & StrokeAttribute_Type ) ;
2008-07-09 08:24:13 +00:00
}
2008-07-21 21:24:37 +00:00
//------------------------INSTANCE METHODS ----------------------------------
int StrokeAttribute___init__ ( BPy_StrokeAttribute * self , PyObject * args , PyObject * kwds )
{
PyObject * obj1 = 0 , * obj2 = 0 , * obj3 = 0 , * obj4 = 0 , * obj5 = 0 , * obj6 = 0 ;
if ( ! PyArg_ParseTuple ( args , " |OOOOOO " , & obj1 , & obj2 , & obj3 , & obj4 , & obj5 , & obj6 ) )
return - 1 ;
if ( ! obj1 | | ! obj2 | | ! obj3 ) {
self - > sa = new StrokeAttribute ( ) ;
} else if ( BPy_StrokeAttribute_Check ( obj1 ) & &
BPy_StrokeAttribute_Check ( obj2 ) & &
PyFloat_Check ( obj3 ) ) {
self - > sa = new StrokeAttribute ( * ( ( ( BPy_StrokeAttribute * ) obj1 ) - > sa ) ,
* ( ( ( BPy_StrokeAttribute * ) obj2 ) - > sa ) ,
PyFloat_AsDouble ( obj3 ) ) ;
2008-07-22 00:27:40 +00:00
} else if ( obj4 & & obj5 & & obj6 ) {
2008-07-21 21:24:37 +00:00
self - > sa = new StrokeAttribute ( PyFloat_AsDouble ( obj1 ) ,
PyFloat_AsDouble ( obj2 ) ,
PyFloat_AsDouble ( obj3 ) ,
PyFloat_AsDouble ( obj4 ) ,
PyFloat_AsDouble ( obj5 ) ,
PyFloat_AsDouble ( obj6 ) ) ;
} else {
return - 1 ;
}
return 0 ;
2008-07-09 08:24:13 +00:00
}
2008-07-21 21:24:37 +00:00
void StrokeAttribute___dealloc__ ( BPy_StrokeAttribute * self )
{
delete self - > sa ;
self - > ob_type - > tp_free ( ( PyObject * ) self ) ;
2008-07-09 08:24:13 +00:00
}
2008-07-21 21:24:37 +00:00
PyObject * StrokeAttribute___repr__ ( BPy_StrokeAttribute * self )
{
2008-07-22 00:27:40 +00:00
stringstream repr ( " StrokeAttribute: " ) ;
repr < < " r: " < < self - > sa - > getColorR ( )
< < " g: " < < self - > sa - > getColorG ( )
< < " b: " < < self - > sa - > getColorB ( )
< < " a: " < < self - > sa - > getAlpha ( )
< < " - R: " < < self - > sa - > getThicknessR ( )
< < " L: " < < self - > sa - > getThicknessL ( ) ;
return PyString_FromFormat ( repr . str ( ) . c_str ( ) ) ;
2008-07-09 08:24:13 +00:00
}
2008-07-21 21:24:37 +00:00
PyObject * StrokeAttribute_getColorR ( BPy_StrokeAttribute * self ) {
return PyFloat_FromDouble ( self - > sa - > getColorR ( ) ) ;
2008-07-09 08:24:13 +00:00
}
2008-07-21 21:24:37 +00:00
PyObject * StrokeAttribute_getColorG ( BPy_StrokeAttribute * self ) {
return PyFloat_FromDouble ( self - > sa - > getColorG ( ) ) ;
}
2008-07-09 08:24:13 +00:00
2008-07-21 21:24:37 +00:00
PyObject * StrokeAttribute_getColorB ( BPy_StrokeAttribute * self ) {
return PyFloat_FromDouble ( self - > sa - > getColorB ( ) ) ;
2008-07-09 08:24:13 +00:00
}
2008-07-21 21:24:37 +00:00
PyObject * StrokeAttribute_getColorRGB ( BPy_StrokeAttribute * self ) {
Vec3f v ( self - > sa - > getColorRGB ( ) ) ;
return Vector_from_Vec3f ( v ) ;
}
2008-07-09 08:24:13 +00:00
2008-07-21 21:24:37 +00:00
PyObject * StrokeAttribute_getAlpha ( BPy_StrokeAttribute * self ) {
return PyFloat_FromDouble ( self - > sa - > getAlpha ( ) ) ;
2008-07-09 08:24:13 +00:00
}
2008-07-21 21:24:37 +00:00
PyObject * StrokeAttribute_getThicknessR ( BPy_StrokeAttribute * self ) {
return PyFloat_FromDouble ( self - > sa - > getThicknessR ( ) ) ;
}
PyObject * StrokeAttribute_getThicknessL ( BPy_StrokeAttribute * self ) {
return PyFloat_FromDouble ( self - > sa - > getThicknessL ( ) ) ;
}
PyObject * StrokeAttribute_getThicknessRL ( BPy_StrokeAttribute * self ) {
Vec2f v ( self - > sa - > getThicknessRL ( ) ) ;
return Vector_from_Vec2f ( v ) ;
2008-07-09 08:24:13 +00:00
}
2008-07-21 21:24:37 +00:00
PyObject * StrokeAttribute_isVisible ( BPy_StrokeAttribute * self ) {
return PyBool_from_bool ( self - > sa - > isVisible ( ) ) ;
2008-07-09 08:24:13 +00:00
}
2008-07-21 21:24:37 +00:00
PyObject * StrokeAttribute_getAttributeReal ( BPy_StrokeAttribute * self , PyObject * args ) {
char * attr ;
2008-07-09 08:24:13 +00:00
2008-07-21 21:24:37 +00:00
if ( ! ( PyArg_ParseTuple ( args , " s " , & attr ) ) ) {
cout < < " ERROR: StrokeAttribute_getAttributeReal " < < endl ;
Py_RETURN_NONE ;
}
2008-07-09 08:24:13 +00:00
2008-07-21 21:24:37 +00:00
double a = self - > sa - > getAttributeReal ( attr ) ;
return PyFloat_FromDouble ( a ) ;
2008-07-09 08:24:13 +00:00
}
2008-07-21 21:24:37 +00:00
PyObject * StrokeAttribute_getAttributeVec2f ( BPy_StrokeAttribute * self , PyObject * args ) {
char * attr ;
2008-07-09 08:24:13 +00:00
2008-07-21 21:24:37 +00:00
if ( ! ( PyArg_ParseTuple ( args , " s " , & attr ) ) ) {
cout < < " ERROR: StrokeAttribute_getAttributeVec2f " < < endl ;
Py_RETURN_NONE ;
}
Vec2f a = self - > sa - > getAttributeVec2f ( attr ) ;
return Vector_from_Vec2f ( a ) ;
2008-07-09 08:24:13 +00:00
}
2008-07-21 21:24:37 +00:00
PyObject * StrokeAttribute_getAttributeVec3f ( BPy_StrokeAttribute * self , PyObject * args ) {
char * attr ;
2008-07-09 08:24:13 +00:00
2008-07-21 21:24:37 +00:00
if ( ! ( PyArg_ParseTuple ( args , " s " , & attr ) ) ) {
cout < < " ERROR: StrokeAttribute_getAttributeVec3f " < < endl ;
Py_RETURN_NONE ;
}
2008-07-09 08:24:13 +00:00
2008-07-21 21:24:37 +00:00
Vec3f a = self - > sa - > getAttributeVec3f ( attr ) ;
return Vector_from_Vec3f ( a ) ;
2008-07-09 08:24:13 +00:00
}
2008-07-21 21:24:37 +00:00
PyObject * StrokeAttribute_isAttributeAvailableReal ( BPy_StrokeAttribute * self , PyObject * args ) {
char * attr ;
if ( ! ( PyArg_ParseTuple ( args , " s " , & attr ) ) ) {
cout < < " ERROR: StrokeAttribute_isAttributeAvailableReal " < < endl ;
Py_RETURN_NONE ;
}
2008-07-09 08:24:13 +00:00
2008-07-21 21:24:37 +00:00
return PyBool_from_bool ( self - > sa - > isAttributeAvailableReal ( attr ) ) ;
2008-07-09 08:24:13 +00:00
}
2008-07-21 21:24:37 +00:00
PyObject * StrokeAttribute_isAttributeAvailableVec2f ( BPy_StrokeAttribute * self , PyObject * args ) {
char * attr ;
2008-07-09 08:24:13 +00:00
2008-07-21 21:24:37 +00:00
if ( ! ( PyArg_ParseTuple ( args , " s " , & attr ) ) ) {
cout < < " ERROR: StrokeAttribute_isAttributeAvailableVec2f " < < endl ;
Py_RETURN_NONE ;
}
return PyBool_from_bool ( self - > sa - > isAttributeAvailableVec2f ( attr ) ) ;
2008-07-09 08:24:13 +00:00
}
2008-07-21 21:24:37 +00:00
PyObject * StrokeAttribute_isAttributeAvailableVec3f ( BPy_StrokeAttribute * self , PyObject * args ) {
char * attr ;
if ( ! ( PyArg_ParseTuple ( args , " s " , & attr ) ) ) {
cout < < " ERROR: StrokeAttribute_isAttributeAvailableVec3f " < < endl ;
Py_RETURN_NONE ;
}
2008-07-09 08:24:13 +00:00
2008-07-21 21:24:37 +00:00
return PyBool_from_bool ( self - > sa - > isAttributeAvailableVec3f ( attr ) ) ;
2008-07-09 08:24:13 +00:00
}
2008-07-22 00:27:40 +00:00
PyObject * StrokeAttribute_setColor ( BPy_StrokeAttribute * self , PyObject * args ) {
2008-07-21 21:24:37 +00:00
PyObject * obj1 = 0 , * obj2 = 0 , * obj3 = 0 ;
if ( ! ( PyArg_ParseTuple ( args , " O|OO " , & obj1 , & obj2 , & obj3 ) ) ) {
cout < < " ERROR: StrokeAttribute_setColor " < < endl ;
2008-07-22 00:27:40 +00:00
Py_RETURN_NONE ;
2008-07-21 21:24:37 +00:00
}
2008-07-22 00:27:40 +00:00
2008-07-21 21:24:37 +00:00
if ( PyList_Check ( obj1 ) & & ! obj2 & & ! obj3 ) {
Vec3f v ( PyFloat_AsDouble ( PyList_GetItem ( obj1 , 0 ) ) ,
PyFloat_AsDouble ( PyList_GetItem ( obj1 , 1 ) ) ,
PyFloat_AsDouble ( PyList_GetItem ( obj1 , 2 ) ) ) ;
self - > sa - > setColor ( v ) ;
2008-07-22 00:27:40 +00:00
} else if ( obj1 & & obj2 & & obj3 ) {
2008-07-21 21:24:37 +00:00
self - > sa - > setColor ( PyFloat_AsDouble ( obj1 ) ,
PyFloat_AsDouble ( obj2 ) ,
PyFloat_AsDouble ( obj3 ) ) ;
}
2008-07-22 00:27:40 +00:00
Py_RETURN_NONE ;
2008-07-09 08:24:13 +00:00
}
2008-07-22 00:27:40 +00:00
PyObject * StrokeAttribute_setAlpha ( BPy_StrokeAttribute * self , PyObject * args ) {
2008-07-21 21:24:37 +00:00
float f = 0 ;
2008-07-09 08:24:13 +00:00
2008-07-21 21:24:37 +00:00
if ( ! ( PyArg_ParseTuple ( args , " f " , & f ) ) ) {
cout < < " ERROR: StrokeAttribute_setAlpha " < < endl ;
2008-07-22 00:27:40 +00:00
Py_RETURN_NONE ;
2008-07-21 21:24:37 +00:00
}
self - > sa - > setAlpha ( f ) ;
2008-07-22 00:27:40 +00:00
Py_RETURN_NONE ;
2008-07-09 08:24:13 +00:00
}
2008-07-22 00:27:40 +00:00
PyObject * StrokeAttribute_setThickness ( BPy_StrokeAttribute * self , PyObject * args ) {
2008-07-21 21:24:37 +00:00
PyObject * obj1 = 0 , * obj2 = 0 ;
if ( ! ( PyArg_ParseTuple ( args , " O|O " , & obj1 , & obj2 ) ) ) {
cout < < " ERROR: StrokeAttribute_setThickness " < < endl ;
2008-07-22 00:27:40 +00:00
Py_RETURN_NONE ;
2008-07-21 21:24:37 +00:00
}
if ( PyList_Check ( obj1 ) & & ! obj2 ) {
Vec2f v ( PyFloat_AsDouble ( PyList_GetItem ( obj1 , 0 ) ) ,
PyFloat_AsDouble ( PyList_GetItem ( obj1 , 1 ) ) ) ;
self - > sa - > setThickness ( v ) ;
2008-07-22 00:27:40 +00:00
} else if ( obj1 & & obj2 ) {
2008-07-21 21:24:37 +00:00
self - > sa - > setThickness ( PyFloat_AsDouble ( obj1 ) ,
PyFloat_AsDouble ( obj2 ) ) ;
}
2008-07-22 00:27:40 +00:00
Py_RETURN_NONE ;
2008-07-09 08:24:13 +00:00
}
2008-07-22 00:27:40 +00:00
PyObject * StrokeAttribute_setVisible ( BPy_StrokeAttribute * self , PyObject * args ) {
2008-07-21 21:24:37 +00:00
int i = 0 ;
2008-07-09 08:24:13 +00:00
2008-07-21 21:24:37 +00:00
if ( ! ( PyArg_ParseTuple ( args , " i " , & i ) ) ) {
cout < < " ERROR: StrokeAttribute_setVisible " < < endl ;
2008-07-22 00:27:40 +00:00
Py_RETURN_NONE ;
2008-07-21 21:24:37 +00:00
}
self - > sa - > setVisible ( i ) ;
2008-07-22 00:27:40 +00:00
Py_RETURN_NONE ;
2008-07-09 08:24:13 +00:00
}
2008-07-22 00:27:40 +00:00
PyObject * StrokeAttribute_setAttributeReal ( BPy_StrokeAttribute * self , PyObject * args ) {
2008-07-21 21:24:37 +00:00
char * s = 0 ;
double d = 0 ;
if ( ! ( PyArg_ParseTuple ( args , " sd " , & s , & d ) ) ) {
cout < < " ERROR: StrokeAttribute_setAttributeReal " < < endl ;
2008-07-22 00:27:40 +00:00
Py_RETURN_NONE ;
2008-07-21 21:24:37 +00:00
}
2008-07-09 08:24:13 +00:00
2008-07-21 21:24:37 +00:00
self - > sa - > setAttributeReal ( s , d ) ;
2008-07-22 00:27:40 +00:00
Py_RETURN_NONE ;
2008-07-09 08:24:13 +00:00
}
2008-07-22 00:27:40 +00:00
PyObject * StrokeAttribute_setAttributeVec2f ( BPy_StrokeAttribute * self , PyObject * args ) {
2008-07-21 21:24:37 +00:00
char * s ;
PyObject * obj = 0 ;
2008-07-09 08:24:13 +00:00
2008-07-21 21:24:37 +00:00
if ( ! ( PyArg_ParseTuple ( args , " sO " , & s , & obj ) ) ) {
cout < < " ERROR: StrokeAttribute_setAttributeVec2f " < < endl ;
2008-07-22 00:27:40 +00:00
Py_RETURN_NONE ;
2008-07-21 21:24:37 +00:00
}
2008-07-09 08:24:13 +00:00
2008-07-21 21:24:37 +00:00
if ( PyList_Check ( obj ) & & PyList_Size ( obj ) > 1 ) {
2008-07-09 08:24:13 +00:00
2008-07-21 21:24:37 +00:00
Vec2f v ( PyFloat_AsDouble ( PyList_GetItem ( obj , 0 ) ) ,
PyFloat_AsDouble ( PyList_GetItem ( obj , 1 ) ) ) ;
self - > sa - > setAttributeVec2f ( s , v ) ;
}
2008-07-22 00:27:40 +00:00
Py_RETURN_NONE ;
2008-07-09 08:24:13 +00:00
}
2008-07-22 00:27:40 +00:00
PyObject * StrokeAttribute_setAttributeVec3f ( BPy_StrokeAttribute * self , PyObject * args ) {
2008-07-21 21:24:37 +00:00
char * s ;
PyObject * obj = 0 ;
2008-07-09 08:24:13 +00:00
2008-07-21 21:24:37 +00:00
if ( ! ( PyArg_ParseTuple ( args , " sO " , & s , & obj ) ) ) {
cout < < " ERROR: StrokeAttribute_setAttributeVec3f " < < endl ;
2008-07-22 00:27:40 +00:00
Py_RETURN_NONE ;
2008-07-21 21:24:37 +00:00
}
2008-07-09 08:24:13 +00:00
2008-07-21 21:24:37 +00:00
if ( PyList_Check ( obj ) & & PyList_Size ( obj ) > 2 ) {
2008-07-09 08:24:13 +00:00
2008-07-21 21:24:37 +00:00
Vec3f v ( PyFloat_AsDouble ( PyList_GetItem ( obj , 0 ) ) ,
PyFloat_AsDouble ( PyList_GetItem ( obj , 1 ) ) ,
PyFloat_AsDouble ( PyList_GetItem ( obj , 2 ) ) ) ;
2008-07-09 08:24:13 +00:00
2008-07-21 21:24:37 +00:00
self - > sa - > setAttributeVec3f ( s , v ) ;
}
2008-07-22 00:27:40 +00:00
Py_RETURN_NONE ;
2008-07-09 08:24:13 +00:00
}
2008-07-21 21:24:37 +00:00
///////////////////////////////////////////////////////////////////////////////////////////
2008-07-09 08:24:13 +00:00
2008-07-21 21:24:37 +00:00
# ifdef __cplusplus
2008-07-09 08:24:13 +00:00
}
2008-07-21 21:24:37 +00:00
# endif
2008-07-09 08:24:13 +00:00