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-23 05:12:23 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-02-23 05:12:23 +0400
commit68b0a8e39026ea2b391751406dc4bdb0a4ed958c (patch)
treecdf8a143a6cf2b832f49a31c2d3b7003f92eaa43 /source/blender/freestyle/intern/python/UnaryPredicate1D
parent0fb83d78faa99a8ea3fd396887b2b31a6a36a8cd (diff)
Freestyle Python API improvements - part 7.
Fix for PyGetSetDef and proper handling of keyword arguments were done in UnaryPredicate0D, UnaryPredicate1D, BinaryPredicate1D, and StrokeShader classes. Style modules were updated accordingly. Additional code clean-up was also made.
Diffstat (limited to 'source/blender/freestyle/intern/python/UnaryPredicate1D')
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.cpp6
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.cpp8
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp6
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp6
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.cpp6
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.cpp6
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.cpp6
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp18
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.cpp6
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.cpp5
10 files changed, 41 insertions, 32 deletions
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.cpp
index dbbcc4255cf..f9461033f23 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.cpp
@@ -21,9 +21,11 @@ static char ContourUP1D___doc__[] =
" :return: True if the Interface1D is a contour, false otherwise.\n"
" :rtype: bool\n";
-static int ContourUP1D___init__( BPy_ContourUP1D* self, PyObject *args )
+static int ContourUP1D___init__(BPy_ContourUP1D* self, PyObject *args, PyObject *kwds)
{
- if(!( PyArg_ParseTuple(args, "") ))
+ static const char *kwlist[] = {NULL};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
return -1;
self->py_up1D.up1D = new Predicates1D::ContourUP1D();
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.cpp
index c88f077c23b..0d49f6be6c9 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.cpp
@@ -34,14 +34,14 @@ static char DensityLowerThanUP1D___doc__[] =
" :return: True if the density is lower than a threshold.\n"
" :rtype: bool\n";
-static int DensityLowerThanUP1D___init__( BPy_DensityLowerThanUP1D* self, PyObject *args )
+static int DensityLowerThanUP1D___init__(BPy_DensityLowerThanUP1D* self, PyObject *args, PyObject *kwds)
{
+ static const char *kwlist[] = {"threshold", "sigma", NULL};
double d1, d2 = 2.0;
- if( !PyArg_ParseTuple(args, "d|d", &d1, &d2) )
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "d|d", (char **)kwlist, &d1, &d2))
return -1;
-
- self->py_up1D.up1D = new Predicates1D::DensityLowerThanUP1D(d1,d2);
+ self->py_up1D.up1D = new Predicates1D::DensityLowerThanUP1D(d1, d2);
return 0;
}
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp
index 2310f5792c5..861702d31be 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp
@@ -28,13 +28,13 @@ static char EqualToChainingTimeStampUP1D___doc__[] =
" :return: True if the time stamp is equal to a user-defined value.\n"
" :rtype: bool\n";
-static int EqualToChainingTimeStampUP1D___init__( BPy_EqualToChainingTimeStampUP1D* self, PyObject *args )
+static int EqualToChainingTimeStampUP1D___init__(BPy_EqualToChainingTimeStampUP1D* self, PyObject *args, PyObject *kwds)
{
+ static const char *kwlist[] = {"ts", NULL};
unsigned u;
- if( !PyArg_ParseTuple(args, "I", &u) )
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &u))
return -1;
-
self->py_up1D.up1D = new Predicates1D::EqualToChainingTimeStampUP1D(u);
return 0;
}
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp
index 97415b2b28f..9a2b0baa026 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp
@@ -28,13 +28,13 @@ static char EqualToTimeStampUP1D___doc__[] =
" :return: True if the time stamp is equal to a user-defined value.\n"
" :rtype: bool\n";
-static int EqualToTimeStampUP1D___init__( BPy_EqualToTimeStampUP1D* self, PyObject *args )
+static int EqualToTimeStampUP1D___init__(BPy_EqualToTimeStampUP1D* self, PyObject *args, PyObject *kwds)
{
+ static const char *kwlist[] = {"ts", NULL};
unsigned u;
- if( !PyArg_ParseTuple(args, "I", &u) )
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &u))
return -1;
-
self->py_up1D.up1D = new Predicates1D::EqualToTimeStampUP1D(u);
return 0;
}
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.cpp
index 3c9156f3a89..168ab7e254f 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.cpp
@@ -23,9 +23,11 @@ static char ExternalContourUP1D___doc__[] =
" otherwise.\n"
" :rtype: bool\n";
-static int ExternalContourUP1D___init__( BPy_ExternalContourUP1D* self, PyObject *args )
+static int ExternalContourUP1D___init__(BPy_ExternalContourUP1D* self, PyObject *args, PyObject *kwds)
{
- if(!( PyArg_ParseTuple(args, "") ))
+ static const char *kwlist[] = {NULL};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
return -1;
self->py_up1D.up1D = new Predicates1D::ExternalContourUP1D();
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.cpp
index ac878a7770b..d3b399f49a7 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.cpp
@@ -20,9 +20,11 @@ static char FalseUP1D___doc__[] =
" :return: False.\n"
" :rtype: bool\n";
-static int FalseUP1D___init__( BPy_FalseUP1D* self, PyObject *args )
+static int FalseUP1D___init__(BPy_FalseUP1D* self, PyObject *args, PyObject *kwds)
{
- if(!( PyArg_ParseTuple(args, "") ))
+ static const char *kwlist[] = {NULL};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
return -1;
self->py_up1D.up1D = new Predicates1D::FalseUP1D();
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.cpp
index cabc4689a03..c333a6742a7 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.cpp
@@ -31,13 +31,13 @@ static char QuantitativeInvisibilityUP1D___doc__[] =
" value.\n"
" :rtype: bool\n";
-static int QuantitativeInvisibilityUP1D___init__( BPy_QuantitativeInvisibilityUP1D* self, PyObject *args )
+static int QuantitativeInvisibilityUP1D___init__(BPy_QuantitativeInvisibilityUP1D* self, PyObject *args, PyObject *kwds)
{
+ static const char *kwlist[] = {"qi", NULL};
int i = 0;
- if( !PyArg_ParseTuple(args, "|i", &i) )
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "|i", (char **)kwlist, &i))
return -1;
-
self->py_up1D.up1D = new Predicates1D::QuantitativeInvisibilityUP1D(i);
return 0;
}
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp
index 9e6e57c8d94..8af592b8923 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp
@@ -11,14 +11,14 @@ extern "C" {
static char ShapeUP1D___doc__[] =
"Class hierarchy: :class:`UnaryPredicate1D` > :class:`ShapeUP1D`\n"
"\n"
-".. method:: __init__(idFirst, idSecond=0)\n"
+".. method:: __init__(first, second=0)\n"
"\n"
" Builds a ShapeUP1D object.\n"
"\n"
-" :arg idFirst: The first Id component.\n"
-" :type idFirst: int\n"
-" :arg idSecond: The second Id component.\n"
-" :type idSecond: int\n"
+" :arg first: The first Id component.\n"
+" :type first: int\n"
+" :arg second: The second Id component.\n"
+" :type second: int\n"
"\n"
".. method:: __call__(inter)\n"
"\n"
@@ -31,14 +31,14 @@ static char ShapeUP1D___doc__[] =
" user-specified Id.\n"
" :rtype: bool\n";
-static int ShapeUP1D___init__( BPy_ShapeUP1D* self, PyObject *args )
+static int ShapeUP1D___init__(BPy_ShapeUP1D* self, PyObject *args, PyObject *kwds)
{
+ static const char *kwlist[] = {"first", "second", NULL};
unsigned u1, u2 = 0;
- if( !PyArg_ParseTuple(args, "I|I", &u1, &u2) )
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "I|I", (char **)kwlist, &u1, &u2))
return -1;
-
- self->py_up1D.up1D = new Predicates1D::ShapeUP1D(u1,u2);
+ self->py_up1D.up1D = new Predicates1D::ShapeUP1D(u1, u2);
return 0;
}
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.cpp
index 01da1a44453..630f302a31b 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.cpp
@@ -20,9 +20,11 @@ static char TrueUP1D___doc__[] =
" :return: True.\n"
" :rtype: bool\n";
-static int TrueUP1D___init__( BPy_TrueUP1D* self, PyObject *args )
+static int TrueUP1D___init__(BPy_TrueUP1D* self, PyObject *args, PyObject *kwds)
{
- if(!( PyArg_ParseTuple(args, "") ))
+ static const char *kwlist[] = {NULL};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
return -1;
self->py_up1D.up1D = new Predicates1D::TrueUP1D();
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.cpp
index 9beae103113..14cc70917df 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.cpp
@@ -28,11 +28,12 @@ static char WithinImageBoundaryUP1D___doc__[] =
"\n"
" Returns true if the Interface1D intersects with image boundary.\n";
-static int WithinImageBoundaryUP1D___init__( BPy_WithinImageBoundaryUP1D* self, PyObject *args )
+static int WithinImageBoundaryUP1D___init__(BPy_WithinImageBoundaryUP1D* self, PyObject *args, PyObject *kwds)
{
+ static const char *kwlist[] = {"xmin", "ymin", "xmax", "ymax", NULL};
double xmin, ymin, xmax, ymax;
- if(!( PyArg_ParseTuple(args, "dddd", &xmin, &ymin, &xmax, &ymax) ))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "dddd", (char **)kwlist, &xmin, &ymin, &xmax, &ymax))
return -1;
self->py_up1D.up1D = new Predicates1D::WithinImageBoundaryUP1D(xmin, ymin, xmax, ymax);
return 0;