Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2009-08-02 22:25:26 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2009-08-02 22:25:26 +0400
commit0ea01da4ba0e370c966a73a797cb8fd96edbae1a (patch)
tree57b8e96a89d814bd77558e58dbe08f40b507dc6e /source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp
parentcc19c8e270f05cce217349486ee7dc3ca2dc955c (diff)
Fixed the argument parsing in CurvePoint.__init__().
Diffstat (limited to 'source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp')
-rw-r--r--source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp39
1 files changed, 24 insertions, 15 deletions
diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp
index 85ccae1c247..2858091b07a 100644
--- a/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp
+++ b/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp
@@ -128,24 +128,33 @@ int CurvePoint___init__(BPy_CurvePoint *self, PyObject *args, PyObject *kwds)
PyObject *obj1 = 0, *obj2 = 0 , *obj3 = 0;
- if (! PyArg_ParseTuple(args, "|OOO", &obj1, &obj2, &obj3) )
+ if (! PyArg_ParseTuple(args, "|OOO!", &obj1, &obj2, &PyFloat_Type, &obj3) )
return -1;
- if( !obj1 && !obj2 && !obj3 ){
+ if( !obj1 ){
self->cp = new CurvePoint();
- } else if( PyFloat_Check(obj3) ) {
- if( BPy_SVertex_Check(obj1) && BPy_SVertex_Check(obj2) ) {
- self->cp = new CurvePoint( ((BPy_SVertex *) obj1)->sv,
- ((BPy_SVertex *) obj2)->sv,
- PyFloat_AsDouble( obj3 ) );
- } else if( BPy_CurvePoint_Check(obj1) && BPy_CurvePoint_Check(obj2) ) {
- self->cp = new CurvePoint( ((BPy_CurvePoint *) obj1)->cp,
- ((BPy_CurvePoint *) obj2)->cp,
- PyFloat_AsDouble( obj3 ) );
- } else {
- PyErr_SetString(PyExc_TypeError, "invalid argument(s)");
- return -1;
- }
+
+ } else if( !obj2 && BPy_CurvePoint_Check(obj1) ) {
+ self->cp = new CurvePoint( *(((BPy_CurvePoint *) obj1)->cp) );
+
+ } else if( obj3 && BPy_SVertex_Check(obj1) && BPy_SVertex_Check(obj2) ) {
+ self->cp = new CurvePoint( ((BPy_SVertex *) obj1)->sv,
+ ((BPy_SVertex *) obj2)->sv,
+ PyFloat_AsDouble( obj3 ) );
+
+ } else if( obj3 && BPy_CurvePoint_Check(obj1) && BPy_CurvePoint_Check(obj2) ) {
+ CurvePoint *cp1 = ((BPy_CurvePoint *) obj1)->cp;
+ CurvePoint *cp2 = ((BPy_CurvePoint *) obj2)->cp;
+ if( !cp1 || cp1->A() == 0 || cp1->B() == 0 ) {
+ PyErr_SetString(PyExc_TypeError, "argument 1 is an invalid CurvePoint object");
+ return -1;
+ }
+ if( !cp2 || cp2->A() == 0 || cp2->B() == 0 ) {
+ PyErr_SetString(PyExc_TypeError, "argument 2 is an invalid CurvePoint object");
+ return -1;
+ }
+ self->cp = new CurvePoint( cp1, cp2, PyFloat_AsDouble( obj3 ) );
+
} else {
PyErr_SetString(PyExc_TypeError, "invalid argument(s)");
return -1;