Re: [Maya-Python] Re: some Mel toughts

2017-08-19 Thread yury nedelin
I am curious , why not python ?
Yury

On Sat, Aug 19, 2017 at 2:46 PM, Cedric Bazillou 
wrote:

> Like the other people said its a scripting language, and your variable are
> strongly typed ( so what is the point of whining :its normal to be confused
> when to start using something new...)
> most of what you said for string manipulation has an equivalent in mel (
> just need to learn how the docs are organized )
>
> SO yeah its more difficult but you dont need OOp everywhere certainly not
> and at a scripting level ( automation and normal user executing code they
> drag from the script editor...).
>
> A lot of people tend to be lure into aesthetics part of code when its the
> functionality and robustness which matters ( code maintenance and upgrade
> is another beast ).
> When you will be a bit more c++ savy you can create your how nodes a
> command to do the actual work i you dont like mel syntax (for other people
> we work together at ilion btw )?
>
> Le vendredi 18 août 2017 17:08:56 UTC-5, Rudi Hammad a écrit :
>>
>> Hello,
>> I recently started a job in a studio that relies only on Mel, where
>> python is officially forbidden to use. I never used mel before. Since I am
>> familiar with C++ it was easy to learn, but still, I would like to share
>> some thought and try to explain
>> why I don´t like it. I only know 3 languages, python, c++ and mel now, so
>> maybe you can shed some light and tell me if my thoughts are wrong or if
>> you agree:
>>
>> 1-Why do you need to declare the data types in a high level scripting
>> languages? Aren´t data types declaration supposed to help manage memory to
>> optimize your programs? Since mel is high level, do you really need
>> declaring data types?
>>
>> 2-the dollar sign before each variable. why? it feels that mel is not
>> smart enough to understand . It needs not only the declaration data type,
>> but also a $ to understand that you are creating a variable.
>>
>> 3-working with strings is excruciating in Mel. In python, since
>> everything is an object you can access all the string methods.
>> .capitalize(), .split() etc... To do simple .split in mel, you have to
>> create a empty array first, then use a proc like tokenize, give it the name
>> to split, where to do the split, and cast it in the empty array, and
>> finally, retrieve the index you need in that array in python you simply
>> do somehting like myName = l_myControl_CTR.split("_CTR")[0]...
>>
>> 4- quote marks to have a variable take a return. so string $myArray[] =
>> `ls -sl`;
>>
>> 5- no default values on arguments?! you can' t do something like proc
>> myFunc(string $myName="foo", int $default=1)
>>
>> (6. Also of course not having dictionaries , no external library, no OOP,
>> no access to the API are also big things to consider)
>>
>>
>> My point is not to criticize anyone using Mel. This list is just to help
>> me understand a bit better how scripting languages compare to each other.
>> When you work in a studio with a huge Mel legacy you have to get along
>> with it. And I do, I already developed many thing is mel. My only problem
>> is that I am not allowed to use python, but it is what it is.
>>
>> Anyway, to sum up, for the reasons I exposed above, I find Mel not smart,
>> long, ugly, very painful when it comes to strings, and very limited.
>>
>> So as I said, my point is not to criticize Mel, but try to understand it
>> a little better. Do you agree with anything I said, or am I just crazy
>>
>> Thanks,
>> R
>>
> --
> 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 python_inside_maya+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/python_inside_maya/5c37a29e-ace2-470f-af93-
> 5233240f7509%40googlegroups.com
> 
> .
> 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 python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CACqGSchO78a7TSV4wgTbYS3j7g%2BbJ6hGOT3xrmkBF7FXZzFtMw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Python Noob question

2017-08-19 Thread Johnathan Scoon
Thanks Justin, you're a rock star!

