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:
authorBenoit Bolsee <benoit.bolsee@online.be>2008-12-29 19:36:58 +0300
committerBenoit Bolsee <benoit.bolsee@online.be>2008-12-29 19:36:58 +0300
commit1c663bbc7e53cda1fe35579302574b0d98aa8db3 (patch)
tree4c0d3be6453932c01a9dc0fee0f820275cd6701d /source/gameengine/Expressions/PyObjectPlus.h
parentd91daaa5f690645153adf647c371262c9c6cb009 (diff)
First batch of GE API cleanup.
The principle is to replace most get/set methods of logic bricks by direct property access. To make porting of game code easier, the properties have usually the same type and use than the return values/parameters of the get/set methods. More details on http://wiki.blender.org/index.php/GameEngineDev/Python_API_Clean_Up Old methods are still available but will produce deprecation warnings on the console: "<method> is deprecated, use the <property> property instead" You can avoid these messages by turning on the "Ignore deprecation warnings" option in Game menu. PyDoc is updated to include the new properties and display a deprecation warning for the get/set methods that are being deprecated.
Diffstat (limited to 'source/gameengine/Expressions/PyObjectPlus.h')
-rw-r--r--source/gameengine/Expressions/PyObjectPlus.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/source/gameengine/Expressions/PyObjectPlus.h b/source/gameengine/Expressions/PyObjectPlus.h
index 3a054454a0b..55998ce1c97 100644
--- a/source/gameengine/Expressions/PyObjectPlus.h
+++ b/source/gameengine/Expressions/PyObjectPlus.h
@@ -185,7 +185,10 @@ static inline void Py_Fatal(const char *M) {
#define KX_PYMETHODTABLE(class_name, method_name) \
{#method_name , (PyCFunction) class_name::sPy##method_name, METH_VARARGS, (PY_METHODCHAR)class_name::method_name##_doc}
-#define KX_PYMETHODTABLE_NOARG(class_name, method_name) \
+#define KX_PYMETHODTABLE_O(class_name, method_name) \
+ {#method_name , (PyCFunction) class_name::sPy##method_name, METH_O, (PY_METHODCHAR)class_name::method_name##_doc}
+
+#define KX_PYMETHODTABLE_NOARGS(class_name, method_name) \
{#method_name , (PyCFunction) class_name::sPy##method_name, METH_NOARGS, (PY_METHODCHAR)class_name::method_name##_doc}
/**
@@ -195,7 +198,15 @@ static inline void Py_Fatal(const char *M) {
const char class_name::method_name##_doc[] = doc_string; \
PyObject* class_name::Py##method_name(PyObject*, PyObject* args, PyObject*)
-#define KX_PYMETHODDEF_DOC_NOARG(class_name, method_name, doc_string) \
+#define KX_PYMETHODDEF_DOC_VARARGS(class_name, method_name, doc_string) \
+const char class_name::method_name##_doc[] = doc_string; \
+PyObject* class_name::Py##method_name(PyObject*, PyObject* args)
+
+#define KX_PYMETHODDEF_DOC_O(class_name, method_name, doc_string) \
+const char class_name::method_name##_doc[] = doc_string; \
+PyObject* class_name::Py##method_name(PyObject*, PyObject* value)
+
+#define KX_PYMETHODDEF_DOC_NOARGS(class_name, method_name, doc_string) \
const char class_name::method_name##_doc[] = doc_string; \
PyObject* class_name::Py##method_name(PyObject*)