I think what Christoper is asking is for you to write his software for him. But Christopher, that my friend is called taking advantage of people's goodwill. I can only speak for myself, but I'd rather help you learn to do it on your own, than to be your monkey.
On 4 June 2015 at 06:49, Joe Weidenbach <[email protected]> wrote: > You will basically need to come up with a desired UI layout. For a file > dialog, you could do something similar to this: > > import os.path > > import maya.cmds as cmds > > homeDir = os.path.expanduser("~") > > filter = "Jpeg Images (*.jpg)" > filePath = cmds.fileDialog2(cap="Choose File Save Directory", > startingDirectory=homeDir, > fileFilter=filter, fileMode=0) > > print filePath[0] > > That would get you the desired folder and filename, which you could then > split apart and attach your tile numbering to. For the most part, the > Python versions of the UI elements work the same as their MEL > counterparts. If you can write the UI in MEL, it's pretty easy to > translate it to Python. Python gives some extra benefits in terms of > string manipulation and other things. I haven't played with it, but it > looks to me like this whole project could be written in Python. I left the > uvSnapshot command in MEL for the sake of demonstrating the appropriate use > case of calling MEL code from Python in my earlier code. > > If you're struggling with converting from MEL to Python, I did a basic > writeup on my blog outlining some of the major differences. > > http://jaydubonline.com/2014/10/01/1-1-2-introduction-to-mel/ > http://jaydubonline.com/2014/10/08/1-1-3-introduction-to-python/ > > I unfortunately haven't had time to continue the series beyond the basics > of variables, but it's at least a start. > > On Wed, Jun 3, 2015 at 3:13 PM, Joe Weidenbach <[email protected]> wrote: > >> Yes indeed I did. >> >> On Wed, Jun 3, 2015 at 2:15 PM, Crest Christopher < >> [email protected]> wrote: >> >>> You rewrote the MEL code in python correct ? >>> >>> Crest Christopher <[email protected]> >>> Wednesday, June 03, 2015 5:14 PM >>> I would like the UI to let the user choose. >>> >>> Joe Weidenbach wrote: >>> Joe Weidenbach <[email protected]> >>> Wednesday, June 03, 2015 4:00 PM >>> Are you looking to specify those as code, or do you want a UI to let the >>> use choose? Two very different scenarios. >>> >>> >>> -- >>> You received this message because you are subscribed to a topic in the >>> Google Groups "Python Programming for Autodesk Maya" group. >>> To unsubscribe from this topic, visit >>> https://groups.google.com/d/topic/python_inside_maya/T7kfPkQi68A/unsubscribe >>> . >>> To unsubscribe from this group and all its topics, send an email to >>> [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/python_inside_maya/CAM33%3Da7bqAj08ogetFbmuEUShQbzp%3Dy-5ASg%2Bm23R%3D4AaLxwMQ%40mail.gmail.com >>> <https://groups.google.com/d/msgid/python_inside_maya/CAM33%3Da7bqAj08ogetFbmuEUShQbzp%3Dy-5ASg%2Bm23R%3D4AaLxwMQ%40mail.gmail.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> Christopher. <[email protected]> >>> Wednesday, June 03, 2015 1:36 PM >>> Hi Joe, that works well, thank you, *but*, can I squeeze in a addition >>> ? ;-) >>> Can choose where to save & the resolution from 1024 to max 8192 res ? >>> >>> On Wednesday, June 3, 2015 at 1:28:46 PM UTC-4, Christopher. wrote: >>> -- >>> You received this message because you are subscribed to a topic in the >>> Google Groups "Python Programming for Autodesk Maya" group. >>> To unsubscribe from this topic, visit >>> https://groups.google.com/d/topic/python_inside_maya/T7kfPkQi68A/unsubscribe >>> . >>> To unsubscribe from this group and all its topics, send an email to >>> [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/python_inside_maya/797eb677-ca8d-4b01-92b5-45c72e7d4461%40googlegroups.com >>> <https://groups.google.com/d/msgid/python_inside_maya/797eb677-ca8d-4b01-92b5-45c72e7d4461%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> Crest Christopher <[email protected]> >>> Wednesday, June 03, 2015 1:28 PM >>> Hi Joe, before testing your code, I agree with you, the code is best run >>> in MEL before you even brought up that concern I was thinking, it doesn't >>> make sense, and if someone in the group brought it to the surface, it >>> wouldn't surprise me. >>> >>> The reason; the MEL code has to be wrapped in python code, otherwise the >>> other script, did I mention it was part of another script, regardless if I >>> did or didn't, it can't read MEL individually, that is why, not I wanted >>> to, or felt the desire to ;-) instead I had to wrap it in python. ;-) >>> >>> Let me give your code a run ;-) >>> >>> Joe Weidenbach wrote: >>> Joe Weidenbach <[email protected]> >>> Wednesday, June 03, 2015 1:21 PM >>> Questioning the code aside: >>> >>> The immediate issue you're running into seems to be that Python doesn't >>> support multi-line strings which are just denoted with a single quotation >>> mark. >>> >>> If you're going for multi-line strings, you'll need to use the >>> multi-line string quote-- """String here""" -- Note the triple quotations. >>> >>> With that said, I agree with Marcus here. >>> >>> First, why are we calling this script from Python? It seems like it >>> might be better suited to be entirely in MEL. I've run into a number of >>> situations where I need to call MEL code from my Python scripts, but this >>> looks like primarily coding in MEL and then forcing it into Python. >>> >>> You could do the same thing more like this: >>> >>> # Avoid importing under other names >>> import maya.mel as mel >>> >>> uMin = -1 >>> uMax = 1 >>> vMin = -1 >>> vMax = 1 >>> >>> for i in range(uMin, uMax - uMin): >>> for j in range(uMin, uMax - uMin): >>> path = r"c:\\5\\uvImage_u{0}_v{1}.jpg".format(i+1, j+1) >>> UVCmd = r'uvSnapshot -o -aa -uMin {0} -uMax {1} - vMin {2} -vMax >>> {3} -n "{4}" -xr 4096 -yr 4096 -ff jpg;' >>> UVCmd = UVCmd.format(i, i+1, j, j+1, path) >>> mel.eval(UVCmd) >>> >>> It's best if you're going to use Python to use it all the way through, >>> with independent MEL commands where there is no other option (which, to be >>> fair, happens all too often in Maya). >>> >>> Let me know if you have questions on that code, I utilized a few string >>> formatters that I find make my code easier to read, but can be a bit >>> confusing if you're not used to them. >>> >>> Hope that helps! >>> >>> On 6/3/2015 8:58 AM, Christopher. wrote: >>> >>> >>> >>> ------------------------------ >>> <https://www.avast.com/antivirus> >>> >>> This email is free from viruses and malware because avast! Antivirus >>> <https://www.avast.com/antivirus> protection is active. >>> >>> -- >>> You received this message because you are subscribed to a topic in the >>> Google Groups "Python Programming for Autodesk Maya" group. >>> To unsubscribe from this topic, visit >>> https://groups.google.com/d/topic/python_inside_maya/T7kfPkQi68A/unsubscribe >>> . >>> To unsubscribe from this group and all its topics, send an email to >>> [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/python_inside_maya/556F379A.6010608%40gmail.com >>> <https://groups.google.com/d/msgid/python_inside_maya/556F379A.6010608%40gmail.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >>> -- >>> 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/556F6E79.1030903%40gmail.com >>> <https://groups.google.com/d/msgid/python_inside_maya/556F6E79.1030903%40gmail.com?utm_medium=email&utm_source=footer> >>> . >>> >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> > -- > 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/CAM33%3Da5QP8y0GE7z1msrWPzehW2NHT988d-ktt5079qy14jR%3DA%40mail.gmail.com > <https://groups.google.com/d/msgid/python_inside_maya/CAM33%3Da5QP8y0GE7z1msrWPzehW2NHT988d-ktt5079qy14jR%3DA%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- *Marcus Ottosson* [email protected] -- 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/CAFRtmOBoW_ewyMQunCsAU_PFJXe48HQKxOEZjnOcb47eRZYp9Q%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
