diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2009-03-14 16:11:34 +0300 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2009-03-14 16:11:34 +0300 |
commit | 52e289ee3bfdeb063a3099c0a805a0294044af47 (patch) | |
tree | 3c2f1f87eb5d497b47d9bd1050c1899b984c878c /source | |
parent | c14e91590efd56959eaaaddc47c16817973c59de (diff) |
Fixed StrokeVertex::setPoint() to accept a Blender Vector object as the argument.
Now this method accepts 2D coordinates in the following three forms:
a) Python list of 2 real numbers: setPoint([x, y])
b) Blender Vector of 2 elements: setPoint(Vector(x, y))
c) 2 real numbers: setPoint(x, y)
[The log of Revision 19283 had a wrong message...]
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp index 1e2d34c2767..a62296a37d7 100644 --- a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp @@ -235,11 +235,27 @@ PyObject *StrokeVertex_setPoint( BPy_StrokeVertex *self , PyObject *args) { } if( PyList_Check(obj1) && !obj2 ){ + if ( PyList_Size(obj1) != 2 ) { + cout << "Error: StrokeVertex::setPoint() accepts a list of 2 elements (" + << PyList_Size(obj1) << " found)" << endl; + Py_RETURN_NONE; + } Vec2f v( PyFloat_AsDouble( PyList_GetItem(obj1, 0) ), PyFloat_AsDouble( PyList_GetItem(obj1, 1) ) ); self->sv->setPoint( v ); + } else if ( VectorObject_Check(obj1) && !obj2) { + if ( ((VectorObject *)obj1)->size != 2 ) { + cout << "Error: StrokeVertex::setPoint() accepts a vector of 2 elements (" + << ((VectorObject *)obj1)->size << " found)" << endl; + Py_RETURN_NONE; + } + Vec2f *v = Vec2f_ptr_from_Vector( obj1 ); + self->sv->setPoint( *v ); + delete v; } else if( obj1 && obj2 ){ self->sv->setPoint( PyFloat_AsDouble(obj1), PyFloat_AsDouble(obj2) ); + } else { + cout << "Error: StrokeVertex::setPoint(): unknown argument type" << endl; } Py_RETURN_NONE; |