[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54739] branches/soc-2008-mxcurioni/source /blender/freestyle/intern/python: Missing code updates in the previous commit.

Tamito Kajiyama rd6t-kjym at asahi-net.or.jp
Fri Feb 22 03:48:42 CET 2013


Revision: 54739
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54739
Author:   kjym3
Date:     2013-02-22 02:48:41 +0000 (Fri, 22 Feb 2013)
Log Message:
-----------
Missing code updates in the previous commit.

Also improved __repr__() so that the .getName() is no longer necessary in user-defined
Function0D and Function1D subclasses.

Modified Paths:
--------------
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp	2013-02-22 02:31:46 UTC (rev 54738)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp	2013-02-22 02:48:41 UTC (rev 54739)
@@ -119,7 +119,7 @@
 
 static PyObject * UnaryFunction0DDouble___repr__(BPy_UnaryFunction0DDouble* self)
 {
-	return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_double->getName().c_str(), self->uf0D_double);
+	return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_double);
 }
 
 static PyObject * UnaryFunction0DDouble___call__(BPy_UnaryFunction0DDouble *self, PyObject *args, PyObject *kwds)

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp	2013-02-22 02:31:46 UTC (rev 54738)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp	2013-02-22 02:48:41 UTC (rev 54739)
@@ -63,7 +63,7 @@
 
 static PyObject * UnaryFunction0DEdgeNature___repr__(BPy_UnaryFunction0DEdgeNature* self)
 {
-	return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_edgenature->getName().c_str(), self->uf0D_edgenature);
+	return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_edgenature);
 }
 
 static PyObject * UnaryFunction0DEdgeNature___call__(BPy_UnaryFunction0DEdgeNature *self, PyObject *args, PyObject *kwds)
@@ -73,7 +73,7 @@
 
 	if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj))
 		return NULL;
-	
+
 	if (typeid(*(self->uf0D_edgenature)) == typeid(UnaryFunction0D<Nature::EdgeNature>)) {
 		PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden");
 		return NULL;

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp	2013-02-22 02:31:46 UTC (rev 54738)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp	2013-02-22 02:48:41 UTC (rev 54739)
@@ -93,7 +93,7 @@
 
 static PyObject * UnaryFunction0DFloat___repr__(BPy_UnaryFunction0DFloat* self)
 {
-	return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_float->getName().c_str(), self->uf0D_float);
+	return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_float);
 }
 
 static PyObject * UnaryFunction0DFloat___call__(BPy_UnaryFunction0DFloat *self, PyObject *args, PyObject *kwds)
@@ -103,7 +103,7 @@
 
 	if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj))
 		return NULL;
-	
+
 	if (typeid(*(self->uf0D_float)) == typeid(UnaryFunction0D<float>)) {
 		PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden");
 		return NULL;

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp	2013-02-22 02:31:46 UTC (rev 54738)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp	2013-02-22 02:48:41 UTC (rev 54739)
@@ -63,7 +63,7 @@
 
 static PyObject * UnaryFunction0DId___repr__(BPy_UnaryFunction0DId* self)
 {
-	return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_id->getName().c_str(), self->uf0D_id);
+	return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_id);
 }
 
 static PyObject * UnaryFunction0DId___call__(BPy_UnaryFunction0DId *self, PyObject *args, PyObject *kwds)
@@ -73,7 +73,7 @@
 
 	if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj))
 		return NULL;
-	
+
 	if (typeid(*(self->uf0D_id)) == typeid(UnaryFunction0D<Id>)) {
 		PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden");
 		return NULL;

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp	2013-02-22 02:31:46 UTC (rev 54738)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp	2013-02-22 02:48:41 UTC (rev 54739)
@@ -64,7 +64,7 @@
 
 static PyObject * UnaryFunction0DMaterial___repr__(BPy_UnaryFunction0DMaterial* self)
 {
-	return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_material->getName().c_str(), self->uf0D_material);
+	return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_material);
 }
 
 static PyObject * UnaryFunction0DMaterial___call__(BPy_UnaryFunction0DMaterial *self, PyObject *args, PyObject *kwds)
@@ -74,7 +74,7 @@
 
 	if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj))
 		return NULL;
-	
+
 	if (typeid(*(self->uf0D_material)) == typeid(UnaryFunction0D<FrsMaterial>)) {
 		PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden");
 		return NULL;
@@ -87,7 +87,6 @@
 		return NULL;
 	}
 	return BPy_FrsMaterial_from_FrsMaterial(self->uf0D_material->result);
