本文整理汇总了Python中freestyle.types.Operators.sort方法的典型用法代码示例。如果您正苦于以下问题:Python Operators.sort方法的具体用法?Python Operators.sort怎么用?Python Operators.sort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类freestyle.types.Operators
的用法示例。
在下文中一共展示了Operators.sort方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: lineset_post
# 需要导入模块: from freestyle.types import Operators [as 别名]
# 或者: from freestyle.types.Operators import sort [as 别名]
def lineset_post(scene, layer, lineset):
if not (scene.render.use_freestyle and scene.svg_export.use_svg_export and scene.svg_export.object_fill):
return
# reset the stroke selection (but don't delete the already generated strokes)
Operators.reset(delete_strokes=False)
# shape detection
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ContourUP1D())
Operators.select(upred)
# chain when the same shape and visible
bpred = SameShapeIdBP1D()
Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(QuantitativeInvisibilityUP1D(0)))
# sort according to the distance from camera
Operators.sort(pyZBP1D())
# render and write fills
shader = SVGFillShader(create_path(scene), render_height(scene), lineset.name)
Operators.create(TrueUP1D(), [shader, ])
shader.write()
示例2: import
# 需要导入模块: from freestyle.types import Operators [as 别名]
# 或者: from freestyle.types.Operators import sort [as 别名]
# Authors : Fredo Durand, Stephane Grabli, Francois Sillion, Emmanuel Turquin
# Date : 08/04/2005
from freestyle.chainingiterators import ChainSilhouetteIterator
from freestyle.predicates import (
QuantitativeInvisibilityUP1D,
pyDensityUP1D,
pyZBP1D,
)
from freestyle.shaders import (
ConstantColorShader,
ConstantThicknessShader,
SamplingShader,
StrokeTextureShader,
)
from freestyle.types import IntegrationType, Operators, Stroke
Operators.select(QuantitativeInvisibilityUP1D(0))
Operators.bidirectional_chain(ChainSilhouetteIterator())
#Operators.sequential_split(pyVertexNatureUP0D(Nature.VIEW_VERTEX), 2)
Operators.sort(pyZBP1D())
shaders_list = [
StrokeTextureShader("smoothAlpha.bmp", Stroke.OPAQUE_MEDIUM, False),
ConstantThicknessShader(3),
SamplingShader(5.0),
ConstantColorShader(0, 0, 0, 1),
]
Operators.create(pyDensityUP1D(2, 0.05, IntegrationType.MEAN, 4), shaders_list)
#Operators.create(pyDensityFunctorUP1D(8, 0.03, pyGetInverseProjectedZF1D(), 0, 1, IntegrationType.MEAN), shaders_list)
示例3: process
# 需要导入模块: from freestyle.types import Operators [as 别名]
# 或者: from freestyle.types.Operators import sort [as 别名]
#.........这里部分代码省略.........
if linestyle.use_same_object:
Operators.bidirectional_chain(pySketchyChainSilhouetteIterator(linestyle.rounds))
else:
Operators.bidirectional_chain(pySketchyChainingIterator(linestyle.rounds))
else:
Operators.chain(ChainPredicateIterator(FalseUP1D(), FalseBP1D()), NotUP1D(upred))
# split chains
if linestyle.material_boundary:
Operators.sequential_split(MaterialBoundaryUP0D())
if linestyle.use_angle_min or linestyle.use_angle_max:
angle_min = linestyle.angle_min if linestyle.use_angle_min else None
angle_max = linestyle.angle_max if linestyle.use_angle_max else None
Operators.sequential_split(Curvature2DAngleThresholdUP0D(angle_min, angle_max))
if linestyle.use_split_length:
Operators.sequential_split(Length2DThresholdUP0D(linestyle.split_length), 1.0)
if linestyle.use_split_pattern:
pattern = []
if linestyle.split_dash1 > 0 and linestyle.split_gap1 > 0:
pattern.append(linestyle.split_dash1)
pattern.append(linestyle.split_gap1)
if linestyle.split_dash2 > 0 and linestyle.split_gap2 > 0:
pattern.append(linestyle.split_dash2)
pattern.append(linestyle.split_gap2)
if linestyle.split_dash3 > 0 and linestyle.split_gap3 > 0:
pattern.append(linestyle.split_dash3)
pattern.append(linestyle.split_gap3)
if len(pattern) > 0:
sampling = 1.0
controller = SplitPatternController(pattern, sampling)
Operators.sequential_split(SplitPatternStartingUP0D(controller),
SplitPatternStoppingUP0D(controller),
sampling)
# 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()
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:
if not m.use:
continue
if m.type == 'SAMPLING':
shaders_list.append(SamplingShader(
m.sampling))
elif m.type == 'BEZIER_CURVE':
shaders_list.append(BezierCurveShader(
m.error))
elif m.type == 'SINUS_DISPLACEMENT':
shaders_list.append(SinusDisplacementShader(
示例4: NotUP1D
# 需要导入模块: from freestyle.types import Operators [as 别名]
# 或者: from freestyle.types.Operators import sort [as 别名]
TipRemoverShader,
pyNonLinearVaryingThicknessShader,
pySamplingShader,
)
from freestyle.types import IntegrationType, Operators
Operators.select(QuantitativeInvisibilityUP1D(0))
Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
## Splits strokes at points of highest 2D curavture
## when there are too many abrupt turns in it
func = pyInverseCurvature2DAngleF0D()
Operators.recursive_split(func, pyParameterUP0D(0.2, 0.8), NotUP1D(pyHigherNumberOfTurnsUP1D(3, 0.5)), 2)
## Keeps only long enough strokes
Operators.select(pyHigherLengthUP1D(100))
## Sorts so as to draw the longest strokes first
## (this will be done using the causal density)
Operators.sort(pyLengthBP1D())
shaders_list = [
pySamplingShader(10),
BezierCurveShader(30),
SamplingShader(50),
ConstantThicknessShader(10),
pyNonLinearVaryingThicknessShader(4, 25, 0.6),
TextureAssignerShader(6),
ConstantColorShader(0.2, 0.2, 0.2,1.0),
TipRemoverShader(10),
]
## Use the causal density to avoid cluttering
Operators.create(pyDensityUP1D(8, 0.4, IntegrationType.MEAN), shaders_list)