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-03 19:19:51 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2009-08-03 19:19:51 +0400
commitff110c17f705976435ee14f2cde9c85f7334a56c (patch)
treeb1748338ca9489ddef1a61ff923b46438ed937ce /source/blender/freestyle/intern/python/Interface1D
parentd4ff63fe20d912a72a7695852a204ab3f1d3dce7 (diff)
Fixed argument checking in __init__ methods of Interface1D, Predicates,
Functions, and StrokeShader types.
Diffstat (limited to 'source/blender/freestyle/intern/python/Interface1D')
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp12
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp17
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp2
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp4
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp4
5 files changed, 23 insertions, 16 deletions
diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp
index ccdcbe98c69..2f09a50b616 100644
--- a/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp
+++ b/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp
@@ -152,16 +152,20 @@ PyTypeObject FEdge_Type = {
int FEdge___init__(BPy_FEdge *self, PyObject *args, PyObject *kwds)
{
-
PyObject *obj1 = 0, *obj2 = 0;
- if (! PyArg_ParseTuple(args, "|O!O!", &SVertex_Type, &obj1, &SVertex_Type, &obj2) )
+ if (! PyArg_ParseTuple(args, "|OO", &obj1, &obj2) )
return -1;
- if( !obj1 && !obj2 ){
+ if( !obj1 ){
self->fe = new FEdge();
- } else if( obj1 && obj2 ) {
+
+ } else if( !obj2 && BPy_FEdge_Check(obj1) ) {
+ self->fe = new FEdge(*( ((BPy_FEdge *) obj1)->fe ));
+
+ } else if( obj2 && BPy_SVertex_Check(obj1) && BPy_SVertex_Check(obj2) ) {
self->fe = new FEdge( ((BPy_SVertex *) obj1)->sv, ((BPy_SVertex *) obj2)->sv );
+
} else {
PyErr_SetString(PyExc_TypeError, "invalid argument(s)");
return -1;
diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp
index 38cba3f1275..d388cb10c06 100644
--- a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp
+++ b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp
@@ -183,18 +183,19 @@ int Stroke___init__(BPy_Stroke *self, PyObject *args, PyObject *kwds)
if (! PyArg_ParseTuple(args, "|OO", &obj1, &obj2) )
return -1;
- if( !obj1 && !obj2 ){
+ if( !obj1 ){
self->s = new Stroke();
- } else if ( obj1 && !obj2 ) {
- if (! BPy_Stroke_Check(obj1) ) {
- PyErr_SetString(PyExc_TypeError, "not a Stroke object");
- return -1;
- }
+
+ } else if ( !obj2 && BPy_Stroke_Check(obj1) ) {
self->s = new Stroke(*( ((BPy_Stroke *)obj1)->s ));
- } else {
- PyErr_SetString(PyExc_NotImplementedError,
+
+ } else if ( obj2 ) {
+ PyErr_SetString(PyExc_TypeError,
"Stroke(InputVertexIterator iBegin, InputVertexIterator iEnd) not implemented");
return -1;
+ } else {
+ PyErr_SetString(PyExc_TypeError, "invalid argument(s)");
+ return -1;
}
self->py_if1D.if1D = self->s;
diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp
index ba0c4756b9b..634b0ff906d 100644
--- a/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp
+++ b/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp
@@ -161,6 +161,8 @@ PyTypeObject ViewEdge_Type = {
int ViewEdge___init__(BPy_ViewEdge *self, PyObject *args, PyObject *kwds)
{
+ if ( !PyArg_ParseTuple(args, "") )
+ return -1;
self->ve = new ViewEdge();
self->py_if1D.if1D = self->ve;
self->py_if1D.borrowed = 0;
diff --git a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp
index 7f60098a4d1..5e037064aa8 100644
--- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp
+++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp
@@ -135,10 +135,10 @@ int FEdgeSharp___init__(BPy_FEdgeSharp *self, PyObject *args, PyObject *kwds)
if( !obj1 ){
self->fes = new FEdgeSharp();
- } else if( BPy_FEdgeSharp_Check(obj1) ) {
+ } else if( !obj2 && BPy_FEdgeSharp_Check(obj1) ) {
self->fes = new FEdgeSharp(*( ((BPy_FEdgeSharp *) obj1)->fes ));
- } else if( BPy_SVertex_Check(obj1) && BPy_SVertex_Check(obj2) ) {
+ } else if( obj2 && BPy_SVertex_Check(obj1) && BPy_SVertex_Check(obj2) ) {
self->fes = new FEdgeSharp( ((BPy_SVertex *) obj1)->sv, ((BPy_SVertex *) obj2)->sv );
} else {
diff --git a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp
index c19ef463f22..36d5b75bc25 100644
--- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp
+++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp
@@ -127,10 +127,10 @@ int FEdgeSmooth___init__(BPy_FEdgeSmooth *self, PyObject *args, PyObject *kwds)
if( !obj1 ){
self->fes = new FEdgeSmooth();
- } else if( BPy_FEdgeSmooth_Check(obj1) ) {
+ } else if( !obj2 && BPy_FEdgeSmooth_Check(obj1) ) {
self->fes = new FEdgeSmooth(*( ((BPy_FEdgeSmooth *) obj1)->fes ));
- } else if( BPy_SVertex_Check(obj1) && BPy_SVertex_Check(obj2) ) {
+ } else if( obj2 && BPy_SVertex_Check(obj1) && BPy_SVertex_Check(obj2) ) {
self->fes = new FEdgeSmooth( ((BPy_SVertex *) obj1)->sv, ((BPy_SVertex *) obj2)->sv );
} else {