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_UnaryFunction0D.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_UnaryFunction0D.cpp')
-rw-r--r--source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp52
1 files changed, 34 insertions, 18 deletions
diff --git a/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp
index 9cb855f32ae..69d57e96d7c 100644
--- a/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp
+++ b/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp
@@ -19,26 +19,26 @@ extern "C" {
///////////////////////////////////////////////////////////////////////////////////////////
//-------------------MODULE INITIALIZATION--------------------------------
-int UnaryFunction0D_Init( PyObject *module )
+int UnaryFunction0D_Init(PyObject *module)
{
- if( module == NULL )
+ if (module == NULL)
return -1;
- if( PyType_Ready( &UnaryFunction0D_Type ) < 0 )
+ if (PyType_Ready(&UnaryFunction0D_Type) < 0)
return -1;
- Py_INCREF( &UnaryFunction0D_Type );
+ Py_INCREF(&UnaryFunction0D_Type);
PyModule_AddObject(module, "UnaryFunction0D", (PyObject *)&UnaryFunction0D_Type);
- UnaryFunction0DDouble_Init( module );
- UnaryFunction0DEdgeNature_Init( module );
- UnaryFunction0DFloat_Init( module );
- UnaryFunction0DId_Init( module );
- UnaryFunction0DMaterial_Init( module );
- UnaryFunction0DUnsigned_Init( module );
- UnaryFunction0DVec2f_Init( module );
- UnaryFunction0DVec3f_Init( module );
- UnaryFunction0DVectorViewShape_Init( module );
- UnaryFunction0DViewShape_Init( module );
+ UnaryFunction0DDouble_Init(module);
+ UnaryFunction0DEdgeNature_Init(module);
+ UnaryFunction0DFloat_Init(module);
+ UnaryFunction0DId_Init(module);
+ UnaryFunction0DMaterial_Init(module);
+ UnaryFunction0DUnsigned_Init(module);
+ UnaryFunction0DVec2f_Init(module);
+ UnaryFunction0DVec3f_Init(module);
+ UnaryFunction0DVectorViewShape_Init(module);
+ UnaryFunction0DViewShape_Init(module);
return 0;
}
@@ -67,15 +67,31 @@ static char UnaryFunction0D___doc__[] =
static void UnaryFunction0D___dealloc__(BPy_UnaryFunction0D* self)
{
- Py_TYPE(self)->tp_free((PyObject*)self);
+ Py_TYPE(self)->tp_free((PyObject*)self);
}
-
static PyObject * UnaryFunction0D___repr__(BPy_UnaryFunction0D* self)
{
- return PyUnicode_FromString("UnaryFunction0D");
+ return PyUnicode_FromString("UnaryFunction0D");
}
+/*----------------------UnaryFunction0D get/setters ----------------------------*/
+
+PyDoc_STRVAR(UnaryFunction0D_name_doc,
+"The name of the unary 0D function.\n"
+"\n"
+":type: str");
+
+static PyObject *UnaryFunction0D_name_get(BPy_UnaryFunction0D *self, void *UNUSED(closure))
+{
+ return PyUnicode_FromString(Py_TYPE(self)->tp_name);
+}
+
+static PyGetSetDef BPy_UnaryFunction0D_getseters[] = {
+ {(char *)"name", (getter)UnaryFunction0D_name_get, (setter)NULL, (char *)UnaryFunction0D_name_doc, NULL},
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+};
+
/*-----------------------BPy_UnaryFunction0D type definition ------------------------------*/
PyTypeObject UnaryFunction0D_Type = {
@@ -108,7 +124,7 @@ PyTypeObject UnaryFunction0D_Type = {
0, /* tp_iternext */
0, /* tp_methods */
0, /* tp_members */
- 0, /* tp_getset */
+ BPy_UnaryFunction0D_getseters, /* tp_getset */
0, /* tp_base */
0, /* tp_dict */
0, /* tp_descr_get */