gpt4 book ai didi

python : export keyframe from maya in line

转载 作者:行者123 更新时间:2023-12-05 06:34:51 25 4
gpt4 key购买 nike

我正在尝试制作一个脚本,将所有需要的参数写在一行中,而不是一行中,以创建一个到 nuke 的管道(关键帧在行中)要在 nuke 中有效,关键帧需要像这样

translate {{curve R x1 list of valueX}} {curve R x1 list of valueY}} {curve R x1 list of valueZ}}

例子

translate {{curve R x1 10 11.03448296 12.06896591 13.10344791 14.13793087 15.17241383} {curve R x1 20 22.06896591 24.13793182 26.20689583 28.27586174 30.34482765} {curve R x1 30 33.10344696 36.20689774 39.3103447 42.41379166 45.51724243}}

现在我能够从我想要的属性中提取值,但它会导致列,当我输入几个命令时,它会返回并出错

def convert():
print "Loading file: "

# Select the incoming tracked camera
cmds.select('Camera0Node', r=1)

# Get first and last key set to determine bake range
firstKey = int(cmds.findKeyframe(time=(0, 100000), which='first'))
lastKey = int(cmds.findKeyframe(time=(0, 100000), which='last'))
print "Frame range: [", int(firstKey), ":", int(lastKey), "]"

# Enable depth of field
tx = cmds.getAttr(".tx")
ty = cmds.getAttr(".ty")
tz = cmds.getAttr(".tz")
rx = cmds.getAttr(".rx")
ry = cmds.getAttr(".ry")
rz = cmds.getAttr(".rz")
hfa = cmds.getAttr('.horizontalFilmAperture')
vfa = cmds.getAttr('.verticalFilmAperture')
fl = cmds.getAttr('.focalLength')
vfov = 2 * (math.atan2(vfa/2.0*25.4,fl) * 180 / math.pi);

# Bake out to Euler angles
cmds.bakeResults('Camera0Node',sparseAnimCurveBake=False, minimizeRotation=True, removeBakedAttributeFromLayer=False, removeBakedAnimFromLayer=False, oversamplingRate=1, bakeOnOverrideLayer=False, preserveOutsideKeys=False, simulation=True, sampleBy=1, shape=True, t=(firstKey, lastKey), disableImplicitControl=True, controlPoints=False)
print str(tx)

convert()

返回

Loading file: 
Frame range: [ 1 : 504 ]
2385.11

所以我只有一个 x 值,我如何获取所有关键帧值并将其格式化为 nuke 方式?

谢谢

最佳答案

我找到了答案:

keyframe -q -vc Camera0Node.translateX

你给了我我所需要的。

谢谢。

关于 python : export keyframe from maya in line,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49984662/

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