[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23920] branches/soc-2008-mxcurioni/source /blender/freestyle/intern/python/BPy_Nature.cpp: Fixed a bug in the Freestyle.Nature class that instances are always

Tamito Kajiyama rd6t-kjym at asahi-net.or.jp
Sun Oct 18 19:28:15 CEST 2009


Revision: 23920
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23920
Author:   kjym3
Date:     2009-10-18 19:28:15 +0200 (Sun, 18 Oct 2009)

Log Message:
-----------
Fixed a bug in the Freestyle.Nature class that instances are always
considered True even if their integer values are 0.

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

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Nature.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Nature.cpp	2009-10-18 17:06:29 UTC (rev 23919)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Nature.cpp	2009-10-18 17:28:15 UTC (rev 23920)
@@ -11,6 +11,7 @@
 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 @@
 	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 @@
 	return BPy_Nature_bitwise(a, '|', b);
 }
 
+static int
+BPy_Nature_bool(PyObject *v)
+{
+	return ((PyLongObject *)v)->ob_digit[0] != 0;
+}
+
 ///////////////////////////////////////////////////////////////////////////////////////////
 
 #ifdef __cplusplus





More information about the Bf-blender-cvs mailing list