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-10-18 21:28:15 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2009-10-18 21:28:15 +0400
commit211e7be58099445af48d5d678566794f39754ec2 (patch)
tree0dae91a5a81b499f53171c018b9222ce1b794773 /source/blender/freestyle/intern/python
parentbecfa7ec89dcf1180d55556b3a7baf274f3e67c6 (diff)
Fixed a bug in the Freestyle.Nature class that instances are always
considered True even if their integer values are 0.
Diffstat (limited to 'source/blender/freestyle/intern/python')
-rw-r--r--source/blender/freestyle/intern/python/BPy_Nature.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/freestyle/intern/python/BPy_Nature.cpp b/source/blender/freestyle/intern/python/BPy_Nature.cpp
index 0e6a80e0feb..3769271712e 100644
--- a/source/blender/freestyle/intern/python/BPy_Nature.cpp
+++ b/source/blender/freestyle/intern/python/BPy_Nature.cpp
@@ -11,6 +11,7 @@ extern "C" {
static PyObject *BPy_Nature___and__(PyObject *a, PyObject *b);
static PyObject *BPy_Nature___xor__(PyObject *a, PyObject *b);
static PyObject *BPy_Nature___or__(PyObject *a, PyObject *b);
+static int BPy_Nature_bool(PyObject *v);
/*-----------------------BPy_Nature number method definitions --------------------*/
@@ -24,7 +25,7 @@ PyNumberMethods nature_as_number = {
0, /* unaryfunc nb_negative */
0, /* unaryfunc nb_positive */
0, /* unaryfunc nb_absolute */
- 0, /* inquiry nb_bool */
+ (inquiry)BPy_Nature_bool, /* inquiry nb_bool */
0, /* unaryfunc nb_invert */
0, /* binaryfunc nb_lshift */
0, /* binaryfunc nb_rshift */
@@ -239,6 +240,12 @@ BPy_Nature___or__(PyObject *a, PyObject *b)
return BPy_Nature_bitwise(a, '|', b);
}
+static int
+BPy_Nature_bool(PyObject *v)
+{
+ return ((PyLongObject *)v)->ob_digit[0] != 0;
+}
+
///////////////////////////////////////////////////////////////////////////////////////////
#ifdef __cplusplus