Reputation: 609
I am trying to animate an existing model I have made in Maya by using a Python script. However, I can't figure out how to access it or its polygons in order to animate them in the script. I know how to select objects beforehand but I just want to write things like this
cmds.setKeyframe( objectName, time = startTime, attribute ='rotateY', value = 0 )
where objectName is either my entire model or a specific polygon in the model
Upvotes: 0
Views: 189
Reputation: 2620
If you want to set attribute values inside your setKeyFrame call like you have shown in your code, you will have to set the attribute
string appropriately. Egs. To set the y transform of a vertex attribute and keyframe it you'd do:
objectName = 'pSphere1.vtx[297]'
cmds.setKeyFrame(objectName, attribute='pnty', value=0.7)
# Where 'pnty' stands for Point Y, which is the y transform value for vertices.
Another way would be to perform all the transforms before the call to cmds.setKeyFrame() and call it with the controlPoints=True so it catches vertex and control point changes, as @theodox suggested.
Upvotes: 1