From 54e90167704072f0105eb279e7431caa6c4d8e20 Mon Sep 17 00:00:00 2001 From: Tamito Kajiyama Date: Sun, 24 Nov 2013 22:18:38 +0000 Subject: [PATCH] Updated Freestyle API modules according to the new hierarchical package structure. Additional bug fixes were also done along with the code updates: * Fix for the use of old Interface1D.pointsBegin() and .pointsEnd() method names in the definition of pyDensityAnisotropyF1D and pyViewMapGradientNormF1D. * Fix for wrong data types (int instead of bool) for: - pyChainSilhouetteGenericIterator constructor and its .orientation property in modules/freestyle/chainingiterators.py. - SpatialNoiseShader constructor in styles/external_contour_sketchy.py. - ChainSilhouetteIterator constructor in styles/multiple_parameterization.py. --- .../modules/freestyle/chainingiterators.py | 59 +++++++------ .../freestyle/modules/freestyle/functions.py | 6 +- .../freestyle/modules/freestyle/predicates.py | 17 +++- .../freestyle/modules/freestyle/shaders.py | 22 ++++- .../freestyle/modules/parameter_editor.py | 88 ++++++++++++++----- .../freestyle/styles/anisotropic_diffusion.py | 22 ++++- .../styles/apriori_and_causal_density.py | 19 +++- .../freestyle/styles/apriori_density.py | 18 +++- .../freestyle/styles/backbone_stretcher.py | 15 +++- .../freestyle/styles/blueprint_circles.py | 23 +++-- .../freestyle/styles/blueprint_ellipses.py | 23 +++-- .../freestyle/styles/blueprint_squares.py | 23 +++-- release/scripts/freestyle/styles/cartoon.py | 16 +++- release/scripts/freestyle/styles/contour.py | 17 +++- .../scripts/freestyle/styles/curvature2d.py | 17 +++- .../freestyle/styles/external_contour.py | 17 +++- .../styles/external_contour_sketchy.py | 24 +++-- .../styles/external_contour_smooth.py | 20 ++++- release/scripts/freestyle/styles/haloing.py | 22 +++-- .../styles/ignore_small_occlusions.py | 14 ++- .../freestyle/styles/invisible_lines.py | 15 +++- .../freestyle/styles/japanese_bigbrush.py | 32 +++++-- .../styles/long_anisotropically_dense.py | 22 +++-- .../styles/multiple_parameterization.py | 22 +++-- release/scripts/freestyle/styles/nature.py | 16 +++- .../scripts/freestyle/styles/near_lines.py | 19 +++- .../styles/occluded_by_specific_object.py | 19 +++- .../scripts/freestyle/styles/polygonalize.py | 16 +++- release/scripts/freestyle/styles/qi0.py | 15 +++- .../styles/qi0_not_external_contour.py | 21 ++++- release/scripts/freestyle/styles/qi1.py | 15 +++- release/scripts/freestyle/styles/qi2.py | 15 +++- .../styles/sequentialsplit_sketchy.py | 20 ++++- .../sketchy_multiple_parameterization.py | 20 +++-- .../styles/sketchy_topology_broken.py | 20 +++-- .../styles/sketchy_topology_preserved.py | 18 +++- .../styles/split_at_highest_2d_curvatures.py | 21 +++-- .../freestyle/styles/split_at_tvertices.py | 18 +++- .../freestyle/styles/stroke_texture.py | 19 +++- .../scripts/freestyle/styles/suggestive.py | 18 +++- .../thickness_fof_depth_discontinuity.py | 17 +++- .../scripts/freestyle/styles/tipremover.py | 16 +++- .../freestyle/styles/tvertex_remover.py | 17 +++- .../freestyle/styles/uniformpruning_zsort.py | 18 +++- 44 files changed, 714 insertions(+), 217 deletions(-) diff --git a/release/scripts/freestyle/modules/freestyle/chainingiterators.py b/release/scripts/freestyle/modules/freestyle/chainingiterators.py index 1e8c1927432..07ce14495cc 100644 --- a/release/scripts/freestyle/modules/freestyle/chainingiterators.py +++ b/release/scripts/freestyle/modules/freestyle/chainingiterators.py @@ -26,6 +26,11 @@ from _freestyle import ( from freestyle.types import ( AdjacencyIterator, ChainingIterator, + Nature, + TVertex, + ) +from freestyle.predicates import ( + ExternalContourUP1D, ) from freestyle.utils import ContextFunctions as CF import bpy @@ -283,7 +288,7 @@ class pyFillOcclusionsRelativeChainingIterator(ChainingIterator): self._length = 0 def traverse(self, iter): winner = None - winnerOrientation = 0 + winnerOrientation = False #print(self.current_edge.id.first, self.current_edge.id.second) it = AdjacencyIterator(iter) tvertex = self.next_vertex @@ -294,9 +299,9 @@ class pyFillOcclusionsRelativeChainingIterator(ChainingIterator): if ve.id == mateVE.id: winner = ve if not it.is_incoming: - winnerOrientation = 1 + winnerOrientation = True else: - winnerOrientation = 0 + winnerOrientation = False break it.increment() else: @@ -311,9 +316,9 @@ class pyFillOcclusionsRelativeChainingIterator(ChainingIterator): count = count+1 winner = ve if not it.is_incoming: - winnerOrientation = 1 + winnerOrientation = True else: - winnerOrientation = 0 + winnerOrientation = False it.increment() if count != 1: winner = None @@ -328,7 +333,7 @@ class pyFillOcclusionsRelativeChainingIterator(ChainingIterator): # Did we compute the prospective chain length already ? if self._length == 0: #if not, let's do it - _it = pyChainSilhouetteGenericIterator(0,0) + _it = pyChainSilhouetteGenericIterator(False, False) _it.begin = winner _it.current_edge = winner _it.orientation = winnerOrientation @@ -354,7 +359,7 @@ class pyFillOcclusionsRelativeChainingIterator(ChainingIterator): # let's do the comparison: # nw let's compute the length of this connex non selected part: connexl = 0 - _cit = pyChainSilhouetteGenericIterator(0,0) + _cit = pyChainSilhouetteGenericIterator(False, False) _cit.begin = winner _cit.current_edge = winner _cit.orientation = winnerOrientation @@ -380,7 +385,7 @@ class pyFillOcclusionsAbsoluteChainingIterator(ChainingIterator): pass def traverse(self, iter): winner = None - winnerOrientation = 0 + winnerOrientation = False #print(self.current_edge.id.first, self.current_edge.id.second) it = AdjacencyIterator(iter) tvertex = self.next_vertex @@ -391,9 +396,9 @@ class pyFillOcclusionsAbsoluteChainingIterator(ChainingIterator): if ve.id == mateVE.id: winner = ve if not it.is_incoming: - winnerOrientation = 1 + winnerOrientation = True else: - winnerOrientation = 0 + winnerOrientation = False break it.increment() else: @@ -408,9 +413,9 @@ class pyFillOcclusionsAbsoluteChainingIterator(ChainingIterator): count = count+1 winner = ve if not it.is_incoming: - winnerOrientation = 1 + winnerOrientation = True else: - winnerOrientation = 0 + winnerOrientation = False it.increment() if count != 1: winner = None @@ -421,7 +426,7 @@ class pyFillOcclusionsAbsoluteChainingIterator(ChainingIterator): #print("---", winner.id.first, winner.id.second) # nw let's compute the length of this connex non selected part: connexl = 0 - _cit = pyChainSilhouetteGenericIterator(0,0) + _cit = pyChainSilhouetteGenericIterator(False, False) _cit.begin = winner _cit.current_edge = winner _cit.orientation = winnerOrientation @@ -453,7 +458,7 @@ class pyFillOcclusionsAbsoluteAndRelativeChainingIterator(ChainingIterator): self._length = 0 def traverse(self, iter): winner = None - winnerOrientation = 0 + winnerOrientation = False #print(self.current_edge.id.first, self.current_edge.id.second) it = AdjacencyIterator(iter) tvertex = self.next_vertex @@ -464,9 +469,9 @@ class pyFillOcclusionsAbsoluteAndRelativeChainingIterator(ChainingIterator): if ve.id == mateVE.id: winner = ve if not it.is_incoming: - winnerOrientation = 1 + winnerOrientation = True else: - winnerOrientation = 0 + winnerOrientation = False break it.increment() else: @@ -481,9 +486,9 @@ class pyFillOcclusionsAbsoluteAndRelativeChainingIterator(ChainingIterator): count = count+1 winner = ve if not it.is_incoming: - winnerOrientation = 1 + winnerOrientation = True else: - winnerOrientation = 0 + winnerOrientation = False it.increment() if count != 1: winner = None @@ -498,7 +503,7 @@ class pyFillOcclusionsAbsoluteAndRelativeChainingIterator(ChainingIterator): # Did we compute the prospective chain length already ? if self._length == 0: #if not, let's do it - _it = pyChainSilhouetteGenericIterator(0,0) + _it = pyChainSilhouetteGenericIterator(False, False) _it.begin = winner _it.current_edge = winner _it.orientation = winnerOrientation @@ -524,7 +529,7 @@ class pyFillOcclusionsAbsoluteAndRelativeChainingIterator(ChainingIterator): # let's do the comparison: # nw let's compute the length of this connex non selected part: connexl = 0 - _cit = pyChainSilhouetteGenericIterator(0,0) + _cit = pyChainSilhouetteGenericIterator(False, False) _cit.begin = winner _cit.current_edge = winner _cit.orientation = winnerOrientation @@ -556,7 +561,7 @@ class pyFillQi0AbsoluteAndRelativeChainingIterator(ChainingIterator): self._length = 0 def traverse(self, iter): winner = None - winnerOrientation = 0 + winnerOrientation = False #print(self.current_edge.id.first, self.current_edge.id.second) it = AdjacencyIterator(iter) tvertex = self.next_vertex @@ -567,9 +572,9 @@ class pyFillQi0AbsoluteAndRelativeChainingIterator(ChainingIterator): if ve.id == mateVE.id: winner = ve if not it.is_incoming: - winnerOrientation = 1 + winnerOrientation = True else: - winnerOrientation = 0 + winnerOrientation = False break it.increment() else: @@ -584,9 +589,9 @@ class pyFillQi0AbsoluteAndRelativeChainingIterator(ChainingIterator): count = count+1 winner = ve if not it.is_incoming: - winnerOrientation = 1 + winnerOrientation = True else: - winnerOrientation = 0 + winnerOrientation = False it.increment() if count != 1: winner = None @@ -601,7 +606,7 @@ class pyFillQi0AbsoluteAndRelativeChainingIterator(ChainingIterator): # Did we compute the prospective chain length already ? if self._length == 0: #if not, let's do it - _it = pyChainSilhouetteGenericIterator(0,0) + _it = pyChainSilhouetteGenericIterator(False, False) _it.begin = winner _it.current_edge = winner _it.orientation = winnerOrientation @@ -627,7 +632,7 @@ class pyFillQi0AbsoluteAndRelativeChainingIterator(ChainingIterator): # let's do the comparison: # nw let's compute the length of this connex non selected part: connexl = 0 - _cit = pyChainSilhouetteGenericIterator(0,0) + _cit = pyChainSilhouetteGenericIterator(False, False) _cit.begin = winner _cit.current_edge = winner _cit.orientation = winnerOrientation diff --git a/release/scripts/freestyle/modules/freestyle/functions.py b/release/scripts/freestyle/modules/freestyle/functions.py index 911030c3094..3c67c843a77 100644 --- a/release/scripts/freestyle/modules/freestyle/functions.py +++ b/release/scripts/freestyle/modules/freestyle/functions.py @@ -73,6 +73,7 @@ from _freestyle import ( # modules for implementing functions from freestyle.types import ( + CurvePoint, IntegrationType, UnaryFunction0DDouble, UnaryFunction0DMaterial, @@ -80,6 +81,7 @@ from freestyle.types import ( UnaryFunction1DDouble, ) from freestyle.utils import ContextFunctions as CF +from freestyle.utils import integrate import math import mathutils @@ -183,7 +185,7 @@ class pyDensityAnisotropyF1D(UnaryFunction1DDouble): self._integration = integrationType self._sampling = sampling def __call__(self, inter): - v = integrate(self._func, inter.pointsBegin(self._sampling), inter.pointsEnd(self._sampling), self._integration) + v = integrate(self._func, inter.points_begin(self._sampling), inter.points_end(self._sampling), self._integration) return v class pyViewMapGradientNormF1D(UnaryFunction1DDouble): @@ -193,5 +195,5 @@ class pyViewMapGradientNormF1D(UnaryFunction1DDouble): self._integration = integrationType self._sampling = sampling def __call__(self, inter): - v = integrate(self._func, inter.pointsBegin(self._sampling), inter.pointsEnd(self._sampling), self._integration) + v = integrate(self._func, inter.points_begin(self._sampling), inter.points_end(self._sampling), self._integration) return v diff --git a/release/scripts/freestyle/modules/freestyle/predicates.py b/release/scripts/freestyle/modules/freestyle/predicates.py index ee6006c0ed4..236ff6c46b9 100644 --- a/release/scripts/freestyle/modules/freestyle/predicates.py +++ b/release/scripts/freestyle/modules/freestyle/predicates.py @@ -39,12 +39,27 @@ from _freestyle import ( # modules for implementing predicates from freestyle.types import ( - IntegrationType, BinaryPredicate1D, + IntegrationType, + Nature, + TVertex, UnaryPredicate0D, UnaryPredicate1D, ) from freestyle.functions import ( + Curvature2DAngleF0D, + CurveNatureF1D, + DensityF1D, + GetCompleteViewMapDensityF1D, + GetCurvilinearAbscissaF0D, + GetDirectionalViewMapDensityF1D, + GetOccludersF1D, + GetProjectedZF1D, + GetShapeF1D, + GetSteerableViewMapDensityF1D, + GetZF1D, + QuantitativeInvisibilityF0D, + ZDiscontinuityF1D, pyCurvilinearLengthF0D, pyDensityAnisotropyF1D, pyViewMapGradientNormF1D, diff --git a/release/scripts/freestyle/modules/freestyle/shaders.py b/release/scripts/freestyle/modules/freestyle/shaders.py index 6b1609be709..edac96278a9 100644 --- a/release/scripts/freestyle/modules/freestyle/shaders.py +++ b/release/scripts/freestyle/modules/freestyle/shaders.py @@ -48,8 +48,26 @@ from _freestyle import ( ) # modules for implementing shaders -from freestyle.types import StrokeShader -from freestyle.predicates import pyVertexNatureUP0D +from freestyle.types import ( + Interface0DIterator, + Nature, + Noise, + StrokeAttribute, + StrokeShader, + StrokeVertexIterator, + ) +from freestyle.functions import ( + Curvature2DAngleF0D, + DensityF0D, + GetProjectedZF0D, + MaterialF0D, + Normal2DF0D, + Orientation2DF1D, + ZDiscontinuityF0D, + ) +from freestyle.predicates import ( + pyVertexNatureUP0D, + ) from freestyle.utils import ContextFunctions as CF import math import mathutils diff --git a/release/scripts/freestyle/modules/parameter_editor.py b/release/scripts/freestyle/modules/parameter_editor.py index dd8a6aa63ee..8065cfe5c12 100644 --- a/release/scripts/freestyle/modules/parameter_editor.py +++ b/release/scripts/freestyle/modules/parameter_editor.py @@ -21,25 +21,71 @@ # Date : 26/07/2010 # Purpose : Interactive manipulation of stylization parameters -import freestyle +from freestyle import Operators +from freestyle.types import ( + BinaryPredicate1D, + Interface0DIterator, + Nature, + Noise, + StrokeAttribute, + UnaryPredicate0D, + UnaryPredicate1D, + TVertex, + ) +from freestyle.chainingiterators import ( + ChainPredicateIterator, + ChainSilhouetteIterator, + pySketchyChainSilhouetteIterator, + pySketchyChainingIterator, + ) +from freestyle.functions import ( + Curvature2DAngleF0D, + CurveMaterialF0D, + Normal2DF0D, + QuantitativeInvisibilityF1D, + VertexOrientation2DF0D, + ) +from freestyle.predicates import ( + AndUP1D, + ContourUP1D, + ExternalContourUP1D, + FalseBP1D, + FalseUP1D, + NotUP1D, + OrUP1D, + QuantitativeInvisibilityUP1D, + TrueBP1D, + TrueUP1D, + WithinImageBoundaryUP1D, + pyNatureUP1D, + ) +from freestyle.shaders import ( + BackboneStretcherShader, + BezierCurveShader, + ConstantColorShader, + GuidingLinesShader, + PolygonalizationShader, + SamplingShader, + SpatialNoiseShader, + StrokeShader, + TipRemoverShader, + pyBluePrintCirclesShader, + pyBluePrintEllipsesShader, + pyBluePrintSquaresShader, + ) +from freestyle.utils import ( + ContextFunctions, + getCurrentScene, + ) +from _freestyle import ( + blendRamp, + evaluateColorRamp, + evaluateCurveMappingF, + ) import math import mathutils import time -from _freestyle import blendRamp, evaluateColorRamp, evaluateCurveMappingF - -from ChainingIterators import pySketchyChainSilhouetteIterator, pySketchyChainingIterator -from freestyle import BackboneStretcherShader, BezierCurveShader, BinaryPredicate1D, ChainPredicateIterator, \ - ChainSilhouetteIterator, ConstantColorShader, ContourUP1D, Curvature2DAngleF0D, ExternalContourUP1D, \ - FalseBP1D, FalseUP1D, GuidingLinesShader, Interface0DIterator, Nature, Noise, Normal2DF0D, Operators, \ - PolygonalizationShader, QuantitativeInvisibilityF1D, QuantitativeInvisibilityUP1D, SamplingShader, \ - SpatialNoiseShader, StrokeAttribute, StrokeShader, TipRemoverShader, TrueBP1D, TrueUP1D, UnaryPredicate0D, \ - UnaryPredicate1D, VertexOrientation2DF0D, WithinImageBoundaryUP1D, ContextFunctions, TVertex -from Functions0D import CurveMaterialF0D -from PredicatesU1D import pyNatureUP1D -from logical_operators import AndUP1D, NotUP1D, OrUP1D -from shaders import pyBluePrintCirclesShader, pyBluePrintEllipsesShader, pyBluePrintSquaresShader - class ColorRampModifier(StrokeShader): def __init__(self, blend, influence, ramp): @@ -49,12 +95,12 @@ class ColorRampModifier(StrokeShader): self.__ramp = ramp def evaluate(self, t): - col = freestyle.evaluateColorRamp(self.__ramp, t) + col = evaluateColorRamp(self.__ramp, t) col = col.xyz # omit alpha return col def blend_ramp(self, a, b): - return freestyle.blendRamp(self.__blend, a, self.__influence, b) + return blendRamp(self.__blend, a, self.__influence, b) class ScalarBlendModifier(StrokeShader): @@ -106,7 +152,7 @@ class CurveMappingModifier(ScalarBlendModifier): return t def CURVE(self, t): - return freestyle.evaluateCurveMappingF(self.__curve, 0, t) + return evaluateCurveMappingF(self.__curve, 0, t) def evaluate(self, t): return self.__mapping(t) @@ -114,7 +160,7 @@ class CurveMappingModifier(ScalarBlendModifier): class ThicknessModifierMixIn: def __init__(self): - scene = freestyle.getCurrentScene() + scene = getCurrentScene() self.__persp_camera = (scene.camera.data.type == 'PERSP') def set_thickness(self, sv, outer, inner): @@ -312,7 +358,7 @@ class ThicknessDistanceFromCameraShader(ThicknessBlenderMixIn, CurveMappingModif # Distance from Object modifiers def iter_distance_from_object(stroke, object, range_min, range_max): - scene = freestyle.getCurrentScene() + scene = getCurrentScene() mv = scene.camera.matrix_world.copy() # model-view matrix mv.invert() loc = mv * object.location # loc in the camera coordinate @@ -1114,7 +1160,7 @@ class StrokeCleaner(StrokeShader): # main function for parameter processing def process(layer_name, lineset_name): - scene = freestyle.getCurrentScene() + scene = getCurrentScene() layer = scene.render.layers[layer_name] lineset = layer.freestyle_settings.linesets[lineset_name] linestyle = lineset.linestyle diff --git a/release/scripts/freestyle/styles/anisotropic_diffusion.py b/release/scripts/freestyle/styles/anisotropic_diffusion.py index 274381a9a89..95eb2793210 100644 --- a/release/scripts/freestyle/styles/anisotropic_diffusion.py +++ b/release/scripts/freestyle/styles/anisotropic_diffusion.py @@ -21,10 +21,24 @@ # Date : 12/08/2004 # Purpose : Smoothes lines using an anisotropic diffusion scheme -from freestyle import ChainPredicateIterator, ConstantThicknessShader, ExternalContourUP1D, IncreasingColorShader, \ - Operators, QuantitativeInvisibilityUP1D, SamplingShader, Stroke, StrokeTextureShader, TrueBP1D, TrueUP1D -from logical_operators import AndUP1D, NotUP1D -from shaders import pyDiffusion2Shader +from freestyle import Operators +from freestyle.types import Stroke +from freestyle.chainingiterators import ChainPredicateIterator +from freestyle.predicates import ( + AndUP1D, + ExternalContourUP1D, + NotUP1D, + QuantitativeInvisibilityUP1D, + TrueBP1D, + TrueUP1D, + ) +from freestyle.shaders import ( + ConstantThicknessShader, + IncreasingColorShader, + SamplingShader, + StrokeTextureShader, + pyDiffusion2Shader, + ) # pyDiffusion2Shader parameters offset = 0.25 diff --git a/release/scripts/freestyle/styles/apriori_and_causal_density.py b/release/scripts/freestyle/styles/apriori_and_causal_density.py index 501c5169be9..b834cd30052 100644 --- a/release/scripts/freestyle/styles/apriori_and_causal_density.py +++ b/release/scripts/freestyle/styles/apriori_and_causal_density.py @@ -23,10 +23,21 @@ # subjects them to the causal density so as to avoid # cluttering -from freestyle import ChainPredicateIterator, ConstantColorShader, ConstantThicknessShader, IntegrationType, \ - Operators, QuantitativeInvisibilityUP1D, TrueBP1D -from PredicatesU1D import pyDensityUP1D, pyHighViewMapDensityUP1D -from logical_operators import AndUP1D, NotUP1D +from freestyle import Operators +from freestyle.types import IntegrationType +from freestyle.chainingiterators import ChainPredicateIterator +from freestyle.predicates import ( + AndUP1D, + NotUP1D, + QuantitativeInvisibilityUP1D, + TrueBP1D, + pyDensityUP1D, + pyHighViewMapDensityUP1D, + ) +from freestyle.shaders import ( + ConstantColorShader, + ConstantThicknessShader, + ) upred = AndUP1D(QuantitativeInvisibilityUP1D(0), pyHighViewMapDensityUP1D(0.3, IntegrationType.LAST)) Operators.select(upred) diff --git a/release/scripts/freestyle/styles/apriori_density.py b/release/scripts/freestyle/styles/apriori_density.py index f59dd5cd36d..a247f5f6bac 100644 --- a/release/scripts/freestyle/styles/apriori_density.py +++ b/release/scripts/freestyle/styles/apriori_density.py @@ -21,10 +21,20 @@ # Date : 04/08/2005 # Purpose : Draws lines having a high a priori density -from freestyle import ChainPredicateIterator, ConstantColorShader, ConstantThicknessShader, Operators, \ - QuantitativeInvisibilityUP1D, TrueBP1D, TrueUP1D -from PredicatesU1D import pyHighViewMapDensityUP1D -from logical_operators import AndUP1D, NotUP1D +from freestyle import Operators +from freestyle.chainingiterators import ChainPredicateIterator +from freestyle.predicates import ( + AndUP1D, + NotUP1D, + QuantitativeInvisibilityUP1D, + TrueBP1D, + TrueUP1D, + pyHighViewMapDensityUP1D, + ) +from freestyle.shaders import ( + ConstantColorShader, + ConstantThicknessShader, + ) Operators.select(AndUP1D(QuantitativeInvisibilityUP1D(0), pyHighViewMapDensityUP1D(0.1,5))) bpred = TrueBP1D() diff --git a/release/scripts/freestyle/styles/backbone_stretcher.py b/release/scripts/freestyle/styles/backbone_stretcher.py index c920d66328e..9ab49b6d7db 100644 --- a/release/scripts/freestyle/styles/backbone_stretcher.py +++ b/release/scripts/freestyle/styles/backbone_stretcher.py @@ -21,9 +21,18 @@ # Date : 04/08/2005 # Purpose : Stretches the geometry of visible lines -from freestyle import BackboneStretcherShader, ChainSilhouetteIterator, ConstantColorShader, \ - Operators, QuantitativeInvisibilityUP1D, TextureAssignerShader, TrueUP1D -from logical_operators import NotUP1D +from freestyle import Operators +from freestyle.chainingiterators import ChainSilhouetteIterator +from freestyle.predicates import ( + NotUP1D, + QuantitativeInvisibilityUP1D, + TrueUP1D, + ) +from freestyle.shaders import ( + BackboneStretcherShader, + ConstantColorShader, + TextureAssignerShader, + ) Operators.select(QuantitativeInvisibilityUP1D(0)) Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0))) diff --git a/release/scripts/freestyle/styles/blueprint_circles.py b/release/scripts/freestyle/styles/blueprint_circles.py index 8d80893a6c3..254649d85b4 100644 --- a/release/scripts/freestyle/styles/blueprint_circles.py +++ b/release/scripts/freestyle/styles/blueprint_circles.py @@ -21,11 +21,24 @@ # Date : 04/08/2005 # Purpose : Produces a blueprint using circular contour strokes -from freestyle import ChainPredicateIterator, ConstantThicknessShader, ContourUP1D, IncreasingColorShader, \ - Operators, QuantitativeInvisibilityUP1D, SameShapeIdBP1D, TextureAssignerShader, TrueUP1D -from PredicatesU1D import pyHigherLengthUP1D -from logical_operators import AndUP1D, NotUP1D -from shaders import pyBluePrintCirclesShader, pyPerlinNoise1DShader +from freestyle import Operators +from freestyle.chainingiterators import ChainPredicateIterator +from freestyle.predicates import ( + AndUP1D, + ContourUP1D, + NotUP1D, + QuantitativeInvisibilityUP1D, + SameShapeIdBP1D, + TrueUP1D, + pyHigherLengthUP1D, + ) +from freestyle.shaders import ( + ConstantThicknessShader, + IncreasingColorShader, + TextureAssignerShader, + pyBluePrintCirclesShader, + pyPerlinNoise1DShader, + ) upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ContourUP1D()) bpred = SameShapeIdBP1D() diff --git a/release/scripts/freestyle/styles/blueprint_ellipses.py b/release/scripts/freestyle/styles/blueprint_ellipses.py index d5e9f385c12..d14ff8711c6 100644 --- a/release/scripts/freestyle/styles/blueprint_ellipses.py +++ b/release/scripts/freestyle/styles/blueprint_ellipses.py @@ -21,11 +21,24 @@ # Date : 04/08/2005 # Purpose : Produces a blueprint using elliptic contour strokes -from freestyle import ChainPredicateIterator, ConstantThicknessShader, ContourUP1D, IncreasingColorShader, \ - Operators, QuantitativeInvisibilityUP1D, SameShapeIdBP1D, TextureAssignerShader, TrueUP1D -from PredicatesU1D import pyHigherLengthUP1D -from logical_operators import AndUP1D, NotUP1D -from shaders import pyBluePrintEllipsesShader, pyPerlinNoise1DShader +from freestyle import Operators +from freestyle.chainingiterators import ChainPredicateIterator +from freestyle.predicates import ( + AndUP1D, + ContourUP1D, + NotUP1D, + QuantitativeInvisibilityUP1D, + SameShapeIdBP1D, + TrueUP1D, + pyHigherLengthUP1D, + ) +from freestyle.shaders import ( + ConstantThicknessShader, + IncreasingColorShader, + TextureAssignerShader, + pyBluePrintEllipsesShader, + pyPerlinNoise1DShader, + ) upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ContourUP1D()) bpred = SameShapeIdBP1D() diff --git a/release/scripts/freestyle/styles/blueprint_squares.py b/release/scripts/freestyle/styles/blueprint_squares.py index 35cfc33fd69..ba1bdb5d6bf 100644 --- a/release/scripts/freestyle/styles/blueprint_squares.py +++ b/release/scripts/freestyle/styles/blueprint_squares.py @@ -21,11 +21,24 @@ # Date : 04/08/2005 # Purpose : Produces a blueprint using square contour strokes -from freestyle import ChainPredicateIterator, ConstantThicknessShader, ContourUP1D, IncreasingColorShader, \ - Operators, QuantitativeInvisibilityUP1D, SameShapeIdBP1D, TextureAssignerShader, TrueUP1D -from PredicatesU1D import pyHigherLengthUP1D -from logical_operators import AndUP1D, NotUP1D -from shaders import pyBluePrintSquaresShader, pyPerlinNoise1DShader +from freestyle import Operators +from freestyle.chainingiterators import ChainPredicateIterator +from freestyle.predicates import ( + AndUP1D, + ContourUP1D, + NotUP1D, + QuantitativeInvisibilityUP1D, + SameShapeIdBP1D, + TrueUP1D, + pyHigherLengthUP1D, + ) +from freestyle.shaders import ( + ConstantThicknessShader, + IncreasingColorShader, + TextureAssignerShader, + pyBluePrintSquaresShader, + pyPerlinNoise1DShader, + ) upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ContourUP1D()) bpred = SameShapeIdBP1D() diff --git a/release/scripts/freestyle/styles/cartoon.py b/release/scripts/freestyle/styles/cartoon.py index de4a5dd6c5d..4118b4e1552 100644 --- a/release/scripts/freestyle/styles/cartoon.py +++ b/release/scripts/freestyle/styles/cartoon.py @@ -23,10 +23,18 @@ # infered from each object's material in a cartoon-like # fashion. -from freestyle import BezierCurveShader, ChainSilhouetteIterator, ConstantThicknessShader, Operators, \ - QuantitativeInvisibilityUP1D, TrueUP1D -from logical_operators import NotUP1D -from shaders import pyMaterialColorShader +from freestyle import Operators +from freestyle.chainingiterators import ChainSilhouetteIterator +from freestyle.predicates import ( + NotUP1D, + QuantitativeInvisibilityUP1D, + TrueUP1D, + ) +from freestyle.shaders import ( + BezierCurveShader, + ConstantThicknessShader, + pyMaterialColorShader, + ) Operators.select(QuantitativeInvisibilityUP1D(0)) Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0))) diff --git a/release/scripts/freestyle/styles/contour.py b/release/scripts/freestyle/styles/contour.py index f7a42d9c906..3d754cc63cf 100644 --- a/release/scripts/freestyle/styles/contour.py +++ b/release/scripts/freestyle/styles/contour.py @@ -21,9 +21,20 @@ # Date : 04/08/2005 # Purpose : Draws each object's visible contour -from freestyle import ChainPredicateIterator, ConstantThicknessShader, ContourUP1D, IncreasingColorShader, \ - Operators, QuantitativeInvisibilityUP1D, SameShapeIdBP1D, TrueUP1D -from logical_operators import AndUP1D, NotUP1D +from freestyle import Operators +from freestyle.chainingiterators import ChainPredicateIterator +from freestyle.predicates import ( + AndUP1D, + ContourUP1D, + NotUP1D, + QuantitativeInvisibilityUP1D, + SameShapeIdBP1D, + TrueUP1D, + ) +from freestyle.shaders import ( + ConstantThicknessShader, + IncreasingColorShader, + ) Operators.select(AndUP1D(QuantitativeInvisibilityUP1D(0), ContourUP1D())) bpred = SameShapeIdBP1D() diff --git a/release/scripts/freestyle/styles/curvature2d.py b/release/scripts/freestyle/styles/curvature2d.py index 4204951fbd5..8f8292e663c 100644 --- a/release/scripts/freestyle/styles/curvature2d.py +++ b/release/scripts/freestyle/styles/curvature2d.py @@ -22,10 +22,19 @@ # Purpose : The stroke points are colored in gray levels and depending # on the 2d curvature value -from freestyle import ChainSilhouetteIterator, ConstantThicknessShader, Operators, \ - QuantitativeInvisibilityUP1D, Stroke, StrokeTextureShader, TrueUP1D -from logical_operators import NotUP1D -from shaders import py2DCurvatureColorShader +from freestyle import Operators +from freestyle.types import Stroke +from freestyle.chainingiterators import ChainSilhouetteIterator +from freestyle.predicates import ( + NotUP1D, + QuantitativeInvisibilityUP1D, + TrueUP1D, + ) +from freestyle.shaders import ( + ConstantThicknessShader, + StrokeTextureShader, + py2DCurvatureColorShader, + ) Operators.select(QuantitativeInvisibilityUP1D(0)) Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0))) diff --git a/release/scripts/freestyle/styles/external_contour.py b/release/scripts/freestyle/styles/external_contour.py index c7e51f1a16d..7556332fdf1 100644 --- a/release/scripts/freestyle/styles/external_contour.py +++ b/release/scripts/freestyle/styles/external_contour.py @@ -21,9 +21,20 @@ # Date : 04/08/2005 # Purpose : Draws the external contour of the scene -from freestyle import ChainPredicateIterator, ConstantColorShader, ConstantThicknessShader, \ - ExternalContourUP1D, Operators, QuantitativeInvisibilityUP1D, TrueBP1D, TrueUP1D -from logical_operators import AndUP1D, NotUP1D +from freestyle import Operators +from freestyle.chainingiterators import ChainPredicateIterator +from freestyle.predicates import ( + AndUP1D, + ExternalContourUP1D, + NotUP1D, + QuantitativeInvisibilityUP1D, + TrueBP1D, + TrueUP1D, + ) +from freestyle.shaders import ( + ConstantColorShader, + ConstantThicknessShader, + ) upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ExternalContourUP1D()) Operators.select(upred) diff --git a/release/scripts/freestyle/styles/external_contour_sketchy.py b/release/scripts/freestyle/styles/external_contour_sketchy.py index b8d381ea24e..2163ce4d52c 100644 --- a/release/scripts/freestyle/styles/external_contour_sketchy.py +++ b/release/scripts/freestyle/styles/external_contour_sketchy.py @@ -23,18 +23,30 @@ # chaining iterator (in particular each ViewEdge can be drawn # several times -from ChainingIterators import pySketchyChainingIterator -from freestyle import ExternalContourUP1D, IncreasingColorShader, IncreasingThicknessShader, \ - Operators, QuantitativeInvisibilityUP1D, SamplingShader, SmoothingShader, SpatialNoiseShader, \ - TextureAssignerShader, TrueUP1D -from logical_operators import AndUP1D, NotUP1D +from freestyle import Operators +from freestyle.chainingiterators import pySketchyChainingIterator +from freestyle.predicates import ( + AndUP1D, + ExternalContourUP1D, + NotUP1D, + QuantitativeInvisibilityUP1D, + TrueUP1D, + ) +from freestyle.shaders import ( + IncreasingColorShader, + IncreasingThicknessShader, + SamplingShader, + SmoothingShader, + SpatialNoiseShader, + TextureAssignerShader, + ) upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ExternalContourUP1D()) Operators.select(upred) Operators.bidirectional_chain(pySketchyChainingIterator(), NotUP1D(upred)) shaders_list = [ SamplingShader(4), - SpatialNoiseShader(10, 150, 2, 1, 1), + SpatialNoiseShader(10, 150, 2, True, True), IncreasingThicknessShader(4, 10), SmoothingShader(400, 0.1, 0, 0.2, 0, 0, 0, 1), IncreasingColorShader(1, 0, 0, 1, 0, 1, 0, 1), diff --git a/release/scripts/freestyle/styles/external_contour_smooth.py b/release/scripts/freestyle/styles/external_contour_smooth.py index 045984ea4a5..b67193cb127 100644 --- a/release/scripts/freestyle/styles/external_contour_smooth.py +++ b/release/scripts/freestyle/styles/external_contour_smooth.py @@ -21,10 +21,22 @@ # Date : 04/08/2005 # Purpose : Draws a smooth external contour -from freestyle import ChainPredicateIterator, ExternalContourUP1D, IncreasingColorShader, \ - IncreasingThicknessShader, Operators, QuantitativeInvisibilityUP1D, SamplingShader, \ - SmoothingShader, TrueBP1D, TrueUP1D -from logical_operators import AndUP1D, NotUP1D +from freestyle import Operators +from freestyle.chainingiterators import ChainPredicateIterator +from freestyle.predicates import ( + AndUP1D, + ExternalContourUP1D, + NotUP1D, + QuantitativeInvisibilityUP1D, + TrueBP1D, + TrueUP1D, + ) +from freestyle.shaders import ( + IncreasingColorShader, + IncreasingThicknessShader, + SamplingShader, + SmoothingShader, + ) upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ExternalContourUP1D()) Operators.select(upred) diff --git a/release/scripts/freestyle/styles/haloing.py b/release/scripts/freestyle/styles/haloing.py index feadb5dd1ee..5d162436b7f 100644 --- a/release/scripts/freestyle/styles/haloing.py +++ b/release/scripts/freestyle/styles/haloing.py @@ -24,11 +24,23 @@ # object and trims them in order to produce # a haloing effect around the target shape -from freestyle import ChainSilhouetteIterator, Id, IncreasingColorShader, IncreasingThicknessShader, \ - Operators, QuantitativeInvisibilityUP1D, SamplingShader, TipRemoverShader, TrueUP1D -from PredicatesU1D import pyIsOccludedByUP1D -from logical_operators import AndUP1D, NotUP1D -from shaders import pyTVertexRemoverShader +from freestyle import Operators +from freestyle.types import Id +from freestyle.chainingiterators import ChainSilhouetteIterator +from freestyle.predicates import ( + AndUP1D, + NotUP1D, + QuantitativeInvisibilityUP1D, + TrueUP1D, + pyIsOccludedByUP1D, + ) +from freestyle.shaders import ( + IncreasingColorShader, + IncreasingThicknessShader, + SamplingShader, + TipRemoverShader, + pyTVertexRemoverShader, + ) # id corresponds to the id of the target object # (accessed by SHIFT+click) diff --git a/release/scripts/freestyle/styles/ignore_small_occlusions.py b/release/scripts/freestyle/styles/ignore_small_occlusions.py index a9dc102a0bd..86bcc2c2a5c 100644 --- a/release/scripts/freestyle/styles/ignore_small_occlusions.py +++ b/release/scripts/freestyle/styles/ignore_small_occlusions.py @@ -21,9 +21,17 @@ # Date : 04/08/2005 # Purpose : The strokes are drawn through small occlusions -from ChainingIterators import pyFillOcclusionsAbsoluteChainingIterator -from freestyle import ConstantColorShader, ConstantThicknessShader, Operators, \ - QuantitativeInvisibilityUP1D, SamplingShader, TrueUP1D +from freestyle import Operators +from freestyle.chainingiterators import pyFillOcclusionsAbsoluteChainingIterator +from freestyle.predicates import ( + QuantitativeInvisibilityUP1D, + TrueUP1D, + ) +from freestyle.shaders import ( + ConstantColorShader, + ConstantThicknessShader, + SamplingShader, + ) Operators.select(QuantitativeInvisibilityUP1D(0)) #Operators.bidirectional_chain(pyFillOcclusionsChainingIterator(0.1)) diff --git a/release/scripts/freestyle/styles/invisible_lines.py b/release/scripts/freestyle/styles/invisible_lines.py index b94d7b0a5fd..fd038b6f715 100644 --- a/release/scripts/freestyle/styles/invisible_lines.py +++ b/release/scripts/freestyle/styles/invisible_lines.py @@ -22,9 +22,18 @@ # Purpose : Draws all lines whose Quantitative Invisibility # is different from 0 -from freestyle import ChainSilhouetteIterator, ConstantColorShader, ConstantThicknessShader, \ - Operators, QuantitativeInvisibilityUP1D, SamplingShader, TrueUP1D -from logical_operators import NotUP1D +from freestyle import Operators +from freestyle.chainingiterators import ChainSilhouetteIterator +from freestyle.predicates import ( + NotUP1D, + QuantitativeInvisibilityUP1D, + TrueUP1D, + ) +from freestyle.shaders import ( + ConstantColorShader, + ConstantThicknessShader, + SamplingShader, + ) upred = NotUP1D(QuantitativeInvisibilityUP1D(0)) Operators.select(upred) diff --git a/release/scripts/freestyle/styles/japanese_bigbrush.py b/release/scripts/freestyle/styles/japanese_bigbrush.py index 4a5203fb31f..71aeb960287 100644 --- a/release/scripts/freestyle/styles/japanese_bigbrush.py +++ b/release/scripts/freestyle/styles/japanese_bigbrush.py @@ -21,15 +21,29 @@ # Date : 04/08/2005 # Purpose : Simulates a big brush fr oriental painting -from freestyle import BezierCurveShader, ChainSilhouetteIterator, ConstantColorShader, \ - ConstantThicknessShader, IntegrationType, Operators, QuantitativeInvisibilityUP1D, \ - SamplingShader, TextureAssignerShader, TipRemoverShader -from Functions0D import pyInverseCurvature2DAngleF0D -from PredicatesB1D import pyLengthBP1D -from PredicatesU0D import pyParameterUP0D -from PredicatesU1D import pyDensityUP1D, pyHigherLengthUP1D, pyHigherNumberOfTurnsUP1D -from logical_operators import NotUP1D -from shaders import pyNonLinearVaryingThicknessShader, pySamplingShader +from freestyle import Operators +from freestyle.types import IntegrationType +from freestyle.chainingiterators import ChainSilhouetteIterator +from freestyle.functions import pyInverseCurvature2DAngleF0D +from freestyle.predicates import ( + NotUP1D, + QuantitativeInvisibilityUP1D, + pyDensityUP1D, + pyHigherLengthUP1D, + pyHigherNumberOfTurnsUP1D, + pyLengthBP1D, + pyParameterUP0D, + ) +from freestyle.shaders import ( + BezierCurveShader, + ConstantColorShader, + ConstantThicknessShader, + SamplingShader, + TextureAssignerShader, + TipRemoverShader, + pyNonLinearVaryingThicknessShader, + pySamplingShader, + ) Operators.select(QuantitativeInvisibilityUP1D(0)) Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0))) diff --git a/release/scripts/freestyle/styles/long_anisotropically_dense.py b/release/scripts/freestyle/styles/long_anisotropically_dense.py index f181bcc2348..ca729562c2d 100644 --- a/release/scripts/freestyle/styles/long_anisotropically_dense.py +++ b/release/scripts/freestyle/styles/long_anisotropically_dense.py @@ -28,11 +28,23 @@ # ******** The Directional a priori density maps must ****** # ******** have been computed prior to using this style module ****** -from freestyle import ChainSilhouetteIterator, ConstantColorShader, ConstantThicknessShader, DensityF1D, \ - IntegrationType, Operators, QuantitativeInvisibilityUP1D, SamplingShader, UnaryPredicate1D -from PredicatesB1D import pyLengthBP1D -from PredicatesU1D import pyHighDensityAnisotropyUP1D, pyHigherLengthUP1D -from logical_operators import NotUP1D +from freestyle import Operators +from freestyle.types import IntegrationType +from freestyle.chainingiterators import ChainSilhouetteIterator +from freestyle.functions import DensityF1D +from freestyle.predicates import ( + NotUP1D, + QuantitativeInvisibilityUP1D, + UnaryPredicate1D, + pyHighDensityAnisotropyUP1D, + pyHigherLengthUP1D, + pyLengthBP1D, + ) +from freestyle.shaders import ( + ConstantColorShader, + ConstantThicknessShader, + SamplingShader, + ) ## custom density predicate class pyDensityUP1D(UnaryPredicate1D): diff --git a/release/scripts/freestyle/styles/multiple_parameterization.py b/release/scripts/freestyle/styles/multiple_parameterization.py index 922a5ffa972..da140c75147 100644 --- a/release/scripts/freestyle/styles/multiple_parameterization.py +++ b/release/scripts/freestyle/styles/multiple_parameterization.py @@ -27,15 +27,25 @@ # the strokes using a second parameterization that only # covers the visible portions. -from freestyle import ChainSilhouetteIterator, ConstantColorShader, IncreasingColorShader, \ - IncreasingThicknessShader, Operators, QuantitativeInvisibilityUP1D, SamplingShader, \ - TextureAssignerShader, TrueUP1D -from shaders import pyHLRShader +from freestyle import Operators +from freestyle.chainingiterators import ChainSilhouetteIterator +from freestyle.predicates import ( + QuantitativeInvisibilityUP1D, + TrueUP1D, + ) +from freestyle.shaders import ( + ConstantColorShader, + IncreasingColorShader, + IncreasingThicknessShader, + SamplingShader, + TextureAssignerShader, + pyHLRShader, + ) Operators.select(QuantitativeInvisibilityUP1D(0)) ## Chain following the same nature, but without the restriction -## of staying inside the selection (0). -Operators.bidirectional_chain(ChainSilhouetteIterator(0)) +## of staying inside the selection (False). +Operators.bidirectional_chain(ChainSilhouetteIterator(False)) shaders_list = [ SamplingShader(20), IncreasingThicknessShader(1.5, 30), diff --git a/release/scripts/freestyle/styles/nature.py b/release/scripts/freestyle/styles/nature.py index fdc627ecade..35b57399942 100644 --- a/release/scripts/freestyle/styles/nature.py +++ b/release/scripts/freestyle/styles/nature.py @@ -25,10 +25,18 @@ # The suggestive contours must have been enabled in the # options dialog to appear in the View Map. -from freestyle import ChainSilhouetteIterator, IncreasingColorShader, \ - IncreasingThicknessShader, Nature, Operators, TrueUP1D -from PredicatesU1D import pyNatureUP1D -from logical_operators import NotUP1D +from freestyle import Operators +from freestyle.types import Nature +from freestyle.chainingiterators import ChainSilhouetteIterator +from freestyle.predicates import ( + NotUP1D, + TrueUP1D, + pyNatureUP1D, + ) +from freestyle.shaders import ( + IncreasingColorShader, + IncreasingThicknessShader, + ) Operators.select(pyNatureUP1D(Nature.SILHOUETTE)) Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(pyNatureUP1D(Nature.SILHOUETTE))) diff --git a/release/scripts/freestyle/styles/near_lines.py b/release/scripts/freestyle/styles/near_lines.py index 977b99546bc..3ae2e093041 100644 --- a/release/scripts/freestyle/styles/near_lines.py +++ b/release/scripts/freestyle/styles/near_lines.py @@ -22,10 +22,21 @@ # Purpose : Draws the lines that are "closer" than a threshold # (between 0 and 1) -from freestyle import ChainSilhouetteIterator, ConstantColorShader, ConstantThicknessShader, \ - IntegrationType, Operators, QuantitativeInvisibilityUP1D, TextureAssignerShader, TrueUP1D -from PredicatesU1D import pyZSmallerUP1D -from logical_operators import AndUP1D, NotUP1D +from freestyle import Operators +from freestyle.types import IntegrationType +from freestyle.chainingiterators import ChainSilhouetteIterator +from freestyle.predicates import ( + AndUP1D, + NotUP1D, + QuantitativeInvisibilityUP1D, + TrueUP1D, + pyZSmallerUP1D, + ) +from freestyle.shaders import ( + ConstantColorShader, + ConstantThicknessShader, + TextureAssignerShader, + ) upred = AndUP1D(QuantitativeInvisibilityUP1D(0), pyZSmallerUP1D(0.5, IntegrationType.MEAN)) Operators.select(upred) diff --git a/release/scripts/freestyle/styles/occluded_by_specific_object.py b/release/scripts/freestyle/styles/occluded_by_specific_object.py index 0ae0804f2a8..89ef8692be5 100644 --- a/release/scripts/freestyle/styles/occluded_by_specific_object.py +++ b/release/scripts/freestyle/styles/occluded_by_specific_object.py @@ -21,10 +21,21 @@ # Date : 04/08/2005 # Purpose : Draws only the lines that are occluded by a given object -from freestyle import ChainSilhouetteIterator, ConstantColorShader, ConstantThicknessShader, \ - Id, Operators, QuantitativeInvisibilityUP1D, SamplingShader, TrueUP1D -from PredicatesU1D import pyIsInOccludersListUP1D -from logical_operators import AndUP1D, NotUP1D +from freestyle import Operators +from freestyle.types import Id +from freestyle.chainingiterators import ChainSilhouetteIterator +from freestyle.predicates import ( + AndUP1D, + NotUP1D, + QuantitativeInvisibilityUP1D, + TrueUP1D, + pyIsInOccludersListUP1D, + ) +from freestyle.shaders import ( + ConstantColorShader, + ConstantThicknessShader, + SamplingShader, + ) ## the id of the occluder (use SHIFT+click on the ViewMap to ## retrieve ids) diff --git a/release/scripts/freestyle/styles/polygonalize.py b/release/scripts/freestyle/styles/polygonalize.py index e570e15ca6c..7291f145047 100644 --- a/release/scripts/freestyle/styles/polygonalize.py +++ b/release/scripts/freestyle/styles/polygonalize.py @@ -21,9 +21,19 @@ # Date : 04/08/2005 # Purpose : Make the strokes more "polygonal" -from freestyle import ChainSilhouetteIterator, ConstantColorShader, ConstantThicknessShader, \ - Operators, PolygonalizationShader, QuantitativeInvisibilityUP1D, SamplingShader, TrueUP1D -from logical_operators import NotUP1D +from freestyle import Operators +from freestyle.chainingiterators import ChainSilhouetteIterator +from freestyle.predicates import ( + NotUP1D, + QuantitativeInvisibilityUP1D, + TrueUP1D, + ) +from freestyle.shaders import ( + ConstantColorShader, + ConstantThicknessShader, + PolygonalizationShader, + SamplingShader, + ) Operators.select(QuantitativeInvisibilityUP1D(0)) Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0))) diff --git a/release/scripts/freestyle/styles/qi0.py b/release/scripts/freestyle/styles/qi0.py index 8386817754a..41fd251c5d9 100644 --- a/release/scripts/freestyle/styles/qi0.py +++ b/release/scripts/freestyle/styles/qi0.py @@ -22,9 +22,18 @@ # Purpose : Draws the visible lines (chaining follows same nature lines) # (most basic style module) -from freestyle import ChainSilhouetteIterator, ConstantColorShader, ConstantThicknessShader, \ - Operators, QuantitativeInvisibilityUP1D, SamplingShader, TrueUP1D -from logical_operators import NotUP1D +from freestyle import Operators +from freestyle.chainingiterators import ChainSilhouetteIterator +from freestyle.predicates import ( + NotUP1D, + QuantitativeInvisibilityUP1D, + TrueUP1D, + ) +from freestyle.shaders import ( + ConstantColorShader, + ConstantThicknessShader, + SamplingShader, + ) Operators.select(QuantitativeInvisibilityUP1D(0)) Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0))) diff --git a/release/scripts/freestyle/styles/qi0_not_external_contour.py b/release/scripts/freestyle/styles/qi0_not_external_contour.py index 6315f1291d4..9486f01d0e8 100644 --- a/release/scripts/freestyle/styles/qi0_not_external_contour.py +++ b/release/scripts/freestyle/styles/qi0_not_external_contour.py @@ -22,10 +22,23 @@ # Purpose : Draws the visible lines (chaining follows same nature lines) # that do not belong to the external contour of the scene -from freestyle import BackboneStretcherShader, ChainSilhouetteIterator, ExternalContourUP1D, \ - IncreasingColorShader, IncreasingThicknessShader, Operators, QuantitativeInvisibilityUP1D, \ - SamplingShader, SpatialNoiseShader, TextureAssignerShader, TrueUP1D -from logical_operators import AndUP1D, NotUP1D +from freestyle import Operators +from freestyle.chainingiterators import ChainSilhouetteIterator +from freestyle.predicates import ( + AndUP1D, + ExternalContourUP1D, + NotUP1D, + QuantitativeInvisibilityUP1D, + TrueUP1D, + ) +from freestyle.shaders import ( + BackboneStretcherShader, + IncreasingColorShader, + IncreasingThicknessShader, + SamplingShader, + SpatialNoiseShader, + TextureAssignerShader, + ) upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ExternalContourUP1D()) Operators.select(upred) diff --git a/release/scripts/freestyle/styles/qi1.py b/release/scripts/freestyle/styles/qi1.py index d5424b37748..cae086cd73e 100644 --- a/release/scripts/freestyle/styles/qi1.py +++ b/release/scripts/freestyle/styles/qi1.py @@ -23,9 +23,18 @@ # *** Quantitative Invisibility must have been # enabled in the options dialog to use this style module **** -from freestyle import ChainSilhouetteIterator, ConstantColorShader, ConstantThicknessShader, \ - Operators, QuantitativeInvisibilityUP1D, SamplingShader, TrueUP1D -from logical_operators import NotUP1D +from freestyle import Operators +from freestyle.chainingiterators import ChainSilhouetteIterator +from freestyle.predicates import ( + NotUP1D, + QuantitativeInvisibilityUP1D, + TrueUP1D, + ) +from freestyle.shaders import ( + ConstantColorShader, + ConstantThicknessShader, + SamplingShader, + ) Operators.select(QuantitativeInvisibilityUP1D(1)) Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(1))) diff --git a/release/scripts/freestyle/styles/qi2.py b/release/scripts/freestyle/styles/qi2.py index 367139de2e2..7375e80dd72 100644 --- a/release/scripts/freestyle/styles/qi2.py +++ b/release/scripts/freestyle/styles/qi2.py @@ -23,9 +23,18 @@ # *** Quantitative Invisibility must have been # enabled in the options dialog to use this style module **** -from freestyle import ChainSilhouetteIterator, ConstantColorShader, ConstantThicknessShader, \ - Operators, QuantitativeInvisibilityUP1D, SamplingShader, TrueUP1D -from logical_operators import NotUP1D +from freestyle import Operators +from freestyle.chainingiterators import ChainSilhouetteIterator +from freestyle.predicates import ( + NotUP1D, + QuantitativeInvisibilityUP1D, + TrueUP1D, + ) +from freestyle.shaders import ( + ConstantColorShader, + ConstantThicknessShader, + SamplingShader, + ) Operators.select(QuantitativeInvisibilityUP1D(2)) Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(2))) diff --git a/release/scripts/freestyle/styles/sequentialsplit_sketchy.py b/release/scripts/freestyle/styles/sequentialsplit_sketchy.py index 755098d96b6..6f1e93953dd 100644 --- a/release/scripts/freestyle/styles/sequentialsplit_sketchy.py +++ b/release/scripts/freestyle/styles/sequentialsplit_sketchy.py @@ -23,10 +23,22 @@ # predicates to specify respectively the starting and # the stopping extremities for strokes -from freestyle import ChainSilhouetteIterator, ConstantColorShader, IncreasingThicknessShader, Nature, \ - Operators, QuantitativeInvisibilityUP1D, SpatialNoiseShader, TextureAssignerShader, TrueUP1D -from PredicatesU0D import pyBackTVertexUP0D, pyVertexNatureUP0D -from logical_operators import NotUP1D +from freestyle import Operators +from freestyle.types import Nature +from freestyle.chainingiterators import ChainSilhouetteIterator +from freestyle.predicates import ( + NotUP1D, + QuantitativeInvisibilityUP1D, + TrueUP1D, + pyBackTVertexUP0D, + pyVertexNatureUP0D, + ) +from freestyle.shaders import ( + ConstantColorShader, + IncreasingThicknessShader, + SpatialNoiseShader, + TextureAssignerShader, + ) upred = QuantitativeInvisibilityUP1D(0) Operators.select(upred) diff --git a/release/scripts/freestyle/styles/sketchy_multiple_parameterization.py b/release/scripts/freestyle/styles/sketchy_multiple_parameterization.py index c1cc4361f7f..0e92277ba0f 100644 --- a/release/scripts/freestyle/styles/sketchy_multiple_parameterization.py +++ b/release/scripts/freestyle/styles/sketchy_multiple_parameterization.py @@ -23,11 +23,21 @@ # parameterization that covers the complete lines (visible+invisible) # whereas only the visible portions are actually drawn -from ChainingIterators import pySketchyChainSilhouetteIterator -from freestyle import IncreasingColorShader, IncreasingThicknessShader, Operators, \ - QuantitativeInvisibilityUP1D, SamplingShader, SmoothingShader, SpatialNoiseShader, \ - TextureAssignerShader, TrueUP1D -from shaders import pyHLRShader +from freestyle import Operators +from freestyle.chainingiterators import pySketchyChainSilhouetteIterator +from freestyle.predicates import ( + QuantitativeInvisibilityUP1D, + TrueUP1D, + ) +from freestyle.shaders import ( + IncreasingColorShader, + IncreasingThicknessShader, + SamplingShader, + SmoothingShader, + SpatialNoiseShader, + TextureAssignerShader, + pyHLRShader, + ) Operators.select(QuantitativeInvisibilityUP1D(0)) Operators.bidirectional_chain(pySketchyChainSilhouetteIterator(3, False)) diff --git a/release/scripts/freestyle/styles/sketchy_topology_broken.py b/release/scripts/freestyle/styles/sketchy_topology_broken.py index 27669d20a4e..9b450f62f1d 100644 --- a/release/scripts/freestyle/styles/sketchy_topology_broken.py +++ b/release/scripts/freestyle/styles/sketchy_topology_broken.py @@ -23,11 +23,21 @@ # independantly from the 3D topology of objects, # and, second, so as to chain several times the same ViewEdge. -from ChainingIterators import pySketchyChainingIterator -from freestyle import IncreasingColorShader, IncreasingThicknessShader, Operators, \ - QuantitativeInvisibilityUP1D, SamplingShader, SmoothingShader, SpatialNoiseShader, \ - TextureAssignerShader, TrueUP1D -from shaders import pyBackboneStretcherNoCuspShader +from freestyle import Operators +from freestyle.chainingiterators import pySketchyChainingIterator +from freestyle.predicates import ( + QuantitativeInvisibilityUP1D, + TrueUP1D, + ) +from freestyle.shaders import ( + IncreasingColorShader, + IncreasingThicknessShader, + SamplingShader, + SmoothingShader, + SpatialNoiseShader, + TextureAssignerShader, + pyBackboneStretcherNoCuspShader + ) Operators.select(QuantitativeInvisibilityUP1D(0)) ## Chain 3 times each ViewEdge indpendantly from the diff --git a/release/scripts/freestyle/styles/sketchy_topology_preserved.py b/release/scripts/freestyle/styles/sketchy_topology_preserved.py index 25e593b7c99..07cc615bb2c 100644 --- a/release/scripts/freestyle/styles/sketchy_topology_preserved.py +++ b/release/scripts/freestyle/styles/sketchy_topology_preserved.py @@ -23,10 +23,20 @@ # so as to chain several times the same ViewEdge. # The topology of the objects is preserved -from ChainingIterators import pySketchyChainSilhouetteIterator -from freestyle import ConstantColorShader, IncreasingThicknessShader, Operators, \ - QuantitativeInvisibilityUP1D, SamplingShader, SmoothingShader, SpatialNoiseShader, \ - TextureAssignerShader, TrueUP1D +from freestyle import Operators +from freestyle.chainingiterators import pySketchyChainSilhouetteIterator +from freestyle.predicates import ( + QuantitativeInvisibilityUP1D, + TrueUP1D, + ) +from freestyle.shaders import ( + ConstantColorShader, + IncreasingThicknessShader, + SamplingShader, + SmoothingShader, + SpatialNoiseShader, + TextureAssignerShader, + ) upred = QuantitativeInvisibilityUP1D(0) Operators.select(upred) diff --git a/release/scripts/freestyle/styles/split_at_highest_2d_curvatures.py b/release/scripts/freestyle/styles/split_at_highest_2d_curvatures.py index 474183c3810..67b540865d5 100644 --- a/release/scripts/freestyle/styles/split_at_highest_2d_curvatures.py +++ b/release/scripts/freestyle/styles/split_at_highest_2d_curvatures.py @@ -22,12 +22,21 @@ # Purpose : Draws the visible lines (chaining follows same nature lines) # (most basic style module) -from freestyle import ChainSilhouetteIterator, ConstantThicknessShader, IncreasingColorShader, \ - Operators, QuantitativeInvisibilityUP1D, TextureAssignerShader, TrueUP1D -from Functions0D import pyInverseCurvature2DAngleF0D -from PredicatesU0D import pyParameterUP0D -from PredicatesU1D import pyHigherLengthUP1D -from logical_operators import NotUP1D +from freestyle import Operators +from freestyle.chainingiterators import ChainSilhouetteIterator +from freestyle.functions import pyInverseCurvature2DAngleF0D +from freestyle.predicates import ( + NotUP1D, + QuantitativeInvisibilityUP1D, + TrueUP1D, + pyHigherLengthUP1D, + pyParameterUP0D, + ) +from freestyle.shaders import ( + ConstantThicknessShader, + IncreasingColorShader, + TextureAssignerShader, + ) Operators.select(QuantitativeInvisibilityUP1D(0)) Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0))) diff --git a/release/scripts/freestyle/styles/split_at_tvertices.py b/release/scripts/freestyle/styles/split_at_tvertices.py index 70446e0178e..20d9b4ac378 100644 --- a/release/scripts/freestyle/styles/split_at_tvertices.py +++ b/release/scripts/freestyle/styles/split_at_tvertices.py @@ -21,10 +21,20 @@ # Date : 04/08/2005 # Purpose : Draws strokes that starts and stops at Tvertices (visible or not) -from freestyle import ChainSilhouetteIterator, ConstantThicknessShader, IncreasingColorShader, \ - Nature, Operators, QuantitativeInvisibilityUP1D, TextureAssignerShader, TrueUP1D -from PredicatesU0D import pyVertexNatureUP0D -from logical_operators import NotUP1D +from freestyle import Operators +from freestyle.types import Nature +from freestyle.chainingiterators import ChainSilhouetteIterator +from freestyle.predicates import ( + NotUP1D, + QuantitativeInvisibilityUP1D, + TrueUP1D, + pyVertexNatureUP0D, + ) +from freestyle.shaders import ( + ConstantThicknessShader, + IncreasingColorShader, + TextureAssignerShader, + ) Operators.select(QuantitativeInvisibilityUP1D(0)) Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0))) diff --git a/release/scripts/freestyle/styles/stroke_texture.py b/release/scripts/freestyle/styles/stroke_texture.py index c925633b579..046b7c18696 100644 --- a/release/scripts/freestyle/styles/stroke_texture.py +++ b/release/scripts/freestyle/styles/stroke_texture.py @@ -21,10 +21,21 @@ # Date : 04/08/2005 # Purpose : Draws textured strokes (illustrate the StrokeTextureShader shader) -from freestyle import BezierCurveShader, ChainSilhouetteIterator, ConstantColorShader, \ - ConstantThicknessShader, Operators, QuantitativeInvisibilityUP1D, SamplingShader, \ - Stroke, StrokeTextureShader, TrueUP1D -from logical_operators import NotUP1D +from freestyle import Operators +from freestyle.types import Stroke +from freestyle.chainingiterators import ChainSilhouetteIterator +from freestyle.predicates import ( + NotUP1D, + QuantitativeInvisibilityUP1D, + TrueUP1D, + ) +from freestyle.shaders import ( + BezierCurveShader, + ConstantColorShader, + ConstantThicknessShader, + SamplingShader, + StrokeTextureShader, + ) Operators.select(QuantitativeInvisibilityUP1D(0)) Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0))) diff --git a/release/scripts/freestyle/styles/suggestive.py b/release/scripts/freestyle/styles/suggestive.py index bb5e20f2a2e..e6559b28294 100644 --- a/release/scripts/freestyle/styles/suggestive.py +++ b/release/scripts/freestyle/styles/suggestive.py @@ -23,10 +23,20 @@ # ***** The suggestive contours must be enabled # in the options dialog ***** -from freestyle import ChainSilhouetteIterator, ConstantColorShader, IncreasingThicknessShader, \ - Nature, Operators, QuantitativeInvisibilityUP1D, TrueUP1D -from PredicatesU1D import pyNatureUP1D -from logical_operators import AndUP1D, NotUP1D +from freestyle import Operators +from freestyle.types import Nature +from freestyle.chainingiterators import ChainSilhouetteIterator +from freestyle.predicates import ( + AndUP1D, + NotUP1D, + QuantitativeInvisibilityUP1D, + TrueUP1D, + pyNatureUP1D, + ) +from freestyle.shaders import ( + ConstantColorShader, + IncreasingThicknessShader, + ) upred = AndUP1D(pyNatureUP1D(Nature.SUGGESTIVE_CONTOUR), QuantitativeInvisibilityUP1D(0)) Operators.select(upred) diff --git a/release/scripts/freestyle/styles/thickness_fof_depth_discontinuity.py b/release/scripts/freestyle/styles/thickness_fof_depth_discontinuity.py index 20c8240b3cd..c7b2d352e59 100644 --- a/release/scripts/freestyle/styles/thickness_fof_depth_discontinuity.py +++ b/release/scripts/freestyle/styles/thickness_fof_depth_discontinuity.py @@ -21,10 +21,19 @@ # Date : 04/08/2005 # Purpose : Assigns to strokes a thickness that depends on the depth discontinuity -from freestyle import ChainSilhouetteIterator, ConstantColorShader, ConstantThicknessShader, \ - Operators, QuantitativeInvisibilityUP1D, SamplingShader, TrueUP1D -from logical_operators import NotUP1D -from shaders import pyDepthDiscontinuityThicknessShader +from freestyle import Operators +from freestyle.chainingiterators import ChainSilhouetteIterator +from freestyle.predicates import ( + NotUP1D, + QuantitativeInvisibilityUP1D, + TrueUP1D, + ) +from freestyle.shaders import ( + ConstantColorShader, + ConstantThicknessShader, + SamplingShader, + pyDepthDiscontinuityThicknessShader, + ) Operators.select(QuantitativeInvisibilityUP1D(0)) Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0))) diff --git a/release/scripts/freestyle/styles/tipremover.py b/release/scripts/freestyle/styles/tipremover.py index efcddb7321f..a80679fa991 100644 --- a/release/scripts/freestyle/styles/tipremover.py +++ b/release/scripts/freestyle/styles/tipremover.py @@ -21,9 +21,19 @@ # Date : 04/08/2005 # Purpose : Removes strokes extremities -from freestyle import ChainSilhouetteIterator, ConstantColorShader, ConstantThicknessShader, \ - Operators, QuantitativeInvisibilityUP1D, SamplingShader, TipRemoverShader, TrueUP1D -from logical_operators import NotUP1D +from freestyle import Operators +from freestyle.chainingiterators import ChainSilhouetteIterator +from freestyle.predicates import ( + NotUP1D, + QuantitativeInvisibilityUP1D, + TrueUP1D, + ) +from freestyle.shaders import ( + ConstantColorShader, + ConstantThicknessShader, + SamplingShader, + TipRemoverShader, + ) Operators.select(QuantitativeInvisibilityUP1D(0)) Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0))) diff --git a/release/scripts/freestyle/styles/tvertex_remover.py b/release/scripts/freestyle/styles/tvertex_remover.py index 565962c1b0e..113f20a8fd3 100644 --- a/release/scripts/freestyle/styles/tvertex_remover.py +++ b/release/scripts/freestyle/styles/tvertex_remover.py @@ -21,10 +21,19 @@ # Date : 04/08/2005 # Purpose : Removes TVertices -from freestyle import ChainSilhouetteIterator, ConstantColorShader, IncreasingThicknessShader, \ - Operators, QuantitativeInvisibilityUP1D, SamplingShader, TrueUP1D -from logical_operators import NotUP1D -from shaders import pyTVertexRemoverShader +from freestyle import Operators +from freestyle.chainingiterators import ChainSilhouetteIterator +from freestyle.predicates import ( + NotUP1D, + QuantitativeInvisibilityUP1D, + TrueUP1D, + ) +from freestyle.shaders import ( + ConstantColorShader, + IncreasingThicknessShader, + SamplingShader, + pyTVertexRemoverShader, + ) Operators.select(QuantitativeInvisibilityUP1D(0)) Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0))) diff --git a/release/scripts/freestyle/styles/uniformpruning_zsort.py b/release/scripts/freestyle/styles/uniformpruning_zsort.py index efa977ccf5f..10a4d5ff144 100644 --- a/release/scripts/freestyle/styles/uniformpruning_zsort.py +++ b/release/scripts/freestyle/styles/uniformpruning_zsort.py @@ -20,10 +20,20 @@ # Authors : Fredo Durand, Stephane Grabli, Francois Sillion, Emmanuel Turquin # Date : 08/04/2005 -from freestyle import ChainSilhouetteIterator, ConstantColorShader, ConstantThicknessShader, IntegrationType, \ - Operators, QuantitativeInvisibilityUP1D, SamplingShader, Stroke, StrokeTextureShader -from PredicatesB1D import pyZBP1D -from PredicatesU1D import pyDensityUP1D +from freestyle import Operators +from freestyle.types import IntegrationType, Stroke +from freestyle.chainingiterators import ChainSilhouetteIterator +from freestyle.predicates import ( + QuantitativeInvisibilityUP1D, + pyDensityUP1D, + pyZBP1D, + ) +from freestyle.shaders import ( + ConstantColorShader, + ConstantThicknessShader, + SamplingShader, + StrokeTextureShader, + ) Operators.select(QuantitativeInvisibilityUP1D(0)) Operators.bidirectional_chain(ChainSilhouetteIterator())