本文整理汇总了Python中freestyle.types.Operators.get_stroke_from_index方法的典型用法代码示例。如果您正苦于以下问题:Python Operators.get_stroke_from_index方法的具体用法?Python Operators.get_stroke_from_index怎么用?Python Operators.get_stroke_from_index使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类freestyle.types.Operators
的用法示例。
在下文中一共展示了Operators.get_stroke_from_index方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: postprocess
# 需要导入模块: from freestyle.types import Operators [as 别名]
# 或者: from freestyle.types.Operators import get_stroke_from_index [as 别名]
def postprocess(frame_start=None, frame_end=None, interval=0):
"""
frame_start: the start frame (default Scene.frame_start)
frame_end: the end frame (default: Scene.frame_end)
interval: the number of frames inserted as interval between two strokes
"""
totlen = 0.0
nstrokes = Operators.get_strokes_size()
#print('#strokes', nstrokes)
for i in range(nstrokes):
stroke = Operators.get_stroke_from_index(i)
totlen += stroke.length_2d
#print('totlen', totlen)
scene = getCurrentScene()
sta = scene.frame_start if frame_start is None else frame_start
end = scene.frame_end if frame_end is None else frame_end
cur = scene.frame_current
fac = (cur - sta) / (end - sta)
#print('fac', fac)
totDrawingFrames = (end - sta + 1) - interval * (nstrokes - 1)
if totDrawingFrames < 0:
raise RuntimeError('The number of frames is too small')
lengthPerFrame = totlen / totDrawingFrames
#print('lengthPerFrame', lengthPerFrame)
thresh = (cur - sta + 1) * lengthPerFrame + 1e-6
#print('thresh', thresh)
curlen = 0.0
for i in range(nstrokes):
stroke = Operators.get_stroke_from_index(i)
for svert in stroke:
svert.attribute.visible = curlen + svert.curvilinear_abscissa < thresh
curlen += stroke.length_2d + lengthPerFrame * interval
#print('done')