On Saturday, 19 August 2017 18:10:40 UTC-4, Justin Israel wrote:
>
>
>
> On Sun, Aug 20, 2017 at 1:51 AM Johnathan Scoon  > wrote:
>
>> Hey thanks haggi, that definitely works. I'm still curious if there is a 
>> way to make a list of ascending objects into a range? Or do you think this 
>> would not ever be necessary?
>>
>
> It could be neccessary given the circumstances. The following creates an 
> empty list and then performs a for-loop to append formatted strings:
>
> objs = []for i in xrange(1, 10):
> objs.append('BLOCK{}'.format(i))
>
> ​
>
> Python provides a feature called list comprehension, which can perform the 
> equivalent:
>
> objs = ['BLOCK{}'.format(i) for i in xrange(1, 10)]
>
> ​
>
>
>
>>
>> On Saturday, 19 August 2017 09:43:26 UTC-4, haggi wrote:
>>>
>>> At a first glance, you do not need the BlockList at all because you so 
>>> not use the contents. You only use it to get a number of elements to 
>>> iterate over. You would get the same result if you simply do a:
>>>
>>> for i in range(10):
>>>   cmds.duplicate()
>>>   
>>>
>>>
>>> Just in case you want to give the new objects a name, you can do a:
>>>
>>> newName = "BLOCK{0}".format(i)
>>>
>>> haggi
>>>
>>> Am 19.08.2017 um 15:31 schrieb Johnathan Scoon:
>>>
>>> Hey guys, I'm just playing around with simple for loops trying to get my 
>>> head around it. I wrote a script that creates a series of cubes and places 
>>> them a certain distance apart on the translate X axis. 
>>>
>>> from maya import cmds
>>> BlockList = ("BLOCK", "BLOCK1", "BLOCK2", "BLOCK3", "BLOCK4", "BLOCK5")
>>> cmds.polyCube(n="BLOCK")
>>> for s in BlockList:
>>>  cmds.duplicate()
>>>  Name = cmds.ls (selection = True)
>>>  movevalue = 2
>>>  postvalue = cmds.getAttr(Name[0]+".tx")
>>>  shift = movevalue + postvalue
>>>  cmds.move(shift,0,0)
>>>
>>>
>>> Now this works fine but what if I wanted to increase the number of cubes 
>>> to say 100 or more? It would be inefficient for me to have to type all 
>>> those names out into Blocklist. I know you can represent a long list of 
>>> numbers in a range, but I can't seem to find any information on how to make 
>>> a range what would include object names with the numbers. Any help here is 
>>> greatly appreciated! 
>>> -- 
>>> 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 python_inside_maya+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/python_inside_maya/6509bf81-3b30-4099-a1c8-de3358da91cd%40googlegroups.com
>>>  
>>> 
>>> .
>>> 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 python_inside_maya+unsubscr...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/python_inside_maya/b253ca55-244f-4018-859e-93de87637bb5%40googlegroups.com
>>  
>> 
>> .
>> 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 python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/1252be4a-22c9-4209-abd7-9ab84c285f82%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Python Noob question

2017-08-19 Thread Justin Israel
On Sun, Aug 20, 2017 at 1:51 AM Johnathan Scoon 
wrote:

> Hey thanks haggi, that definitely works. I'm still curious if there is a
> way to make a list of ascending objects into a range? Or do you think this
> would not ever be necessary?
>

It could be neccessary given the circumstances. The following creates an
empty list and then performs a for-loop to append formatted strings:

objs = []for i in xrange(1, 10):
objs.append('BLOCK{}'.format(i))

​

Python provides a feature called list comprehension, which can perform the
equivalent:

objs = ['BLOCK{}'.format(i) for i in xrange(1, 10)]

​



>
> On Saturday, 19 August 2017 09:43:26 UTC-4, haggi wrote:
>>
>> At a first glance, you do not need the BlockList at all because you so
>> not use the contents. You only use it to get a number of elements to
>> iterate over. You would get the same result if you simply do a:
>>
>> for i in range(10):
>>   cmds.duplicate()
>>   
>>
>>
>> Just in case you want to give the new objects a name, you can do a:
>>
>> newName = "BLOCK{0}".format(i)
>>
>> haggi
>>
>> Am 19.08.2017 um 15:31 schrieb Johnathan Scoon:
>>
>> Hey guys, I'm just playing around with simple for loops trying to get my
>> head around it. I wrote a script that creates a series of cubes and places
>> them a certain distance apart on the translate X axis.
>>
>> from maya import cmds
>> BlockList = ("BLOCK", "BLOCK1", "BLOCK2", "BLOCK3", "BLOCK4", "BLOCK5")
>> cmds.polyCube(n="BLOCK")
>> for s in BlockList:
>>  cmds.duplicate()
>>  Name = cmds.ls (selection = True)
>>  movevalue = 2
>>  postvalue = cmds.getAttr(Name[0]+".tx")
>>  shift = movevalue + postvalue
>>  cmds.move(shift,0,0)
>>
>>
>> Now this works fine but what if I wanted to increase the number of cubes
>> to say 100 or more? It would be inefficient for me to have to type all
>> those names out into Blocklist. I know you can represent a long list of
>> numbers in a range, but I can't seem to find any information on how to make
>> a range what would include object names with the numbers. Any help here is
>> greatly appreciated!
>> --
>> 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 python_inside_maya+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/python_inside_maya/6509bf81-3b30-4099-a1c8-de3358da91cd%40googlegroups.com
>> 
>> .
>> 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 python_inside_maya+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/b253ca55-244f-4018-859e-93de87637bb5%40googlegroups.com
> 
> .
> 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 python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA1a7qpbY4AJ0S7-Tm6Z8hiTjLmg_ScrO7LcmtadToyUfA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Re: some Mel toughts

2017-08-19 Thread Cedric Bazillou
Like the other people said its a scripting language, and your variable are 
strongly typed ( so what is the point of whining :its normal to be confused 
when to start using something new...)
most of what you said for string manipulation has an equivalent in mel ( 
just need to learn how the docs are organized )

SO yeah its more difficult but you dont need OOp everywhere certainly not 
and at a scripting level ( automation and normal user executing code they 
drag from the script editor...).

A lot of people tend to be lure into aesthetics part of code when its the 
functionality and robustness which matters ( code maintenance and upgrade 
is another beast ).
When you will be a bit more c++ savy you can create your how nodes a 
command to do the actual work i you dont like mel syntax (for other people 
we work together at ilion btw )?

Le vendredi 18 août 2017 17:08:56 UTC-5, Rudi Hammad a écrit :
>
> Hello,
> I recently started a job in a studio that relies only on Mel, where python 
> is officially forbidden to use. I never used mel before. Since I am 
> familiar with C++ it was easy to learn, but still, I would like to share 
> some thought and try to explain 
> why I don´t like it. I only know 3 languages, python, c++ and mel now, so 
> maybe you can shed some light and tell me if my thoughts are wrong or if 
> you agree:
>
> 1-Why do you need to declare the data types in a high level scripting 
> languages? Aren´t data types declaration supposed to help manage memory to 
> optimize your programs? Since mel is high level, do you really need 
> declaring data types?
>  
> 2-the dollar sign before each variable. why? it feels that mel is not 
> smart enough to understand . It needs not only the declaration data type, 
> but also a $ to understand that you are creating a variable. 
>  
> 3-working with strings is excruciating in Mel. In python, since everything 
> is an object you can access all the string methods. .capitalize(), .split() 
> etc... To do simple .split in mel, you have to create a empty array first, 
> then use a proc like tokenize, give it the name to split, where to do the 
> split, and cast it in the empty array, and finally, retrieve the index you 
> need in that array in python you simply do somehting like myName = 
> l_myControl_CTR.split("_CTR")[0]...
>
> 4- quote marks to have a variable take a return. so string $myArray[] = 
> `ls -sl`;
>
> 5- no default values on arguments?! you can' t do something like proc 
> myFunc(string $myName="foo", int $default=1)
>
> (6. Also of course not having dictionaries , no external library, no OOP, 
> no access to the API are also big things to consider)
>
>
> My point is not to criticize anyone using Mel. This list is just to help 
> me understand a bit better how scripting languages compare to each other.
> When you work in a studio with a huge Mel legacy you have to get along 
> with it. And I do, I already developed many thing is mel. My only problem 
> is that I am not allowed to use python, but it is what it is.
>
> Anyway, to sum up, for the reasons I exposed above, I find Mel not smart, 
> long, ugly, very painful when it comes to strings, and very limited.
>
> So as I said, my point is not to criticize Mel, but try to understand it a 
> little better. Do you agree with anything I said, or am I just crazy
>
> Thanks,
> R
>

-- 
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 python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/5c37a29e-ace2-470f-af93-5233240f7509%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Python Noob question

2017-08-19 Thread Johnathan Scoon
Hey thanks haggi, that definitely works. I'm still curious if there is a 
way to make a list of ascending objects into a range? Or do you think this 
would not ever be necessary?

