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 05:57:20 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-02-22 05:57:20 +0400
commit33f34e1a7bc08f123d76198ae0671e3da1ded401 (patch)
tree2e94232e350814cd1334cc262309fd9efd8b9ab6 /source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp
parent6cd036ab96fa50b280a6a0cfda7f09f1c1f57600 (diff)
Freestyle Python API improvements - part 6.
Fix for PyGetSetDef and proper handling of keyword arguments were done in Function0D and Function1D classes. Additional code clean-up was also made.
Diffstat (limited to 'source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp')
-rw-r--r--source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp47
1 files changed, 32 insertions, 15 deletions
diff --git a/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp
index f4de9edb962..91c566dc369 100644
--- a/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp
+++ b/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp
@@ -16,24 +16,24 @@ extern "C" {
///////////////////////////////////////////////////////////////////////////////////////////
//-------------------MODULE INITIALIZATION--------------------------------
-int UnaryFunction1D_Init( PyObject *module )
+int UnaryFunction1D_Init(PyObject *module)
{
- if( module == NULL )
+ if (module == NULL)
return -1;
- if( PyType_Ready( &UnaryFunction1D_Type ) < 0 )
+ if (PyType_Ready(&UnaryFunction1D_Type) < 0)
return -1;
- Py_INCREF( &UnaryFunction1D_Type );
+ Py_INCREF(&UnaryFunction1D_Type);
PyModule_AddObject(module, "UnaryFunction1D", (PyObject *)&UnaryFunction1D_Type);
- UnaryFunction1DDouble_Init( module );
- UnaryFunction1DEdgeNature_Init( module );
- UnaryFunction1DFloat_Init( module );
- UnaryFunction1DUnsigned_Init( module );
- UnaryFunction1DVec2f_Init( module );
- UnaryFunction1DVec3f_Init( module );
- UnaryFunction1DVectorViewShape_Init( module );
- UnaryFunction1DVoid_Init( module );
+ UnaryFunction1DDouble_Init(module);
+ UnaryFunction1DEdgeNature_Init(module);
+ UnaryFunction1DFloat_Init(module);
+ UnaryFunction1DUnsigned_Init(module);
+ UnaryFunction1DVec2f_Init(module);
+ UnaryFunction1DVec3f_Init(module);
+ UnaryFunction1DVectorViewShape_Init(module);
+ UnaryFunction1DVoid_Init(module);
return 0;
}
@@ -59,14 +59,31 @@ static char UnaryFunction1D___doc__[] =
static void UnaryFunction1D___dealloc__(BPy_UnaryFunction1D* self)
{
- Py_TYPE(self)->tp_free((PyObject*)self);
+ Py_TYPE(self)->tp_free((PyObject*)self);
}
static PyObject * UnaryFunction1D___repr__(BPy_UnaryFunction1D* self)
{
- return PyUnicode_FromString("UnaryFunction1D");
+ return PyUnicode_FromString("UnaryFunction1D");
}
+/*----------------------UnaryFunction1D get/setters ----------------------------*/
+
+PyDoc_STRVAR(UnaryFunction1D_name_doc,
+"The name of the unary 1D function.\n"
+"\n"
+":type: str");
+
+static PyObject *UnaryFunction1D_name_get(BPy_UnaryFunction1D *self, void *UNUSED(closure))
+{
+ return PyUnicode_FromString(Py_TYPE(self)->tp_name);
+}
+
+static PyGetSetDef BPy_UnaryFunction1D_getseters[] = {
+ {(char *)"name", (getter)UnaryFunction1D_name_get, (setter)NULL, (char *)UnaryFunction1D_name_doc, NULL},
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+};
+
/*-----------------------BPy_UnaryFunction1D type definition ------------------------------*/
PyTypeObject UnaryFunction1D_Type = {
@@ -99,7 +116,7 @@ PyTypeObject UnaryFunction1D_Type = {
0, /* tp_iternext */
0, /* tp_methods */
0, /* tp_members */
- 0, /* tp_getset */
+ BPy_UnaryFunction1D_getseters, /* tp_getset */
0, /* tp_base */
0, /* tp_dict */
0, /* tp_descr_get */