Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2011-11-14 00:20:50 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2011-11-14 00:20:50 +0400
commit99f7f3ac81c3854e131562c660183bdf5279dc38 (patch)
tree43cdd319fa819910347221a336e118ea16e5d9e9 /release/scripts/freestyle/style_modules
parent43c74f768b41551127d2952d398cee40703b28a5 (diff)
Added new options for splitting chains of feature edges by a minimum
and maximum 2D angle.
Diffstat (limited to 'release/scripts/freestyle/style_modules')
-rw-r--r--release/scripts/freestyle/style_modules/parameter_editor.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/release/scripts/freestyle/style_modules/parameter_editor.py b/release/scripts/freestyle/style_modules/parameter_editor.py
index 6da3e509e86..882e40ced3f 100644
--- a/release/scripts/freestyle/style_modules/parameter_editor.py
+++ b/release/scripts/freestyle/style_modules/parameter_editor.py
@@ -802,6 +802,23 @@ class MaterialBoundaryUP0D(UnaryPredicate0D):
idx2 = fe.materialIndex() if fe.isSmooth() else fe.bMaterialIndex()
return idx1 != idx2
+class Curvature2DAngleThresholdUP0D(UnaryPredicate0D):
+ def __init__(self, min_angle=None, max_angle=None):
+ UnaryPredicate0D.__init__(self)
+ print(min_angle, max_angle)
+ self._min_angle = min_angle
+ self._max_angle = max_angle
+ self._func = Curvature2DAngleF0D()
+ def getName(self):
+ return "Curvature2DAngleThresholdUP0D"
+ def __call__(self, inter):
+ angle = math.pi - self._func(inter)
+ if self._min_angle is not None and angle < self._min_angle:
+ return True
+ if self._max_angle is not None and angle > self._max_angle:
+ return True
+ return False
+
# Seed for random number generation
class Seed:
@@ -926,6 +943,10 @@ def process(layer_name, lineset_name):
# split chains
if linestyle.material_boundary:
Operators.sequentialSplit(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))
# select chains
if linestyle.use_min_length or linestyle.use_max_length:
min_length = linestyle.min_length if linestyle.use_min_length else None