gpt4 book ai didi

python - 生成一个 mel 脚本

转载 作者:太空宇宙 更新时间:2023-11-04 10:57:58 24 4
gpt4 key购买 nike

按照我昨天提出的问题,这里是 passing contents from multiple lists generated in different functions to a file我已经写了代码。部分代码如下,

def lower_lip_under_upper_teeth_bezier(x_n, p0, p3) :
""" Calculating sampling points using rational bezier curve equation"""
lower_lip_under_upper_teeth_p_u_list = []
u = x_n
p1 = p0
p2 = p3

lower_lip_under_upper_teeth_p_u = math.pow(1 - u, 3) * p0 + 3 * u * math.pow(1 - u, 2) * p1 \
+ 3 * (1 - u) * math.pow(u, 2) * p2 + math.pow(u, 3) * p3
lower_lip_under_upper_teeth_p_u = lower_lip_under_upper_teeth_p_u * w
d = math.pow(1 - u, 3) * w + 3 * u * w * math.pow(1 - u, 2) + 3 * (1 - u) * w * math.pow(u, 2) + math.pow(u, 3) * w
lower_lip_under_upper_teeth_p_u = lower_lip_under_upper_teeth_p_u / d

print "p(u): ", lower_lip_under_upper_teeth_p_u
lower_lip_under_upper_teeth_p_u_list.append(lower_lip_under_upper_teeth_p_u)

return lower_lip_under_upper_teeth_p_u_list

def mel_script() :
""" Generating the mel script with the animation information """
print "\n The mel script generated for the input speech with the chosen energy level"
with open("mel.txt", "w") as melFile :
melFile.write('setKeyframe "BS_stickyLips_SL_recept.head_geo_stickyLips_wire";'
'setKeyframe "BS_stickyLips_baseSL_recept.head_geo";'
'setKeyframe "BS_stickyLips_wireSL_recept.head_geo";'
'setKeyframe "blend_shape.lip_round";'
'setKeyframe "blend_shape.jaw_open";'
'setKeyframe "blend_shape.lips_spread";'
'setKeyframe "blend_shape.lips_part";'
'setKeyframe "blend_shape.lower_lip_under_upper_teeth";')

for p in lower_lip_under_upper_teeth_bezier :
melFile.write('setAttr "blend_shape.jaw_open" %f ;' % p )
melFile.write('setKeyframe -breakdown 0 -hierarchy none -controlPoints 0 -shape 0 {"blend_shape"};')

但是我得到了一个错误,它是,

    for p in lower_lip_under_upper_teeth_bezier :
TypeError: 'function' object is not iterable

最佳答案

您没有调用函数。要调用它,请使用

lower_lip_under_upper_teeth_bezier(x_n, p0, p3)

并为参数替换适当的值。

关于python - 生成一个 mel 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8214006/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com