玛雅蟒蛇和相机动画



嘿,所以在使用python的Maya中,我正在导入带有键控动画锁定的摄像机,我只是希望底部的时间滑块更新为导入的摄像机的动画长度。我可以让时间滑块进行调整,我只是无法找到通过 python 调整它的关键帧。

(例如:我导入了 4 个摄像机。1 个摄像机是 10 个关键帧。2 和 3 是 15 个关键帧。然后 4 个是 52。所以我希望时间滑块是 1-52。我可以让它移动,但我不知道如何找到数字 52)

编辑:对不起,基本上我导入了我的相机

cams = [cam1,cam2,cam3,cam4]

对于 x 个凸轮:

cmds.file(x, i=True, dns=True, rnn = True) #i for import
 # this is how i change the timeslider but I want it to
 # be the number of keyframed animation on the camera
cmds.playbackOptions(max=1000)
camera = 'Camera1'
channel = 'translateX'
keyframes = cmds.keyframe('{}.{}'.format(camera, channel), query=True)
first, last = keyframes[0], keyframes[-1]
cmds.playbackOptions(min=first, max=last, ast=first, aet=last)

无论通道是否锁定,这都有效。

最新更新