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>2013-02-22 06:48:41 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-02-22 06:48:41 +0400
commita4a7341aef2e772b7a233ade5dbccfbb959fd8e4 (patch)
tree0011931ebb83858aeb53b15f1b3ddc69bd4f71dd /source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp
parent33f34e1a7bc08f123d76198ae0671e3da1ded401 (diff)
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.
Diffstat (limited to 'source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp')
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp50
1 files changed, 17 insertions, 33 deletions
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp
index 688c9851d30..01c884f8de2 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp
@@ -13,19 +13,19 @@ extern "C" {
//-------------------MODULE INITIALIZATION--------------------------------
-int UnaryFunction0DVectorViewShape_Init( PyObject *module ) {
+int UnaryFunction0DVectorViewShape_Init(PyObject *module) {
- if( module == NULL )
+ if (module == NULL)
return -1;
- if( PyType_Ready( &UnaryFunction0DVectorViewShape_Type ) < 0 )
+ if (PyType_Ready(&UnaryFunction0DVectorViewShape_Type) < 0)
return -1;
- Py_INCREF( &UnaryFunction0DVectorViewShape_Type );
+ Py_INCREF(&UnaryFunction0DVectorViewShape_Type);
PyModule_AddObject(module, "UnaryFunction0DVectorViewShape", (PyObject *)&UnaryFunction0DVectorViewShape_Type);
- if( PyType_Ready( &GetOccludersF0D_Type ) < 0 )
+ if (PyType_Ready(&GetOccludersF0D_Type) < 0)
return -1;
- Py_INCREF( &GetOccludersF0D_Type );
+ Py_INCREF(&GetOccludersF0D_Type);
PyModule_AddObject(module, "GetOccludersF0D", (PyObject *)&GetOccludersF0D_Type);
return 0;
@@ -46,8 +46,10 @@ static char UnaryFunction0DVectorViewShape___doc__[] =
static int UnaryFunction0DVectorViewShape___init__(BPy_UnaryFunction0DVectorViewShape* 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_vectorviewshape = new UnaryFunction0D< std::vector<ViewShape*> >();
self->uf0D_vectorviewshape->py_uf0D = (PyObject *)self;
return 0;
@@ -62,38 +64,22 @@ static void UnaryFunction0DVectorViewShape___dealloc__(BPy_UnaryFunction0DVector
static PyObject * UnaryFunction0DVectorViewShape___repr__(BPy_UnaryFunction0DVectorViewShape* self)
{
- return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_vectorviewshape->getName().c_str(), self->uf0D_vectorviewshape );
-}
-
-static char UnaryFunction0DVectorViewShape_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 * UnaryFunction0DVectorViewShape_getName( BPy_UnaryFunction0DVectorViewShape *self )
-{
- return PyUnicode_FromString( self->uf0D_vectorviewshape->getName().c_str() );
+ return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_vectorviewshape);
}
-static PyObject * UnaryFunction0DVectorViewShape___call__( BPy_UnaryFunction0DVectorViewShape *self, PyObject *args, PyObject *kwds)
+static PyObject * UnaryFunction0DVectorViewShape___call__(BPy_UnaryFunction0DVectorViewShape *self, PyObject *args, PyObject *kwds)
{
+ static const char *kwlist[] = {"it", NULL};
PyObject *obj;
- if( kwds != NULL ) {
- PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported");
- return NULL;
- }
- if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj))
return NULL;
- if( typeid(*(self->uf0D_vectorviewshape)) == typeid(UnaryFunction0D< std::vector<ViewShape*> >) ) {
+ if (typeid(*(self->uf0D_vectorviewshape)) == typeid(UnaryFunction0D< std::vector<ViewShape*> >)) {
PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden");
return NULL;
}
- if (self->uf0D_vectorviewshape->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it )) < 0) {
+ if (self->uf0D_vectorviewshape->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) {
if (!PyErr_Occurred()) {
string class_name(Py_TYPE(self)->tp_name);
PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str());
@@ -102,7 +88,7 @@ static PyObject * UnaryFunction0DVectorViewShape___call__( BPy_UnaryFunction0DVe
}
PyObject *list = PyList_New(0);
PyObject *item;
- for( unsigned int i = 0; i < self->uf0D_vectorviewshape->result.size(); i++) {
+ for(unsigned int i = 0; i < self->uf0D_vectorviewshape->result.size(); i++) {
ViewShape *v = self->uf0D_vectorviewshape->result[i];
if (v) {
item = BPy_ViewShape_from_ViewShape(*v);
@@ -116,9 +102,7 @@ static PyObject * UnaryFunction0DVectorViewShape___call__( BPy_UnaryFunction0DVe
return list;
}
-/*----------------------UnaryFunction0DVectorViewShape instance definitions ----------------------------*/
static PyMethodDef BPy_UnaryFunction0DVectorViewShape_methods[] = {
- {"getName", ( PyCFunction ) UnaryFunction0DVectorViewShape_getName, METH_NOARGS, UnaryFunction0DVectorViewShape_getName___doc__},
{NULL, NULL, 0, NULL}
};