Maya for 3D Printing - Rapid Prototyping
In this course we're going to look at something a little different, creating technically accurate 3D printed parts.
# 1 14-07-2014, 04:36 PM
St4rb0y
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.

 
Thread Tools Search this Thread
Reply to this thread
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