Revision: 19284
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19284
Author:   kjym3
Date:     2009-03-14 14:11:34 +0100 (Sat, 14 Mar 2009)

Log Message:
-----------
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...]

Revision Links:
--------------
    
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19283

Modified Paths:
--------------
    
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp

Modified: 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp
===================================================================
--- 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp
      2009-03-14 13:06:09 UTC (rev 19283)
+++ 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp
      2009-03-14 13:11:34 UTC (rev 19284)
@@ -235,11 +235,27 @@
        }
        
        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;


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to