diff options
author | Maxime Curioni <maxime.curioni@gmail.com> | 2008-07-29 14:42:10 +0400 |
---|---|---|
committer | Maxime Curioni <maxime.curioni@gmail.com> | 2008-07-29 14:42:10 +0400 |
commit | 725915615a0044962f1f3b3971d942e70bf2eb6f (patch) | |
tree | fc47989ea5be571f32122553508ac30644b7bd35 /source/blender | |
parent | db6388e0f2b1e03ff280615fb96b93c565c9b22a (diff) |
soc-2008-mxcurioni: SWIG replacement is effective and the native Freestyle API renders a correct result for the test style module 'contour.py'. More testing needs to be done to make sure my work was correct.
To make it work, I had to:
- update Operators to include all of its methods in the Python API
- redefine the Freestyle modules as local classes, allowing predicates to support the __call__ method (I found out that Python does not allow modules to be callable). The API is defined in the new freestyle_init.py file.
- remove all references to former Python Freestyle API (located in source/blender/freestyle/python/, under the Freestyle.py file) and replace it with the new API file.
- normalize all constants related to the Nature class
- redefine the logical_operators.py file so that AndUP1D, OrUP1D and NotUP1D would be subclasses of a UnaryPredicate1D subclass having a operator() implementation. Using UnaryPredicate1D as a superclass would somehow prevent calls to the operator(). For the time being, I chose ContourUP1D (even though it does not really matter which subclass it is, since the __call__ method is redefined in all of these classes). I will implement this classes in C++ to get rid of the problem altogether.
- turn off a few classes that somehow are not well recognized (Noise, Curve...). I will reenable them later once I understand what's going on.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/freestyle/intern/python/BPy_Operators.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/source/blender/freestyle/intern/python/BPy_Operators.cpp b/source/blender/freestyle/intern/python/BPy_Operators.cpp index 2d883363998..b0a8e7e3bd2 100644 --- a/source/blender/freestyle/intern/python/BPy_Operators.cpp +++ b/source/blender/freestyle/intern/python/BPy_Operators.cpp @@ -19,10 +19,33 @@ extern "C" { static void Operators___dealloc__(BPy_Operators *self); static PyObject * Operators_select(BPy_Operators* self, PyObject *args); +static PyObject * Operators_bidirectionalChain(BPy_Operators* self, PyObject *args); +static PyObject * Operators_sequentialSplit(BPy_Operators* self, PyObject *args); +static PyObject * Operators_recursiveSplit(BPy_Operators* self, PyObject *args); +static PyObject * Operators_sort(BPy_Operators* self, PyObject *args); +static PyObject * Operators_create(BPy_Operators* self, PyObject *args); /*----------------------Operators instance definitions ----------------------------*/ static PyMethodDef BPy_Operators_methods[] = { - {"select", ( PyCFunction ) Operators_select, METH_VARARGS | METH_STATIC, "(UnaryPredicate1D up1D )Selects the ViewEdges of the ViewMap verifying a specified condition. "}, + {"select", ( PyCFunction ) Operators_select, METH_VARARGS | METH_STATIC, + "select operator"}, + + {"bidirectionalChain", ( PyCFunction ) Operators_bidirectionalChain, METH_VARARGS | METH_STATIC, + "select operator"}, + + {"sequentialSplit", ( PyCFunction ) Operators_sequentialSplit, METH_VARARGS | METH_STATIC, + "select operator"}, + + {"recursiveSplit", ( PyCFunction ) Operators_recursiveSplit, METH_VARARGS | METH_STATIC, + "select operator"}, + + {"sort", ( PyCFunction ) Operators_sort, METH_VARARGS | METH_STATIC, + "select operator"}, + + {"create", ( PyCFunction ) Operators_create, METH_VARARGS | METH_STATIC, + "select operator"}, + + {NULL, NULL, 0, NULL} }; |