Re: [Maya-Python] Rename all objects in list with name of an other lists

2017-02-23 Thread denis hoffmann
Thank you very mutch, you are my hero!

import maya.cmds as cmds

ShaderNames = cmds.ls ('phong*',  mat=True)

NewNames = ('Name1', 'Name2','Name3','Name4','Name5',)

for i in xrange(len(ShaderNames)):
cmds.rename (ShaderNames[i] , NewNames[i])

That is my final resoult.



Am Donnerstag, 23. Februar 2017 18:53:08 UTC+1 schrieb Michał Frątczak:
>
> smth like this...
>
> for i in xrange(len(ShaderNames)):
> rename ShaderNames[i]  NewNames[i]
>
>
> W dniu 2017-02-23 o 17:14, denis hoffmann pisze:
>
> Hey guys,
>
> I want to rename all shaders with names from a list.
>
> so I make a list of all shaders and a var with all names I want to have.
>
> ShaderNames = [u'Shader0', u'Shader1', u'Shader2', u'Shader3', u'Shader4', 
> u'Shader5']
>
> NewNames = ['Name1', 'Name2', 'Name3', 'Name4', 'Name5']
>
>
> what is the solution if I want to have my "Shader0"  new name is "Name1" 
>
> Thank You very mutch!!!
>
>
>
>
>

-- 
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/eb75ed5c-b026-4918-a96d-fe639c8d7bb3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Rename all objects in list with name of an other lists

2017-02-23 Thread Robert White
for shader_name, new_name in zip(ShaderNames, newNames):
rename shader_name, new_name

On Thursday, February 23, 2017 at 11:53:08 AM UTC-6, Michał Frątczak wrote:
>
> smth like this...
>
> for i in xrange(len(ShaderNames)):
> rename ShaderNames[i]  NewNames[i]
>
>
> W dniu 2017-02-23 o 17:14, denis hoffmann pisze:
>
> Hey guys,
>
> I want to rename all shaders with names from a list.
>
> so I make a list of all shaders and a var with all names I want to have.
>
> ShaderNames = [u'Shader0', u'Shader1', u'Shader2', u'Shader3', u'Shader4', 
> u'Shader5']
>
> NewNames = ['Name1', 'Name2', 'Name3', 'Name4', 'Name5']
>
>
> what is the solution if I want to have my "Shader0"  new name is "Name1" 
>
> Thank You very mutch!!!
>
>
> -- 
> 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/a9ca5154-c746-4b35-8789-088d654186b0%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/0ca3db9c-bb43-43e1-9b3c-76fff114c999%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Rename all objects in list with name of an other lists

2017-02-23 Thread f.michal

  
  
smth like this...
  
  for i in xrange(len(ShaderNames)):
      rename ShaderNames[i]  NewNames[i]
  
  
  W dniu 2017-02-23 o 17:14, denis hoffmann pisze:


  Hey guys,

I want to rename all shaders with names from a list.

so I make a list of all shaders and a var with all names I want
to have.

ShaderNames = [u'Shader0', u'Shader1', u'Shader2', u'Shader3',
u'Shader4', u'Shader5']

NewNames = ['Name1', 'Name2', 'Name3', 'Name4', 'Name5']


what is the solution if I want to have my "Shader0"  new name is
"Name1" 

Thank You very mutch!!!


  
  -- 
  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/a9ca5154-c746-4b35-8789-088d654186b0%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/0e9d438d-a07c-3b07-01a2-e48f107b1d58%40gmail.com.
For more options, visit https://groups.google.com/d/optout.