0 Replies - 418 Views - Last Post: 15 June 2016 - 02:36 PM Rate Topic: -----

#1 //Claudcaad  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 03-May 16

For loop for motionPath assigning in Maya

Posted 15 June 2016 - 02:36 PM

Hello,

I have written a script in python which I intend to use in Maya to assign a sphere to curves (animationPath) that are in my scene. The curves are named 'curve_pt_0', 'curve_pt_1','curve_pt_2','curve_pt_3'etc.

I want to assign a sphere to each of these curves. I have written the following script that does this for the first curve.

import maya.cmds as cmds

#create a set of objects for the motion path animation
#assign the path e.g the curves

path = 'curve_pt_$0'

#create the object to asign to the curve

object = cmds.sphere()
cmds.scale(0.024, 0.024, 0.024)

#animate the sphere along the specified curve for an amount of time e.g 0-200

cmds.pathAnimation( object[0], stu=0, etu=200, c=path)

cmds.snapshot( 'nurbsSphere1', constructionHistory = True, startTime = 0, endTime = 200, increment = 2)


I know that I need to create a for loop in order for this to apply to all the curves with stepped names but I can seem to figure out how to put this into a for loop!

Is there anyone who may be able to help me??

please please :)

Is This A Good Question/Topic? 0
  • +

Page 1 of 1