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>2014-10-01 10:42:37 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2014-10-01 11:01:40 +0400
commit2cb134be2bc8add5a5dcc94a73b08cbe563c782e (patch)
tree7c11cefd2cbbdcb809da80382abd360f6f5635c7 /release/scripts/freestyle
parent55aa42ad6f10d663439f30acfa6a6c449aa97a95 (diff)
Freestyle: New line style options for sorting and chain selection.
The following two sort keys are added for sorting chains. * Projected X - Sort by the projected X value in the image coordinate system. * Projected Y - Sort by the projected Y value in the image coordinate system. A new line style option for the selection of first N chains is also added. Moreover, the chain sorting and chain selection operations are now executed in this order instead of the reverse order used previously. The UI has also changed accordingly. This functional change is backward compatible and won't result in visual differences.
Diffstat (limited to 'release/scripts/freestyle')
-rw-r--r--release/scripts/freestyle/modules/freestyle/predicates.py22
-rw-r--r--release/scripts/freestyle/modules/parameter_editor.py19
2 files changed, 36 insertions, 5 deletions
diff --git a/release/scripts/freestyle/modules/freestyle/predicates.py b/release/scripts/freestyle/modules/freestyle/predicates.py
index 9b665755725..54656e450d9 100644
--- a/release/scripts/freestyle/modules/freestyle/predicates.py
+++ b/release/scripts/freestyle/modules/freestyle/predicates.py
@@ -82,6 +82,8 @@ __all__ = (
"pyNatureUP1D",
"pyParameterUP0D",
"pyParameterUP0DGoodOne",
+ "pyProjectedXBP1D",
+ "pyProjectedYBP1D",
"pyShapeIdListUP1D",
"pyShapeIdUP1D",
"pyShuffleBP1D",
@@ -135,6 +137,8 @@ from freestyle.functions import (
GetCurvilinearAbscissaF0D,
GetDirectionalViewMapDensityF1D,
GetOccludersF1D,
+ GetProjectedXF1D,
+ GetProjectedYF1D,
GetProjectedZF1D,
GetShapeF1D,
GetSteerableViewMapDensityF1D,
@@ -596,6 +600,24 @@ class pyZBP1D(BinaryPredicate1D):
return (self.func(i1) > self.func(i2))
+class pyProjectedXBP1D(BinaryPredicate1D):
+ def __init__(self, iType=IntegrationType.MEAN):
+ BinaryPredicate1D.__init__(self)
+ self.func = GetProjectedXF1D(iType)
+
+ def __call__(self, i1, i2):
+ return (self.func(i1) > self.func(i2))
+
+
+class pyProjectedYBP1D(BinaryPredicate1D):
+ def __init__(self, iType=IntegrationType.MEAN):
+ BinaryPredicate1D.__init__(self)
+ self.func = GetProjectedYF1D(iType)
+
+ def __call__(self, i1, i2):
+ return (self.func(i1) > self.func(i2))
+
+
class pyZDiscontinuityBP1D(BinaryPredicate1D):
def __init__(self, iType=IntegrationType.MEAN):
BinaryPredicate1D.__init__(self)
diff --git a/release/scripts/freestyle/modules/parameter_editor.py b/release/scripts/freestyle/modules/parameter_editor.py
index ebd09bd0181..9ac5c665f1e 100644
--- a/release/scripts/freestyle/modules/parameter_editor.py
+++ b/release/scripts/freestyle/modules/parameter_editor.py
@@ -62,7 +62,10 @@ from freestyle.predicates import (
TrueBP1D,
TrueUP1D,
WithinImageBoundaryUP1D,
+ pyNFirstUP1D,
pyNatureUP1D,
+ pyProjectedXBP1D,
+ pyProjectedYBP1D,
pyZBP1D,
)
from freestyle.shaders import (
@@ -1006,11 +1009,6 @@ def process(layer_name, lineset_name):
Operators.sequential_split(SplitPatternStartingUP0D(controller),
SplitPatternStoppingUP0D(controller),
sampling)
- # select chains
- if linestyle.use_length_min or linestyle.use_length_max:
- length_min = linestyle.length_min if linestyle.use_length_min else None
- length_max = linestyle.length_max if linestyle.use_length_max else None
- Operators.select(LengthThresholdUP1D(length_min, length_max))
# sort selected chains
if linestyle.use_sorting:
integration = integration_types.get(linestyle.integration_type, IntegrationType.MEAN)
@@ -1018,9 +1016,20 @@ def process(layer_name, lineset_name):
bpred = pyZBP1D(integration)
elif linestyle.sort_key == '2D_LENGTH':
bpred = Length2DBP1D()
+ elif linestyle.sort_key == 'PROJECTED_X':
+ bpred = pyProjectedXBP1D(integration)
+ elif linestyle.sort_key == 'PROJECTED_Y':
+ bpred = pyProjectedYBP1D(integration)
if linestyle.sort_order == 'REVERSE':
bpred = NotBP1D(bpred)
Operators.sort(bpred)
+ # select chains
+ if linestyle.use_length_min or linestyle.use_length_max:
+ length_min = linestyle.length_min if linestyle.use_length_min else None
+ length_max = linestyle.length_max if linestyle.use_length_max else None
+ Operators.select(LengthThresholdUP1D(length_min, length_max))
+ if linestyle.use_chain_count:
+ Operators.select(pyNFirstUP1D(linestyle.chain_count))
# prepare a list of stroke shaders
shaders_list = []
for m in linestyle.geometry_modifiers: