Monday, November 21, 2011

learning the Python

Well I started to take a class on CG-talk about python
seeing that most riggers know a programming language that's causally a real programming language besides just knowing mel. I know I need to learn more stuff. And also I need to do something while looking for work.

I heard great things about python on how it's fairly easy to get into and used often in maya
So far I think python is pretty cool, and way cleaner than mel and alot easier to read and write the syntax is more simplistic which great for starters like me

Here is a homework from the class which I need write a script which create objects randomly
So when the script is run it creates sphere equal to whatever the user inputted and then creates boxes between each sphere

Link to the Script Here

While that is happening I have a lot of mel script I need to covert to python script
Ugh...The 'Fun' begins!!!

1 comment:

  1. Haha, Maya totally barfed an error at me when I first ran your script.

    # # C:\Program Files\Autodesk\Maya2012\bin\maya.exe:61: DeprecationWarning: integer argument expected, got float
    I;ý~ I+ýë 3ÿL‹æH‰t$(H‹L1HH…Ét HƒÁ ÿ ×~ #generate box scrip

    The reason for the error is that line 61:
    intDist = math.floor (distLen)

    Should be
    intDist = int(math.floor (distLen))

    This is one of those weird errors where the traceback says it's in maya.exe, when it's actually in your script.

    You probably knew intDist should be a int, given the name... I just love the gibberish characters Python/Maya spits out after the error.