-
 }
 
 static PyMethodDef BPy_UnaryFunction0DMaterial_methods[] = {

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp	2013-02-22 02:31:46 UTC (rev 54738)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp	2013-02-22 02:48:41 UTC (rev 54739)
@@ -63,7 +63,7 @@
 
 static PyObject * UnaryFunction0DUnsigned___repr__(BPy_UnaryFunction0DUnsigned* self)
 {
-	return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_unsigned->getName().c_str(), self->uf0D_unsigned);
+	return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_unsigned);
 }
 
 static PyObject * UnaryFunction0DUnsigned___call__(BPy_UnaryFunction0DUnsigned *self, PyObject *args, PyObject *kwds)
@@ -73,7 +73,7 @@
 
 	if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj))
 		return NULL;
-	
+
 	if (typeid(*(self->uf0D_unsigned)) == typeid(UnaryFunction0D<unsigned int>)) {
 		PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden");
 		return NULL;
@@ -86,7 +86,6 @@
 		return NULL;
 	}
 	return PyLong_FromLong(self->uf0D_unsigned->result);
-
 }
 
 static PyMethodDef BPy_UnaryFunction0DUnsigned_methods[] = {

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp	2013-02-22 02:31:46 UTC (rev 54738)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp	2013-02-22 02:48:41 UTC (rev 54739)
@@ -14,24 +14,24 @@
 
 //-------------------MODULE INITIALIZATION--------------------------------
 
-int UnaryFunction0DVec2f_Init( PyObject *module ) {
+int UnaryFunction0DVec2f_Init(PyObject *module) {
 
-	if( module == NULL )
+	if (module == NULL)
 		return -1;
 
-	if( PyType_Ready( &UnaryFunction0DVec2f_Type ) < 0 )
+	if (PyType_Ready(&UnaryFunction0DVec2f_Type) < 0)
 		return -1;
-	Py_INCREF( &UnaryFunction0DVec2f_Type );
+	Py_INCREF(&UnaryFunction0DVec2f_Type);
 	PyModule_AddObject(module, "UnaryFunction0DVec2f", (PyObject *)&UnaryFunction0DVec2f_Type);
 	
-	if( PyType_Ready( &Normal2DF0D_Type ) < 0 )
+	if (PyType_Ready(&Normal2DF0D_Type) < 0)
 		return -1;
-	Py_INCREF( &Normal2DF0D_Type );
+	Py_INCREF(&Normal2DF0D_Type);
 	PyModule_AddObject(module, "Normal2DF0D", (PyObject *)&Normal2DF0D_Type);
 	
-	if( PyType_Ready( &VertexOrientation2DF0D_Type ) < 0 )
+	if (PyType_Ready(&VertexOrientation2DF0D_Type) < 0)
 		return -1;
-	Py_INCREF( &VertexOrientation2DF0D_Type );
+	Py_INCREF(&VertexOrientation2DF0D_Type);
 	PyModule_AddObject(module, "VertexOrientation2DF0D", (PyObject *)&VertexOrientation2DF0D_Type);
 
 	return 0;
@@ -51,8 +51,10 @@
 
 static int UnaryFunction0DVec2f___init__(BPy_UnaryFunction0DVec2f* self, PyObject *args, PyObject *kwds)
 {
-    if ( !PyArg_ParseTuple(args, "") )
-        return -1;
+	static const char *kwlist[] = {NULL};
+
+	if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+		return -1;
 	self->uf0D_vec2f = new UnaryFunction0D<Vec2f>();
 	self->uf0D_vec2f->py_uf0D = (PyObject *)self;
 	return 0;
@@ -67,51 +69,32 @@
 
 static PyObject * UnaryFunction0DVec2f___repr__(BPy_UnaryFunction0DVec2f* self)
 {
-	return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_vec2f->getName().c_str(), self->uf0D_vec2f );
+	return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_vec2f);
 }
 
-static char UnaryFunction0DVec2f_getName___doc__[] =
-".. method:: getName()\n"
-"\n"
-"   Returns the name of the unary 0D predicate.\n"
-"\n"
-"   :return: The name of the unary 0D predicate.\n"
-"   :rtype: str\n";
-
-static PyObject * UnaryFunction0DVec2f_getName( BPy_UnaryFunction0DVec2f *self )
+static PyObject * UnaryFunction0DVec2f___call__(BPy_UnaryFunction0DVec2f *self, PyObject *args, PyObject *kwds)
 {

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list