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-04-18 09:59:02 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2014-04-18 10:02:45 +0400
commitf60a66f41784de388a01c4c882c969730d675375 (patch)
treea469d0acdfa48cefa2611837d268f2c636225372 /release
parent6a94e73a854286f711bffa81d351d640b4cf3675 (diff)
Freestyle: New options for sorting to arrange the stacking order of lines.
Line styles now have a set of new options for rearranging the stacking order of lines. This gives artists more control to determine which lines should be drawn on top of others. Two available sort keys are the distance from camera and curvilinear 2D length. Since the distance of a line from camera may vary over vertices, another option called integration type is used to compute the sort key for a line from the values computed at individual vertices. Available integration types are MEAN, MIN, MAX, FIRST and LAST (see the tool tips for more detail).
Diffstat (limited to 'release')
-rw-r--r--release/scripts/freestyle/modules/parameter_editor.py22
-rw-r--r--release/scripts/startup/bl_ui/properties_freestyle.py12
2 files changed, 34 insertions, 0 deletions
diff --git a/release/scripts/freestyle/modules/parameter_editor.py b/release/scripts/freestyle/modules/parameter_editor.py
index ce15028d0d7..73ae0f4712c 100644
--- a/release/scripts/freestyle/modules/parameter_editor.py
+++ b/release/scripts/freestyle/modules/parameter_editor.py
@@ -23,6 +23,7 @@
from freestyle.types import (
BinaryPredicate1D,
+ IntegrationType,
Interface0DIterator,
Nature,
Noise,
@@ -51,6 +52,8 @@ from freestyle.predicates import (
ExternalContourUP1D,
FalseBP1D,
FalseUP1D,
+ Length2DBP1D,
+ NotBP1D,
NotUP1D,
OrUP1D,
QuantitativeInvisibilityUP1D,
@@ -58,6 +61,7 @@ from freestyle.predicates import (
TrueUP1D,
WithinImageBoundaryUP1D,
pyNatureUP1D,
+ pyZBP1D,
)
from freestyle.shaders import (
BackboneStretcherShader,
@@ -1163,6 +1167,14 @@ class StrokeCleaner(StrokeShader):
stroke.update_length()
+integration_types = {
+ 'MEAN': IntegrationType.MEAN,
+ 'MIN': IntegrationType.MIN,
+ 'MAX': IntegrationType.MAX,
+ 'FIRST': IntegrationType.FIRST,
+ 'LAST': IntegrationType.LAST}
+
+
# main function for parameter processing
def process(layer_name, lineset_name):
@@ -1291,6 +1303,16 @@ def process(layer_name, lineset_name):
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)
+ if linestyle.sort_key == 'DISTANCE_FROM_CAMERA':
+ bpred = pyZBP1D(integration)
+ elif linestyle.sort_key == '2D_LENGTH':
+ bpred = Length2DBP1D()
+ if linestyle.sort_order == 'REVERSE':
+ bpred = NotBP1D(bpred)
+ Operators.sort(bpred)
# prepare a list of stroke shaders
shaders_list = []
###
diff --git a/release/scripts/startup/bl_ui/properties_freestyle.py b/release/scripts/startup/bl_ui/properties_freestyle.py
index 197b0d2f970..bedee24d8ef 100644
--- a/release/scripts/startup/bl_ui/properties_freestyle.py
+++ b/release/scripts/startup/bl_ui/properties_freestyle.py
@@ -603,6 +603,18 @@ class RENDERLAYER_PT_freestyle_linestyle(RenderLayerFreestyleEditorButtonsPanel,
sub.active = linestyle.use_length_max
sub.prop(linestyle, "length_max")
+ ## Sorting
+ layout.prop(linestyle, "use_sorting", text="Sorting:")
+ col = layout.column()
+ col.active = linestyle.use_sorting
+ row = col.row(align=True)
+ row.prop(linestyle, "sort_key", text="")
+ sub = row.row()
+ sub.active = linestyle.sort_key in {'DISTANCE_FROM_CAMERA'}
+ sub.prop(linestyle, "integration_type", text="")
+ row = col.row(align=True)
+ row.prop(linestyle, "sort_order", expand=True)
+
## Caps
layout.label(text="Caps:")
row = layout.row(align=True)