[Bf-blender-cvs] [28e068b55cf] master: Cleanup: run autopep8 on release/scripts/freestyle

Campbell Barton noreply at git.blender.org
Wed Apr 20 08:19:09 CEST 2022


Commit: 28e068b55cfc5b3d0af87235079978e3708178e7
Author: Campbell Barton
Date:   Wed Apr 20 16:14:24 2022 +1000
Branches: master
https://developer.blender.org/rB28e068b55cfc5b3d0af87235079978e3708178e7

Cleanup: run autopep8 on release/scripts/freestyle

===================================================================

M	release/scripts/freestyle/modules/freestyle/functions.py
M	release/scripts/freestyle/modules/freestyle/shaders.py
M	release/scripts/freestyle/styles/backbone_stretcher.py
M	release/scripts/freestyle/styles/split_at_highest_2d_curvatures.py

===================================================================

diff --git a/release/scripts/freestyle/modules/freestyle/functions.py b/release/scripts/freestyle/modules/freestyle/functions.py
index e9fa53c8b7e..4a4a2f036e1 100644
--- a/release/scripts/freestyle/modules/freestyle/functions.py
+++ b/release/scripts/freestyle/modules/freestyle/functions.py
@@ -91,7 +91,7 @@ __all__ = (
     "pyViewMapGradientNormF0D",
     "pyViewMapGradientNormF1D",
     "pyViewMapGradientVectorF0D",
-    )
+)
 
 
 # module members
@@ -147,7 +147,7 @@ from _freestyle import (
     VertexOrientation3DF0D,
     ZDiscontinuityF0D,
     ZDiscontinuityF1D,
-    )
+)
 
 # constructs for function definition in Python
 from freestyle.types import (
@@ -157,7 +157,7 @@ from freestyle.types import (
     UnaryFunction0DMaterial,
     UnaryFunction0DVec2f,
     UnaryFunction1DDouble,
-    )
+)
 from freestyle.utils import ContextFunctions as CF
 from freestyle.utils import integrate
 
@@ -176,6 +176,7 @@ class CurveMaterialF0D(UnaryFunction0DMaterial):
     Notes: expects instances of CurvePoint to be iterated over
            can return None if no fedge can be found
     """
+
     def __call__(self, inter):
         fe = inter.object.fedge
         if fe is None:
@@ -203,6 +204,7 @@ class pyCurvilinearLengthF0D(UnaryFunction0DDouble):
 
 class pyDensityAnisotropyF0D(UnaryFunction0DDouble):
     """Estimates the anisotropy of density."""
+
     def __init__(self, level):
         UnaryFunction0DDouble.__init__(self)
         self.IsoDensity = ReadCompleteViewMapPixelF0D(level)
@@ -233,6 +235,7 @@ class pyViewMapGradientVectorF0D(UnaryFunction0DVec2f):
        :arg level: the level at which to compute the gradient
        :type level: int
     """
+
     def __init__(self, level):
         UnaryFunction0DVec2f.__init__(self)
         self._l = level
@@ -241,9 +244,9 @@ class pyViewMapGradientVectorF0D(UnaryFunction0DVec2f):
     def __call__(self, iter):
         p = iter.object.point_2d
         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))
+            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))
+            CF.read_complete_view_map_pixel(self._l, int(p.x), int(p.y))
         return Vector((gx, gy))
 
 
@@ -256,9 +259,9 @@ class pyViewMapGradientNormF0D(UnaryFunction0DDouble):
     def __call__(self, iter):
         p = iter.object.point_2d
         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))
+            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))
+            CF.read_complete_view_map_pixel(self._l, int(p.x), int(p.y))
         return Vector((gx, gy)).length
 
 # -- Functions for 1D elements (curves) -- #
@@ -286,7 +289,10 @@ class pyDensityAnisotropyF1D(UnaryFunction1DDouble):
         self._sampling = sampling
 
     def __call__(self, inter):
-        v = integrate(self._func, inter.points_begin(self._sampling), inter.points_end(self._sampling), self._integration)
+        v = integrate(
+            self._func, inter.points_begin(
+                self._sampling), inter.points_end(
+                self._sampling), self._integration)
         return v
 
 
@@ -298,5 +304,8 @@ class pyViewMapGradientNormF1D(UnaryFunction1DDouble):
         self._sampling = sampling
 
     def __call__(self, inter):
-        v = integrate(self._func, inter.points_begin(self._sampling), inter.points_end(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/shaders.py b/release/scripts/freestyle/modules/freestyle/shaders.py
index 494722bad39..d2b10206b9f 100644
--- a/release/scripts/freestyle/modules/freestyle/shaders.py
+++ b/release/scripts/freestyle/modules/freestyle/shaders.py
@@ -71,7 +71,7 @@ __all__ = (
     "pyTimeColorShader",
     "pyTipRemoverShader",
     "pyZDependingThicknessShader",
-    )
+)
 
 
 # module members
@@ -94,7 +94,7 @@ from _freestyle import (
     StrokeTextureStepShader,
     ThicknessNoiseShader,
     TipRemoverShader,
-    )
+)
 
 # constructs for shader definition in Python
 from freestyle.types import (
@@ -105,7 +105,7 @@ from freestyle.types import (
     StrokeShader,
     StrokeVertexIterator,
     StrokeVertex,
-    )
+)
 from freestyle.functions import (
     Curvature2DAngleF0D,
     DensityF0D,
@@ -114,18 +114,18 @@ from freestyle.functions import (
     Normal2DF0D,
     Orientation2DF1D,
     ZDiscontinuityF0D,
-    )
+)
 from freestyle.predicates import (
     pyVertexNatureUP0D,
     pyUEqualsUP0D,
-    )
+)
 
 from freestyle.utils import (
     bound,
     BoundingBox,
     pairwise,
     phase_to_direction,
-    )
+)
 
 from freestyle.utils import ContextFunctions as CF
 
