Introduction to Maya - Modeling Fundamentals Vol 2
This course will look in the fundamentals of modeling in Maya with an emphasis on creating good topology. It's aimed at people that have some modeling experience in Maya but are having trouble with complex objects.
# 1 14-07-2014 , 04:36 PM
Subscriber
Join Date: Sep 2013
Posts: 3

Keyframe simple maya loops in python?

Hey,

I have this very simple python script in Maya that I want to "animate".
I first want to adapt the end time of the animation to the number of iterations, in order to have enough keyframes for the animation.
After that I want to add a keyframe for the movement of the polyCube at each loop iteration to produce the moving animation.

Code:
import maya.cmds as mc

iterations = 10 #number of keyframes
transVal = 1 #translation value for each iteration

mc.polyCube(constructionHistory=True, width=1, height=1, depth=1)

for i in range(iterations):
    mc.move(transVal, cube, relative=True, moveZ=True)
    mc.setKeyframe(insert=True, value=i)
Would it alternatively be possible to add a keyframe at the beginning and one at the end and let maya calculate the motion tweens (like it does when using the UI)?

Any ideas?

Thanks.

Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads