本文整理汇总了Python中freestyle.types.Operators.sequential_split方法的典型用法代码示例。如果您正苦于以下问题:Python Operators.sequential_split方法的具体用法?Python Operators.sequential_split怎么用?Python Operators.sequential_split使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类freestyle.types.Operators
的用法示例。
在下文中一共展示了Operators.sequential_split方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: process
# 需要导入模块: from freestyle.types import Operators [as 别名]
# 或者: from freestyle.types.Operators import sequential_split [as 别名]
def process(layer_name, lineset_name):
scene = getCurrentScene()
layer = scene.render.layers[layer_name]
lineset = layer.freestyle_settings.linesets[lineset_name]
linestyle = lineset.linestyle
selection_criteria = []
# prepare selection criteria by visibility
if lineset.select_by_visibility:
if lineset.visibility == 'VISIBLE':
selection_criteria.append(
QuantitativeInvisibilityUP1D(0))
elif lineset.visibility == 'HIDDEN':
selection_criteria.append(
NotUP1D(QuantitativeInvisibilityUP1D(0)))
elif lineset.visibility == 'RANGE':
selection_criteria.append(
QuantitativeInvisibilityRangeUP1D(lineset.qi_start, lineset.qi_end))
# prepare selection criteria by edge types
if lineset.select_by_edge_types:
edge_type_criteria = []
if lineset.select_silhouette:
upred = pyNatureUP1D(Nature.SILHOUETTE)
edge_type_criteria.append(NotUP1D(upred) if lineset.exclude_silhouette else upred)
if lineset.select_border:
upred = pyNatureUP1D(Nature.BORDER)
edge_type_criteria.append(NotUP1D(upred) if lineset.exclude_border else upred)
if lineset.select_crease:
upred = pyNatureUP1D(Nature.CREASE)
edge_type_criteria.append(NotUP1D(upred) if lineset.exclude_crease else upred)
if lineset.select_ridge_valley:
upred = pyNatureUP1D(Nature.RIDGE)
edge_type_criteria.append(NotUP1D(upred) if lineset.exclude_ridge_valley else upred)
if lineset.select_suggestive_contour:
upred = pyNatureUP1D(Nature.SUGGESTIVE_CONTOUR)
edge_type_criteria.append(NotUP1D(upred) if lineset.exclude_suggestive_contour else upred)
if lineset.select_material_boundary:
upred = pyNatureUP1D(Nature.MATERIAL_BOUNDARY)
edge_type_criteria.append(NotUP1D(upred) if lineset.exclude_material_boundary else upred)
if lineset.select_edge_mark:
upred = pyNatureUP1D(Nature.EDGE_MARK)
edge_type_criteria.append(NotUP1D(upred) if lineset.exclude_edge_mark else upred)
if lineset.select_contour:
upred = ContourUP1D()
edge_type_criteria.append(NotUP1D(upred) if lineset.exclude_contour else upred)
if lineset.select_external_contour:
upred = ExternalContourUP1D()
edge_type_criteria.append(NotUP1D(upred) if lineset.exclude_external_contour else upred)
if lineset.edge_type_combination == 'OR':
upred = OrUP1D(*edge_type_criteria)
else:
upred = AndUP1D(*edge_type_criteria)
if upred is not None:
if lineset.edge_type_negation == 'EXCLUSIVE':
upred = NotUP1D(upred)
selection_criteria.append(upred)
# prepare selection criteria by face marks
if lineset.select_by_face_marks:
if lineset.face_mark_condition == 'BOTH':
upred = FaceMarkBothUP1D()
else:
upred = FaceMarkOneUP1D()
if lineset.face_mark_negation == 'EXCLUSIVE':
upred = NotUP1D(upred)
selection_criteria.append(upred)
# prepare selection criteria by group of objects
if lineset.select_by_group:
if lineset.group is not None:
names = {ob.name: True for ob in lineset.group.objects}
upred = ObjectNamesUP1D(names, lineset.group_negation == 'EXCLUSIVE')
selection_criteria.append(upred)
# prepare selection criteria by image border
if lineset.select_by_image_border:
upred = WithinImageBoundaryUP1D(*ContextFunctions.get_border())
selection_criteria.append(upred)
# select feature edges
upred = AndUP1D(*selection_criteria)
if upred is None:
upred = TrueUP1D()
Operators.select(upred)
# join feature edges to form chains
if linestyle.use_chaining:
if linestyle.chaining == 'PLAIN':
if linestyle.use_same_object:
Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(upred))
else:
Operators.bidirectional_chain(ChainPredicateIterator(upred, TrueBP1D()), NotUP1D(upred))
elif linestyle.chaining == 'SKETCHY':
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
#.........这里部分代码省略.........
示例2: Tvertices
# 需要导入模块: from freestyle.types import Operators [as 别名]
# 或者: from freestyle.types.Operators import sequential_split [as 别名]
# Filename : split_at_tvertices.py
# Author : Stephane Grabli
# Date : 04/08/2005
# Purpose : Draws strokes that starts and stops at Tvertices (visible or not)
from freestyle.chainingiterators import ChainSilhouetteIterator
from freestyle.predicates import (
NotUP1D,
QuantitativeInvisibilityUP1D,
TrueUP1D,
pyVertexNatureUP0D,
)
from freestyle.shaders import (
ConstantThicknessShader,
IncreasingColorShader,
)
from freestyle.types import Nature, Operators
Operators.select(QuantitativeInvisibilityUP1D(0))
Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
start = pyVertexNatureUP0D(Nature.T_VERTEX)
## use the same predicate to decide where to start and where to stop
## the strokes:
Operators.sequential_split(start, start, 10)
shaders_list = [
ConstantThicknessShader(5),
IncreasingColorShader(1, 0, 0, 1, 0, 1, 0, 1),
]
Operators.create(TrueUP1D(), shaders_list)