Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2012
    Posts
    1

    python newbie question

    Hey everyone,

    I'm trying to animate some type with python. I created some variables with strings, the print bothlines works fine, but I can't figure out what attribute to work so that this would animate line1 and line 2 into maya through 0-24 frames. If I change bothlines to line1 or line2 it'll split each word onto it's own line, but I want python to split each variable onto it's own line. Any help would be fantastic!

    Thanks!

    Code:
    import maya.cmds as cmds
    
    line1 = 'this is line one'
    line2 = 'this is line two'
    
    bothlines = [line1, line2]
    
    print bothlines
    
    for i,words in enumerate(bothlines.split()): 
        getWords = cmds.textCurves(t=words)
        cmds.setKeyframe(getWords[0]+'.ty',value=0,time=0)
        cmds.setKeyframe(getWords[0]+'.ty',value=-1*i,time=24*i)

  2. #2
    Join Date
    Jul 2005
    Posts
    634
    Its still a little early for me so I'm not 100% certain on what your looking for but try looping through the slit without the split.

    So:
    Code:
    for line in bothlines:
        getWords = cmd.textCurves(t=line)
    The first iteration of the for loop will use the first index of the list which is line1, second iteration will be line2.

    So you will end up with two textCruves one that says "this is line one" and one that says "this is line two".

    Is that what your after?
    Si vis pacem, para bellum

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •