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-24 06:39:38 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-02-24 06:39:38 +0400
commit3df023ae82eef0ea105dc61c9730af87b59a07d1 (patch)
tree2d2a4e753c1129fc91f360f0457d30859cd38737
parentd38a335d47f1632000db5172877499ff0184d114 (diff)
Freestyle Python API improvements - part 8.
* Proper handling of keyword arguments was implemented in Operators and ContextFunctions, as well as in methods of Interface0D, Interface1D, Iterator, their subclasses, Noise and IntegrationType. * Operators' methods and functions in the ContextFunctions module were renamed from CamelCase to lower cases + underscores. Style modules were updated accordingly. * Additional code clean-up was also made.
-rw-r--r--release/scripts/freestyle/style_modules/ChainingIterators.py23
-rw-r--r--release/scripts/freestyle/style_modules/Functions0D.py9
-rw-r--r--release/scripts/freestyle/style_modules/anisotropic_diffusion.py2
-rw-r--r--release/scripts/freestyle/style_modules/apriori_and_causal_density.py2
-rw-r--r--release/scripts/freestyle/style_modules/apriori_density.py2
-rw-r--r--release/scripts/freestyle/style_modules/backbone_stretcher.py2
-rw-r--r--release/scripts/freestyle/style_modules/blueprint_circles.py2
-rw-r--r--release/scripts/freestyle/style_modules/blueprint_ellipses.py2
-rw-r--r--release/scripts/freestyle/style_modules/blueprint_squares.py2
-rw-r--r--release/scripts/freestyle/style_modules/cartoon.py2
-rw-r--r--release/scripts/freestyle/style_modules/contour.py2
-rw-r--r--release/scripts/freestyle/style_modules/curvature2d.py2
-rw-r--r--release/scripts/freestyle/style_modules/external_contour.py4
-rw-r--r--release/scripts/freestyle/style_modules/external_contour_sketchy.py2
-rw-r--r--release/scripts/freestyle/style_modules/external_contour_smooth.py2
-rw-r--r--release/scripts/freestyle/style_modules/haloing.py2
-rw-r--r--release/scripts/freestyle/style_modules/ignore_small_occlusions.py4
-rw-r--r--release/scripts/freestyle/style_modules/invisible_lines.py2
-rw-r--r--release/scripts/freestyle/style_modules/japanese_bigbrush.py4
-rw-r--r--release/scripts/freestyle/style_modules/long_anisotropically_dense.py2
-rw-r--r--release/scripts/freestyle/style_modules/multiple_parameterization.py2
-rw-r--r--release/scripts/freestyle/style_modules/nature.py2
-rw-r--r--release/scripts/freestyle/style_modules/near_lines.py2
-rw-r--r--release/scripts/freestyle/style_modules/occluded_by_specific_object.py2
-rw-r--r--release/scripts/freestyle/style_modules/parameter_editor.py20
-rw-r--r--release/scripts/freestyle/style_modules/polygonalize.py4
-rw-r--r--release/scripts/freestyle/style_modules/qi0.py4
-rw-r--r--release/scripts/freestyle/style_modules/qi0_not_external_contour.py2
-rw-r--r--release/scripts/freestyle/style_modules/qi1.py2
-rw-r--r--release/scripts/freestyle/style_modules/qi2.py4
-rw-r--r--release/scripts/freestyle/style_modules/sequentialsplit_sketchy.py4
-rw-r--r--release/scripts/freestyle/style_modules/shaders.py3
-rw-r--r--release/scripts/freestyle/style_modules/sketchy_multiple_parameterization.py2
-rw-r--r--release/scripts/freestyle/style_modules/sketchy_topology_broken.py2
-rw-r--r--release/scripts/freestyle/style_modules/sketchy_topology_preserved.py2
-rw-r--r--release/scripts/freestyle/style_modules/split_at_highest_2d_curvatures.py4
-rw-r--r--release/scripts/freestyle/style_modules/split_at_tvertices.py4
-rw-r--r--release/scripts/freestyle/style_modules/stroke_texture.py2
-rw-r--r--release/scripts/freestyle/style_modules/suggestive.py2
-rw-r--r--release/scripts/freestyle/style_modules/thickness_fof_depth_discontinuity.py2
-rw-r--r--release/scripts/freestyle/style_modules/tipremover.py4
-rw-r--r--release/scripts/freestyle/style_modules/tvertex_remover.py2
-rw-r--r--release/scripts/freestyle/style_modules/uniformpruning_zsort.py4
-rw-r--r--source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp202
-rw-r--r--source/blender/freestyle/intern/python/BPy_FrsNoise.cpp132
-rw-r--r--source/blender/freestyle/intern/python/BPy_IntegrationType.cpp58
-rw-r--r--source/blender/freestyle/intern/python/BPy_Interface0D.cpp19
-rw-r--r--source/blender/freestyle/intern/python/BPy_Interface1D.cpp18
-rw-r--r--source/blender/freestyle/intern/python/BPy_Operators.cpp455
-rw-r--r--source/blender/freestyle/intern/python/BPy_SShape.cpp26
-rw-r--r--source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp145
-rw-r--r--source/blender/freestyle/intern/python/BPy_ViewMap.cpp14
-rw-r--r--source/blender/freestyle/intern/python/BPy_ViewShape.cpp28
-rw-r--r--source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp30
-rw-r--r--source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp20
-rw-r--r--source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp26
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp44
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp110
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp50
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp13
60 files changed, 781 insertions, 764 deletions
diff --git a/release/scripts/freestyle/style_modules/ChainingIterators.py b/release/scripts/freestyle/style_modules/ChainingIterators.py
index 97654e0bf88..3ed67383115 100644
--- a/release/scripts/freestyle/style_modules/ChainingIterators.py
+++ b/release/scripts/freestyle/style_modules/ChainingIterators.py
@@ -26,6 +26,7 @@
#############################################################################
from freestyle_init import *
+from Freestyle import ContextFunctions as CF
## the natural chaining iterator
## It follows the edges of same nature following the topology of
@@ -155,7 +156,7 @@ class pyExternalContourChainingIterator(ChainingIterator):
while not it.is_end:
ve = it.object
if self._isExternalContour(ve):
- if ve.time_stamp == GetTimeStampCF():
+ if ve.time_stamp == CF.get_time_stamp():
winner = ve
it.increment()
@@ -178,10 +179,10 @@ class pyExternalContourChainingIterator(ChainingIterator):
class pySketchyChainSilhouetteIterator(ChainingIterator):
def __init__(self, nRounds=3,stayInSelection=True):
ChainingIterator.__init__(self, stayInSelection, False, None, True)
- self._timeStamp = GetTimeStampCF()+nRounds
+ self._timeStamp = CF.get_time_stamp()+nRounds
self._nRounds = nRounds
def init(self):
- self._timeStamp = GetTimeStampCF()+self._nRounds
+ self._timeStamp = CF.get_time_stamp()+self._nRounds
def traverse(self, iter):
winner = None
it = AdjacencyIterator(iter)
@@ -235,10 +236,10 @@ class pySketchyChainSilhouetteIterator(ChainingIterator):
class pySketchyChainingIterator(ChainingIterator):
def __init__(self, nRounds=3, stayInSelection=True):
ChainingIterator.__init__(self, stayInSelection, False, None, True)
- self._timeStamp = GetTimeStampCF()+nRounds
+ self._timeStamp = CF.get_time_stamp()+nRounds
self._nRounds = nRounds
def init(self):
- self._timeStamp = GetTimeStampCF()+self._nRounds
+ self._timeStamp = CF.get_time_stamp()+self._nRounds
def traverse(self, iter):
winner = None
it = AdjacencyIterator(iter)
@@ -309,7 +310,7 @@ class pyFillOcclusionsRelativeChainingIterator(ChainingIterator):
break
if winner is not None:
# check whether this edge was part of the selection
- if winner.time_stamp != GetTimeStampCF():
+ if winner.time_stamp != CF.get_time_stamp():
#print("---", winner.id.first, winner.id.second)
# if not, let's check whether it's short enough with
# respect to the chain made without staying in the selection
@@ -348,7 +349,7 @@ class pyFillOcclusionsRelativeChainingIterator(ChainingIterator):
_cit.current_edge = winner
_cit.orientation = winnerOrientation
_cit.init()
- while _cit.is_end == 0 and _cit.object.time_stamp != GetTimeStampCF():
+ while _cit.is_end == 0 and _cit.object.time_stamp != CF.get_time_stamp():
ve = _cit.object
#print("-------- --------", ve.id.first, ve.id.second)
connexl = connexl + ve.length_2d
@@ -406,7 +407,7 @@ class pyFillOcclusionsAbsoluteChainingIterator(ChainingIterator):
break
if winner is not None:
# check whether this edge was part of the selection
- if winner.time_stamp != GetTimeStampCF():
+ if winner.time_stamp != CF.get_time_stamp():
#print("---", winner.id.first, winner.id.second)
# nw let's compute the length of this connex non selected part:
connexl = 0
@@ -415,7 +416,7 @@ class pyFillOcclusionsAbsoluteChainingIterator(ChainingIterator):
_cit.current_edge = winner
_cit.orientation = winnerOrientation
_cit.init()
- while _cit.is_end == 0 and _cit.object.time_stamp != GetTimeStampCF():
+ while _cit.is_end == 0 and _cit.object.time_stamp != CF.get_time_stamp():
ve = _cit.object
#print("-------- --------", ve.id.first, ve.id.second)
connexl = connexl + ve.length_2d
@@ -479,7 +480,7 @@ class pyFillOcclusionsAbsoluteAndRelativeChainingIterator(ChainingIterator):
break
if winner is not None:
# check whether this edge was part of the selection
- if winner.time_stamp != GetTimeStampCF():
+ if winner.time_stamp != CF.get_time_stamp():
#print("---", winner.id.first, winner.id.second)
# if not, let's check whether it's short enough with
# respect to the chain made without staying in the selection
@@ -518,7 +519,7 @@ class pyFillOcclusionsAbsoluteAndRelativeChainingIterator(ChainingIterator):
_cit.current_edge = winner
_cit.orientation = winnerOrientation
_cit.init()
- while _cit.is_end == 0 and _cit.object.time_stamp != GetTimeStampCF():
+ while _cit.is_end == 0 and _cit.object.time_stamp != CF.get_time_stamp():
ve = _cit.object
#print("-------- --------", ve.id.first, ve.id.second)
connexl = connexl + ve.length_2d
diff --git a/release/scripts/freestyle/style_modules/Functions0D.py b/release/scripts/freestyle/style_modules/Functions0D.py
index ffdddaa4a1f..abbf5fe278c 100644
--- a/release/scripts/freestyle/style_modules/Functions0D.py
+++ b/release/scripts/freestyle/style_modules/Functions0D.py
@@ -1,4 +1,5 @@
from freestyle_init import *
+from Freestyle import ContextFunctions as CF
class CurveMaterialF0D(UnaryFunction0DMaterial):
# A replacement of the built-in MaterialF0D for stroke creation.
@@ -55,8 +56,8 @@ class pyViewMapGradientVectorF0D(UnaryFunction0DVec2f):
self._step = pow(2,self._l)
def __call__(self, iter):
p = iter.object.point_2d
- gx = ReadCompleteViewMapPixelCF(self._l, int(p.x+self._step), int(p.y))- ReadCompleteViewMapPixelCF(self._l, int(p.x), int(p.y))
- gy = ReadCompleteViewMapPixelCF(self._l, int(p.x), int(p.y+self._step))- ReadCompleteViewMapPixelCF(self._l, int(p.x), int(p.y))
+ gx = CF.read_complete_view_map_pixel(self._l, int(p.x+self._step), int(p.y))- CF.read_complete_view_map_pixel(self._l, int(p.x), int(p.y))
+ gy = CF.read_complete_view_map_pixel(self._l, int(p.x), int(p.y+self._step))- CF.read_complete_view_map_pixel(self._l, int(p.x), int(p.y))
return Vector([gx, gy])
class pyViewMapGradientNormF0D(UnaryFunction0DDouble):
@@ -66,8 +67,8 @@ class pyViewMapGradientNormF0D(UnaryFunction0DDouble):
self._step = pow(2,self._l)
def __call__(self, iter):
p = iter.object.point_2d
- gx = ReadCompleteViewMapPixelCF(self._l, int(p.x+self._step), int(p.y))- ReadCompleteViewMapPixelCF(self._l, int(p.x), int(p.y))
- gy = ReadCompleteViewMapPixelCF(self._l, int(p.x), int(p.y+self._step))- ReadCompleteViewMapPixelCF(self._l, int(p.x), int(p.y))
+ gx = CF.read_complete_view_map_pixel(self._l, int(p.x+self._step), int(p.y))- CF.read_complete_view_map_pixel(self._l, int(p.x), int(p.y))
+ gy = CF.read_complete_view_map_pixel(self._l, int(p.x), int(p.y+self._step))- CF.read_complete_view_map_pixel(self._l, int(p.x), int(p.y))
grad = Vector([gx, gy])
return grad.length
diff --git a/release/scripts/freestyle/style_modules/anisotropic_diffusion.py b/release/scripts/freestyle/style_modules/anisotropic_diffusion.py
index 44a820a1048..17fb2e738f6 100644
--- a/release/scripts/freestyle/style_modules/anisotropic_diffusion.py
+++ b/release/scripts/freestyle/style_modules/anisotropic_diffusion.py
@@ -36,7 +36,7 @@ nbIter = 30
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ExternalContourUP1D())
Operators.select( upred )
bpred = TrueBP1D()
-Operators.bidirectionalChain(ChainPredicateIterator(upred, bpred), NotUP1D(upred) )
+Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(upred) )
shaders_list = [
ConstantThicknessShader(4),
StrokeTextureShader("smoothAlpha.bmp", Stroke.OPAQUE_MEDIUM, False),
diff --git a/release/scripts/freestyle/style_modules/apriori_and_causal_density.py b/release/scripts/freestyle/style_modules/apriori_and_causal_density.py
index 7cdd4b2fd66..212e2b8479e 100644
--- a/release/scripts/freestyle/style_modules/apriori_and_causal_density.py
+++ b/release/scripts/freestyle/style_modules/apriori_and_causal_density.py
@@ -37,7 +37,7 @@ from shaders import *
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), pyHighViewMapDensityUP1D(0.3, IntegrationType.LAST))
Operators.select(upred)
bpred = TrueBP1D()
-Operators.bidirectionalChain(ChainPredicateIterator(upred, bpred), NotUP1D(QuantitativeInvisibilityUP1D(0)))
+Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(QuantitativeInvisibilityUP1D(0)))
shaders_list = [
ConstantThicknessShader(2),
ConstantColorShader(0.0, 0.0, 0.0,1)
diff --git a/release/scripts/freestyle/style_modules/apriori_density.py b/release/scripts/freestyle/style_modules/apriori_density.py
index 5ff6c58e77f..31f33354674 100644
--- a/release/scripts/freestyle/style_modules/apriori_density.py
+++ b/release/scripts/freestyle/style_modules/apriori_density.py
@@ -35,7 +35,7 @@ from shaders import *
Operators.select(AndUP1D(QuantitativeInvisibilityUP1D(0), pyHighViewMapDensityUP1D(0.1,5)))
bpred = TrueBP1D()
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), pyHighViewMapDensityUP1D(0.0007,5))
-Operators.bidirectionalChain(ChainPredicateIterator(upred, bpred), NotUP1D(QuantitativeInvisibilityUP1D(0)))
+Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(QuantitativeInvisibilityUP1D(0)))
shaders_list = [
ConstantThicknessShader(2),
ConstantColorShader(0.0, 0.0, 0.0,1)
diff --git a/release/scripts/freestyle/style_modules/backbone_stretcher.py b/release/scripts/freestyle/style_modules/backbone_stretcher.py
index 8a6b9d71a66..a08d0806c7e 100644
--- a/release/scripts/freestyle/style_modules/backbone_stretcher.py
+++ b/release/scripts/freestyle/style_modules/backbone_stretcher.py
@@ -31,6 +31,6 @@ from PredicatesB1D import *
from shaders import *
Operators.select(QuantitativeInvisibilityUP1D(0))
-Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
+Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
shaders_list = [TextureAssignerShader(4), ConstantColorShader(0.5, 0.5, 0.5), BackboneStretcherShader(20)]
Operators.create(TrueUP1D(), shaders_list)
diff --git a/release/scripts/freestyle/style_modules/blueprint_circles.py b/release/scripts/freestyle/style_modules/blueprint_circles.py
index 7f3a7564cfe..5315fd6cebe 100644
--- a/release/scripts/freestyle/style_modules/blueprint_circles.py
+++ b/release/scripts/freestyle/style_modules/blueprint_circles.py
@@ -34,7 +34,7 @@ from shaders import *
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ContourUP1D())
bpred = SameShapeIdBP1D()
Operators.select(upred)
-Operators.bidirectionalChain(ChainPredicateIterator(upred,bpred), NotUP1D(upred))
+Operators.bidirectional_chain(ChainPredicateIterator(upred,bpred), NotUP1D(upred))
Operators.select(pyHigherLengthUP1D(200))
shaders_list = [
ConstantThicknessShader(5),
diff --git a/release/scripts/freestyle/style_modules/blueprint_ellipses.py b/release/scripts/freestyle/style_modules/blueprint_ellipses.py
index a5cfe4ec30b..c4c7d1312f0 100644
--- a/release/scripts/freestyle/style_modules/blueprint_ellipses.py
+++ b/release/scripts/freestyle/style_modules/blueprint_ellipses.py
@@ -34,7 +34,7 @@ from shaders import *
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ContourUP1D())
bpred = SameShapeIdBP1D()
Operators.select(upred)
-Operators.bidirectionalChain(ChainPredicateIterator(upred,bpred), NotUP1D(upred))
+Operators.bidirectional_chain(ChainPredicateIterator(upred,bpred), NotUP1D(upred))
Operators.select(pyHigherLengthUP1D(200))
shaders_list = [
ConstantThicknessShader(5),
diff --git a/release/scripts/freestyle/style_modules/blueprint_squares.py b/release/scripts/freestyle/style_modules/blueprint_squares.py
index 7798acc7d47..4504a83e1cb 100644
--- a/release/scripts/freestyle/style_modules/blueprint_squares.py
+++ b/release/scripts/freestyle/style_modules/blueprint_squares.py
@@ -32,7 +32,7 @@ from shaders import *
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ContourUP1D())
bpred = SameShapeIdBP1D()
Operators.select(upred)
-Operators.bidirectionalChain(ChainPredicateIterator(upred,bpred), NotUP1D(upred))
+Operators.bidirectional_chain(ChainPredicateIterator(upred,bpred), NotUP1D(upred))
Operators.select(pyHigherLengthUP1D(200))
shaders_list = [
ConstantThicknessShader(8),
diff --git a/release/scripts/freestyle/style_modules/cartoon.py b/release/scripts/freestyle/style_modules/cartoon.py
index 6ace7e0585a..1e9e164ad4e 100644
--- a/release/scripts/freestyle/style_modules/cartoon.py
+++ b/release/scripts/freestyle/style_modules/cartoon.py
@@ -33,7 +33,7 @@ from PredicatesB1D import *
from shaders import *
Operators.select(QuantitativeInvisibilityUP1D(0))
-Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
+Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
shaders_list = [
BezierCurveShader(3),
ConstantThicknessShader(4),
diff --git a/release/scripts/freestyle/style_modules/contour.py b/release/scripts/freestyle/style_modules/contour.py
index c4b3a0f0827..0e4cf38212f 100644
--- a/release/scripts/freestyle/style_modules/contour.py
+++ b/release/scripts/freestyle/style_modules/contour.py
@@ -34,7 +34,7 @@ from shaders import *
Operators.select(AndUP1D(QuantitativeInvisibilityUP1D(0), ContourUP1D() ) )
bpred = SameShapeIdBP1D();
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ContourUP1D())
-Operators.bidirectionalChain(ChainPredicateIterator(upred, bpred), NotUP1D(QuantitativeInvisibilityUP1D(0)))
+Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(QuantitativeInvisibilityUP1D(0)))
shaders_list = [
ConstantThicknessShader(5.0),
IncreasingColorShader(0.8,0,0,1,0.1,0,0,1)
diff --git a/release/scripts/freestyle/style_modules/curvature2d.py b/release/scripts/freestyle/style_modules/curvature2d.py
index ca84bf21b83..89edb3dadfb 100644
--- a/release/scripts/freestyle/style_modules/curvature2d.py
+++ b/release/scripts/freestyle/style_modules/curvature2d.py
@@ -31,7 +31,7 @@ from logical_operators import *
from shaders import *
Operators.select(QuantitativeInvisibilityUP1D(0))
-Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
+Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
shaders_list = [
StrokeTextureShader("smoothAlpha.bmp", Stroke.OPAQUE_MEDIUM, False),
ConstantThicknessShader(5),
diff --git a/release/scripts/freestyle/style_modules/external_contour.py b/release/scripts/freestyle/style_modules/external_contour.py
index 2a39b79a410..64864978a83 100644
--- a/release/scripts/freestyle/style_modules/external_contour.py
+++ b/release/scripts/freestyle/style_modules/external_contour.py
@@ -35,9 +35,9 @@ from shaders import *
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ExternalContourUP1D())
Operators.select(upred )
bpred = TrueBP1D();
-Operators.bidirectionalChain(ChainPredicateIterator(upred, bpred), NotUP1D(upred))
+Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(upred))
shaders_list = [
ConstantThicknessShader(3),
ConstantColorShader(0.0, 0.0, 0.0,1)
]
-Operators.create(TrueUP1D(), shaders_list) \ No newline at end of file
+Operators.create(TrueUP1D(), shaders_list)
diff --git a/release/scripts/freestyle/style_modules/external_contour_sketchy.py b/release/scripts/freestyle/style_modules/external_contour_sketchy.py
index 8a4c570b279..dc0162f535b 100644
--- a/release/scripts/freestyle/style_modules/external_contour_sketchy.py
+++ b/release/scripts/freestyle/style_modules/external_contour_sketchy.py
@@ -36,7 +36,7 @@ from shaders import *
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ExternalContourUP1D())
Operators.select(upred)
-Operators.bidirectionalChain(pySketchyChainingIterator(), NotUP1D(upred))
+Operators.bidirectional_chain(pySketchyChainingIterator(), NotUP1D(upred))
shaders_list = [
SamplingShader(4),
SpatialNoiseShader(10, 150, 2, 1, 1),
diff --git a/release/scripts/freestyle/style_modules/external_contour_smooth.py b/release/scripts/freestyle/style_modules/external_contour_smooth.py
index 201dc271388..d2036dbf3be 100644
--- a/release/scripts/freestyle/style_modules/external_contour_smooth.py
+++ b/release/scripts/freestyle/style_modules/external_contour_smooth.py
@@ -34,7 +34,7 @@ from ChainingIterators import *
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ExternalContourUP1D())
Operators.select(upred)
bpred = TrueBP1D();
-Operators.bidirectionalChain(ChainPredicateIterator(upred, bpred), NotUP1D(upred))
+Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(upred))
shaders_list = [
SamplingShader(2),
IncreasingThicknessShader(4,20),
diff --git a/release/scripts/freestyle/style_modules/haloing.py b/release/scripts/freestyle/style_modules/haloing.py
index afa46173d54..7b6afedce50 100644
--- a/release/scripts/freestyle/style_modules/haloing.py
+++ b/release/scripts/freestyle/style_modules/haloing.py
@@ -39,7 +39,7 @@ from shaders import *
id = Id(3,0)
upred = AndUP1D(QuantitativeInvisibilityUP1D(0) , pyIsOccludedByUP1D(id))
Operators.select(upred)
-Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(upred))
+Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(upred))
shaders_list = [
IncreasingThicknessShader(3, 5),
IncreasingColorShader(1,0,0, 1,0,1,0,1),
diff --git a/release/scripts/freestyle/style_modules/ignore_small_occlusions.py b/release/scripts/freestyle/style_modules/ignore_small_occlusions.py
index ff6efa89ade..1623c245940 100644
--- a/release/scripts/freestyle/style_modules/ignore_small_occlusions.py
+++ b/release/scripts/freestyle/style_modules/ignore_small_occlusions.py
@@ -31,8 +31,8 @@ from ChainingIterators import *
from shaders import *
Operators.select(QuantitativeInvisibilityUP1D(0))
-#Operators.bidirectionalChain(pyFillOcclusionsChainingIterator(0.1))
-Operators.bidirectionalChain(pyFillOcclusionsAbsoluteChainingIterator(12))
+#Operators.bidirectional_chain(pyFillOcclusionsChainingIterator(0.1))
+Operators.bidirectional_chain(pyFillOcclusionsAbsoluteChainingIterator(12))
shaders_list = [
SamplingShader(5.0),
ConstantThicknessShader(3),
diff --git a/release/scripts/freestyle/style_modules/invisible_lines.py b/release/scripts/freestyle/style_modules/invisible_lines.py
index ea509463bfd..602e3ea0a5b 100644
--- a/release/scripts/freestyle/style_modules/invisible_lines.py
+++ b/release/scripts/freestyle/style_modules/invisible_lines.py
@@ -33,7 +33,7 @@ from shaders import *
upred = NotUP1D(QuantitativeInvisibilityUP1D(0))
Operators.select(upred)
-Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(upred))
+Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(upred))
shaders_list = [
SamplingShader(5.0),
ConstantThicknessShader(3.0),
diff --git a/release/scripts/freestyle/style_modules/japanese_bigbrush.py b/release/scripts/freestyle/style_modules/japanese_bigbrush.py
index 7f109598aaa..a4cd392a79b 100644
--- a/release/scripts/freestyle/style_modules/japanese_bigbrush.py
+++ b/release/scripts/freestyle/style_modules/japanese_bigbrush.py
@@ -33,11 +33,11 @@ from Functions0D import *
from shaders import *
Operators.select(QuantitativeInvisibilityUP1D(0))
-Operators.bidirectionalChain(ChainSilhouetteIterator(),NotUP1D(QuantitativeInvisibilityUP1D(0)))
+Operators.bidirectional_chain(ChainSilhouetteIterator(),NotUP1D(QuantitativeInvisibilityUP1D(0)))
## Splits strokes at points of highest 2D curavture
## when there are too many abrupt turns in it
func = pyInverseCurvature2DAngleF0D()
-Operators.recursiveSplit(func, pyParameterUP0D(0.2,0.8), NotUP1D(pyHigherNumberOfTurnsUP1D(3, 0.5)), 2)
+Operators.recursive_split(func, pyParameterUP0D(0.2,0.8), NotUP1D(pyHigherNumberOfTurnsUP1D(3, 0.5)), 2)
## Keeps only long enough strokes
Operators.select(pyHigherLengthUP1D(100))
## Sorts so as to draw the longest strokes first
diff --git a/release/scripts/freestyle/style_modules/long_anisotropically_dense.py b/release/scripts/freestyle/style_modules/long_anisotropically_dense.py
index 565519642f7..b06642ff40d 100644
--- a/release/scripts/freestyle/style_modules/long_anisotropically_dense.py
+++ b/release/scripts/freestyle/style_modules/long_anisotropically_dense.py
@@ -61,7 +61,7 @@ class pyDensityUP1D(UnaryPredicate1D):
return 0
Operators.select(QuantitativeInvisibilityUP1D(0))
-Operators.bidirectionalChain(ChainSilhouetteIterator(),NotUP1D(QuantitativeInvisibilityUP1D(0)))
+Operators.bidirectional_chain(ChainSilhouetteIterator(),NotUP1D(QuantitativeInvisibilityUP1D(0)))
Operators.select(pyHigherLengthUP1D(40))
## selects lines having a high anisotropic a priori density
Operators.select(pyHighDensityAnisotropyUP1D(0.3,4))
diff --git a/release/scripts/freestyle/style_modules/multiple_parameterization.py b/release/scripts/freestyle/style_modules/multiple_parameterization.py
index 3f0409db5fa..0e9dc452827 100644
--- a/release/scripts/freestyle/style_modules/multiple_parameterization.py
+++ b/release/scripts/freestyle/style_modules/multiple_parameterization.py
@@ -39,7 +39,7 @@ from shaders import *
Operators.select(QuantitativeInvisibilityUP1D(0))
## Chain following the same nature, but without the restriction
## of staying inside the selection (0).
-Operators.bidirectionalChain(ChainSilhouetteIterator(0))
+Operators.bidirectional_chain(ChainSilhouetteIterator(0))
shaders_list = [
SamplingShader(20),
IncreasingThicknessShader(1.5, 30),
diff --git a/release/scripts/freestyle/style_modules/nature.py b/release/scripts/freestyle/style_modules/nature.py
index b5481a8e519..e8d5ec72a1d 100644
--- a/release/scripts/freestyle/style_modules/nature.py
+++ b/release/scripts/freestyle/style_modules/nature.py
@@ -35,7 +35,7 @@ from PredicatesB1D import *
from shaders import *
Operators.select(pyNatureUP1D(Nature.SILHOUETTE))
-Operators.bidirectionalChain(ChainSilhouetteIterator(),NotUP1D( pyNatureUP1D( Nature.SILHOUETTE) ) )
+Operators.bidirectional_chain(ChainSilhouetteIterator(),NotUP1D( pyNatureUP1D( Nature.SILHOUETTE) ) )
shaders_list = [
IncreasingThicknessShader(3, 10),
IncreasingColorShader(0.0,0.0,0.0, 1, 0.8,0,0,1)
diff --git a/release/scripts/freestyle/style_modules/near_lines.py b/release/scripts/freestyle/style_modules/near_lines.py
index 565bca1fe1f..de5d8ce0813 100644
--- a/release/scripts/freestyle/style_modules/near_lines.py
+++ b/release/scripts/freestyle/style_modules/near_lines.py
@@ -35,7 +35,7 @@ from shaders import *
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), pyZSmallerUP1D(0.5, IntegrationType.MEAN))
Operators.select(upred)
-Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(upred))
+Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(upred))
shaders_list = [
TextureAssignerShader(-1),
ConstantThicknessShader(5),
diff --git a/release/scripts/freestyle/style_modules/occluded_by_specific_object.py b/release/scripts/freestyle/style_modules/occluded_by_specific_object.py
index 09ce39d5dd6..6154aa1e080 100644
--- a/release/scripts/freestyle/style_modules/occluded_by_specific_object.py
+++ b/release/scripts/freestyle/style_modules/occluded_by_specific_object.py
@@ -36,7 +36,7 @@ id = Id(3,0)
upred = AndUP1D(NotUP1D(QuantitativeInvisibilityUP1D(0)),
pyIsInOccludersListUP1D(id))
Operators.select(upred)
-Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(upred))
+Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(upred))
shaders_list = [
SamplingShader(5),
ConstantThicknessShader(3),
diff --git a/release/scripts/freestyle/style_modules/parameter_editor.py b/release/scripts/freestyle/style_modules/parameter_editor.py
index 8ec33732eea..64a68e1b6dc 100644
--- a/release/scripts/freestyle/style_modules/parameter_editor.py
+++ b/release/scripts/freestyle/style_modules/parameter_editor.py
@@ -1057,25 +1057,25 @@ def process(layer_name, lineset_name):
if linestyle.use_chaining:
if linestyle.chaining == "PLAIN":
if linestyle.same_object:
- Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(upred))
+ Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(upred))
else:
- Operators.bidirectionalChain(ChainPredicateIterator(upred, TrueBP1D()), NotUP1D(upred))
+ Operators.bidirectional_chain(ChainPredicateIterator(upred, TrueBP1D()), NotUP1D(upred))
elif linestyle.chaining == "SKETCHY":
if linestyle.same_object:
- Operators.bidirectionalChain(pySketchyChainSilhouetteIterator(linestyle.rounds))
+ Operators.bidirectional_chain(pySketchyChainSilhouetteIterator(linestyle.rounds))
else:
- Operators.bidirectionalChain(pySketchyChainingIterator(linestyle.rounds))
+ Operators.bidirectional_chain(pySketchyChainingIterator(linestyle.rounds))
else:
Operators.chain(ChainPredicateIterator(FalseUP1D(), FalseBP1D()), NotUP1D(upred))
# split chains
if linestyle.material_boundary:
- Operators.sequentialSplit(MaterialBoundaryUP0D())
+ Operators.sequential_split(MaterialBoundaryUP0D())
if linestyle.use_min_angle or linestyle.use_max_angle:
min_angle = linestyle.min_angle if linestyle.use_min_angle else None
max_angle = linestyle.max_angle if linestyle.use_max_angle else None
- Operators.sequentialSplit(Curvature2DAngleThresholdUP0D(min_angle, max_angle))
+ Operators.sequential_split(Curvature2DAngleThresholdUP0D(min_angle, max_angle))
if linestyle.use_split_length:
- Operators.sequentialSplit(Length2DThresholdUP0D(linestyle.split_length), 1.0)
+ Operators.sequential_split(Length2DThresholdUP0D(linestyle.split_length), 1.0)
if linestyle.use_split_pattern:
pattern = []
if linestyle.split_dash1 > 0 and linestyle.split_gap1 > 0:
@@ -1090,9 +1090,9 @@ def process(layer_name, lineset_name):
if len(pattern) > 0:
sampling = 1.0
controller = SplitPatternController(pattern, sampling)
- Operators.sequentialSplit(SplitPatternStartingUP0D(controller),
- SplitPatternStoppingUP0D(controller),
- sampling)
+ Operators.sequential_split(SplitPatternStartingUP0D(controller),
+ SplitPatternStoppingUP0D(controller),
+ sampling)
# select chains
if linestyle.use_min_length or linestyle.use_max_length:
min_length = linestyle.min_length if linestyle.use_min_length else None
diff --git a/release/scripts/freestyle/style_modules/polygonalize.py b/release/scripts/freestyle/style_modules/polygonalize.py
index 4446c4c1dcc..a1f2f00d658 100644
--- a/release/scripts/freestyle/style_modules/polygonalize.py
+++ b/release/scripts/freestyle/style_modules/polygonalize.py
@@ -30,11 +30,11 @@ from ChainingIterators import *
from shaders import *
Operators.select(QuantitativeInvisibilityUP1D(0))
-Operators.bidirectionalChain(ChainSilhouetteIterator(),NotUP1D(QuantitativeInvisibilityUP1D(0)))
+Operators.bidirectional_chain(ChainSilhouetteIterator(),NotUP1D(QuantitativeInvisibilityUP1D(0)))
shaders_list = [
SamplingShader(2.0),
ConstantThicknessShader(3),
ConstantColorShader(0.0,0.0,0.0),
PolygonalizationShader(8)
]
-Operators.create(TrueUP1D(), shaders_list) \ No newline at end of file
+Operators.create(TrueUP1D(), shaders_list)
diff --git a/release/scripts/freestyle/style_modules/qi0.py b/release/scripts/freestyle/style_modules/qi0.py
index d35d23cb7c3..7b67a207930 100644
--- a/release/scripts/freestyle/style_modules/qi0.py
+++ b/release/scripts/freestyle/style_modules/qi0.py
@@ -32,10 +32,10 @@ from ChainingIterators import *
from shaders import *
Operators.select(QuantitativeInvisibilityUP1D(0))
-Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
+Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
shaders_list = [
SamplingShader(5.0),
ConstantThicknessShader(4.0),
ConstantColorShader(0.0,0.0,0.0)
]
-Operators.create(TrueUP1D(), shaders_list) \ No newline at end of file
+Operators.create(TrueUP1D(), shaders_list)
diff --git a/release/scripts/freestyle/style_modules/qi0_not_external_contour.py b/release/scripts/freestyle/style_modules/qi0_not_external_contour.py
index eed41af32b4..59b68b9ed29 100644
--- a/release/scripts/freestyle/style_modules/qi0_not_external_contour.py
+++ b/release/scripts/freestyle/style_modules/qi0_not_external_contour.py
@@ -31,7 +31,7 @@ from logical_operators import *
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ExternalContourUP1D())
Operators.select(upred)
-Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(upred))
+Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(upred))
shaders_list = [
SamplingShader(4),
SpatialNoiseShader(4, 150, 2, True, True),
diff --git a/release/scripts/freestyle/style_modules/qi1.py b/release/scripts/freestyle/style_modules/qi1.py
index 8d248376138..4d459d12a21 100644
--- a/release/scripts/freestyle/style_modules/qi1.py
+++ b/release/scripts/freestyle/style_modules/qi1.py
@@ -33,7 +33,7 @@ from PredicatesB1D import *
from shaders import *
Operators.select(QuantitativeInvisibilityUP1D(1))
-Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(1)))
+Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(1)))
shaders_list = [
SamplingShader(5.0),
ConstantThicknessShader(3),
diff --git a/release/scripts/freestyle/style_modules/qi2.py b/release/scripts/freestyle/style_modules/qi2.py
index ba5e97b6982..1ba33ecead5 100644
--- a/release/scripts/freestyle/style_modules/qi2.py
+++ b/release/scripts/freestyle/style_modules/qi2.py
@@ -33,10 +33,10 @@ from PredicatesB1D import *
from shaders import *
Operators.select(QuantitativeInvisibilityUP1D(2))
-Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(2)))
+Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(2)))
shaders_list = [
SamplingShader(10),
ConstantThicknessShader(1.5),
ConstantColorShader(0.7,0.7,0.7, 1)
]
-Operators.create(TrueUP1D(), shaders_list) \ No newline at end of file
+Operators.create(TrueUP1D(), shaders_list)
diff --git a/release/scripts/freestyle/style_modules/sequentialsplit_sketchy.py b/release/scripts/freestyle/style_modules/sequentialsplit_sketchy.py
index d72a3730e25..8eda37bfc3c 100644
--- a/release/scripts/freestyle/style_modules/sequentialsplit_sketchy.py
+++ b/release/scripts/freestyle/style_modules/sequentialsplit_sketchy.py
@@ -35,11 +35,11 @@ from Functions0D import *
upred = QuantitativeInvisibilityUP1D(0)
Operators.select(upred)
-Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(upred))
+Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(upred))
## starting and stopping predicates:
start = pyVertexNatureUP0D(Nature.NON_T_VERTEX)
stop = pyBackTVertexUP0D()
-Operators.sequentialSplit(start, stop, 10)
+Operators.sequential_split(start, stop, 10)
shaders_list = [
SpatialNoiseShader(7, 120, 2, True, True),
IncreasingThicknessShader(5, 8),
diff --git a/release/scripts/freestyle/style_modules/shaders.py b/release/scripts/freestyle/style_modules/shaders.py
index 73fddc2abf4..568a3309fda 100644
--- a/release/scripts/freestyle/style_modules/shaders.py
+++ b/release/scripts/freestyle/style_modules/shaders.py
@@ -1,4 +1,5 @@
from freestyle_init import *
+from Freestyle import ContextFunctions as CF
from PredicatesU0D import *
from PredicatesB1D import *
from PredicatesU1D import *
@@ -1192,7 +1193,7 @@ class pyDummyShader(StrokeShader):
class pyDebugShader(StrokeShader):
def shade(self, stroke):
- fe = GetSelectedFEdgeCF()
+ fe = CF.get_selected_fedge()
id1 = fe.first_svertex.id
id2 = fe.second_svertex.id
#print(id1.first, id1.second)
diff --git a/release/scripts/freestyle/style_modules/sketchy_multiple_parameterization.py b/release/scripts/freestyle/style_modules/sketchy_multiple_parameterization.py
index 76ab4343316..98050c37eb9 100644
--- a/release/scripts/freestyle/style_modules/sketchy_multiple_parameterization.py
+++ b/release/scripts/freestyle/style_modules/sketchy_multiple_parameterization.py
@@ -35,7 +35,7 @@ from shaders import *
Operators.select(QuantitativeInvisibilityUP1D(0))
## 0: don't restrict to selection
-Operators.bidirectionalChain(pySketchyChainSilhouetteIterator(3,0))
+Operators.bidirectional_chain(pySketchyChainSilhouetteIterator(3,0))
shaders_list = [
SamplingShader(2),
SpatialNoiseShader(15, 120, 2, True, True),
diff --git a/release/scripts/freestyle/style_modules/sketchy_topology_broken.py b/release/scripts/freestyle/style_modules/sketchy_topology_broken.py
index eb600e62af7..49f40e965c7 100644
--- a/release/scripts/freestyle/style_modules/sketchy_topology_broken.py
+++ b/release/scripts/freestyle/style_modules/sketchy_topology_broken.py
@@ -35,7 +35,7 @@ from shaders import *
Operators.select(QuantitativeInvisibilityUP1D(0))
## Chain 3 times each ViewEdge indpendantly from the
## initial objects topology
-Operators.bidirectionalChain(pySketchyChainingIterator(3))
+Operators.bidirectional_chain(pySketchyChainingIterator(3))
shaders_list = [
SamplingShader(4),
SpatialNoiseShader(6, 120, 2, True, True),
diff --git a/release/scripts/freestyle/style_modules/sketchy_topology_preserved.py b/release/scripts/freestyle/style_modules/sketchy_topology_preserved.py
index 0c2d9d759a6..8111f449bb3 100644
--- a/release/scripts/freestyle/style_modules/sketchy_topology_preserved.py
+++ b/release/scripts/freestyle/style_modules/sketchy_topology_preserved.py
@@ -35,7 +35,7 @@ from shaders import *
upred = QuantitativeInvisibilityUP1D(0)
Operators.select(upred)
-Operators.bidirectionalChain(pySketchyChainSilhouetteIterator(3,1))
+Operators.bidirectional_chain(pySketchyChainSilhouetteIterator(3,1))
shaders_list = [
SamplingShader(4),
SpatialNoiseShader(20, 220, 2, True, True),
diff --git a/release/scripts/freestyle/style_modules/split_at_highest_2d_curvatures.py b/release/scripts/freestyle/style_modules/split_at_highest_2d_curvatures.py
index 52cc10a9c60..3c7ea0c3f73 100644
--- a/release/scripts/freestyle/style_modules/split_at_highest_2d_curvatures.py
+++ b/release/scripts/freestyle/style_modules/split_at_highest_2d_curvatures.py
@@ -33,9 +33,9 @@ from PredicatesU1D import *
from Functions0D import *
Operators.select(QuantitativeInvisibilityUP1D(0))
-Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
+Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
func = pyInverseCurvature2DAngleF0D()
-Operators.recursiveSplit(func, pyParameterUP0D(0.4,0.6), NotUP1D(pyHigherLengthUP1D(100)), 2)
+Operators.recursive_split(func, pyParameterUP0D(0.4,0.6), NotUP1D(pyHigherLengthUP1D(100)), 2)
shaders_list = [ConstantThicknessShader(10), IncreasingColorShader(1,0,0,1,0,1,0,1), TextureAssignerShader(3)]
Operators.create(TrueUP1D(), shaders_list)
diff --git a/release/scripts/freestyle/style_modules/split_at_tvertices.py b/release/scripts/freestyle/style_modules/split_at_tvertices.py
index 78f781dd290..ccf76950efc 100644
--- a/release/scripts/freestyle/style_modules/split_at_tvertices.py
+++ b/release/scripts/freestyle/style_modules/split_at_tvertices.py
@@ -32,11 +32,11 @@ from PredicatesU0D import *
from Functions0D import *
Operators.select(QuantitativeInvisibilityUP1D(0))
-Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
+Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
start = pyVertexNatureUP0D(Nature.T_VERTEX)
## use the same predicate to decide where to start and where to stop
## the strokes:
-Operators.sequentialSplit(start, start, 10)
+Operators.sequential_split(start, start, 10)
shaders_list = [ConstantThicknessShader(5), IncreasingColorShader(1,0,0,1,0,1,0,1), TextureAssignerShader(3)]
Operators.create(TrueUP1D(), shaders_list)
diff --git a/release/scripts/freestyle/style_modules/stroke_texture.py b/release/scripts/freestyle/style_modules/stroke_texture.py
index 035967dc39c..eb0878c2f14 100644
--- a/release/scripts/freestyle/style_modules/stroke_texture.py
+++ b/release/scripts/freestyle/style_modules/stroke_texture.py
@@ -32,7 +32,7 @@ from shaders import *
from ChainingIterators import *
Operators.select(QuantitativeInvisibilityUP1D(0))
-Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
+Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
shaders_list = [
SamplingShader(3),
BezierCurveShader(4),
diff --git a/release/scripts/freestyle/style_modules/suggestive.py b/release/scripts/freestyle/style_modules/suggestive.py
index 39d8515ed6c..c27409abffb 100644
--- a/release/scripts/freestyle/style_modules/suggestive.py
+++ b/release/scripts/freestyle/style_modules/suggestive.py
@@ -35,7 +35,7 @@ from shaders import *
upred = AndUP1D(pyNatureUP1D(Nature.SUGGESTIVE_CONTOUR), QuantitativeInvisibilityUP1D(0))
Operators.select(upred)
-Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(upred))
+Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(upred))
shaders_list = [
IncreasingThicknessShader(1, 3),
ConstantColorShader(0.2,0.2,0.2, 1)
diff --git a/release/scripts/freestyle/style_modules/thickness_fof_depth_discontinuity.py b/release/scripts/freestyle/style_modules/thickness_fof_depth_discontinuity.py
index 8394aa1bde4..9fd8d061489 100644
--- a/release/scripts/freestyle/style_modules/thickness_fof_depth_discontinuity.py
+++ b/release/scripts/freestyle/style_modules/thickness_fof_depth_discontinuity.py
@@ -30,7 +30,7 @@ from logical_operators import *
from shaders import *
Operators.select(QuantitativeInvisibilityUP1D(0))
-Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
+Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
shaders_list = [
SamplingShader(1),
ConstantThicknessShader(3),
diff --git a/release/scripts/freestyle/style_modules/tipremover.py b/release/scripts/freestyle/style_modules/tipremover.py
index 3e495b7d332..0f83190b14b 100644
--- a/release/scripts/freestyle/style_modules/tipremover.py
+++ b/release/scripts/freestyle/style_modules/tipremover.py
@@ -32,11 +32,11 @@ from ChainingIterators import *
from shaders import *
Operators.select(QuantitativeInvisibilityUP1D(0))
-Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
+Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
shaders_list = [
SamplingShader(5),
ConstantThicknessShader(3),
ConstantColorShader(0,0,0),
TipRemoverShader(20)
]
-Operators.create(TrueUP1D(), shaders_list) \ No newline at end of file
+Operators.create(TrueUP1D(), shaders_list)
diff --git a/release/scripts/freestyle/style_modules/tvertex_remover.py b/release/scripts/freestyle/style_modules/tvertex_remover.py
index c328f4c98ec..109218b63fd 100644
--- a/release/scripts/freestyle/style_modules/tvertex_remover.py
+++ b/release/scripts/freestyle/style_modules/tvertex_remover.py
@@ -32,7 +32,7 @@ from PredicatesB1D import *
from shaders import *
Operators.select(QuantitativeInvisibilityUP1D(0))
-Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
+Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
shaders_list = [
IncreasingThicknessShader(3, 5),
ConstantColorShader(0.2,0.2,0.2, 1),
diff --git a/release/scripts/freestyle/style_modules/uniformpruning_zsort.py b/release/scripts/freestyle/style_modules/uniformpruning_zsort.py
index c8537cd4241..b4b1b778f7e 100644
--- a/release/scripts/freestyle/style_modules/uniformpruning_zsort.py
+++ b/release/scripts/freestyle/style_modules/uniformpruning_zsort.py
@@ -8,8 +8,8 @@ from Functions1D import *
from shaders import *
Operators.select(QuantitativeInvisibilityUP1D(0))
-Operators.bidirectionalChain(ChainSilhouetteIterator())
-#Operators.sequentialSplit(pyVertexNatureUP0D(Nature.VIEW_VERTEX), 2)
+Operators.bidirectional_chain(ChainSilhouetteIterator())
+#Operators.sequential_split(pyVertexNatureUP0D(Nature.VIEW_VERTEX), 2)
Operators.sort(pyZBP1D())
shaders_list = [
StrokeTextureShader("smoothAlpha.bmp", Stroke.OPAQUE_MEDIUM, False),
diff --git a/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp b/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp
index e96df3fe762..af5085dc548 100644
--- a/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp
+++ b/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp
@@ -37,13 +37,13 @@
#ifdef __cplusplus
extern "C" {
#endif
-
+
///////////////////////////////////////////////////////////////////////////////////////////
//------------------------ MODULE FUNCTIONS ----------------------------------
-static char ContextFunctions_GetTimeStampCF___doc__[] =
-".. function:: GetTimeStampCF()\n"
+static char ContextFunctions_get_time_stamp___doc__[] =
+".. function:: get_time_stamp()\n"
"\n"
" Returns the system time stamp.\n"
"\n"
@@ -51,13 +51,13 @@ static char ContextFunctions_GetTimeStampCF___doc__[] =
" :rtype: int\n";
static PyObject *
-ContextFunctions_GetTimeStampCF( PyObject* self )
+ContextFunctions_get_time_stamp(PyObject* self)
{
- return PyLong_FromLong( ContextFunctions::GetTimeStampCF() );
+ return PyLong_FromLong(ContextFunctions::GetTimeStampCF());
}
-static char ContextFunctions_GetCanvasWidthCF___doc__[] =
-".. method:: GetCanvasWidthCF()\n"
+static char ContextFunctions_get_canvas_width___doc__[] =
+".. method:: get_canvas_width()\n"
"\n"
" Returns the canvas width.\n"
"\n"
@@ -65,13 +65,13 @@ static char ContextFunctions_GetCanvasWidthCF___doc__[] =
" :rtype: int\n";
static PyObject *
-ContextFunctions_GetCanvasWidthCF( PyObject* self )
+ContextFunctions_get_canvas_width(PyObject* self)
{
- return PyLong_FromLong( ContextFunctions::GetCanvasWidthCF() );
+ return PyLong_FromLong(ContextFunctions::GetCanvasWidthCF());
}
-static char ContextFunctions_GetCanvasHeightCF___doc__[] =
-".. method:: GetCanvasHeightCF()\n"
+static char ContextFunctions_get_canvas_height___doc__[] =
+".. method:: get_canvas_height()\n"
"\n"
" Returns the canvas height.\n"
"\n"
@@ -79,49 +79,48 @@ static char ContextFunctions_GetCanvasHeightCF___doc__[] =
" :rtype: int\n";
static PyObject *
-ContextFunctions_GetCanvasHeightCF( PyObject* self )
+ContextFunctions_get_canvas_height(PyObject* self)
{
- return PyLong_FromLong( ContextFunctions::GetCanvasHeightCF() );
+ return PyLong_FromLong(ContextFunctions::GetCanvasHeightCF());
}
-static char ContextFunctions_LoadMapCF___doc__[] =
-".. function:: LoadMapCF(iFileName, iMapName, iNbLevels=4, iSigma=1.0)\n"
+static char ContextFunctions_load_map___doc__[] =
+".. function:: load_map(file_name, map_name, num_levels=4, sigma=1.0)\n"
"\n"
" Loads an image map for further reading.\n"
"\n"
-" :arg iFileName: The name of the image file.\n"
-" :type iFileName: str\n"
-" :arg iMapName: The name that will be used to access this image.\n"
-" :type iMapName: str\n"
-" :arg iNbLevels: The number of levels in the map pyramid\n"
-" (default = 4). If iNbLevels == 0, the complete pyramid is\n"
+" :arg file_name: The name of the image file.\n"
+" :type file_name: str\n"
+" :arg map_name: The name that will be used to access this image.\n"
+" :type map_name: str\n"
+" :arg num_levels: The number of levels in the map pyramid\n"
+" (default = 4). If num_levels == 0, the complete pyramid is\n"
" built.\n"
-" :type iNbLevels: int\n"
-" :arg iSigma: The sigma value of the gaussian function.\n"
-" :type iSigma: float\n";
+" :type num_levels: int\n"
+" :arg sigma: The sigma value of the gaussian function.\n"
+" :type sigma: float\n";
static PyObject *
-ContextFunctions_LoadMapCF( PyObject *self, PyObject *args )
+ContextFunctions_load_map(PyObject *self, PyObject *args, PyObject *kwds)
{
- char *fileName, *mapName;
- unsigned nbLevels;
- float sigma;
-
- if( !PyArg_ParseTuple(args, "ssIf", &fileName, &mapName, &nbLevels, &sigma) )
- return NULL;
-
- ContextFunctions::LoadMapCF(fileName, mapName, nbLevels, sigma);
-
- Py_RETURN_NONE;
+ static const char *kwlist[] = {"file_name", "map_name", "num_levels", "sigma", NULL};
+ char *fileName, *mapName;
+ unsigned nbLevels = 4;
+ float sigma = 1.0;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "ss|If", (char **)kwlist, &fileName, &mapName, &nbLevels, &sigma))
+ return NULL;
+ ContextFunctions::LoadMapCF(fileName, mapName, nbLevels, sigma);
+ Py_RETURN_NONE;
}
-static char ContextFunctions_ReadMapPixelCF___doc__[] =
-".. function:: ReadMapPixelCF(iMapName, level, x, y)\n"
+static char ContextFunctions_read_map_pixel___doc__[] =
+".. function:: read_map_pixel(map_name, level, x, y)\n"
"\n"
" Reads a pixel in a user-defined map.\n"
"\n"
-" :arg iMapName: The name of the map.\n"
-" :type iMapName: str\n"
+" :arg map_name: The name of the map.\n"
+" :type map_name: str\n"
" :arg level: The level of the pyramid in which we wish to read the\n"
" pixel.\n"
" :type level: int\n"
@@ -135,22 +134,20 @@ static char ContextFunctions_ReadMapPixelCF___doc__[] =
" :rtype: float\n";
static PyObject *
-ContextFunctions_ReadMapPixelCF( PyObject *self, PyObject *args )
+ContextFunctions_read_map_pixel(PyObject *self, PyObject *args, PyObject *kwds)
{
- char *mapName;
- int level;
- unsigned x, y;
-
- if( !PyArg_ParseTuple(args, "siII", &mapName, &level, &x, &y) )
- return NULL;
-
- float f = ContextFunctions::ReadMapPixelCF(mapName, level, x, y);
-
- return PyFloat_FromDouble( f );
+ static const char *kwlist[] = {"map_name", "level", "x", "y", NULL};
+ char *mapName;
+ int level;
+ unsigned x, y;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "siII", (char **)kwlist, &mapName, &level, &x, &y))
+ return NULL;
+ return PyFloat_FromDouble(ContextFunctions::ReadMapPixelCF(mapName, level, x, y));
}
-static char ContextFunctions_ReadCompleteViewMapPixelCF___doc__[] =
-".. function:: ReadCompleteViewMapPixelCF(level, x, y)\n"
+static char ContextFunctions_read_complete_view_map_pixel___doc__[] =
+".. function:: read_complete_view_map_pixel(level, x, y)\n"
"\n"
" Reads a pixel in the complete view map.\n"
"\n"
@@ -167,27 +164,25 @@ static char ContextFunctions_ReadCompleteViewMapPixelCF___doc__[] =
" :rtype: float\n";
static PyObject *
-ContextFunctions_ReadCompleteViewMapPixelCF( PyObject *self, PyObject *args )
+ContextFunctions_read_complete_view_map_pixel(PyObject *self, PyObject *args, PyObject *kwds)
{
- int level;
- unsigned x, y;
+ static const char *kwlist[] = {"level", "x", "y", NULL};
+ int level;
+ unsigned x, y;
- if( !PyArg_ParseTuple(args, "iII", &level, &x, &y) )
- return NULL;
-
- float f = ContextFunctions::ReadCompleteViewMapPixelCF(level, x, y);
-
- return PyFloat_FromDouble( f );
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "iII", (char **)kwlist, &level, &x, &y))
+ return NULL;
+ return PyFloat_FromDouble(ContextFunctions::ReadCompleteViewMapPixelCF(level, x, y));
}
-static char ContextFunctions_ReadDirectionalViewMapPixelCF___doc__[] =
-".. function:: ReadDirectionalViewMapPixelCF(iOrientation, level, x, y)\n"
+static char ContextFunctions_read_directional_view_map_pixel___doc__[] =
+".. function:: read_directional_view_map_pixel(orientation, level, x, y)\n"
"\n"
" Reads a pixel in one of the oriented view map images.\n"
"\n"
-" :arg iOrientation: The number telling which orientation we want to\n"
+" :arg orientation: The number telling which orientation we want to\n"
" check.\n"
-" :type iOrientation: int\n"
+" :type orientation: int\n"
" :arg level: The level of the pyramid in which we wish to read the\n"
" pixel.\n"
" :type level: int\n"
@@ -201,21 +196,19 @@ static char ContextFunctions_ReadDirectionalViewMapPixelCF___doc__[] =
" :rtype: float\n";
static PyObject *
-ContextFunctions_ReadDirectionalViewMapPixelCF( PyObject *self, PyObject *args )
+ContextFunctions_read_directional_view_map_pixel(PyObject *self, PyObject *args, PyObject *kwds)
{
- int orientation, level;
- unsigned x, y;
-
- if( !PyArg_ParseTuple(args, "iiII", &orientation, &level, &x, &y) )
- return NULL;
-
- float f = ContextFunctions::ReadDirectionalViewMapPixelCF(orientation, level, x, y);
+ static const char *kwlist[] = {"orientation", "level", "x", "y", NULL};
+ int orientation, level;
+ unsigned x, y;
- return PyFloat_FromDouble( f );
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "iiII", (char **)kwlist, &orientation, &level, &x, &y))
+ return NULL;
+ return PyFloat_FromDouble(ContextFunctions::ReadDirectionalViewMapPixelCF(orientation, level, x, y));
}
-static char ContextFunctions_GetSelectedFEdgeCF___doc__[] =
-".. function:: GetSelectedFEdgeCF()\n"
+static char ContextFunctions_get_selected_fedge___doc__[] =
+".. function:: get_selected_fedge()\n"
"\n"
" Returns the selected FEdge.\n"
"\n"
@@ -223,13 +216,12 @@ static char ContextFunctions_GetSelectedFEdgeCF___doc__[] =
" :rtype: :class:`FEdge`\n";
static PyObject *
-ContextFunctions_GetSelectedFEdgeCF( PyObject *self )
+ContextFunctions_get_selected_fedge(PyObject *self)
{
- FEdge *fe = ContextFunctions::GetSelectedFEdgeCF();
- if( fe )
- return Any_BPy_FEdge_from_FEdge( *fe );
-
- Py_RETURN_NONE;
+ FEdge *fe = ContextFunctions::GetSelectedFEdgeCF();
+ if (fe)
+ return Any_BPy_FEdge_from_FEdge(*fe);
+ Py_RETURN_NONE;
}
/*-----------------------ContextFunctions module docstring-------------------------------*/
@@ -239,14 +231,14 @@ static char module_docstring[] = "The Blender Freestyle.ContextFunctions submodu
/*-----------------------ContextFunctions module functions definitions-------------------*/
static PyMethodDef module_functions[] = {
- {"GetTimeStampCF", (PyCFunction)ContextFunctions_GetTimeStampCF, METH_NOARGS, ContextFunctions_GetTimeStampCF___doc__},
- {"GetCanvasWidthCF", (PyCFunction)ContextFunctions_GetCanvasWidthCF, METH_NOARGS, ContextFunctions_GetCanvasWidthCF___doc__},
- {"GetCanvasHeightCF", (PyCFunction)ContextFunctions_GetCanvasHeightCF, METH_NOARGS, ContextFunctions_GetCanvasHeightCF___doc__},
- {"LoadMapCF", (PyCFunction)ContextFunctions_LoadMapCF, METH_VARARGS, ContextFunctions_LoadMapCF___doc__},
- {"ReadMapPixelCF", (PyCFunction)ContextFunctions_ReadMapPixelCF, METH_VARARGS, ContextFunctions_ReadMapPixelCF___doc__},
- {"ReadCompleteViewMapPixelCF", (PyCFunction)ContextFunctions_ReadCompleteViewMapPixelCF, METH_VARARGS, ContextFunctions_ReadCompleteViewMapPixelCF___doc__},
- {"ReadDirectionalViewMapPixelCF", (PyCFunction)ContextFunctions_ReadDirectionalViewMapPixelCF, METH_VARARGS, ContextFunctions_ReadDirectionalViewMapPixelCF___doc__},
- {"GetSelectedFEdgeCF", (PyCFunction)ContextFunctions_GetSelectedFEdgeCF, METH_NOARGS, ContextFunctions_GetSelectedFEdgeCF___doc__},
+ {"get_time_stamp", (PyCFunction)ContextFunctions_get_time_stamp, METH_NOARGS, ContextFunctions_get_time_stamp___doc__},
+ {"get_canvas_width", (PyCFunction)ContextFunctions_get_canvas_width, METH_NOARGS, ContextFunctions_get_canvas_width___doc__},
+ {"get_canvas_height", (PyCFunction)ContextFunctions_get_canvas_height, METH_NOARGS, ContextFunctions_get_canvas_height___doc__},
+ {"load_map", (PyCFunction)ContextFunctions_load_map, METH_VARARGS | METH_KEYWORDS, ContextFunctions_load_map___doc__},
+ {"read_map_pixel", (PyCFunction)ContextFunctions_read_map_pixel, METH_VARARGS | METH_KEYWORDS, ContextFunctions_read_map_pixel___doc__},
+ {"read_complete_view_map_pixel", (PyCFunction)ContextFunctions_read_complete_view_map_pixel, METH_VARARGS | METH_KEYWORDS, ContextFunctions_read_complete_view_map_pixel___doc__},
+ {"read_directional_view_map_pixel", (PyCFunction)ContextFunctions_read_directional_view_map_pixel, METH_VARARGS | METH_KEYWORDS, ContextFunctions_read_directional_view_map_pixel___doc__},
+ {"get_selected_fedge", (PyCFunction)ContextFunctions_get_selected_fedge, METH_NOARGS, ContextFunctions_get_selected_fedge___doc__},
{NULL, NULL, 0, NULL}
};
@@ -262,28 +254,20 @@ static PyModuleDef module_definition = {
//------------------- MODULE INITIALIZATION --------------------------------
-int ContextFunctions_Init( PyObject *module )
-{
- PyObject *m, *d, *f;
-
- if( module == NULL )
- return -1;
+int ContextFunctions_Init(PyObject *module)
+{
+ PyObject *m;
- m = PyModule_Create(&module_definition);
- if (m == NULL)
- return -1;
- Py_INCREF(m);
- PyModule_AddObject(module, "ContextFunctions", m);
+ if (module == NULL)
+ return -1;
- // from ContextFunctions import *
- d = PyModule_GetDict(m);
- for (PyMethodDef *p = module_functions; p->ml_name; p++) {
- f = PyDict_GetItemString(d, p->ml_name);
- Py_INCREF(f);
- PyModule_AddObject(module, p->ml_name, f);
- }
+ m = PyModule_Create(&module_definition);
+ if (m == NULL)
+ return -1;
+ Py_INCREF(m);
+ PyModule_AddObject(module, "ContextFunctions", m);
- return 0;
+ return 0;
}
///////////////////////////////////////////////////////////////////////////////////////////
diff --git a/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp b/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp
index b559eabb046..b6e90a4b440 100644
--- a/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp
+++ b/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp
@@ -41,22 +41,22 @@ extern "C" {
///////////////////////////////////////////////////////////////////////////////////////////
//-------------------MODULE INITIALIZATION--------------------------------
-int FrsNoise_Init( PyObject *module )
+int FrsNoise_Init(PyObject *module)
{
- if( module == NULL )
+ if (module == NULL)
return -1;
- if( PyType_Ready( &FrsNoise_Type ) < 0 )
+ if (PyType_Ready(&FrsNoise_Type) < 0)
return -1;
-
- Py_INCREF( &FrsNoise_Type );
+ Py_INCREF(&FrsNoise_Type);
PyModule_AddObject(module, "Noise", (PyObject *)&FrsNoise_Type);
+
return 0;
}
//------------------------INSTANCE METHODS ----------------------------------
-static char FrsNoise___doc__[] =
+PyDoc_STRVAR(FrsNoise_doc,
"Class to provide Perlin noise functionalities.\n"
"\n"
".. method:: __init__(seed = -1)\n"
@@ -66,30 +66,31 @@ static char FrsNoise___doc__[] =
" otherwise, time is used as a seed.\n"
"\n"
" :arg seed: Seed for random number generation.\n"
-" :type seed: int\n";
+" :type seed: int");
-static int FrsNoise___init__(BPy_FrsNoise *self, PyObject *args, PyObject *kwds)
+static int FrsNoise_init(BPy_FrsNoise *self, PyObject *args, PyObject *kwds)
{
+ static const char *kwlist[] = {"seed", NULL};
long seed = -1;
- if(!( PyArg_ParseTuple(args, "|l", &seed) ))
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "|l", (char **)kwlist, &seed))
return -1;
self->n = new Noise(seed);
return 0;
}
-static void FrsNoise___dealloc__(BPy_FrsNoise* self)
+static void FrsNoise_dealloc(BPy_FrsNoise* self)
{
delete self->n;
- Py_TYPE(self)->tp_free((PyObject*)self);
+ Py_TYPE(self)->tp_free((PyObject*)self);
}
-
-static PyObject * FrsNoise___repr__(BPy_FrsNoise* self)
+static PyObject * FrsNoise_repr(BPy_FrsNoise* self)
{
- return PyUnicode_FromFormat("Noise - address: %p", self->n );
+ return PyUnicode_FromFormat("Noise - address: %p", self->n);
}
-static char FrsNoise_turbulence1___doc__[] =
+PyDoc_STRVAR(FrsNoise_turbulence1_doc,
".. method:: turbulence1(v, freq, amp, oct=4)\n"
"\n"
" Returns a noise value for a 1D element.\n"
@@ -103,19 +104,20 @@ static char FrsNoise_turbulence1___doc__[] =
" :arg oct: Number of octaves.\n"
" :type oct: int\n"
" :return: A noise value.\n"
-" :rtype: float\n";
+" :rtype: float");
-static PyObject * FrsNoise_turbulence1( BPy_FrsNoise *self , PyObject *args) {
+static PyObject * FrsNoise_turbulence1(BPy_FrsNoise *self , PyObject *args, PyObject *kwds)
+{
+ static const char *kwlist[] = {"v", "freq", "amp", "oct", NULL};
float f1, f2, f3;
unsigned int i = 4;
- if(!( PyArg_ParseTuple(args, "fff|I", &f1, &f2, &f3, &i) ))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "fff|I", (char **)kwlist, &f1, &f2, &f3, &i))
return NULL;
-
- return PyFloat_FromDouble( self->n->turbulence1(f1, f2, f3, i) );
+ return PyFloat_FromDouble(self->n->turbulence1(f1, f2, f3, i));
}
-static char FrsNoise_turbulence2___doc__[] =
+PyDoc_STRVAR(FrsNoise_turbulence2_doc,
".. method:: turbulence2(v, freq, amp, oct=4)\n"
"\n"
" Returns a noise value for a 2D element.\n"
@@ -129,26 +131,28 @@ static char FrsNoise_turbulence2___doc__[] =
" :arg oct: Number of octaves.\n"
" :type oct: int\n"
" :return: A noise value.\n"
-" :rtype: float\n";
+" :rtype: float");
-static PyObject * FrsNoise_turbulence2( BPy_FrsNoise *self , PyObject *args) {
+static PyObject * FrsNoise_turbulence2(BPy_FrsNoise *self , PyObject *args, PyObject *kwds)
+{
+ static const char *kwlist[] = {"v", "freq", "amp", "oct", NULL};
PyObject *obj1;
float f2, f3;
unsigned int i = 4;
- if(!( PyArg_ParseTuple(args, "Off|I", &obj1, &f2, &f3, &i) ))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "Off|I", (char **)kwlist, &obj1, &f2, &f3, &i))
return NULL;
Vec2f *v = Vec2f_ptr_from_PyObject(obj1);
- if( !v ) {
+ if (!v) {
PyErr_SetString(PyExc_TypeError, "argument 1 must be a 2D vector (either a list of 2 elements or Vector)");
return NULL;
}
float t = self->n->turbulence2(*v, f2, f3, i);
delete v;
- return PyFloat_FromDouble( t );
+ return PyFloat_FromDouble(t);
}
-static char FrsNoise_turbulence3___doc__[] =
+PyDoc_STRVAR(FrsNoise_turbulence3_doc,
".. method:: turbulence3(v, freq, amp, oct=4)\n"
"\n"
" Returns a noise value for a 3D element.\n"
@@ -162,26 +166,28 @@ static char FrsNoise_turbulence3___doc__[] =
" :arg oct: Number of octaves.\n"
" :type oct: int\n"
" :return: A noise value.\n"
-" :rtype: float\n";
+" :rtype: float");
-static PyObject * FrsNoise_turbulence3( BPy_FrsNoise *self , PyObject *args) {
+static PyObject * FrsNoise_turbulence3(BPy_FrsNoise *self , PyObject *args, PyObject *kwds)
+{
+ static const char *kwlist[] = {"v", "freq", "amp", "oct", NULL};
PyObject *obj1;
float f2, f3;
unsigned int i = 4;
- if(!( PyArg_ParseTuple(args, "Off|I", &obj1, &f2, &f3, &i) ))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "Off|I", (char **)kwlist, &obj1, &f2, &f3, &i))
return NULL;
Vec3f *v = Vec3f_ptr_from_PyObject(obj1);
- if( !v ) {
+ if (!v) {
PyErr_SetString(PyExc_TypeError, "argument 1 must be a 3D vector (either a list of 3 elements or Vector)");
return NULL;
}
float t = self->n->turbulence3(*v, f2, f3, i);
delete v;
- return PyFloat_FromDouble( t );
+ return PyFloat_FromDouble(t);
}
-static char FrsNoise_smoothNoise1___doc__[] =
+PyDoc_STRVAR(FrsNoise_smoothNoise1_doc,
".. method:: smoothNoise1(v)\n"
"\n"
" Returns a smooth noise value for a 1D element.\n"
@@ -189,18 +195,19 @@ static char FrsNoise_smoothNoise1___doc__[] =
" :arg v: One-dimensional sample point.\n"
" :type v: float\n"
" :return: A smooth noise value.\n"
-" :rtype: float\n";
+" :rtype: float");
-static PyObject * FrsNoise_smoothNoise1( BPy_FrsNoise *self , PyObject *args) {
+static PyObject * FrsNoise_smoothNoise1(BPy_FrsNoise *self , PyObject *args, PyObject *kwds)
+{
+ static const char *kwlist[] = {"v", NULL};
float f;
- if(!( PyArg_ParseTuple(args, "f", &f) ))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &f))
return NULL;
-
- return PyFloat_FromDouble( self->n->smoothNoise1(f) );
+ return PyFloat_FromDouble(self->n->smoothNoise1(f));
}
-static char FrsNoise_smoothNoise2___doc__[] =
+PyDoc_STRVAR(FrsNoise_smoothNoise2_doc,
".. method:: smoothNoise2(v)\n"
"\n"
" Returns a smooth noise value for a 2D element.\n"
@@ -208,24 +215,26 @@ static char FrsNoise_smoothNoise2___doc__[] =
" :arg v: Two-dimensional sample point.\n"
" :type v: :class:`mathutils.Vector`, list or tuple of 2 real numbers\n"
" :return: A smooth noise value.\n"
-" :rtype: float\n";
+" :rtype: float");
-static PyObject * FrsNoise_smoothNoise2( BPy_FrsNoise *self , PyObject *args) {
+static PyObject * FrsNoise_smoothNoise2(BPy_FrsNoise *self , PyObject *args, PyObject *kwds)
+{
+ static const char *kwlist[] = {"v", NULL};
PyObject *obj;
- if(!( PyArg_ParseTuple(args, "O", &obj) ))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", (char **)kwlist, &obj))
return NULL;
Vec2f *v = Vec2f_ptr_from_PyObject(obj);
- if( !v ) {
+ if (!v) {
PyErr_SetString(PyExc_TypeError, "argument 1 must be a 2D vector (either a list of 2 elements or Vector)");
return NULL;
}
float t = self->n->smoothNoise2(*v);
delete v;
- return PyFloat_FromDouble( t );
+ return PyFloat_FromDouble(t);
}
-static char FrsNoise_smoothNoise3___doc__[] =
+PyDoc_STRVAR(FrsNoise_smoothNoise3_doc,
".. method:: smoothNoise3(v)\n"
"\n"
" Returns a smooth noise value for a 3D element.\n"
@@ -233,31 +242,32 @@ static char FrsNoise_smoothNoise3___doc__[] =
" :arg v: Three-dimensional sample point.\n"
" :type v: :class:`mathutils.Vector`, list or tuple of 3 real numbers\n"
" :return: A smooth noise value.\n"
-" :rtype: float\n";
+" :rtype: float");
-static PyObject * FrsNoise_smoothNoise3( BPy_FrsNoise *self , PyObject *args) {
+static PyObject * FrsNoise_smoothNoise3(BPy_FrsNoise *self , PyObject *args, PyObject *kwds)
+{
+ static const char *kwlist[] = {"v", NULL};
PyObject *obj;
- if(!( PyArg_ParseTuple(args, "O", &obj) ))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", (char **)kwlist, &obj))
return NULL;
Vec3f *v = Vec3f_ptr_from_PyObject(obj);
- if( !v ) {
+ if (!v) {
PyErr_SetString(PyExc_TypeError, "argument 1 must be a 3D vector (either a list of 3 elements or Vector)");
return NULL;
}
float t = self->n->smoothNoise3(*v);
delete v;
- return PyFloat_FromDouble( t );
+ return PyFloat_FromDouble(t);
}
-/*----------------------FrsNoise instance definitions ----------------------------*/
static PyMethodDef BPy_FrsNoise_methods[] = {
- {"turbulence1", ( PyCFunction ) FrsNoise_turbulence1, METH_VARARGS, FrsNoise_turbulence1___doc__},
- {"turbulence2", ( PyCFunction ) FrsNoise_turbulence2, METH_VARARGS, FrsNoise_turbulence2___doc__},
- {"turbulence3", ( PyCFunction ) FrsNoise_turbulence3, METH_VARARGS, FrsNoise_turbulence3___doc__},
- {"smoothNoise1", ( PyCFunction ) FrsNoise_smoothNoise1, METH_VARARGS, FrsNoise_smoothNoise1___doc__},
- {"smoothNoise2", ( PyCFunction ) FrsNoise_smoothNoise2, METH_VARARGS, FrsNoise_smoothNoise2___doc__},
- {"smoothNoise3", ( PyCFunction ) FrsNoise_smoothNoise3, METH_VARARGS, FrsNoise_smoothNoise3___doc__},
+ {"turbulence1", (PyCFunction)FrsNoise_turbulence1, METH_VARARGS | METH_KEYWORDS, FrsNoise_turbulence1_doc},
+ {"turbulence2", (PyCFunction)FrsNoise_turbulence2, METH_VARARGS | METH_KEYWORDS, FrsNoise_turbulence2_doc},
+ {"turbulence3", (PyCFunction)FrsNoise_turbulence3, METH_VARARGS | METH_KEYWORDS, FrsNoise_turbulence3_doc},
+ {"smoothNoise1", (PyCFunction)FrsNoise_smoothNoise1, METH_VARARGS | METH_KEYWORDS, FrsNoise_smoothNoise1_doc},
+ {"smoothNoise2", (PyCFunction)FrsNoise_smoothNoise2, METH_VARARGS | METH_KEYWORDS, FrsNoise_smoothNoise2_doc},
+ {"smoothNoise3", (PyCFunction)FrsNoise_smoothNoise3, METH_VARARGS | METH_KEYWORDS, FrsNoise_smoothNoise3_doc},
{NULL, NULL, 0, NULL}
};
@@ -268,12 +278,12 @@ PyTypeObject FrsNoise_Type = {
"Noise", /* tp_name */
sizeof(BPy_FrsNoise), /* tp_basicsize */
0, /* tp_itemsize */
- (destructor)FrsNoise___dealloc__, /* tp_dealloc */
+ (destructor)FrsNoise_dealloc, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
- (reprfunc)FrsNoise___repr__, /* tp_repr */
+ (reprfunc)FrsNoise_repr, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
@@ -284,7 +294,7 @@ PyTypeObject FrsNoise_Type = {
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
- FrsNoise___doc__, /* tp_doc */
+ FrsNoise_doc, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
@@ -299,7 +309,7 @@ PyTypeObject FrsNoise_Type = {
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
- (initproc)FrsNoise___init__, /* tp_init */
+ (initproc)FrsNoise_init, /* tp_init */
0, /* tp_alloc */
PyType_GenericNew, /* tp_new */
};
diff --git a/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp b/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp
index b56a5f96894..8b447129eca 100644
--- a/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp
+++ b/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp
@@ -46,14 +46,14 @@ extern "C" {
//------------------------ MODULE FUNCTIONS ----------------------------------
PyDoc_STRVAR(Integrator_integrate_doc,
-".. function:: integrate(fun, it, it_end, integration_type)\n"
+".. function:: integrate(func, it, it_end, integration_type)\n"
"\n"
" Returns a single value from a set of values evaluated at each 0D\n"
" element of this 1D element.\n"
"\n"
-" :arg fun: The UnaryFunction0D used to compute a value at each\n"
+" :arg func: The UnaryFunction0D used to compute a value at each\n"
" Interface0D.\n"
-" :type fun: :class:`UnaryFunction0D`\n"
+" :type func: :class:`UnaryFunction0D`\n"
" :arg it: The Interface0DIterator used to iterate over the 0D\n"
" elements of this 1D element. The integration will occur over\n"
" the 0D elements starting from the one pointed by it.\n"
@@ -65,41 +65,23 @@ PyDoc_STRVAR(Integrator_integrate_doc,
" single value from a set of values.\n"
" :type integration_type: :class:`IntegrationType`\n"
" :return: The single value obtained for the 1D element. The return\n"
-" value type is float if fun is of the :class:`UnaryFunction0DDouble`\n"
-" or :class:`UnaryFunction0DFloat` type, and int if fun is of the\n"
+" value type is float if func is of the :class:`UnaryFunction0DDouble`\n"
+" or :class:`UnaryFunction0DFloat` type, and int if func is of the\n"
" :class:`UnaryFunction0DUnsigned` type.\n"
" :rtype: int or float");
-static PyObject * Integrator_integrate(PyObject *self, PyObject *args)
+static PyObject * Integrator_integrate(PyObject *self, PyObject *args, PyObject *kwds)
{
+ static const char *kwlist[] = {"func", "it", "it_end", "integration_type", NULL};
PyObject *obj1, *obj4 = 0;
BPy_Interface0DIterator *obj2, *obj3;
-#if 1
- if (!PyArg_ParseTuple(args, "O!O!O!|O!", &UnaryFunction0D_Type, &obj1,
- &Interface0DIterator_Type, &obj2, &Interface0DIterator_Type, &obj3,
- &IntegrationType_Type, &obj4))
- return NULL;
-#else
- if (!PyArg_ParseTuple(args, "OOO|O", &obj1, &obj2, &obj3, &obj4))
- return NULL;
- if (!BPy_UnaryFunction0D_Check(obj1)) {
- PyErr_SetString(PyExc_TypeError, "argument 1 must be a UnaryFunction0D object");
- return NULL;
- }
- if (!BPy_Interface0DIterator_Check(obj2)) {
- PyErr_SetString(PyExc_TypeError, "argument 2 must be a Interface0DIterator object");
- return NULL;
- }
- if (!BPy_Interface0DIterator_Check(obj3)) {
- PyErr_SetString(PyExc_TypeError, "argument 3 must be a Interface0DIterator object");
- return NULL;
- }
- if (obj4 && !BPy_IntegrationType_Check(obj4)) {
- PyErr_SetString(PyExc_TypeError, "argument 4 must be a IntegrationType object");
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!O!O!|O!", (char **)kwlist,
+ &UnaryFunction0D_Type, &obj1, &Interface0DIterator_Type, &obj2,
+ &Interface0DIterator_Type, &obj3, &IntegrationType_Type, &obj4))
+ {
return NULL;
}
-#endif
Interface0DIterator it(*(obj2->if0D_it)), it_end(*(obj3->if0D_it));
IntegrationType t = (obj4) ? IntegrationType_from_BPy_IntegrationType(obj4) : MEAN;
@@ -108,20 +90,20 @@ static PyObject * Integrator_integrate(PyObject *self, PyObject *args)
UnaryFunction0D<double> *fun = ((BPy_UnaryFunction0DDouble *)obj1)->uf0D_double;
double res = integrate(*fun, it, it_end, t);
return PyFloat_FromDouble(res);
-
- } else if (BPy_UnaryFunction0DFloat_Check(obj1)) {
+ }
+ else if (BPy_UnaryFunction0DFloat_Check(obj1)) {
UnaryFunction0D<float> *fun = ((BPy_UnaryFunction0DFloat *)obj1)->uf0D_float;
float res = integrate(*fun, it, it_end, t);
return PyFloat_FromDouble(res);
-
- } else if (BPy_UnaryFunction0DUnsigned_Check(obj1)) {
+ }
+ else if (BPy_UnaryFunction0DUnsigned_Check(obj1)) {
UnaryFunction0D<unsigned int> *fun = ((BPy_UnaryFunction0DUnsigned *)obj1)->uf0D_unsigned;
unsigned int res = integrate(*fun, it, it_end, t);
return PyLong_FromLong(res);
-
- } else {
- string msg("unsupported function type: " + string(obj1->ob_type->tp_name));
- PyErr_SetString(PyExc_TypeError, msg.c_str());
+ }
+ else {
+ string class_name(Py_TYPE(obj1)->tp_name);
+ PyErr_SetString(PyExc_TypeError, ("unsupported function type: " + class_name).c_str());
return NULL;
}
}
@@ -133,7 +115,7 @@ PyDoc_STRVAR(module_docstring, "The Blender Freestyle.Integrator submodule\n\n")
/*-----------------------Integrator module functions definitions---------------------------*/
static PyMethodDef module_functions[] = {
- {"integrate", (PyCFunction) Integrator_integrate, METH_VARARGS, Integrator_integrate_doc},
+ {"integrate", (PyCFunction) Integrator_integrate, METH_VARARGS | METH_KEYWORDS, Integrator_integrate_doc},
{NULL, NULL, 0, NULL}
};
diff --git a/source/blender/freestyle/intern/python/BPy_Interface0D.cpp b/source/blender/freestyle/intern/python/BPy_Interface0D.cpp
index 5b7fdfbbd4a..bbfe99ebbf0 100644
--- a/source/blender/freestyle/intern/python/BPy_Interface0D.cpp
+++ b/source/blender/freestyle/intern/python/BPy_Interface0D.cpp
@@ -57,32 +57,32 @@ int Interface0D_Init(PyObject *module)
return -1;
Py_INCREF(&Interface0D_Type);
PyModule_AddObject(module, "Interface0D", (PyObject *)&Interface0D_Type);
-
+
if (PyType_Ready(&CurvePoint_Type) < 0)
return -1;
Py_INCREF(&CurvePoint_Type);
PyModule_AddObject(module, "CurvePoint", (PyObject *)&CurvePoint_Type);
-
+
if (PyType_Ready(&SVertex_Type) < 0)
return -1;
Py_INCREF(&SVertex_Type);
PyModule_AddObject(module, "SVertex", (PyObject *)&SVertex_Type);
-
+
if (PyType_Ready(&ViewVertex_Type) < 0)
return -1;
Py_INCREF(&ViewVertex_Type);
PyModule_AddObject(module, "ViewVertex", (PyObject *)&ViewVertex_Type);
-
+
if (PyType_Ready(&StrokeVertex_Type) < 0)
return -1;
Py_INCREF(&StrokeVertex_Type);
PyModule_AddObject(module, "StrokeVertex", (PyObject *)&StrokeVertex_Type);
-
+
if (PyType_Ready(&NonTVertex_Type) < 0)
return -1;
Py_INCREF(&NonTVertex_Type);
PyModule_AddObject(module, "NonTVertex", (PyObject *)&NonTVertex_Type);
-
+
if (PyType_Ready(&TVertex_Type) < 0)
return -1;
Py_INCREF(&TVertex_Type);
@@ -137,11 +137,12 @@ PyDoc_STRVAR(Interface0D_get_fedge_doc,
" :return: The FEdge lying between the two 0D elements.\n"
" :rtype: :class:`FEdge`");
-static PyObject *Interface0D_get_fedge(BPy_Interface0D *self, PyObject *args)
+static PyObject *Interface0D_get_fedge(BPy_Interface0D *self, PyObject *args, PyObject *kwds)
{
+ static const char *kwlist[] = {"inter", NULL};
PyObject *py_if0D;
- if (!PyArg_ParseTuple(args, "O!", &Interface0D_Type, &py_if0D))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface0D_Type, &py_if0D))
return NULL;
FEdge *fe = self->if0D->getFEdge(*(((BPy_Interface0D *)py_if0D)->if0D));
if (PyErr_Occurred())
@@ -152,7 +153,7 @@ static PyObject *Interface0D_get_fedge(BPy_Interface0D *self, PyObject *args)
}
static PyMethodDef BPy_Interface0D_methods[] = {
- {"get_fedge", (PyCFunction)Interface0D_get_fedge, METH_VARARGS, Interface0D_get_fedge_doc},
+ {"get_fedge", (PyCFunction)Interface0D_get_fedge, METH_VARARGS | METH_KEYWORDS, Interface0D_get_fedge_doc},
{NULL, NULL, 0, NULL}
};
diff --git a/source/blender/freestyle/intern/python/BPy_Interface1D.cpp b/source/blender/freestyle/intern/python/BPy_Interface1D.cpp
index 4a66ca14021..e990f10f946 100644
--- a/source/blender/freestyle/intern/python/BPy_Interface1D.cpp
+++ b/source/blender/freestyle/intern/python/BPy_Interface1D.cpp
@@ -180,11 +180,12 @@ PyDoc_STRVAR(Interface1D_points_begin_doc,
" :return: An Interface0DIterator pointing to the first point.\n"
" :rtype: :class:`Interface0DIterator`");
-static PyObject * Interface1D_points_begin(BPy_Interface1D *self, PyObject *args)
+static PyObject * Interface1D_points_begin(BPy_Interface1D *self, PyObject *args, PyObject *kwds)
{
- float f = 0;
+ static const char *kwlist[] = {"t", NULL};
+ float f = 0.0f;
- if(!(PyArg_ParseTuple(args, "|f", &f)))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "|f", (char **)kwlist, &f))
return NULL;
Interface0DIterator if0D_it(self->if1D->pointsBegin(f));
return BPy_Interface0DIterator_from_Interface0DIterator(if0D_it, 0);
@@ -204,11 +205,12 @@ PyDoc_STRVAR(Interface1D_points_end_doc,
" :return: An Interface0DIterator pointing after the last point.\n"
" :rtype: :class:`Interface0DIterator`");
-static PyObject * Interface1D_points_end(BPy_Interface1D *self, PyObject *args)
+static PyObject * Interface1D_points_end(BPy_Interface1D *self, PyObject *args, PyObject *kwds)
{
- float f = 0;
+ static const char *kwlist[] = {"t", NULL};
+ float f = 0.0f;
- if (!PyArg_ParseTuple(args, "|f", &f))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "|f", (char **)kwlist, &f))
return NULL;
Interface0DIterator if0D_it(self->if1D->pointsEnd(f));
return BPy_Interface0DIterator_from_Interface0DIterator(if0D_it, 1);
@@ -217,8 +219,8 @@ static PyObject * Interface1D_points_end(BPy_Interface1D *self, PyObject *args)
static PyMethodDef BPy_Interface1D_methods[] = {
{"vertices_begin", (PyCFunction)Interface1D_vertices_begin, METH_NOARGS, Interface1D_vertices_begin_doc},
{"vertices_end", (PyCFunction)Interface1D_vertices_end, METH_NOARGS, Interface1D_vertices_end_doc},
- {"points_begin", (PyCFunction)Interface1D_points_begin, METH_VARARGS, Interface1D_points_begin_doc},
- {"points_end", (PyCFunction)Interface1D_points_end, METH_VARARGS, Interface1D_points_end_doc},
+ {"points_begin", (PyCFunction)Interface1D_points_begin, METH_VARARGS | METH_KEYWORDS, Interface1D_points_begin_doc},
+ {"points_end", (PyCFunction)Interface1D_points_end, METH_VARARGS | METH_KEYWORDS, Interface1D_points_end_doc},
{NULL, NULL, 0, NULL}
};
diff --git a/source/blender/freestyle/intern/python/BPy_Operators.cpp b/source/blender/freestyle/intern/python/BPy_Operators.cpp
index 333b6cc1107..29498b1f480 100644
--- a/source/blender/freestyle/intern/python/BPy_Operators.cpp
+++ b/source/blender/freestyle/intern/python/BPy_Operators.cpp
@@ -48,62 +48,61 @@ extern "C" {
///////////////////////////////////////////////////////////////////////////////////////////
//-------------------MODULE INITIALIZATION--------------------------------
-int Operators_Init( PyObject *module )
-{
- if( module == NULL )
+int Operators_Init(PyObject *module)
+{
+ if (module == NULL)
return -1;
- if( PyType_Ready( &Operators_Type ) < 0 )
+ if (PyType_Ready(&Operators_Type) < 0)
return -1;
+ Py_INCREF(&Operators_Type);
+ PyModule_AddObject(module, "Operators", (PyObject *)&Operators_Type);
- Py_INCREF( &Operators_Type );
- PyModule_AddObject(module, "Operators", (PyObject *)&Operators_Type);
return 0;
}
//------------------------INSTANCE METHODS ----------------------------------
-static char Operators___doc__[] =
+PyDoc_STRVAR(Operators_doc,
"Class defining the operators used in a style module. There are five\n"
"types of operators: Selection, chaining, splitting, sorting and\n"
"creation. All these operators are user controlled through functors,\n"
-"predicates and shaders that are taken as arguments.\n";
+"predicates and shaders that are taken as arguments.");
-static void Operators___dealloc__(BPy_Operators* self)
+static void Operators_dealloc(BPy_Operators* self)
{
- Py_TYPE(self)->tp_free((PyObject*)self);
+ Py_TYPE(self)->tp_free((PyObject*)self);
}
-static char Operators_select___doc__[] =
+PyDoc_STRVAR(Operators_select_doc,
".. staticmethod:: select(pred)\n"
"\n"
" Selects the ViewEdges of the ViewMap verifying a specified\n"
" condition.\n"
"\n"
" :arg pred: The predicate expressing this condition.\n"
-" :type pred: UnaryPredicate1D\n";
+" :type pred: UnaryPredicate1D");
-static PyObject * Operators_select(BPy_Operators* self, PyObject *args)
+static PyObject *Operators_select(BPy_Operators* self, PyObject *args, PyObject *kwds)
{
+ static const char *kwlist[] = {"pred", NULL};
PyObject *obj = 0;
- if ( !PyArg_ParseTuple(args, "O!", &UnaryPredicate1D_Type, &obj) )
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &UnaryPredicate1D_Type, &obj))
return NULL;
- if ( !((BPy_UnaryPredicate1D *) obj)->up1D ) {
+ if (!((BPy_UnaryPredicate1D *)obj)->up1D) {
PyErr_SetString(PyExc_TypeError, "Operators.select(): 1st argument: invalid UnaryPredicate1D object");
return NULL;
}
-
- if (Operators::select(*( ((BPy_UnaryPredicate1D *) obj)->up1D )) < 0) {
+ if (Operators::select(*(((BPy_UnaryPredicate1D *)obj)->up1D)) < 0) {
if (!PyErr_Occurred())
PyErr_SetString(PyExc_RuntimeError, "Operators.select() failed");
return NULL;
}
-
Py_RETURN_NONE;
}
-static char Operators_chain___doc__[] =
+PyDoc_STRVAR(Operators_chain_doc,
".. staticmethod:: chain(it, pred, modifier)\n"
"\n"
" Builds a set of chains from the current set of ViewEdges. Each\n"
@@ -141,57 +140,56 @@ static char Operators_chain___doc__[] =
" :type it: :class:`ViewEdgeIterator`\n"
" :arg pred: The predicate on the ViewEdge that expresses the\n"
" stopping condition.\n"
-" :type pred: :class:`UnaryPredicate1D`\n";
+" :type pred: :class:`UnaryPredicate1D`");
-// CHANGE: first parameter is a chaining iterator, not just a view
-
-static PyObject * Operators_chain(BPy_Operators* self, PyObject *args)
+static PyObject *Operators_chain(BPy_Operators* self, PyObject *args, PyObject *kwds)
{
+ static const char *kwlist[] = {"it", "pred", "modifier", NULL};
PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0;
- if ( !PyArg_ParseTuple(args, "O!O!|O!", &ChainingIterator_Type, &obj1,
- &UnaryPredicate1D_Type, &obj2,
- &UnaryFunction1DVoid_Type, &obj3) )
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!O!|O!", (char **)kwlist,
+ &ChainingIterator_Type, &obj1,
+ &UnaryPredicate1D_Type, &obj2,
+ &UnaryFunction1DVoid_Type, &obj3))
+ {
return NULL;
- if ( !((BPy_ChainingIterator *) obj1)->c_it ) {
+ }
+ if (!((BPy_ChainingIterator *)obj1)->c_it) {
PyErr_SetString(PyExc_TypeError, "Operators.chain(): 1st argument: invalid ChainingIterator object");
return NULL;
}
- if ( !((BPy_UnaryPredicate1D *) obj2)->up1D ) {
+ if (!((BPy_UnaryPredicate1D *)obj2)->up1D) {
PyErr_SetString(PyExc_TypeError, "Operators.chain(): 2nd argument: invalid UnaryPredicate1D object");
return NULL;
}
-
- if( !obj3 ) {
-
- if (Operators::chain( *( ((BPy_ChainingIterator *) obj1)->c_it ),
- *( ((BPy_UnaryPredicate1D *) obj2)->up1D ) ) < 0) {
+ if (!obj3) {
+ if (Operators::chain(*(((BPy_ChainingIterator *)obj1)->c_it),
+ *(((BPy_UnaryPredicate1D *)obj2)->up1D)) < 0)
+ {
if (!PyErr_Occurred())
PyErr_SetString(PyExc_RuntimeError, "Operators.chain() failed");
return NULL;
}
-
- } else {
-
- if ( !((BPy_UnaryFunction1DVoid *) obj3)->uf1D_void ) {
+ }
+ else {
+ if (!((BPy_UnaryFunction1DVoid *)obj3)->uf1D_void) {
PyErr_SetString(PyExc_TypeError, "Operators.chain(): 3rd argument: invalid UnaryFunction1DVoid object");
return NULL;
}
- if (Operators::chain( *( ((BPy_ChainingIterator *) obj1)->c_it ),
- *( ((BPy_UnaryPredicate1D *) obj2)->up1D ),
- *( ((BPy_UnaryFunction1DVoid *) obj3)->uf1D_void ) ) < 0) {
+ if (Operators::chain(*(((BPy_ChainingIterator *)obj1)->c_it),
+ *(((BPy_UnaryPredicate1D *)obj2)->up1D),
+ *(((BPy_UnaryFunction1DVoid *)obj3)->uf1D_void)) < 0)
+ {
if (!PyErr_Occurred())
PyErr_SetString(PyExc_RuntimeError, "Operators.chain() failed");
return NULL;
}
-
}
-
Py_RETURN_NONE;
}
-static char Operators_bidirectionalChain___doc__[] =
-".. staticmethod:: bidirectionalChain(it, pred)\n"
+PyDoc_STRVAR(Operators_bidirectional_chain_doc,
+".. staticmethod:: bidirectional_chain(it, pred)\n"
"\n"
" Builds a set of chains from the current set of ViewEdges. Each\n"
" ViewEdge of the current list potentially starts a new chain. The\n"
@@ -212,7 +210,7 @@ static char Operators_bidirectionalChain___doc__[] =
" stopping condition.\n"
" :type pred: :class:`UnaryPredicate1D`\n"
"\n"
-".. staticmethod:: bidirectionalChain(it)\n"
+".. staticmethod:: bidirectional_chain(it)\n"
"\n"
" The only difference with the above bidirectional chaining algorithm\n"
" is that we don't need to pass a stopping criterion. This might be\n"
@@ -231,47 +229,47 @@ static char Operators_bidirectionalChain___doc__[] =
"\n"
" :arg it: The ChainingIterator on the ViewEdges of the ViewMap. It\n"
" contains the chaining rule.\n"
-" :type it: :class:`ChainingIterator`\n";
+" :type it: :class:`ChainingIterator`");
-static PyObject * Operators_bidirectionalChain(BPy_Operators* self, PyObject *args)
+static PyObject *Operators_bidirectional_chain(BPy_Operators* self, PyObject *args, PyObject *kwds)
{
+ static const char *kwlist[] = {"it", "pred", NULL};
PyObject *obj1 = 0, *obj2 = 0;
- if( !PyArg_ParseTuple(args, "O!|O!", &ChainingIterator_Type, &obj1, &UnaryPredicate1D_Type, &obj2) )
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!|O!", (char **)kwlist,
+ &ChainingIterator_Type, &obj1, &UnaryPredicate1D_Type, &obj2))
+ {
return NULL;
- if ( !((BPy_ChainingIterator *) obj1)->c_it ) {
- PyErr_SetString(PyExc_TypeError, "Operators.bidirectionalChain(): 1st argument: invalid ChainingIterator object");
+ }
+ if (!((BPy_ChainingIterator *)obj1)->c_it) {
+ PyErr_SetString(PyExc_TypeError, "Operators.bidirectional_chain(): 1st argument: invalid ChainingIterator object");
return NULL;
}
-
- if( !obj2 ) {
-
- if (Operators::bidirectionalChain( *( ((BPy_ChainingIterator *) obj1)->c_it ) ) < 0) {
+ if (!obj2) {
+ if (Operators::bidirectionalChain(*(((BPy_ChainingIterator *)obj1)->c_it)) < 0) {
if (!PyErr_Occurred())
- PyErr_SetString(PyExc_RuntimeError, "Operators.bidirectionalChain() failed");
+ PyErr_SetString(PyExc_RuntimeError, "Operators.bidirectional_chain() failed");
return NULL;
}
-
- } else {
-
- if ( !((BPy_UnaryPredicate1D *) obj2)->up1D ) {
- PyErr_SetString(PyExc_TypeError, "Operators.bidirectionalChain(): 2nd argument: invalid UnaryPredicate1D object");
+ }
+ else {
+ if (!((BPy_UnaryPredicate1D *)obj2)->up1D) {
+ PyErr_SetString(PyExc_TypeError, "Operators.bidirectional_chain(): 2nd argument: invalid UnaryPredicate1D object");
return NULL;
}
- if (Operators::bidirectionalChain( *( ((BPy_ChainingIterator *) obj1)->c_it ),
- *( ((BPy_UnaryPredicate1D *) obj2)->up1D ) ) < 0) {
+ if (Operators::bidirectionalChain(*(((BPy_ChainingIterator *)obj1)->c_it),
+ *(((BPy_UnaryPredicate1D *)obj2)->up1D)) < 0)
+ {
if (!PyErr_Occurred())
- PyErr_SetString(PyExc_RuntimeError, "Operators.bidirectionalChain() failed");
+ PyErr_SetString(PyExc_RuntimeError, "Operators.bidirectional_chain() failed");
return NULL;
}
-
}
-
Py_RETURN_NONE;
}
-static char Operators_sequentialSplit___doc__[] =
-".. staticmethod:: sequentialSplit(startingPred, stoppingPred, sampling=0.0)\n"
+PyDoc_STRVAR(Operators_sequential_split_doc,
+".. staticmethod:: sequential_split(starting_pred, stopping_pred, sampling=0.0)\n"
"\n"
" Splits each chain of the current set of chains in a sequential way.\n"
" The points of each chain are processed (with a specified sampling)\n"
@@ -282,19 +280,19 @@ static char Operators_sequentialSplit___doc__[] =
" first point of one of the resulting chains. The splitting ends when\n"
" no more chain can start.\n"
"\n"
-" :arg startingPred: The predicate on a point that expresses the\n"
+" :arg starting_pred: The predicate on a point that expresses the\n"
" starting condition.\n"
-" :type startingPred: :class:`UnaryPredicate0D`\n"
-" :arg stoppingPred: The predicate on a point that expresses the\n"
+" :type starting_pred: :class:`UnaryPredicate0D`\n"
+" :arg stopping_pred: The predicate on a point that expresses the\n"
" stopping condition.\n"
-" :type stoppingPred: :class:`UnaryPredicate0D`\n"
+" :type stopping_pred: :class:`UnaryPredicate0D`\n"
" :arg sampling: The resolution used to sample the chain for the\n"
" predicates evaluation. (The chain is not actually resampled;\n"
" a virtual point only progresses along the curve using this\n"
" resolution.)\n"
" :type sampling: float\n"
"\n"
-".. staticmethod:: sequentialSplit(pred, sampling=0.0)\n"
+".. staticmethod:: sequential_split(pred, sampling=0.0)\n"
"\n"
" Splits each chain of the current set of chains in a sequential way.\n"
" The points of each chain are processed (with a specified sampling)\n"
@@ -309,56 +307,58 @@ static char Operators_sequentialSplit___doc__[] =
" predicate evaluation. (The chain is not actually resampled; a\n"
" virtual point only progresses along the curve using this\n"
" resolution.)\n"
-" :type sampling: float\n";
+" :type sampling: float");
-static PyObject * Operators_sequentialSplit(BPy_Operators* self, PyObject *args)
+static PyObject *Operators_sequential_split(BPy_Operators* self, PyObject *args, PyObject *kwds)
{
+ static const char *kwlist_1[] = {"starting_pred", "stopping_pred", "sampling", NULL};
+ static const char *kwlist_2[] = {"pred", "sampling", NULL};
PyObject *obj1 = 0, *obj2 = 0;
- float f = 0.0;
+ float f = 0.0f;
- if( !PyArg_ParseTuple(args, "O!|Of", &UnaryPredicate0D_Type, &obj1, &obj2, &f) )
- return NULL;
- if ( !((BPy_UnaryPredicate0D *) obj1)->up0D ) {
- PyErr_SetString(PyExc_TypeError, "Operators.sequentialSplit(): 1st argument: invalid UnaryPredicate0D object");
- return NULL;
- }
-
- if( obj2 && BPy_UnaryPredicate0D_Check(obj2) ) {
-
- if ( !((BPy_UnaryPredicate0D *) obj2)->up0D ) {
- PyErr_SetString(PyExc_TypeError, "Operators.sequentialSplit(): 2nd argument: invalid UnaryPredicate0D object");
+ if (PyArg_ParseTupleAndKeywords(args, kwds, "O!O!|f", (char **)kwlist_1,
+ &UnaryPredicate0D_Type, &obj1, &UnaryPredicate0D_Type, &obj2, &f))
+ {
+ if (!((BPy_UnaryPredicate0D *)obj1)->up0D) {
+ PyErr_SetString(PyExc_TypeError, "Operators.sequential_split(): 1st argument: invalid UnaryPredicate0D object");
+ return NULL;
+ }
+ if (!((BPy_UnaryPredicate0D *)obj2)->up0D) {
+ PyErr_SetString(PyExc_TypeError, "Operators.sequential_split(): 2nd argument: invalid UnaryPredicate0D object");
return NULL;
}
- if (Operators::sequentialSplit( *( ((BPy_UnaryPredicate0D *) obj1)->up0D ),
- *( ((BPy_UnaryPredicate0D *) obj2)->up0D ),
- f ) < 0) {
+ if (Operators::sequentialSplit(*(((BPy_UnaryPredicate0D *)obj1)->up0D),
+ *(((BPy_UnaryPredicate0D *)obj2)->up0D),
+ f) < 0)
+ {
if (!PyErr_Occurred())
- PyErr_SetString(PyExc_RuntimeError, "Operators.sequentialSplit() failed");
+ PyErr_SetString(PyExc_RuntimeError, "Operators.sequential_split() failed");
return NULL;
}
-
- } else {
-
- if ( obj2 ) {
- if ( !PyFloat_Check(obj2) ) {
- PyErr_SetString(PyExc_TypeError, "Operators.sequentialSplit(): invalid 2nd argument");
- return NULL;
- }
- f = PyFloat_AsDouble(obj2);
+ }
+ else if (PyErr_Clear(), (f = 0.0f),
+ PyArg_ParseTupleAndKeywords(args, kwds, "O!|f", (char **)kwlist_2,
+ &UnaryPredicate0D_Type, &obj1, &f))
+ {
+ if (!((BPy_UnaryPredicate0D *)obj1)->up0D) {
+ PyErr_SetString(PyExc_TypeError, "Operators.sequential_split(): 1st argument: invalid UnaryPredicate0D object");
+ return NULL;
}
- if (Operators::sequentialSplit( *( ((BPy_UnaryPredicate0D *) obj1)->up0D ), f ) < 0) {
+ if (Operators::sequentialSplit(*(((BPy_UnaryPredicate0D *)obj1)->up0D), f) < 0) {
if (!PyErr_Occurred())
- PyErr_SetString(PyExc_RuntimeError, "Operators.sequentialSplit() failed");
+ PyErr_SetString(PyExc_RuntimeError, "Operators.sequential_split() failed");
return NULL;
}
-
}
-
+ else {
+ PyErr_SetString(PyExc_TypeError, "invalid argument(s)");
+ return NULL;
+ }
Py_RETURN_NONE;
}
-static char Operators_recursiveSplit___doc__[] =
-".. staticmethod:: recursiveSplit(func, pred, sampling=0.0)\n"
+PyDoc_STRVAR(Operators_recursive_split_doc,
+".. staticmethod:: recursive_split(func, pred_1d, sampling=0.0)\n"
"\n"
" Splits the current set of chains in a recursive way. We process the\n"
" points of each chain (with a specified sampling) to find the point\n"
@@ -370,9 +370,9 @@ static char Operators_recursiveSplit___doc__[] =
" :arg func: The Unary Function evaluated at each point of the chain.\n"
" The splitting point is the point minimizing this function.\n"
" :type func: :class:`UnaryFunction0DDouble`\n"
-" :arg pred: The Unary Predicate expressing the recursivity stopping\n"
+" :arg pred_1d: The Unary Predicate expressing the recursivity stopping\n"
" condition. This predicate is evaluated for each curve before it\n"
-" actually gets split. If pred(chain) is true, the curve won't be\n"
+" actually gets split. If pred_1d(chain) is true, the curve won't be\n"
" split anymore.\n"
" :type pred: :class:`UnaryPredicate1D`\n"
" :arg sampling: The resolution used to sample the chain for the\n"
@@ -381,7 +381,7 @@ static char Operators_recursiveSplit___doc__[] =
" resolution.)\n"
" :type sampling: float\n"
"\n"
-".. staticmethod:: recursiveSplit(func, pred0d, pred, sampling=0.0)\n"
+".. staticmethod:: recursive_split(func, pred_0d, pred_1d, sampling=0.0)\n"
"\n"
" Splits the current set of chains in a recursive way. We process the\n"
" points of each chain (with a specified sampling) to find the point\n"
@@ -396,101 +396,105 @@ static char Operators_recursiveSplit___doc__[] =
" :arg func: The Unary Function evaluated at each point of the chain.\n"
" The splitting point is the point minimizing this function.\n"
" :type func: :class:`UnaryFunction0DDouble`\n"
-" :arg pred0d: The Unary Predicate 0D used to select the candidate\n"
+" :arg pred_0d: The Unary Predicate 0D used to select the candidate\n"
" points where the split can occur. For example, it is very likely\n"
" that would rather have your chain splitting around its middle\n"
" point than around one of its extremities. A 0D predicate working\n"
" on the curvilinear abscissa allows to add this kind of constraints.\n"
-" :type pred0d: :class:`UnaryPredicate0D`\n"
-" :arg pred: The Unary Predicate expressing the recursivity stopping\n"
+" :type pred_0d: :class:`UnaryPredicate0D`\n"
+" :arg pred_1d: The Unary Predicate expressing the recursivity stopping\n"
" condition. This predicate is evaluated for each curve before it\n"
-" actually gets split. If pred(chain) is true, the curve won't be\n"
+" actually gets split. If pred_1d(chain) is true, the curve won't be\n"
" split anymore.\n"
" :type pred: :class:`UnaryPredicate1D`\n"
" :arg sampling: The resolution used to sample the chain for the\n"
" predicates evaluation. (The chain is not actually resampled; a\n"
" virtual point only progresses along the curve using this\n"
" resolution.)\n"
-" :type sampling: float\n";
+" :type sampling: float");
-static PyObject * Operators_recursiveSplit(BPy_Operators* self, PyObject *args)
+static PyObject *Operators_recursive_split(BPy_Operators* self, PyObject *args, PyObject *kwds)
{
+ static const char *kwlist_1[] = {"func", "pred_1d", "sampling", NULL};
+ static const char *kwlist_2[] = {"func", "pred_0d", "pred_1d", "sampling", NULL};
PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0;
- float f = 0.0;
+ float f = 0.0f;
- if ( !PyArg_ParseTuple(args, "O!O|Of", &UnaryFunction0DDouble_Type, &obj1, &obj2, &obj3, &f) )
- return NULL;
- if ( !((BPy_UnaryFunction0DDouble *) obj1)->uf0D_double ) {
- PyErr_SetString(PyExc_TypeError, "Operators.recursiveSplit(): 1st argument: invalid UnaryFunction0DDouble object");
- return NULL;
- }
-
- if ( BPy_UnaryPredicate1D_Check(obj2) ) {
-
- if ( !((BPy_UnaryPredicate1D *) obj2)->up1D ) {
- PyErr_SetString(PyExc_TypeError, "Operators.recursiveSplit(): 2nd argument: invalid UnaryPredicate1D object");
+ if (PyArg_ParseTupleAndKeywords(args, kwds, "O!O!|f", (char **)kwlist_1,
+ &UnaryFunction0DDouble_Type, &obj1, &UnaryPredicate1D_Type, &obj2, &f))
+ {
+ if (!((BPy_UnaryFunction0DDouble *)obj1)->uf0D_double) {
+ PyErr_SetString(PyExc_TypeError, "Operators.recursive_split(): 1st argument: invalid UnaryFunction0DDouble object");
return NULL;
}
- if ( obj3 ) {
- if ( !PyFloat_Check(obj3) ) {
- PyErr_SetString(PyExc_TypeError, "Operators.recursiveSplit(): invalid 3rd argument");
- return NULL;
- }
- f = PyFloat_AsDouble(obj3);
+ if (!((BPy_UnaryPredicate1D *)obj2)->up1D) {
+ PyErr_SetString(PyExc_TypeError, "Operators.recursive_split(): 2nd argument: invalid UnaryPredicate1D object");
+ return NULL;
}
- if (Operators::recursiveSplit( *( ((BPy_UnaryFunction0DDouble *) obj1)->uf0D_double ),
- *( ((BPy_UnaryPredicate1D *) obj2)->up1D ),
- f ) < 0) {
+ if (Operators::recursiveSplit(*(((BPy_UnaryFunction0DDouble *)obj1)->uf0D_double),
+ *(((BPy_UnaryPredicate1D *)obj2)->up1D),
+ f) < 0)
+ {
if (!PyErr_Occurred())
- PyErr_SetString(PyExc_RuntimeError, "Operators.recursiveSplit() failed");
+ PyErr_SetString(PyExc_RuntimeError, "Operators.recursive_split() failed");
return NULL;
}
-
- } else {
-
- if ( !BPy_UnaryPredicate0D_Check(obj2) || !((BPy_UnaryPredicate0D *) obj2)->up0D ) {
- PyErr_SetString(PyExc_TypeError, "Operators.recursiveSplit(): invalid 2nd argument");
+ }
+ else if (PyErr_Clear(), (f = 0.0f),
+ PyArg_ParseTupleAndKeywords(args, kwds, "O!O!O!|f", (char **)kwlist_2,
+ &UnaryFunction0DDouble_Type, &obj1, &UnaryPredicate0D_Type, &obj2,
+ &UnaryPredicate1D_Type, &obj3, &f))
+ {
+ if (!((BPy_UnaryFunction0DDouble *)obj1)->uf0D_double) {
+ PyErr_SetString(PyExc_TypeError, "Operators.recursive_split(): 1st argument: invalid UnaryFunction0DDouble object");
return NULL;
}
- if ( !BPy_UnaryPredicate1D_Check(obj3) || !((BPy_UnaryPredicate1D *) obj3)->up1D ) {
- PyErr_SetString(PyExc_TypeError, "Operators.recursiveSplit(): invalid 3rd argument");
+ if (!((BPy_UnaryPredicate0D *)obj2)->up0D) {
+ PyErr_SetString(PyExc_TypeError, "Operators.recursive_split(): 2nd argument: invalid UnaryPredicate0D object");
return NULL;
}
- if (Operators::recursiveSplit( *( ((BPy_UnaryFunction0DDouble *) obj1)->uf0D_double ),
- *( ((BPy_UnaryPredicate0D *) obj2)->up0D ),
- *( ((BPy_UnaryPredicate1D *) obj3)->up1D ),
- f ) < 0) {
+ if (!((BPy_UnaryPredicate1D *)obj3)->up1D) {
+ PyErr_SetString(PyExc_TypeError, "Operators.recursive_split(): 3rd argument: invalid UnaryPredicate1D object");
+ return NULL;
+ }
+ if (Operators::recursiveSplit(*(((BPy_UnaryFunction0DDouble *)obj1)->uf0D_double),
+ *(((BPy_UnaryPredicate0D *)obj2)->up0D),
+ *(((BPy_UnaryPredicate1D *)obj3)->up1D),
+ f) < 0)
+ {
if (!PyErr_Occurred())
- PyErr_SetString(PyExc_RuntimeError, "Operators.recursiveSplit() failed");
+ PyErr_SetString(PyExc_RuntimeError, "Operators.recursive_split() failed");
return NULL;
}
-
}
-
+ else {
+ PyErr_SetString(PyExc_TypeError, "invalid argument(s)");
+ return NULL;
+ }
Py_RETURN_NONE;
}
-static char Operators_sort___doc__[] =
+PyDoc_STRVAR(Operators_sort_doc,
".. staticmethod:: sort(pred)\n"
"\n"
" Sorts the current set of chains (or viewedges) according to the\n"
" comparison predicate given as argument.\n"
"\n"
" :arg pred: The binary predicate used for the comparison.\n"
-" :type pred: BinaryPredicate1D\n";
+" :type pred: BinaryPredicate1D");
-static PyObject * Operators_sort(BPy_Operators* self, PyObject *args)
+static PyObject *Operators_sort(BPy_Operators* self, PyObject *args, PyObject *kwds)
{
+ static const char *kwlist[] = {"pred", NULL};
PyObject *obj = 0;
- if ( !PyArg_ParseTuple(args, "O!", &BinaryPredicate1D_Type, &obj) )
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &BinaryPredicate1D_Type, &obj))
return NULL;
- if ( !((BPy_BinaryPredicate1D *) obj)->bp1D ) {
+ if (!((BPy_BinaryPredicate1D *)obj)->bp1D) {
PyErr_SetString(PyExc_TypeError, "Operators.sort(): 1st argument: invalid BinaryPredicate1D object");
return NULL;
}
-
- if (Operators::sort(*( ((BPy_BinaryPredicate1D *) obj)->bp1D )) < 0) {
+ if (Operators::sort(*(((BPy_BinaryPredicate1D *)obj)->bp1D)) < 0) {
if (!PyErr_Occurred())
PyErr_SetString(PyExc_RuntimeError, "Operators.sort() failed");
return NULL;
@@ -498,7 +502,7 @@ static PyObject * Operators_sort(BPy_Operators* self, PyObject *args)
Py_RETURN_NONE;
}
-static char Operators_create___doc__[] =
+PyDoc_STRVAR(Operators_create_doc,
".. staticmethod:: create(pred, shaders)\n"
"\n"
" Creates and shades the strokes from the current set of chains. A\n"
@@ -508,53 +512,55 @@ static char Operators_create___doc__[] =
" transform as a stroke.\n"
" :type pred: :class:`UnaryPredicate1D`\n"
" :arg shaders: The list of shaders used to shade the strokes.\n"
-" :type shaders: List of StrokeShader objects\n";
+" :type shaders: List of StrokeShader objects");
-static PyObject * Operators_create(BPy_Operators* self, PyObject *args)
+static PyObject *Operators_create(BPy_Operators* self, PyObject *args, PyObject *kwds)
{
+ static const char *kwlist[] = {"pred", "shaders", NULL};
PyObject *obj1 = 0, *obj2 = 0;
- if ( !PyArg_ParseTuple(args, "O!O!", &UnaryPredicate1D_Type, &obj1, &PyList_Type, &obj2) )
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!O!", (char **)kwlist,
+ &UnaryPredicate1D_Type, &obj1, &PyList_Type, &obj2))
+ {
return NULL;
- if ( !((BPy_UnaryPredicate1D *) obj1)->up1D ) {
+ }
+ if (!((BPy_UnaryPredicate1D *)obj1)->up1D) {
PyErr_SetString(PyExc_TypeError, "Operators.create(): 1st argument: invalid UnaryPredicate1D object");
return NULL;
}
-
vector<StrokeShader *> shaders;
- for( int i = 0; i < PyList_Size(obj2); i++) {
- PyObject *py_ss = PyList_GetItem(obj2,i);
-
- if ( !BPy_StrokeShader_Check(py_ss) ) {
- PyErr_SetString(PyExc_TypeError, "Operators.create() 2nd argument must be a list of StrokeShader objects");
+ for (int i = 0; i < PyList_Size(obj2); i++) {
+ PyObject *py_ss = PyList_GetItem(obj2, i);
+ if (!BPy_StrokeShader_Check(py_ss)) {
+ PyErr_SetString(PyExc_TypeError, "Operators.create(): 2nd argument must be a list of StrokeShader objects");
return NULL;
}
- shaders.push_back( ((BPy_StrokeShader *) py_ss)->ss );
+ shaders.push_back(((BPy_StrokeShader *)py_ss)->ss);
}
-
- if (Operators::create( *( ((BPy_UnaryPredicate1D *) obj1)->up1D ), shaders) < 0) {
+ if (Operators::create(*(((BPy_UnaryPredicate1D *)obj1)->up1D), shaders) < 0) {
if (!PyErr_Occurred())
PyErr_SetString(PyExc_RuntimeError, "Operators.create() failed");
return NULL;
}
-
Py_RETURN_NONE;
}
-static char Operators_getViewEdgeFromIndex___doc__[] =
-".. staticmethod:: getViewEdgeFromIndex()\n"
+PyDoc_STRVAR(Operators_get_viewedge_from_index_doc,
+".. staticmethod:: get_viewedge_from_index(i)\n"
"\n"
" Returns the ViewEdge at the index in the current set of ViewEdges.\n"
"\n"
-" :arg i: index (0 <= i < Operators.getViewEdgesSize()).\n"
+" :arg i: index (0 <= i < Operators.get_view_edges_size()).\n"
" :type i: int\n"
" :return: The ViewEdge object.\n"
-" :rtype: :class:`ViewEdge`\n";
+" :rtype: :class:`ViewEdge`");
-static PyObject * Operators_getViewEdgeFromIndex(BPy_Operators* self, PyObject *args) {
+static PyObject *Operators_get_viewedge_from_index(BPy_Operators* self, PyObject *args, PyObject *kwds)
+{
+ static const char *kwlist[] = {"i", NULL};
unsigned int i;
- if (!PyArg_ParseTuple(args, "I", &i))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &i))
return NULL;
if (i >= Operators::getViewEdgesSize()) {
PyErr_SetString(PyExc_IndexError, "index out of range");
@@ -563,20 +569,22 @@ static PyObject * Operators_getViewEdgeFromIndex(BPy_Operators* self, PyObject *
return BPy_ViewEdge_from_ViewEdge(*(Operators::getViewEdgeFromIndex(i)));
}
-static char Operators_getChainFromIndex___doc__[] =
-".. staticmethod:: getChainFromIndex()\n"
+PyDoc_STRVAR(Operators_get_chain_from_index_doc,
+".. staticmethod:: get_chain_from_index(i)\n"
"\n"
" Returns the Chain at the index in the current set of Chains.\n"
"\n"
-" :arg i: index (0 <= i < Operators.getChainsSize()).\n"
+" :arg i: index (0 <= i < Operators.get_chains_size()).\n"
" :type i: int\n"
" :return: The Chain object.\n"
-" :rtype: :class:`Chain`\n";
+" :rtype: :class:`Chain`");
-static PyObject * Operators_getChainFromIndex(BPy_Operators* self, PyObject *args) {
+static PyObject *Operators_get_chain_from_index(BPy_Operators* self, PyObject *args, PyObject *kwds)
+{
+ static const char *kwlist[] = {"i", NULL};
unsigned int i;
- if (!PyArg_ParseTuple(args, "I", &i))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &i))
return NULL;
if (i >= Operators::getChainsSize()) {
PyErr_SetString(PyExc_IndexError, "index out of range");
@@ -585,20 +593,22 @@ static PyObject * Operators_getChainFromIndex(BPy_Operators* self, PyObject *arg
return BPy_Chain_from_Chain(*(Operators::getChainFromIndex(i)));
}
-static char Operators_getStrokeFromIndex___doc__[] =
-".. staticmethod:: getStrokeFromIndex()\n"
+PyDoc_STRVAR(Operators_get_stroke_from_index_doc,
+".. staticmethod:: get_stroke_from_index(i)\n"
"\n"
" Returns the Stroke at the index in the current set of Strokes.\n"
"\n"
-" :arg i: index (0 <= i < Operators.getStrokesSize()).\n"
+" :arg i: index (0 <= i < Operators.get_strokes_size()).\n"
" :type i: int\n"
" :return: The Stroke object.\n"
-" :rtype: :class:`Stroke`\n";
+" :rtype: :class:`Stroke`");
-static PyObject * Operators_getStrokeFromIndex(BPy_Operators* self, PyObject *args) {
+static PyObject *Operators_get_stroke_from_index(BPy_Operators* self, PyObject *args, PyObject *kwds)
+{
+ static const char *kwlist[] = {"i", NULL};
unsigned int i;
- if (!PyArg_ParseTuple(args, "I", &i))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &i))
return NULL;
if (i >= Operators::getStrokesSize()) {
PyErr_SetString(PyExc_IndexError, "index out of range");
@@ -607,57 +617,60 @@ static PyObject * Operators_getStrokeFromIndex(BPy_Operators* self, PyObject *ar
return BPy_Stroke_from_Stroke(*(Operators::getStrokeFromIndex(i)));
}
-static char Operators_getViewEdgesSize___doc__[] =
-".. staticmethod:: getViewEdgesSize()\n"
+PyDoc_STRVAR(Operators_get_view_edges_size_doc,
+".. staticmethod:: get_view_edges_size()\n"
"\n"
" Returns the number of ViewEdges.\n"
"\n"
" :return: The number of ViewEdges.\n"
-" :rtype: int\n";
+" :rtype: int");
-static PyObject * Operators_getViewEdgesSize( BPy_Operators* self) {
- return PyLong_FromLong( Operators::getViewEdgesSize() );
+static PyObject *Operators_get_view_edges_size(BPy_Operators* self)
+{
+ return PyLong_FromLong(Operators::getViewEdgesSize());
}
-static char Operators_getChainsSize___doc__[] =
-".. staticmethod:: getChainsSize()\n"
+PyDoc_STRVAR(Operators_get_chains_size_doc,
+".. staticmethod:: get_chains_size()\n"
"\n"
" Returns the number of Chains.\n"
"\n"
" :return: The number of Chains.\n"
-" :rtype: int\n";
+" :rtype: int");
-static PyObject * Operators_getChainsSize( BPy_Operators* self ) {
- return PyLong_FromLong( Operators::getChainsSize() );
+static PyObject *Operators_get_chains_size(BPy_Operators* self)
+{
+ return PyLong_FromLong(Operators::getChainsSize());
}
-static char Operators_getStrokesSize___doc__[] =
-".. staticmethod:: getStrokesSize()\n"
+PyDoc_STRVAR(Operators_get_strokes_size_doc,
+".. staticmethod:: get_strokes_size()\n"
"\n"
" Returns the number of Strokes.\n"
"\n"
" :return: The number of Strokes.\n"
-" :rtype: int\n";
+" :rtype: int");
-static PyObject * Operators_getStrokesSize( BPy_Operators* self) {
- return PyLong_FromLong( Operators::getStrokesSize() );
+static PyObject *Operators_get_strokes_size(BPy_Operators* self)
+{
+ return PyLong_FromLong(Operators::getStrokesSize());
}
/*----------------------Operators instance definitions ----------------------------*/
static PyMethodDef BPy_Operators_methods[] = {
- {"select", ( PyCFunction ) Operators_select, METH_VARARGS | METH_STATIC, Operators_select___doc__},
- {"chain", ( PyCFunction ) Operators_chain, METH_VARARGS | METH_STATIC, Operators_chain___doc__},
- {"bidirectionalChain", ( PyCFunction ) Operators_bidirectionalChain, METH_VARARGS | METH_STATIC, Operators_bidirectionalChain___doc__},
- {"sequentialSplit", ( PyCFunction ) Operators_sequentialSplit, METH_VARARGS | METH_STATIC, Operators_sequentialSplit___doc__},
- {"recursiveSplit", ( PyCFunction ) Operators_recursiveSplit, METH_VARARGS | METH_STATIC, Operators_recursiveSplit___doc__},
- {"sort", ( PyCFunction ) Operators_sort, METH_VARARGS | METH_STATIC, Operators_sort___doc__},
- {"create", ( PyCFunction ) Operators_create, METH_VARARGS | METH_STATIC, Operators_create___doc__},
- {"getViewEdgeFromIndex", ( PyCFunction ) Operators_getViewEdgeFromIndex, METH_VARARGS | METH_STATIC, Operators_getViewEdgeFromIndex___doc__},
- {"getChainFromIndex", ( PyCFunction ) Operators_getChainFromIndex, METH_VARARGS | METH_STATIC, Operators_getChainFromIndex___doc__},
- {"getStrokeFromIndex", ( PyCFunction ) Operators_getStrokeFromIndex, METH_VARARGS | METH_STATIC, Operators_getStrokeFromIndex___doc__},
- {"getViewEdgesSize", ( PyCFunction ) Operators_getViewEdgesSize, METH_NOARGS | METH_STATIC, Operators_getViewEdgesSize___doc__},
- {"getChainsSize", ( PyCFunction ) Operators_getChainsSize, METH_NOARGS | METH_STATIC, Operators_getChainsSize___doc__},
- {"getStrokesSize", ( PyCFunction ) Operators_getStrokesSize, METH_NOARGS | METH_STATIC, Operators_getStrokesSize___doc__},
+ {"select", (PyCFunction) Operators_select, METH_VARARGS | METH_KEYWORDS | METH_STATIC, Operators_select_doc},
+ {"chain", (PyCFunction) Operators_chain, METH_VARARGS | METH_KEYWORDS | METH_STATIC, Operators_chain_doc},
+ {"bidirectional_chain", (PyCFunction) Operators_bidirectional_chain, METH_VARARGS | METH_KEYWORDS | METH_STATIC, Operators_bidirectional_chain_doc},
+ {"sequential_split", (PyCFunction) Operators_sequential_split, METH_VARARGS | METH_KEYWORDS | METH_STATIC, Operators_sequential_split_doc},
+ {"recursive_split", (PyCFunction) Operators_recursive_split, METH_VARARGS | METH_KEYWORDS | METH_STATIC, 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},
+ {"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, Operators_get_chain_from_index_doc},
+ {"get_stroke_from_index", (PyCFunction) Operators_get_stroke_from_index, METH_VARARGS | METH_KEYWORDS | METH_STATIC, Operators_get_stroke_from_index_doc},
+ {"get_view_edges_size", (PyCFunction) Operators_get_view_edges_size, METH_NOARGS | METH_STATIC, Operators_get_view_edges_size_doc},
+ {"get_chains_size", (PyCFunction) Operators_get_chains_size, METH_NOARGS | METH_STATIC, Operators_get_chains_size_doc},
+ {"get_strokes_size", (PyCFunction) Operators_get_strokes_size, METH_NOARGS | METH_STATIC, Operators_get_strokes_size_doc},
{NULL, NULL, 0, NULL}
};
@@ -668,7 +681,7 @@ PyTypeObject Operators_Type = {
"Operators", /* tp_name */
sizeof(BPy_Operators), /* tp_basicsize */
0, /* tp_itemsize */
- (destructor)Operators___dealloc__, /* tp_dealloc */
+ (destructor)Operators_dealloc, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
@@ -684,7 +697,7 @@ PyTypeObject Operators_Type = {
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
- Operators___doc__, /* tp_doc */
+ Operators_doc, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
@@ -709,5 +722,3 @@ PyTypeObject Operators_Type = {
#ifdef __cplusplus
}
#endif
-
-
diff --git a/source/blender/freestyle/intern/python/BPy_SShape.cpp b/source/blender/freestyle/intern/python/BPy_SShape.cpp
index 47b83d2582f..7d03ea06bc0 100644
--- a/source/blender/freestyle/intern/python/BPy_SShape.cpp
+++ b/source/blender/freestyle/intern/python/BPy_SShape.cpp
@@ -102,37 +102,39 @@ static PyObject * SShape_repr(BPy_SShape *self)
}
static char SShape_add_edge_doc[] =
-".. method:: add_edge(iEdge)\n"
+".. method:: add_edge(edge)\n"
"\n"
" Adds an FEdge to the list of FEdges.\n"
"\n"
-" :arg iEdge: An FEdge object.\n"
-" :type iEdge: :class:`FEdge`\n";
+" :arg edge: An FEdge object.\n"
+" :type edge: :class:`FEdge`\n";
-static PyObject * SShape_add_edge(BPy_SShape *self , PyObject *args)
+static PyObject * SShape_add_edge(BPy_SShape *self , PyObject *args, PyObject *kwds)
{
+ static const char *kwlist[] = {"edge", NULL};
PyObject *py_fe = 0;
- if (!PyArg_ParseTuple(args, "O!", &FEdge_Type, &py_fe))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &FEdge_Type, &py_fe))
return NULL;
self->ss->AddEdge(((BPy_FEdge *)py_fe)->fe);
Py_RETURN_NONE;
}
PyDoc_STRVAR(SShape_add_vertex_doc,
-".. method:: add_vertex(iv)\n"
+".. method:: add_vertex(vertex)\n"
"\n"
" Adds an SVertex to the list of SVertex of this Shape. The SShape\n"
" attribute of the SVertex is also set to this SShape.\n"
"\n"
-" :arg iv: An SVertex object.\n"
-" :type iv: :class:`SVertex`");
+" :arg vertex: An SVertex object.\n"
+" :type vertex: :class:`SVertex`");
-static PyObject * SShape_add_vertex(BPy_SShape *self , PyObject *args)
+static PyObject * SShape_add_vertex(BPy_SShape *self , PyObject *args, PyObject *kwds)
{
+ static const char *kwlist[] = {"edge", NULL};
PyObject *py_sv = 0;
- if (!PyArg_ParseTuple(args, "O!", &SVertex_Type, &py_sv))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &SVertex_Type, &py_sv))
return NULL;
self->ss->AddNewVertex(((BPy_SVertex *)py_sv)->sv);
Py_RETURN_NONE;
@@ -154,8 +156,8 @@ static PyObject * SShape_compute_bbox(BPy_SShape *self)
// void SetMaterials (const vector< Material > &iMaterials)
static PyMethodDef BPy_SShape_methods[] = {
- {"add_edge", (PyCFunction)SShape_add_edge, METH_VARARGS, SShape_add_edge_doc},
- {"add_vertex", (PyCFunction)SShape_add_vertex, METH_VARARGS, SShape_add_vertex_doc},
+ {"add_edge", (PyCFunction)SShape_add_edge, METH_VARARGS | METH_KEYWORDS, SShape_add_edge_doc},
+ {"add_vertex", (PyCFunction)SShape_add_vertex, METH_VARARGS | METH_KEYWORDS, SShape_add_vertex_doc},
{"compute_bbox", (PyCFunction)SShape_compute_bbox, METH_NOARGS, SShape_compute_bbox_doc},
{NULL, NULL, 0, NULL}
};
diff --git a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp
index 811b21ea246..3a5abd21d07 100644
--- a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp
+++ b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp
@@ -156,172 +156,173 @@ static PyObject * StrokeAttribute_repr(BPy_StrokeAttribute* self)
}
PyDoc_STRVAR(StrokeAttribute_get_attribute_real_doc,
-".. method:: get_attribute_real(iName)\n"
+".. method:: get_attribute_real(name)\n"
"\n"
" Returns an attribute of float type.\n"
"\n"
-" :arg iName: The name of the attribute.\n"
-" :type iName: str\n"
+" :arg name: The name of the attribute.\n"
+" :type name: str\n"
" :return: The attribute value.\n"
" :rtype: float\n");
-static PyObject *StrokeAttribute_get_attribute_real(BPy_StrokeAttribute *self, PyObject *args)
+static PyObject *StrokeAttribute_get_attribute_real(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds)
{
+ static const char *kwlist[] = {"name", NULL};
char *attr;
- if(!(PyArg_ParseTuple(args, "s", &attr)))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr))
return NULL;
-
double a = self->sa->getAttributeReal(attr);
return PyFloat_FromDouble(a);
}
PyDoc_STRVAR(StrokeAttribute_get_attribute_vec2_doc,
-".. method:: get_attribute_vec2(iName)\n"
+".. method:: get_attribute_vec2(name)\n"
"\n"
" Returns an attribute of two-dimensional vector type.\n"
"\n"
-" :arg iName: The name of the attribute.\n"
-" :type iName: str\n"
+" :arg name: The name of the attribute.\n"
+" :type name: str\n"
" :return: The attribute value.\n"
" :rtype: :class:`mathutils.Vector`\n");
-static PyObject *StrokeAttribute_get_attribute_vec2(BPy_StrokeAttribute *self, PyObject *args)
+static PyObject *StrokeAttribute_get_attribute_vec2(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds)
{
+ static const char *kwlist[] = {"name", NULL};
char *attr;
- if(!(PyArg_ParseTuple(args, "s", &attr)))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr))
return NULL;
-
Vec2f a = self->sa->getAttributeVec2f(attr);
return Vector_from_Vec2f(a);
}
PyDoc_STRVAR(StrokeAttribute_get_attribute_vec3_doc,
-".. method:: get_attribute_vec3(iName)\n"
+".. method:: get_attribute_vec3(name)\n"
"\n"
" Returns an attribute of three-dimensional vector type.\n"
"\n"
-" :arg iName: The name of the attribute.\n"
-" :type iName: str\n"
+" :arg name: The name of the attribute.\n"
+" :type name: str\n"
" :return: The attribute value.\n"
" :rtype: :class:`mathutils.Vector`\n");
-static PyObject *StrokeAttribute_get_attribute_vec3(BPy_StrokeAttribute *self, PyObject *args)
+static PyObject *StrokeAttribute_get_attribute_vec3(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds)
{
+ static const char *kwlist[] = {"name", NULL};
char *attr;
- if(!(PyArg_ParseTuple(args, "s", &attr)))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr))
return NULL;
-
Vec3f a = self->sa->getAttributeVec3f(attr);
return Vector_from_Vec3f(a);
}
PyDoc_STRVAR(StrokeAttribute_has_attribute_real_doc,
-".. method:: has_attribute_real(iName)\n"
+".. method:: has_attribute_real(name)\n"
"\n"
-" Checks whether the attribute iName of float type is available.\n"
+" Checks whether the attribute name of float type is available.\n"
"\n"
-" :arg iName: The name of the attribute.\n"
-" :type iName: str\n"
+" :arg name: The name of the attribute.\n"
+" :type name: str\n"
" :return: True if the attribute is availbale.\n"
" :rtype: bool\n");
-static PyObject *StrokeAttribute_has_attribute_real(BPy_StrokeAttribute *self, PyObject *args)
+static PyObject *StrokeAttribute_has_attribute_real(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds)
{
+ static const char *kwlist[] = {"name", NULL};
char *attr;
- if(!(PyArg_ParseTuple(args, "s", &attr)))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr))
return NULL;
-
return PyBool_from_bool(self->sa->isAttributeAvailableReal(attr));
}
PyDoc_STRVAR(StrokeAttribute_has_attribute_vec2_doc,
-".. method:: has_attribute_vec2(iName)\n"
+".. method:: has_attribute_vec2(name)\n"
"\n"
-" Checks whether the attribute iName of two-dimensional vector type\n"
+" Checks whether the attribute name of two-dimensional vector type\n"
" is available.\n"
"\n"
-" :arg iName: The name of the attribute.\n"
-" :type iName: str\n"
+" :arg name: The name of the attribute.\n"
+" :type name: str\n"
" :return: True if the attribute is availbale.\n"
" :rtype: bool\n");
-static PyObject *StrokeAttribute_has_attribute_vec2(BPy_StrokeAttribute *self, PyObject *args)
+static PyObject *StrokeAttribute_has_attribute_vec2(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds)
{
+ static const char *kwlist[] = {"name", NULL};
char *attr;
- if(!(PyArg_ParseTuple(args, "s", &attr)))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr))
return NULL;
-
return PyBool_from_bool(self->sa->isAttributeAvailableVec2f(attr));
}
PyDoc_STRVAR(StrokeAttribute_has_attribute_vec3_doc,
-".. method:: has_attribute_vec3(iName)\n"
+".. method:: has_attribute_vec3(name)\n"
"\n"
-" Checks whether the attribute iName of three-dimensional vector\n"
+" Checks whether the attribute name of three-dimensional vector\n"
" type is available.\n"
"\n"
-" :arg iName: The name of the attribute.\n"
-" :type iName: str\n"
+" :arg name: The name of the attribute.\n"
+" :type name: str\n"
" :return: True if the attribute is availbale.\n"
" :rtype: bool\n");
-static PyObject *StrokeAttribute_has_attribute_vec3(BPy_StrokeAttribute *self, PyObject *args)
+static PyObject *StrokeAttribute_has_attribute_vec3(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds)
{
+ static const char *kwlist[] = {"name", NULL};
char *attr;
- if(!(PyArg_ParseTuple(args, "s", &attr)))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr))
return NULL;
-
return PyBool_from_bool(self->sa->isAttributeAvailableVec3f(attr));
}
PyDoc_STRVAR(StrokeAttribute_set_attribute_real_doc,
-".. method:: set_attribute_real(iName, att)\n"
+".. method:: set_attribute_real(name, value)\n"
"\n"
" Adds a user-defined attribute of float type. If there is no\n"
" attribute of the given name, it is added. Otherwise, the new value\n"
" replaces the old one.\n"
"\n"
-" :arg iName: The name of the attribute.\n"
-" :type iName: str\n"
-" :arg att: The attribute value.\n"
-" :type att: float\n");
+" :arg name: The name of the attribute.\n"
+" :type name: str\n"
+" :arg value: The attribute value.\n"
+" :type value: float\n");
-static PyObject * StrokeAttribute_set_attribute_real(BPy_StrokeAttribute *self, PyObject *args)
+static PyObject * StrokeAttribute_set_attribute_real(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds)
{
+ static const char *kwlist[] = {"name", "value", NULL};
char *s = 0;
double d = 0;
- if(!(PyArg_ParseTuple(args, "sd", &s, &d)))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "sd", (char **)kwlist, &s, &d))
return NULL;
-
self->sa->setAttributeReal(s, d);
Py_RETURN_NONE;
}
PyDoc_STRVAR(StrokeAttribute_set_attribute_vec2_doc,
-".. method:: set_attribute_vec2(iName, att)\n"
+".. method:: set_attribute_vec2(name, value)\n"
"\n"
" Adds a user-defined attribute of two-dimensional vector type. If\n"
" there is no attribute of the given name, it is added. Otherwise,\n"
" the new value replaces the old one.\n"
"\n"
-" :arg iName: The name of the attribute.\n"
-" :type iName: str\n"
-" :arg att: The attribute value.\n"
-" :type att: :class:`mathutils.Vector`, list or tuple of 2 real numbers\n");
+" :arg name: The name of the attribute.\n"
+" :type name: str\n"
+" :arg value: The attribute value.\n"
+" :type value: :class:`mathutils.Vector`, list or tuple of 2 real numbers\n");
-static PyObject * StrokeAttribute_set_attribute_vec2(BPy_StrokeAttribute *self, PyObject *args)
+static PyObject * StrokeAttribute_set_attribute_vec2(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds)
{
+ static const char *kwlist[] = {"name", "value", NULL};
char *s;
PyObject *obj = 0;
- if(!(PyArg_ParseTuple(args, "sO", &s, &obj)))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "sO", (char **)kwlist, &s, &obj))
return NULL;
Vec2f *v = Vec2f_ptr_from_PyObject(obj);
if (!v) {
@@ -330,28 +331,28 @@ static PyObject * StrokeAttribute_set_attribute_vec2(BPy_StrokeAttribute *self,
}
self->sa->setAttributeVec2f(s, *v);
delete v;
-
Py_RETURN_NONE;
}
PyDoc_STRVAR(StrokeAttribute_set_attribute_vec3_doc,
-".. method:: set_attribute_vec3(iName, att)\n"
+".. method:: set_attribute_vec3(name, value)\n"
"\n"
" Adds a user-defined attribute of three-dimensional vector type.\n"
" If there is no attribute of the given name, it is added.\n"
" Otherwise, the new value replaces the old one.\n"
"\n"
-" :arg iName: The name of the attribute.\n"
-" :type iName: str\n"
-" :arg att: The attribute value.\n"
-" :type att: :class:`mathutils.Vector`, list or tuple of 3 real numbers\n");
+" :arg name: The name of the attribute.\n"
+" :type name: str\n"
+" :arg value: The attribute value.\n"
+" :type value: :class:`mathutils.Vector`, list or tuple of 3 real numbers\n");
-static PyObject * StrokeAttribute_set_attribute_vec3(BPy_StrokeAttribute *self, PyObject *args)
+static PyObject * StrokeAttribute_set_attribute_vec3(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds)
{
+ static const char *kwlist[] = {"name", "value", NULL};
char *s;
PyObject *obj = 0;
- if(!(PyArg_ParseTuple(args, "sO", &s, &obj)))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "sO", (char **)kwlist, &s, &obj))
return NULL;
Vec3f *v = Vec3f_ptr_from_PyObject(obj);
if (!v) {
@@ -360,21 +361,19 @@ static PyObject * StrokeAttribute_set_attribute_vec3(BPy_StrokeAttribute *self,
}
self->sa->setAttributeVec3f(s, *v);
delete v;
-
Py_RETURN_NONE;
}
-/*----------------------StrokeAttribute instance definitions ----------------------------*/
static PyMethodDef BPy_StrokeAttribute_methods[] = {
- {"get_attribute_real", (PyCFunction) StrokeAttribute_get_attribute_real, METH_VARARGS, StrokeAttribute_get_attribute_real_doc},
- {"get_attribute_vec2", (PyCFunction) StrokeAttribute_get_attribute_vec2, METH_VARARGS, StrokeAttribute_get_attribute_vec2_doc},
- {"get_attribute_vec3", (PyCFunction) StrokeAttribute_get_attribute_vec3, METH_VARARGS, StrokeAttribute_get_attribute_vec3_doc},
- {"has_attribute_real", (PyCFunction) StrokeAttribute_has_attribute_real, METH_VARARGS, StrokeAttribute_has_attribute_real_doc},
- {"has_attribute_vec2", (PyCFunction) StrokeAttribute_has_attribute_vec2, METH_VARARGS, StrokeAttribute_has_attribute_vec2_doc},
- {"has_attribute_vec3", (PyCFunction) StrokeAttribute_has_attribute_vec3, METH_VARARGS, StrokeAttribute_has_attribute_vec3_doc},
- {"set_attribute_real", (PyCFunction) StrokeAttribute_set_attribute_real, METH_VARARGS, StrokeAttribute_set_attribute_real_doc},
- {"set_attribute_vec2", (PyCFunction) StrokeAttribute_set_attribute_vec2, METH_VARARGS, StrokeAttribute_set_attribute_vec2_doc},
- {"set_attribute_vec3", (PyCFunction) StrokeAttribute_set_attribute_vec3, METH_VARARGS, StrokeAttribute_set_attribute_vec3_doc},
+ {"get_attribute_real", (PyCFunction) StrokeAttribute_get_attribute_real, METH_VARARGS | METH_KEYWORDS, StrokeAttribute_get_attribute_real_doc},
+ {"get_attribute_vec2", (PyCFunction) StrokeAttribute_get_attribute_vec2, METH_VARARGS | METH_KEYWORDS, StrokeAttribute_get_attribute_vec2_doc},
+ {"get_attribute_vec3", (PyCFunction) StrokeAttribute_get_attribute_vec3, METH_VARARGS | METH_KEYWORDS, StrokeAttribute_get_attribute_vec3_doc},
+ {"has_attribute_real", (PyCFunction) StrokeAttribute_has_attribute_real, METH_VARARGS | METH_KEYWORDS, StrokeAttribute_has_attribute_real_doc},
+ {"has_attribute_vec2", (PyCFunction) StrokeAttribute_has_attribute_vec2, METH_VARARGS | METH_KEYWORDS, StrokeAttribute_has_attribute_vec2_doc},
+ {"has_attribute_vec3", (PyCFunction) StrokeAttribute_has_attribute_vec3, METH_VARARGS | METH_KEYWORDS, StrokeAttribute_has_attribute_vec3_doc},
+ {"set_attribute_real", (PyCFunction) StrokeAttribute_set_attribute_real, METH_VARARGS | METH_KEYWORDS, StrokeAttribute_set_attribute_real_doc},
+ {"set_attribute_vec2", (PyCFunction) StrokeAttribute_set_attribute_vec2, METH_VARARGS | METH_KEYWORDS, StrokeAttribute_set_attribute_vec2_doc},
+ {"set_attribute_vec3", (PyCFunction) StrokeAttribute_set_attribute_vec3, METH_VARARGS | METH_KEYWORDS, StrokeAttribute_set_attribute_vec3_doc},
{NULL, NULL, 0, NULL}
};
diff --git a/source/blender/freestyle/intern/python/BPy_ViewMap.cpp b/source/blender/freestyle/intern/python/BPy_ViewMap.cpp
index 2160a9d2e38..46aad0d788c 100644
--- a/source/blender/freestyle/intern/python/BPy_ViewMap.cpp
+++ b/source/blender/freestyle/intern/python/BPy_ViewMap.cpp
@@ -99,11 +99,12 @@ PyDoc_STRVAR(ViewMap_get_closest_viewedge_doc,
" :return: The ViewEdge nearest to the specified 2D point.\n"
" :rtype: :class:`ViewEdge`");
-static PyObject * ViewMap_get_closest_viewedge(BPy_ViewMap *self , PyObject *args)
+static PyObject * ViewMap_get_closest_viewedge(BPy_ViewMap *self , PyObject *args, PyObject *kwds)
{
+ static const char *kwlist[] = {"x", "y", NULL};
double x, y;
- if (!PyArg_ParseTuple(args, "dd", &x, &y))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "dd", (char **)kwlist, &x, &y))
return NULL;
ViewEdge *ve = const_cast<ViewEdge *>(self->vm->getClosestViewEdge(x,y));
if (ve)
@@ -123,11 +124,12 @@ PyDoc_STRVAR(ViewMap_get_closest_fedge_doc,
" :return: The FEdge nearest to the specified 2D point.\n"
" :rtype: :class:`FEdge`");
-static PyObject * ViewMap_get_closest_fedge(BPy_ViewMap *self , PyObject *args)
+static PyObject * ViewMap_get_closest_fedge(BPy_ViewMap *self , PyObject *args, PyObject *kwds)
{
+ static const char *kwlist[] = {"x", "y", NULL};
double x, y;
- if (!PyArg_ParseTuple(args, "dd", &x, &y))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "dd", (char **)kwlist, &x, &y))
return NULL;
FEdge *fe = const_cast<FEdge *>(self->vm->getClosestFEdge(x,y));
if (fe)
@@ -138,8 +140,8 @@ static PyObject * ViewMap_get_closest_fedge(BPy_ViewMap *self , PyObject *args)
// static ViewMap *getInstance ();
static PyMethodDef BPy_ViewMap_methods[] = {
- {"get_closest_viewedge", (PyCFunction)ViewMap_get_closest_viewedge, METH_VARARGS, ViewMap_get_closest_viewedge_doc},
- {"get_closest_fedge", (PyCFunction)ViewMap_get_closest_fedge, METH_VARARGS, ViewMap_get_closest_fedge_doc},
+ {"get_closest_viewedge", (PyCFunction)ViewMap_get_closest_viewedge, METH_VARARGS | METH_KEYWORDS, ViewMap_get_closest_viewedge_doc},
+ {"get_closest_fedge", (PyCFunction)ViewMap_get_closest_fedge, METH_VARARGS | METH_KEYWORDS, ViewMap_get_closest_fedge_doc},
{NULL, NULL, 0, NULL}
};
diff --git a/source/blender/freestyle/intern/python/BPy_ViewShape.cpp b/source/blender/freestyle/intern/python/BPy_ViewShape.cpp
index 72ebe43fab5..fdb2a695456 100644
--- a/source/blender/freestyle/intern/python/BPy_ViewShape.cpp
+++ b/source/blender/freestyle/intern/python/BPy_ViewShape.cpp
@@ -125,40 +125,42 @@ static void ViewShape_dealloc(BPy_ViewShape *self)
static PyObject * ViewShape_repr(BPy_ViewShape *self)
{
- return PyUnicode_FromFormat("ViewShape - address: %p", self->vs );
+ return PyUnicode_FromFormat("ViewShape - address: %p", self->vs);
}
PyDoc_STRVAR(ViewShape_add_edge_doc,
-".. method:: add_edge(iEdge)\n"
+".. method:: add_edge(edge)\n"
"\n"
" Adds a ViewEdge to the list of ViewEdge objects.\n"
"\n"
-" :arg iEdge: A ViewEdge object.\n"
-" :type iEdge: :class:`ViewEdge`\n");
+" :arg edge: A ViewEdge object.\n"
+" :type edge: :class:`ViewEdge`\n");
-static PyObject * ViewShape_add_edge(BPy_ViewShape *self , PyObject *args)
+static PyObject * ViewShape_add_edge(BPy_ViewShape *self, PyObject *args, PyObject *kwds)
{
+ static const char *kwlist[] = {"edge", NULL};
PyObject *py_ve = 0;
- if (!PyArg_ParseTuple(args, "O!", &ViewEdge_Type, &py_ve))
+ if (PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &ViewEdge_Type, &py_ve))
return NULL;
self->vs->AddEdge(((BPy_ViewEdge *)py_ve)->ve);
Py_RETURN_NONE;
}
PyDoc_STRVAR(ViewShape_add_vertex_doc,
-".. method:: add_vertex(iVertex)\n"
+".. method:: add_vertex(vertex)\n"
"\n"
" Adds a ViewVertex to the list of the ViewVertex objects.\n"
"\n"
-" :arg iVertex: A ViewVertex object.\n"
-" :type iVertex: :class:`ViewVertex`");
+" :arg vertex: A ViewVertex object.\n"
+" :type vertex: :class:`ViewVertex`");
-static PyObject * ViewShape_add_vertex(BPy_ViewShape *self , PyObject *args)
+static PyObject * ViewShape_add_vertex(BPy_ViewShape *self, PyObject *args, PyObject *kwds)
{
+ static const char *kwlist[] = {"vertex", NULL};
PyObject *py_vv = 0;
- if (!PyArg_ParseTuple(args, "O!", &ViewVertex_Type, &py_vv))
+ if (PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &ViewVertex_Type, &py_vv))
return NULL;
self->vs->AddVertex(((BPy_ViewVertex *)py_vv)->vv);
Py_RETURN_NONE;
@@ -167,8 +169,8 @@ static PyObject * ViewShape_add_vertex(BPy_ViewShape *self , PyObject *args)
// virtual ViewShape *duplicate()
static PyMethodDef BPy_ViewShape_methods[] = {
- {"add_edge", (PyCFunction)ViewShape_add_edge, METH_VARARGS, ViewShape_add_edge_doc},
- {"add_vertex", (PyCFunction)ViewShape_add_vertex, METH_VARARGS, ViewShape_add_vertex_doc},
+ {"add_edge", (PyCFunction)ViewShape_add_edge, METH_VARARGS | METH_KEYWORDS, ViewShape_add_edge_doc},
+ {"add_vertex", (PyCFunction)ViewShape_add_vertex, METH_VARARGS | METH_KEYWORDS, ViewShape_add_vertex_doc},
{NULL, NULL, 0, NULL}
};
diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp
index 6cc16494b87..072a602cf29 100644
--- a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp
+++ b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp
@@ -102,18 +102,20 @@ static int SVertex_init(BPy_SVertex *self, PyObject *args, PyObject *kwds)
}
PyDoc_STRVAR(SVertex_add_normal_doc,
-".. method:: add_normal(n)\n"
+".. method:: add_normal(normal)\n"
"\n"
" Adds a normal to the SVertex's set of normals. If the same normal\n"
" is already in the set, nothing changes.\n"
"\n"
-" :arg n: A three-dimensional vector.\n"
-" :type n: :class:`mathutils.Vector`, list or tuple of 3 real numbers");
+" :arg normal: A three-dimensional vector.\n"
+" :type normal: :class:`mathutils.Vector`, list or tuple of 3 real numbers");
-static PyObject *SVertex_add_normal( BPy_SVertex *self , PyObject *args) {
+static PyObject *SVertex_add_normal(BPy_SVertex *self , PyObject *args, PyObject *kwds)
+{
+ static const char *kwlist[] = {"normal", NULL};
PyObject *py_normal;
- if (!PyArg_ParseTuple(args, "O", &py_normal))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", (char **)kwlist, &py_normal))
return NULL;
Vec3r *n = Vec3r_ptr_from_PyObject(py_normal);
if (!n) {
@@ -127,29 +129,29 @@ static PyObject *SVertex_add_normal( BPy_SVertex *self , PyObject *args) {
}
PyDoc_STRVAR(SVertex_add_fedge_doc,
-".. method:: add_fedge(fe)\n"
+".. method:: add_fedge(fedge)\n"
"\n"
" Add an FEdge to the list of edges emanating from this SVertex.\n"
"\n"
-" :arg fe: An FEdge.\n"
-" :type fe: :class:`FEdge`");
+" :arg fedge: An FEdge.\n"
+" :type fedge: :class:`FEdge`");
-static PyObject *SVertex_add_fedge( BPy_SVertex *self , PyObject *args) {
+static PyObject *SVertex_add_fedge(BPy_SVertex *self , PyObject *args, PyObject *kwds)
+{
+ static const char *kwlist[] = {"fedge", NULL};
PyObject *py_fe;
- if (!PyArg_ParseTuple(args, "O!", &FEdge_Type, &py_fe))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &FEdge_Type, &py_fe))
return NULL;
-
self->sv->AddFEdge(((BPy_FEdge *)py_fe)->fe);
-
Py_RETURN_NONE;
}
// virtual bool operator== (const SVertex &brother)
static PyMethodDef BPy_SVertex_methods[] = {
- {"add_normal", (PyCFunction)SVertex_add_normal, METH_VARARGS, SVertex_add_normal_doc},
- {"add_fedge", (PyCFunction)SVertex_add_fedge, METH_VARARGS, SVertex_add_fedge_doc},
+ {"add_normal", (PyCFunction)SVertex_add_normal, METH_VARARGS | METH_KEYWORDS, SVertex_add_normal_doc},
+ {"add_fedge", (PyCFunction)SVertex_add_fedge, METH_VARARGS | METH_KEYWORDS, SVertex_add_fedge_doc},
{NULL, NULL, 0, NULL}
};
diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp
index 696ab102270..1e5f70144c1 100644
--- a/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp
+++ b/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp
@@ -76,8 +76,6 @@ PyDoc_STRVAR(ViewVertex_edges_begin_doc,
static PyObject * ViewVertex_edges_begin(BPy_ViewVertex *self)
{
- if (!self->vv)
- Py_RETURN_NONE;
ViewVertexInternal::orientedViewEdgeIterator ove_it(self->vv->edgesBegin());
return BPy_orientedViewEdgeIterator_from_orientedViewEdgeIterator(ove_it, 0);
}
@@ -94,8 +92,6 @@ PyDoc_STRVAR(ViewVertex_edges_end_doc,
static PyObject * ViewVertex_edges_end(BPy_ViewVertex *self)
{
#if 0
- if (!self->vv)
- Py_RETURN_NONE;
ViewVertexInternal::orientedViewEdgeIterator ove_it(self->vv->edgesEnd());
return BPy_orientedViewEdgeIterator_from_orientedViewEdgeIterator(ove_it, 1);
#else
@@ -105,23 +101,22 @@ static PyObject * ViewVertex_edges_end(BPy_ViewVertex *self)
}
PyDoc_STRVAR(ViewVertex_edges_iterator_doc,
-".. method:: edges_iterator(iEdge)\n"
+".. method:: edges_iterator(edge)\n"
"\n"
" Returns an orientedViewEdgeIterator pointing to the ViewEdge given\n"
" as argument.\n"
"\n"
-" :arg iEdge: A ViewEdge object.\n"
-" :type iEdge: :class:`ViewEdge`\n"
+" :arg edge: A ViewEdge object.\n"
+" :type edge: :class:`ViewEdge`\n"
" :return: An orientedViewEdgeIterator pointing to the given ViewEdge.\n"
" :rtype: :class:`orientedViewEdgeIterator`");
-static PyObject * ViewVertex_edges_iterator(BPy_ViewVertex *self, PyObject *args)
+static PyObject * ViewVertex_edges_iterator(BPy_ViewVertex *self, PyObject *args, PyObject *kwds)
{
+ static const char *kwlist[] = {"edge", NULL};
PyObject *py_ve;
- if (!self->vv)
- Py_RETURN_NONE;
- if (!PyArg_ParseTuple(args, "O!", &ViewEdge_Type, &py_ve))
+ if (PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &ViewEdge_Type, &py_ve))
return NULL;
ViewEdge *ve = ((BPy_ViewEdge *)py_ve)->ve;
ViewVertexInternal::orientedViewEdgeIterator ove_it(self->vv->edgesIterator(ve));
@@ -131,7 +126,7 @@ static PyObject * ViewVertex_edges_iterator(BPy_ViewVertex *self, PyObject *args
static PyMethodDef BPy_ViewVertex_methods[] = {
{"edges_begin", (PyCFunction)ViewVertex_edges_begin, METH_NOARGS, ViewVertex_edges_begin_doc},
{"edges_end", (PyCFunction)ViewVertex_edges_end, METH_NOARGS, ViewVertex_edges_end_doc},
- {"edges_iterator", (PyCFunction)ViewVertex_edges_iterator, METH_VARARGS, ViewVertex_edges_iterator_doc},
+ {"edges_iterator", (PyCFunction)ViewVertex_edges_iterator, METH_VARARGS | METH_KEYWORDS, ViewVertex_edges_iterator_doc},
{NULL, NULL, 0, NULL}
};
@@ -212,4 +207,3 @@ PyTypeObject ViewVertex_Type = {
#ifdef __cplusplus
}
#endif
-
diff --git a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp
index 7cf6e0571d5..e6285371c77 100644
--- a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp
+++ b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp
@@ -74,20 +74,21 @@ static int TVertex_init(BPy_TVertex *self, PyObject *args, PyObject *kwds)
}
PyDoc_STRVAR(TVertex_get_svertex_doc,
-".. method:: get_svertex(iFEdge)\n"
+".. method:: get_svertex(fedge)\n"
"\n"
" Returns the SVertex (among the 2) belonging to the given FEdge.\n"
"\n"
-" :arg iFEdge: An FEdge object.\n"
-" :type iFEdge: :class:`FEdge`\n"
+" :arg fedge: An FEdge object.\n"
+" :type fedge: :class:`FEdge`\n"
" :return: The SVertex belonging to the given FEdge.\n"
" :rtype: :class:`SVertex`");
-static PyObject * TVertex_get_svertex( BPy_TVertex *self, PyObject *args)
+static PyObject * TVertex_get_svertex( BPy_TVertex *self, PyObject *args, PyObject *kwds)
{
+ static const char *kwlist[] = {"fedge", NULL};
PyObject *py_fe;
- if (!PyArg_ParseTuple(args, "O!", &FEdge_Type, &py_fe))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &FEdge_Type, &py_fe))
return NULL;
SVertex *sv = self->tv->getSVertex(((BPy_FEdge *)py_fe)->fe);
if (sv)
@@ -96,22 +97,23 @@ static PyObject * TVertex_get_svertex( BPy_TVertex *self, PyObject *args)
}
PyDoc_STRVAR(TVertex_get_mate_doc,
-".. method:: get_mate(iEdgeA)\n"
+".. method:: get_mate(viewedge)\n"
"\n"
" Returns the mate edge of the ViewEdge given as argument. If the\n"
" ViewEdge is frontEdgeA, frontEdgeB is returned. If the ViewEdge is\n"
" frontEdgeB, frontEdgeA is returned. Same for back edges.\n"
"\n"
-" :arg iEdgeA: A ViewEdge object.\n"
-" :type iEdgeA: :class:`ViewEdge`\n"
+" :arg viewedge: A ViewEdge object.\n"
+" :type viewedge: :class:`ViewEdge`\n"
" :return: The mate edge of the given ViewEdge.\n"
" :rtype: :class:`ViewEdge`");
-static PyObject * TVertex_get_mate( BPy_TVertex *self, PyObject *args)
+static PyObject * TVertex_get_mate( BPy_TVertex *self, PyObject *args, PyObject *kwds)
{
+ static const char *kwlist[] = {"viewedge", NULL};
PyObject *py_ve;
- if (!PyArg_ParseTuple(args, "O!", &ViewEdge_Type, &py_ve))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &ViewEdge_Type, &py_ve))
return NULL;
ViewEdge *ve = self->tv->mate(((BPy_ViewEdge *)py_ve)->ve);
if (ve)
@@ -120,8 +122,8 @@ static PyObject * TVertex_get_mate( BPy_TVertex *self, PyObject *args)
}
static PyMethodDef BPy_TVertex_methods[] = {
- {"get_svertex", (PyCFunction)TVertex_get_svertex, METH_VARARGS, TVertex_get_svertex_doc},
- {"get_mate", (PyCFunction)TVertex_get_mate, METH_VARARGS, TVertex_get_mate_doc},
+ {"get_svertex", (PyCFunction)TVertex_get_svertex, METH_VARARGS | METH_KEYWORDS, TVertex_get_svertex_doc},
+ {"get_mate", (PyCFunction)TVertex_get_mate, METH_VARARGS | METH_KEYWORDS, TVertex_get_mate_doc},
{NULL, NULL, 0, NULL}
};
diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp
index 438c0eed65e..368b6f80de3 100644
--- a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp
+++ b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp
@@ -96,62 +96,66 @@ static int FrsCurve_init(BPy_FrsCurve *self, PyObject *args, PyObject *kwds)
}
PyDoc_STRVAR(FrsCurve_push_vertex_back_doc,
-".. method:: push_vertex_back(iVertex)\n"
+".. method:: push_vertex_back(vertex)\n"
"\n"
" Adds a single vertex at the end of the Curve.\n"
"\n"
-" :arg iVertex: A vertex object.\n"
-" :type iVertex: :class:`SVertex` or :class:`CurvePoint`");
+" :arg vertex: A vertex object.\n"
+" :type vertex: :class:`SVertex` or :class:`CurvePoint`");
-static PyObject * FrsCurve_push_vertex_back( BPy_FrsCurve *self, PyObject *args )
+static PyObject * FrsCurve_push_vertex_back(BPy_FrsCurve *self, PyObject *args, PyObject *kwds)
{
- PyObject *obj;
+ static const char *kwlist[] = {"vertex", NULL};
+ PyObject *obj = 0;
- if (!PyArg_ParseTuple(args, "O", &obj))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", (char **)kwlist, &obj))
return NULL;
if (BPy_CurvePoint_Check(obj)) {
self->c->push_vertex_back(((BPy_CurvePoint *)obj)->cp);
- } else if (BPy_SVertex_Check(obj)) {
+ }
+ else if (BPy_SVertex_Check(obj)) {
self->c->push_vertex_back(((BPy_SVertex *)obj)->sv);
- } else {
+ }
+ else {
PyErr_SetString(PyExc_TypeError, "invalid argument");
return NULL;
}
-
Py_RETURN_NONE;
}
PyDoc_STRVAR(FrsCurve_push_vertex_front_doc,
-".. method:: push_vertex_front(iVertex)\n"
+".. method:: push_vertex_front(vertex)\n"
"\n"
" Adds a single vertex at the front of the Curve.\n"
"\n"
-" :arg iVertex: A vertex object.\n"
-" :type iVertex: :class:`SVertex` or :class:`CurvePoint`");
+" :arg vertex: A vertex object.\n"
+" :type vertex: :class:`SVertex` or :class:`CurvePoint`");
-static PyObject * FrsCurve_push_vertex_front( BPy_FrsCurve *self, PyObject *args )
+static PyObject * FrsCurve_push_vertex_front(BPy_FrsCurve *self, PyObject *args, PyObject *kwds)
{
- PyObject *obj;
+ static const char *kwlist[] = {"vertex", NULL};
+ PyObject *obj = 0;
- if (!PyArg_ParseTuple(args, "O", &obj))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", (char **)kwlist, &obj))
return NULL;
if (BPy_CurvePoint_Check(obj)) {
self->c->push_vertex_front(((BPy_CurvePoint *)obj)->cp);
- } else if( BPy_SVertex_Check(obj)) {
+ }
+ else if (BPy_SVertex_Check(obj)) {
self->c->push_vertex_front(((BPy_SVertex *)obj)->sv);
- } else {
+ }
+ else {
PyErr_SetString(PyExc_TypeError, "invalid argument");
return NULL;
}
-
Py_RETURN_NONE;
}
static PyMethodDef BPy_FrsCurve_methods[] = {
- {"push_vertex_back", (PyCFunction)FrsCurve_push_vertex_back, METH_VARARGS, FrsCurve_push_vertex_back_doc},
- {"push_vertex_front", (PyCFunction)FrsCurve_push_vertex_front, METH_VARARGS, FrsCurve_push_vertex_front_doc},
+ {"push_vertex_back", (PyCFunction)FrsCurve_push_vertex_back, METH_VARARGS | METH_KEYWORDS, FrsCurve_push_vertex_back_doc},
+ {"push_vertex_front", (PyCFunction)FrsCurve_push_vertex_front, METH_VARARGS | METH_KEYWORDS, FrsCurve_push_vertex_front_doc},
{NULL, NULL, 0, NULL}
};
diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp
index fb57356775c..0cc12373eac 100644
--- a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp
+++ b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp
@@ -107,59 +107,66 @@ static PyObject *Stroke_sq_item(BPy_Stroke *self, int keynum)
}
PyDoc_STRVAR(Stroke_compute_sampling_doc,
-".. method:: compute_sampling(iNVertices)\n"
+".. method:: compute_sampling(n)\n"
"\n"
-" Compute the sampling needed to get iNVertices vertices. If the\n"
+" Compute the sampling needed to get N vertices. If the\n"
" specified number of vertices is less than the actual number of\n"
" vertices, the actual sampling value is returned. (To remove Vertices,\n"
" use the RemoveVertex() method of this class.)\n"
"\n"
-" :arg iNVertices: The number of stroke vertices we eventually want\n"
+" :arg n: The number of stroke vertices we eventually want\n"
" in our Stroke.\n"
-" :type iNVertices: int\n"
+" :type n: int\n"
" :return: The sampling that must be used in the Resample(float)\n"
" method.\n"
" :rtype: float");
-static PyObject * Stroke_compute_sampling(BPy_Stroke *self, PyObject *args)
+static PyObject * Stroke_compute_sampling(BPy_Stroke *self, PyObject *args, PyObject *kwds)
{
+ static const char *kwlist[] = {"n", NULL};
int i;
- if (!PyArg_ParseTuple(args, "i", &i))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "i", (char **)kwlist, &i))
return NULL;
return PyFloat_FromDouble(self->s->ComputeSampling(i));
}
PyDoc_STRVAR(Stroke_resample_doc,
-".. method:: resample(iNPoints)\n"
+".. method:: resample(n)\n"
"\n"
-" Resamples the stroke so that it eventually has iNPoints. That means\n"
-" it is going to add iNPoints-vertices_size, if vertices_size is the\n"
-" number of points we already have. If vertices_size >= iNPoints, no\n"
+" Resamples the stroke so that it eventually has N points. That means\n"
+" it is going to add N-vertices_size, where vertices_size is the\n"
+" number of points we already have. If vertices_size >= N, no\n"
" resampling is done.\n"
"\n"
-" :arg iNPoints: The number of vertices we eventually want in our stroke.\n"
-" :type iNPoints: int\n"
+" :arg n: The number of vertices we eventually want in our stroke.\n"
+" :type n: int\n"
"\n"
-".. method:: resample(iSampling)\n"
+".. method:: resample(sampling)\n"
"\n"
" Resamples the stroke with a given sampling. If the sampling is\n"
" smaller than the actual sampling value, no resampling is done.\n"
"\n"
-" :arg iSampling: The new sampling value.\n"
-" :type iSampling: float");
+" :arg sampling: The new sampling value.\n"
+" :type sampling: float");
-static PyObject * Stroke_resample(BPy_Stroke *self, PyObject *args)
+static PyObject * Stroke_resample(BPy_Stroke *self, PyObject *args, PyObject *kwds)
{
- PyObject *obj;
+ static const char *kwlist_1[] = {"n", NULL};
+ static const char *kwlist_2[] = {"sampling", NULL};
+ int i;
+ float f;
- if (!PyArg_ParseTuple(args, "O", &obj))
- return NULL;
- if (PyLong_Check(obj)) {
- self->s->Resample((int)PyLong_AsLong(obj));
- } else if (PyFloat_Check(obj)) {
- self->s->Resample((float)PyFloat_AsDouble(obj));
- } else {
+ if (PyArg_ParseTupleAndKeywords(args, kwds, "i", (char **)kwlist_1, &i))
+ {
+ self->s->Resample(i);
+ }
+ else if (PyErr_Clear(),
+ PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist_2, &f))
+ {
+ self->s->Resample(f);
+ }
+ else {
PyErr_SetString(PyExc_TypeError, "invalid argument");
return NULL;
}
@@ -167,23 +174,28 @@ static PyObject * Stroke_resample(BPy_Stroke *self, PyObject *args)
}
PyDoc_STRVAR(Stroke_insert_vertex_doc,
-".. method:: insert_vertex(iVertex, next)\n"
+".. method:: insert_vertex(vertex, next)\n"
"\n"
-" Inserts the stroke vertex iVertex in the stroke before next. The\n"
-" length, curvilinear abscissa are updated consequently.\n"
+" Inserts the StrokeVertex given as argument into the Stroke before the\n"
+" point specified by next. The length and curvilinear abscissa are\n"
+" updated consequently.\n"
"\n"
-" :arg iVertex: The StrokeVertex to insert in the Stroke.\n"
-" :type iVertex: :class:`StrokeVertex`\n"
+" :arg vertex: The StrokeVertex to insert in the Stroke.\n"
+" :type vertex: :class:`StrokeVertex`\n"
" :arg next: A StrokeVertexIterator pointing to the StrokeVertex\n"
-" before which iVertex must be inserted.\n"
+" before which vertex must be inserted.\n"
" :type next: :class:`StrokeVertexIterator`");
-static PyObject * Stroke_insert_vertex(BPy_Stroke *self, PyObject *args)
+static PyObject * Stroke_insert_vertex(BPy_Stroke *self, PyObject *args, PyObject *kwds)
{
+ static const char *kwlist[] = {"vertex", "next", NULL};
PyObject *py_sv = 0, *py_sv_it = 0;
- if (!PyArg_ParseTuple(args, "O!O!", &StrokeVertex_Type, &py_sv, &StrokeVertexIterator_Type, &py_sv_it))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!O!", (char **)kwlist,
+ &StrokeVertex_Type, &py_sv, &StrokeVertexIterator_Type, &py_sv_it))
+ {
return NULL;
+ }
StrokeVertex *sv = ((BPy_StrokeVertex *)py_sv)->sv;
StrokeInternal::StrokeVertexIterator sv_it(*(((BPy_StrokeVertexIterator *)py_sv_it)->sv_it));
self->s->InsertVertex(sv, sv_it);
@@ -191,19 +203,20 @@ static PyObject * Stroke_insert_vertex(BPy_Stroke *self, PyObject *args)
}
PyDoc_STRVAR(Stroke_remove_vertex_doc,
-".. method:: remove_vertex(iVertex)\n"
+".. method:: remove_vertex(vertex)\n"
"\n"
-" Removes the stroke vertex iVertex from the stroke. The length and\n"
-" curvilinear abscissa are updated consequently.\n"
+" Removes the StrokeVertex given as argument from the Stroke. The length\n"
+" and curvilinear abscissa are updated consequently.\n"
"\n"
-" :arg iVertex: \n"
-" :type iVertex: :class:`StrokeVertex`");
+" :arg vertex: the StrokeVertex to remove from the Stroke.\n"
+" :type vertex: :class:`StrokeVertex`");
-static PyObject * Stroke_remove_vertex( BPy_Stroke *self, PyObject *args )
+static PyObject * Stroke_remove_vertex( BPy_Stroke *self, PyObject *args, PyObject *kwds)
{
- PyObject *py_sv;
+ static const char *kwlist[] = {"vertex", NULL};
+ PyObject *py_sv = 0;
- if (!PyArg_ParseTuple(args, "O!", &StrokeVertex_Type, &py_sv))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &StrokeVertex_Type, &py_sv))
return NULL;
if (((BPy_StrokeVertex *)py_sv)->sv) {
self->s->RemoveVertex(((BPy_StrokeVertex *)py_sv)->sv);
@@ -238,11 +251,12 @@ PyDoc_STRVAR(Stroke_stroke_vertices_begin_doc,
" :return: A StrokeVertexIterator pointing on the first StrokeVertex.\n"
" :rtype: :class:`StrokeVertexIterator`");
-static PyObject * Stroke_stroke_vertices_begin( BPy_Stroke *self , PyObject *args)
+static PyObject * Stroke_stroke_vertices_begin( BPy_Stroke *self , PyObject *args, PyObject *kwds)
{
- float f = 0;
+ static const char *kwlist[] = {"t", NULL};
+ float f = 0.0f;
- if (!PyArg_ParseTuple(args, "|f", &f))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "|f", (char **)kwlist, &f))
return NULL;
StrokeInternal::StrokeVertexIterator sv_it(self->s->strokeVerticesBegin(f));
return BPy_StrokeVertexIterator_from_StrokeVertexIterator(sv_it, 0);
@@ -277,12 +291,12 @@ static PyObject * Stroke_stroke_vertices_size(BPy_Stroke *self)
}
static PyMethodDef BPy_Stroke_methods[] = {
- {"compute_sampling", (PyCFunction)Stroke_compute_sampling, METH_VARARGS, Stroke_compute_sampling_doc},
- {"resample", (PyCFunction)Stroke_resample, METH_VARARGS, Stroke_resample_doc},
- {"remove_vertex", (PyCFunction)Stroke_remove_vertex, METH_VARARGS, Stroke_remove_vertex_doc},
- {"insert_vertex", (PyCFunction)Stroke_insert_vertex, METH_VARARGS, Stroke_insert_vertex_doc},
+ {"compute_sampling", (PyCFunction)Stroke_compute_sampling, METH_VARARGS | METH_KEYWORDS, Stroke_compute_sampling_doc},
+ {"resample", (PyCFunction)Stroke_resample, METH_VARARGS | METH_KEYWORDS, Stroke_resample_doc},
+ {"remove_vertex", (PyCFunction)Stroke_remove_vertex, METH_VARARGS | METH_KEYWORDS, Stroke_remove_vertex_doc},
+ {"insert_vertex", (PyCFunction)Stroke_insert_vertex, METH_VARARGS | METH_KEYWORDS, Stroke_insert_vertex_doc},
{"update_length", (PyCFunction)Stroke_update_length, METH_NOARGS, Stroke_update_length_doc},
- {"stroke_vertices_begin", (PyCFunction)Stroke_stroke_vertices_begin, METH_VARARGS, Stroke_stroke_vertices_begin_doc},
+ {"stroke_vertices_begin", (PyCFunction)Stroke_stroke_vertices_begin, METH_VARARGS | METH_KEYWORDS, Stroke_stroke_vertices_begin_doc},
{"stroke_vertices_end", (PyCFunction)Stroke_stroke_vertices_end, METH_NOARGS, Stroke_stroke_vertices_end_doc},
{"stroke_vertices_size", (PyCFunction)Stroke_stroke_vertices_size, METH_NOARGS, Stroke_stroke_vertices_size_doc},
{NULL, NULL, 0, NULL}
diff --git a/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp b/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp
index ced48f0d9ab..64e65417579 100644
--- a/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp
+++ b/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp
@@ -52,7 +52,7 @@ PyDoc_STRVAR(Chain_doc,
"\n"
".. method:: __init__()\n"
"\n"
-" Defult constructor.\n"
+" Default constructor.\n"
"\n"
".. method:: __init__(brother)\n"
"\n"
@@ -96,56 +96,62 @@ static int Chain_init(BPy_Chain *self, PyObject *args, PyObject *kwds)
}
PyDoc_STRVAR(Chain_push_viewedge_back_doc,
-".. method:: push_viewedge_back(iViewEdge, orientation)\n"
+".. method:: push_viewedge_back(viewedge, orientation)\n"
"\n"
" Adds a ViewEdge at the end of the Chain.\n"
"\n"
-" :arg iViewEdge: The ViewEdge that must be added.\n"
-" :type iViewEdge: :class:`ViewEdge`\n"
+" :arg viewedge: The ViewEdge that must be added.\n"
+" :type viewedge: :class:`ViewEdge`\n"
" :arg orientation: The orientation with which the ViewEdge must be\n"
" processed.\n"
" :type orientation: bool");
-static PyObject * Chain_push_viewedge_back( BPy_Chain *self, PyObject *args ) {
+static PyObject * Chain_push_viewedge_back(BPy_Chain *self, PyObject *args, PyObject *kwds)
+{
+ static const char *kwlist[] = {"viewedge", "orientation", NULL};
PyObject *obj1 = 0, *obj2 = 0;
- if(!( PyArg_ParseTuple(args, "O!O", &ViewEdge_Type, &obj1, &obj2) ))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!O!", (char **)kwlist,
+ &ViewEdge_Type, &obj1, &PyBool_Type, &obj2))
+ {
return NULL;
-
- ViewEdge *ve = ((BPy_ViewEdge *) obj1)->ve;
- bool orientation = bool_from_PyBool( obj2 );
- self->c->push_viewedge_back( ve, orientation);
-
+ }
+ ViewEdge *ve = ((BPy_ViewEdge *)obj1)->ve;
+ bool orientation = bool_from_PyBool(obj2);
+ self->c->push_viewedge_back(ve, orientation);
Py_RETURN_NONE;
}
PyDoc_STRVAR(Chain_push_viewedge_front_doc,
-".. method:: push_viewedge_front(iViewEdge, orientation)\n"
+".. method:: push_viewedge_front(viewedge, orientation)\n"
"\n"
" Adds a ViewEdge at the beginning of the Chain.\n"
"\n"
-" :arg iViewEdge: The ViewEdge that must be added.\n"
-" :type iViewEdge: :class:`ViewEdge`\n"
+" :arg viewedge: The ViewEdge that must be added.\n"
+" :type viewedge: :class:`ViewEdge`\n"
" :arg orientation: The orientation with which the ViewEdge must be\n"
" processed.\n"
" :type orientation: bool");
-static PyObject * Chain_push_viewedge_front( BPy_Chain *self, PyObject *args ) {
+static PyObject * Chain_push_viewedge_front(BPy_Chain *self, PyObject *args, PyObject *kwds)
+{
+ static const char *kwlist[] = {"viewedge", "orientation", NULL};
PyObject *obj1 = 0, *obj2 = 0;
- if(!( PyArg_ParseTuple(args, "O!O", &ViewEdge_Type, &obj1, &obj2) ))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!O!", (char **)kwlist,
+ &ViewEdge_Type, &obj1, &PyBool_Type, &obj2))
+ {
return NULL;
-
- ViewEdge *ve = ((BPy_ViewEdge *) obj1)->ve;
- bool orientation = bool_from_PyBool( obj2 );
+ }
+ ViewEdge *ve = ((BPy_ViewEdge *)obj1)->ve;
+ bool orientation = bool_from_PyBool(obj2);
self->c->push_viewedge_front(ve, orientation);
-
Py_RETURN_NONE;
}
static PyMethodDef BPy_Chain_methods[] = {
- {"push_viewedge_back", (PyCFunction)Chain_push_viewedge_back, METH_VARARGS, Chain_push_viewedge_back_doc},
- {"push_viewedge_front", (PyCFunction)Chain_push_viewedge_front, METH_VARARGS, Chain_push_viewedge_front_doc},
+ {"push_viewedge_back", (PyCFunction)Chain_push_viewedge_back, METH_VARARGS | METH_KEYWORDS, Chain_push_viewedge_back_doc},
+ {"push_viewedge_front", (PyCFunction)Chain_push_viewedge_front, METH_VARARGS | METH_KEYWORDS, Chain_push_viewedge_front_doc},
{NULL, NULL, 0, NULL}
};
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp
index af648a66bb7..701f6871cc1 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp
@@ -134,7 +134,6 @@ static PyObject *ChainingIterator_init(BPy_ChainingIterator *self)
return NULL;
}
self->c_it->init();
-
Py_RETURN_NONE;
}
@@ -152,27 +151,25 @@ PyDoc_STRVAR(ChainingIterator_traverse_doc,
" :return: Returns the next ViewEdge to follow, or None if chaining ends.\n"
" :rtype: :class:`ViewEdge` or None");
-static PyObject *ChainingIterator_traverse(BPy_ChainingIterator *self, PyObject *args)
+static PyObject *ChainingIterator_traverse(BPy_ChainingIterator *self, PyObject *args, PyObject *kwds)
{
+ static const char *kwlist[] = {"it", NULL};
PyObject *py_a_it;
- if(!(PyArg_ParseTuple(args, "O!", &AdjacencyIterator_Type, &py_a_it)))
- return NULL;
-
if (typeid(*(self->c_it)) == typeid(ChainingIterator)) {
PyErr_SetString(PyExc_TypeError, "traverse() method not properly overridden");
return NULL;
}
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &AdjacencyIterator_Type, &py_a_it))
+ return NULL;
if (((BPy_AdjacencyIterator *)py_a_it)->a_it)
self->c_it->traverse(*(((BPy_AdjacencyIterator *)py_a_it)->a_it));
-
Py_RETURN_NONE;
}
-
static PyMethodDef BPy_ChainingIterator_methods[] = {
{"init", (PyCFunction) ChainingIterator_init, METH_NOARGS, ChainingIterator_init_doc},
- {"traverse", (PyCFunction) ChainingIterator_traverse, METH_VARARGS, ChainingIterator_traverse_doc},
+ {"traverse", (PyCFunction) ChainingIterator_traverse, METH_VARARGS | METH_KEYWORDS, ChainingIterator_traverse_doc},
{NULL, NULL, 0, NULL}
};