diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-02-24 06:39:38 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-02-24 06:39:38 +0400 |
commit | 3df023ae82eef0ea105dc61c9730af87b59a07d1 (patch) | |
tree | 2d2a4e753c1129fc91f360f0457d30859cd38737 /release/scripts | |
parent | d38a335d47f1632000db5172877499ff0184d114 (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.
Diffstat (limited to 'release/scripts')
43 files changed, 79 insertions, 76 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), |