diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2014-09-28 06:05:19 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2014-09-28 06:17:31 +0400 |
commit | c900cd3bd8ab060f34e303ae6da7edf6994223d9 (patch) | |
tree | c44c7d9b448e1b4525128ff2a031794f2fbc60ac /source/blender/freestyle/intern/python | |
parent | 21825c4359159798da2b0b25da8ef1131c7399d1 (diff) |
Freestyle: Expose the Operators.reset() function to Python.
The Operators.reset function is exposed to the Freestyle Python API, which makes
it possible to combine multiple style modules into one file.
Differential revision: https://developer.blender.org/D802
Author: flokkievids (Folkert de Vries)
Reviewed by: kjym3 (Tamito Kajiyama)
Diffstat (limited to 'source/blender/freestyle/intern/python')
-rw-r--r-- | source/blender/freestyle/intern/python/BPy_Operators.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/freestyle/intern/python/BPy_Operators.cpp b/source/blender/freestyle/intern/python/BPy_Operators.cpp index 6beeafe0065..b96a62b85c4 100644 --- a/source/blender/freestyle/intern/python/BPy_Operators.cpp +++ b/source/blender/freestyle/intern/python/BPy_Operators.cpp @@ -548,6 +548,29 @@ static PyObject *Operators_create(BPy_Operators *self, PyObject *args, PyObject Py_RETURN_NONE; } +PyDoc_STRVAR(Operators_reset_doc, +".. staticmethod:: reset(delete_strokes=True)\n" +"\n" +" Resets the stroke selection (and therefore chaining, splitting, sorting and shading)\n" +"\n" +" :arg delete_strokes: Delete the strokes that are currently stored\n" +" :type delete_strokes: bool\n"); + +static PyObject *Operators_reset(BPy_Operators *self, PyObject *args, PyObject *kwds) +{ + static const char *kwlist[] = {"delete_strokes", NULL}; + PyObject *obj1 = 0; + if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &PyBool_Type, &obj1)) { + // true is the default + Operators::reset(obj1 ? bool_from_PyBool(obj1) : true); + } + else { + PyErr_SetString(PyExc_RuntimeError, "Operators.reset() failed"); + return NULL; + } + Py_RETURN_NONE; +} + PyDoc_STRVAR(Operators_get_viewedge_from_index_doc, ".. staticmethod:: get_viewedge_from_index(i)\n" "\n" @@ -671,6 +694,7 @@ static PyMethodDef BPy_Operators_methods[] = { Operators_recursive_split_doc}, {"sort", (PyCFunction) Operators_sort, METH_VARARGS | METH_KEYWORDS | METH_STATIC, Operators_sort_doc}, {"create", (PyCFunction) Operators_create, METH_VARARGS | METH_KEYWORDS | METH_STATIC, Operators_create_doc}, + {"reset", (PyCFunction) Operators_reset, METH_VARARGS | METH_KEYWORDS | METH_STATIC, Operators_reset_doc}, {"get_viewedge_from_index", (PyCFunction) Operators_get_viewedge_from_index, METH_VARARGS | METH_KEYWORDS | METH_STATIC, Operators_get_viewedge_from_index_doc}, {"get_chain_from_index", (PyCFunction) Operators_get_chain_from_index, METH_VARARGS | METH_KEYWORDS | METH_STATIC, |