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-04-04 00:03:09 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2009-04-04 00:03:09 +0400
commitacfd7c82abdc26b7cd2859e762f12cc066a4ef68 (patch)
tree41c8ea9b40a662db1cc86bc167feec4ea563ea2b /source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp
parent5926ad2db281aeb965d382533973393f0459315b (diff)
Relaxed type checking concerning boolean arguments in class constructors
and __call__ methods so that not only True and False but also various other boolean expressions (e.g., 0, 1, and None) are accepted.
Diffstat (limited to 'source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp')
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp
index 4bfaab92a8e..3ad22fe5235 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp
@@ -118,9 +118,17 @@ int ChainSilhouetteIterator___init__(BPy_ChainSilhouetteIterator *self, PyObject
self->cs_it = new ChainSilhouetteIterator(*( ((BPy_ChainSilhouetteIterator *) obj1)->cs_it ));
} else {
- bool restrictToSelection = ( obj1 && PyBool_Check(obj1) ) ? bool_from_PyBool(obj1) : true;
- ViewEdge *begin = ( obj2 && BPy_ViewEdge_Check(obj2) ) ? ((BPy_ViewEdge *) obj2)->ve : 0;
- bool orientation = ( obj3 && PyBool_Check(obj3) ) ? bool_from_PyBool(obj3) : true;
+ bool restrictToSelection = ( obj1 ) ? bool_from_PyBool(obj1) : true;
+ ViewEdge *begin;
+ if ( !obj2 || obj2 == Py_None )
+ begin = NULL;
+ else if ( BPy_ViewEdge_Check(obj2) )
+ begin = ((BPy_ViewEdge *) obj2)->ve;
+ else {
+ PyErr_SetString(PyExc_TypeError, "2nd argument must be either a ViewEdge object or None");
+ return -1;
+ }
+ bool orientation = ( obj3 ) ? bool_from_PyBool(obj3) : true;
self->cs_it = new ChainSilhouetteIterator( restrictToSelection, begin, orientation);
}