[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17369] branches/soc-2008-mxcurioni/source /blender/freestyle/intern/python: Fixed a bug in Nature_Type and BPy_Nature_from_Nature() that broke all nature-related functionalities (e.g.

Tamito Kajiyama rd6t-kjym at asahi-net.or.jp
Sun Nov 9 00:56:16 CET 2008


Revision: 17369
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17369
Author:   kjym3
Date:     2008-11-09 00:56:16 +0100 (Sun, 09 Nov 2008)

Log Message:
-----------
Fixed a bug in Nature_Type and BPy_Nature_from_Nature() that broke all nature-related functionalities (e.g. pyNatureUP1D() and CurveNatureF1D()).

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

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Convert.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Convert.cpp	2008-11-08 22:05:11 UTC (rev 17368)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Convert.cpp	2008-11-08 23:56:16 UTC (rev 17369)
@@ -109,11 +109,11 @@
 }
 
 PyObject * BPy_Nature_from_Nature( unsigned short n ) {
-	PyObject *py_n =  Nature_Type.tp_new( &Nature_Type, 0, 0 );
+	PyObject *py_n;
 
 	PyObject *args = PyTuple_New(1);
 	PyTuple_SetItem( args, 0, PyInt_FromLong(n) );
-	Nature_Type.tp_init( py_n, args, 0 );
+	py_n =  Nature_Type.tp_new(&Nature_Type, args, NULL);
 	Py_DECREF(args);
 
 	return py_n;
@@ -358,4 +358,4 @@
 
 #ifdef __cplusplus
 }
-#endif
\ No newline at end of file
+#endif

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	2008-11-08 22:05:11 UTC (rev 17368)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Nature.cpp	2008-11-08 23:56:16 UTC (rev 17369)
@@ -8,9 +8,6 @@
 
 ///////////////////////////////////////////////////////////////////////////////////////////
 
-/*---------------  Python API function prototypes for Nature instance  -----------*/
-static int Nature___init__(BPy_Nature *self, PyObject *args, PyObject *kwds);
-
 /*----------------------Nature instance definitions ----------------------------*/
 static PyMethodDef BPy_Nature_methods[] = {
 	{NULL, NULL, 0, NULL}
@@ -77,14 +74,14 @@
 	BPy_Nature_methods,	/* struct PyMethodDef *tp_methods; */
 	NULL,                       	/* struct PyMemberDef *tp_members; */
 	NULL,         					/* struct PyGetSetDef *tp_getset; */
-	&PyInt_Type,							/* struct _typeobject *tp_base; */
+	NULL,							/* struct _typeobject *tp_base; */
 	NULL,							/* PyObject *tp_dict; */
 	NULL,							/* descrgetfunc tp_descr_get; */
 	NULL,							/* descrsetfunc tp_descr_set; */
 	0,                          	/* long tp_dictoffset; */
-	(initproc)Nature___init__,                       	/* initproc tp_init; */
+	NULL,							/* initproc tp_init; */
 	NULL,							/* allocfunc tp_alloc; */
-	PyType_GenericNew,			/* newfunc tp_new; */
+	NULL,							/* newfunc tp_new; */
 	
 	/*  Low-level free-memory routine */
 	NULL,                       /* freefunc tp_free;  */
@@ -109,6 +106,7 @@
 	if( module == NULL )
 		return;
 
+	Nature_Type.tp_base = &PyInt_Type;
 	if( PyType_Ready( &Nature_Type ) < 0 )
 		return;
 	Py_INCREF( &Nature_Type );
@@ -133,14 +131,6 @@
 	
 }
 
-int Nature___init__(BPy_Nature *self, PyObject *args, PyObject *kwds)
-{
-    if (PyInt_Type.tp_init((PyObject *)self, args, kwds) < 0)
-        return -1;
-	
-	return 0;
-}
-
 ///////////////////////////////////////////////////////////////////////////////////////////
 
 #ifdef __cplusplus





More information about the Bf-blender-cvs mailing list