On Saturday, 19 August 2017 09:43:26 UTC-4, haggi wrote:
>
> At a first glance, you do not need the BlockList at all because you so not 
> use the contents. You only use it to get a number of elements to iterate 
> over. You would get the same result if you simply do a:
>
> for i in range(10):
>   cmds.duplicate()
>   
>
>
> Just in case you want to give the new objects a name, you can do a:
>
> newName = "BLOCK{0}".format(i)
>
> haggi
>
> Am 19.08.2017 um 15:31 schrieb Johnathan Scoon:
>
> Hey guys, I'm just playing around with simple for loops trying to get my 
> head around it. I wrote a script that creates a series of cubes and places 
> them a certain distance apart on the translate X axis. 
>
> from maya import cmds
> BlockList = ("BLOCK", "BLOCK1", "BLOCK2", "BLOCK3", "BLOCK4", "BLOCK5")
> cmds.polyCube(n="BLOCK")
> for s in BlockList:
>  cmds.duplicate()
>  Name = cmds.ls (selection = True)
>  movevalue = 2
>  postvalue = cmds.getAttr(Name[0]+".tx")
>  shift = movevalue + postvalue
>  cmds.move(shift,0,0)
>
>
> Now this works fine but what if I wanted to increase the number of cubes 
> to say 100 or more? It would be inefficient for me to have to type all 
> those names out into Blocklist. I know you can represent a long list of 
> numbers in a range, but I can't seem to find any information on how to make 
> a range what would include object names with the numbers. Any help here is 
> greatly appreciated! 
> -- 
> 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 python_inside_maya+unsubscr...@googlegroups.com .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/python_inside_maya/6509bf81-3b30-4099-a1c8-de3358da91cd%40googlegroups.com
>  
> 
> .
> 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 python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/b253ca55-244f-4018-859e-93de87637bb5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Python Noob question

2017-08-19 Thread haggi
At a first glance, you do not need the BlockList at all because you so 
not use the contents. You only use it to get a number of elements to 
iterate over. You would get the same result if you simply do a:


for i in range(10):
  cmds.duplicate()
  

Just in case you want to give the new objects a name, you can do a:

newName = "BLOCK{0}".format(i)

haggi


Am 19.08.2017 um 15:31 schrieb Johnathan Scoon:
Hey guys, I'm just playing around with simple for loops trying to get 
my head around it. I wrote a script that creates a series of cubes and 
places them a certain distance apart on the translate X axis.


from maya import cmds
BlockList = ("BLOCK", "BLOCK1", "BLOCK2", "BLOCK3", "BLOCK4", "BLOCK5")
cmds.polyCube(n="BLOCK")
for s in BlockList:
 cmds.duplicate()
 Name = cmds.ls (selection = True)
 movevalue = 2
 postvalue = cmds.getAttr(Name[0]+".tx")
 shift = movevalue + postvalue
 cmds.move(shift,0,0)


Now this works fine but what if I wanted to increase the number of 
cubes to say 100 or more? It would be inefficient for me to have to 
type all those names out into Blocklist. I know you can represent a 
long list of numbers in a range, but I can't seem to find any 
information on how to make a range what would include object names 
with the numbers. Any help here is greatly appreciated!

--
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 python_inside_maya+unsubscr...@googlegroups.com 
.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/6509bf81-3b30-4099-a1c8-de3358da91cd%40googlegroups.com 
.

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 python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/e88860fb-7171-bcba-4685-8e20a3c9f15c%40haggi.de.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Python Noob question

2017-08-19 Thread Johnathan Scoon
Hey guys, I'm just playing around with simple for loops trying to get my 
head around it. I wrote a script that creates a series of cubes and places 
them a certain distance apart on the translate X axis. 

from maya import cmds
BlockList = ("BLOCK", "BLOCK1", "BLOCK2", "BLOCK3", "BLOCK4", "BLOCK5")
cmds.polyCube(n="BLOCK")
for s in BlockList:
 cmds.duplicate()
 Name = cmds.ls (selection = True)
 movevalue = 2
 postvalue = cmds.getAttr(Name[0]+".tx")
 shift = movevalue + postvalue
 cmds.move(shift,0,0)


Now this works fine but what if I wanted to increase the number of cubes to 
say 100 or more? It would be inefficient for me to have to type all those 
names out into Blocklist. I know you can represent a long list of numbers 
in a range, but I can't seem to find any information on how to make a range 
what would include object names with the numbers. Any help here is greatly 
appreciated! 

-- 
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 python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/6509bf81-3b30-4099-a1c8-de3358da91cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.