Hey guys! I have started to write my very first script in Python for Maya and it seems to work just fine but I want to improve it in a few ways.
So first I'm going to show and describe this script for you and then those things I want to change/add. *How it looks:* http://i.imgur.com/tRLRX7Y.png *Code:* http://pastebin.ubuntu.com/6478436/ *What it does:* Main purpose of this tool/script is to be an alternative and more convenient way to set up "Custom axis orientation" which in Maya is represented in radians. So what actually this tool allows you to do is to set X, Y and Z orientation in degrees. Furthermore it gives you some additional options (as you can see in the screenshot above). *How I want to improve it:* 1. Allow to set Custom axis orientation for Rotation tool. This is probably the hardest thing (I assume). As you can see in the image above, "Rotation" option is currently greyed out. That’s because manipRotateContext doesn’t have "Custom axis orientation" mode ( http://download.autodesk.com/global/docs/maya2013/en_us/CommandsPython/show.html?manipRotateContext.html&cat=General<http://download.autodesk.com/global/docs/maya2013/en_us/CommandsPython/show.html?manipRotateContext.html&cat=General>). Is there a way to achieve this effect - rotate Rotation axis? 2. Refresh text (values) in frame "Current values in degrees" after clicking on "Apply" button. When window is created, in frame "Current values in degrees" values of X, Y and Z are retrieved from three fields in "Custom axis orientation". Then they are converted to degrees and displayed (lines 63-83 in the code linked above). But what I also want is to refresh them each time I click "Apply" button. Is there a way to achieve this? 3. Combine formatting of "width", "align" and "precision" in Python. Lines 75-83 are showing Python .format method. Each value has 3 float digit precision (.3f) and in addition to that they are right-aligned with 10 value (>10). Ok, that’s good but I what also want is to have three "0" before dot. So I want apply [width] to it ( http://docs.python.org/2.6/library/string.html#format-specification-mini-language). But I don’t know how to mix [align], [width] and [.precision] together in one formatting {}. 4. Code improvements Because it’s my first script/tool and because I have learning Python for only 3 month now – I don’t have too much experience in it – any advice about the code structure will be highly appreciated :* PS. And as always sorry for my English. -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/f002cc5e-5a10-4c24-b06b-a71c53860f90%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