@@ -145,6 +145,7 @@ class pyDepthDiscontinuityThicknessShader(StrokeShader):
     Assigns a thickness to the stroke based on the stroke's distance
     to the camera (Z-value).
     """
+
     def __init__(self, min, max):
         StrokeShader.__init__(self)
         self.a = max - min
@@ -163,6 +164,7 @@ class pyConstantThicknessShader(StrokeShader):
     """
     Assigns a constant thickness along the stroke.
     """
+
     def __init__(self, thickness):
         StrokeShader.__init__(self)
         self._thickness = thickness / 2.0
@@ -176,6 +178,7 @@ class pyFXSVaryingThicknessWithDensityShader(StrokeShader):
     """
     Assigns thickness to a stroke based on the density of the diffuse map.
     """
+
     def __init__(self, wsize, threshold_min, threshold_max, thicknessMin, thicknessMax):
         StrokeShader.__init__(self)
         self._func = DensityF0D(wsize)
@@ -200,6 +203,7 @@ class pyIncreasingThicknessShader(StrokeShader):
     """
     Increasingly thickens the stroke.
     """
+
     def __init__(self, thicknessMin, thicknessMax):
         StrokeShader.__init__(self)
         self._thicknessMin = thicknessMin
@@ -221,6 +225,7 @@ class pyConstrainedIncreasingThicknessShader(StrokeShader):
     Increasingly thickens the stroke, constrained by a ratio of the
     stroke's length.
     """
+
     def __init__(self, thicknessMin, thicknessMax, ratio):
         StrokeShader.__init__(self)
         self._thicknessMin = thicknessMin
@@ -248,6 +253,7 @@ class pyDecreasingThicknessShader(StrokeShader):
     """
     Inverse of pyIncreasingThicknessShader, decreasingly thickens the stroke.
     """
+
     def __init__(self, thicknessMin, thicknessMax):
         StrokeShader.__init__(self)
         self._thicknessMin = thicknessMin
@@ -269,6 +275,7 @@ class pyNonLinearVaryingThicknessShader(StrokeShader):
     """
     Assigns thickness to a stroke based on an exponential function.
     """
+
     def __init__(self, thicknessExtremity, thicknessMiddle, exponent):
         self._thicknessMin = thicknessMiddle
         self._thicknessMax = thicknessExtremity
@@ -288,6 +295,7 @@ class pySLERPThicknessShader(StrokeShader):
     """
     Assigns thickness to a stroke based on spherical linear interpolation.
     """
+
     def __init__(self, thicknessMin, thicknessMax, omega=1.2):
         StrokeShader.__init__(self)
         self._thicknessMin = thicknessMin
@@ -302,9 +310,9 @@ class pySLERPThicknessShader(StrokeShader):
         for i, svert in enumerate(stroke):
             c = i / n
             if i < (n * 0.5):
-                t = sin((1-c) * omega) / sinhyp * self._thicknessMin + sin(c * omega) / sinhyp * maxT
+                t = sin((1 - c) * omega) / sinhyp * self._thicknessMin + sin(c * omega) / sinhyp * maxT
             else:
-                t = sin((1-c) * omega) / sinhyp * maxT + sin(c * omega) / sinhyp * self._thicknessMin
+                t = sin((1 - c) * omega) / sinhyp * maxT + sin(c * omega) / sinhyp * self._thicknessMin
             svert.attribute.thickness = (t / 2.0, t / 2.0)
 
 
@@ -312,6 +320,7 @@ class pyTVertexThickenerShader(StrokeShader):
     """
     Thickens TVertices (visual intersections between two edges).
     """
+
     def __init__(self, a=1.5, n=3):
         StrokeShader.__init__(self)
         self._a = a
@@ -342,6 +351,7 @@ class pyImportance2DThicknessShader(StrokeShader):
     the thickness is inverted, so the vertices closest to the
     specified point have the lowest thickness.
     """
+
     def __init__(self, x, y, w, kmin, kmax):
         StrokeShader.__init__(self)
         self._origin = Vector((x, y))
@@ -352,16 +362,17 @@ class pyImportance2DThicknessShader(StrokeShader):
         for svert in stroke:
             d = (svert.point_2d - self._origin).length
             k = (self._kmin if (d > self._w) else
-                (self._kmax * (self._w-d) + self._kmin * d) / self._w)
+                 (self._kmax * (self._w - d) + self._kmin * d) / self._w)
 
             (tr, tl) = svert.attribute.thickness
-            svert.attribute.thickness = (k*tr/2.0, k*tl/2.0)
+            svert.attribute.thickness = (k * tr / 2.0, k * tl / 2.0)
 
 
 class pyImportance3DThicknessShader(StrokeShader):
     """
     Assigns thickness based on distance to a given point in 3D space.
     """
+
     def __init__(self, x, y, z, w, kmin, kmax):
         StrokeShader.__init__(self)
         self._origin = Vector((x, y, z))
@@ -372,10 +383,10 @@ class pyImportance3DThicknessShader(StrokeShader):
         for svert in stroke:
             d = (svert.point_3d - self._origin).length
             k = (self._kmin if (d > self._w) else
-                (self._kmax * (self._w-d) + self._kmin * d) / self._w)
+                 (self._kmax * (self._w - d) + self._kmin * d) / self._w)
 
             (tr, tl) = svert.attribute.thickness
-            svert.attribute.thickness = (k*tr/2.0, k*tl/2.0)
+

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list