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:
>
> 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:
>
>
> 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 string s, 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:
>
>
> import maya.mel as multiuvexport
> multiuvexport.eval (
> "{
> int $uMin=-1;
> int $uMax=1;
> int $vMin=-1;
> int $vMax=1;
>
> int $i,$j;
> string $UVCmd;
>
>
> for ($i = $uMin; $i < $uMax; $i++)
> {
> for ($j = $vMin; $j < $vMax; $j++)
> {
> $UVCmd = "uvSnapshot -o -aa -uMin "+$i+" -uMax "+($i+1)+" -vMin
> "+$j+" -vMax "+($j+1)+ "-n
> \"c:\5\uvImage_u"+($i+1)+"_v"+($j+1)+".jpg\" -xr 4096 -yr 4096 -ff
> jpg;" ;
> eval $UVCmd;
> }
>
> }
>
> }"
>
> )
>
> On Tuesday, June 2, 2015 at 3:53:41 PM UTC-4, Justin Israel wrote:
>
> Please paste an example of your actual code. A big pink long
> probably means you have a python syntax error. The Mel code
> should be in an actual string so it should syntax highlight like
> a string.
>
>
> On Wed, 3 Jun 2015 1:36 AM Christopher. <[email protected]
> <javascript:>> wrote:
>
> The beginning and end of the MEL string has a nice long pink
> line in Sublime, I assume this is because Sublime doesn't
> & nbsp; have syntax highlighting for MEL ?
>
> The MEL code doesn't execute, I get a SyntaxError on line 1:
> EOL while scanning string literal ?
>
> On Monday, June 1, 2015 at 10:53:28 PM UTC-4, Justin Israel
> wrote:
>
>
>
> On Tue, Jun 2, 2015 at 2:07 PM Christopher.
> <[email protected]> wrote:
>
> Alright;
> import maya.mel as *whatever name*
> &nbs p; *whatever name*.eval (
> <MEL script>
> )
> Correct ?
>
>
> Yep. Where <MEL script> is a string.
>
>
> Converters are fine for some, I rather understand the
> guts :)
>
>
> On Sunday, May 31, 2015 at 3:34:38 PM UTC-4,
> Christopher. wrote:
>
> Hi, I have a script that uses the def() syntax,
> the problem is the original code is MEL, using
> the following syntax is not working ?
>
> def acme()
> [MEL code]
> acme()
>
>
>
>
>   ; --
> 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 vi sit
>
> https://groups.google.com/d/msgid/python_inside_maya/e4cafeca-cf47-4477-85be-4216a8beca6e%40googlegroups.com
> <
> https://groups.google.com/d/msgid/python_inside_maya/e4cafeca-cf47-4477-85be-4216a8beca6e%40googlegroups.com?utm_medium=email&utm_source=footer
> >.
> For more options, visit
> https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
>
> --
> You received this message because you a re 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] <javascript:>.
> To view this discussion on the web visit
>
> https://groups.google.com/d/msgid/python_inside_maya/57ff7082-05fb-4a49-9a65-57a25ea97041%40googlegroups.com
> <
> https://groups.google.com/d/msgid/python_inside_maya/57ff7082-05fb-4a49-9a65-57a25ea97041%40googlegroups.com?utm_medium=email&utm_source=footer
> >.
> For more options, visit https://groups.google.com/d/optout
>   ; <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]
> <mailto:[email protected]>.
> To view this discussion on the web visit
>
> https://groups.google.com/d/msgid/python_inside_maya/e2fe1755-9028-49a8-97f3-c141f7e5404e%40googlegroups.com
>
> <
> https://groups.google.com/d/msgid/python_inside_maya/e2fe1755-9028-49a8-97f3-c141f7e5404e%40googlegroups.com?utm_medium=email&utm_source=footer
> >.
> For more options, visit https://groups.google.com/d/optout.
>
>
>
>
>
> ------------------------------------------------------------------------
> <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]
> <mailto:[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/797eb677-ca8d-4b01-92b5-45c72e7d4461%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.