You could check if it has a parent first:
hasParent = bool(cmds.listRelatives("cube2", parent=True))
Justin
On Fri, Feb 24, 2017 at 9:42 AM likage wrote:
> This is my outliner, eg. '|hie1|cube1' and 'cube2'
>
> If I select cube1 and did:
> cmds.parent("|hie1|cube1", world=True)
>
>
> This
On Fri, Feb 24, 2017 at 9:36 AM likage wrote:
> Hi Justin,
>
> Sorry for the late reply.
>
> It works like a charm, thanks!
>
Sweet! You are welcome.
>
>
> On Thursday, February 16, 2017 at 8:04:50 PM UTC-8, Justin Israel wrote:
>
> Untested, but that looks to be almost exactly the same logic
This is my outliner, eg. '|hie1|cube1' and 'cube2'
If I select cube1 and did:
cmds.parent("|hie1|cube1", world=True)
This will unparent my cube1 out of hie1 and into 'world' level? Sorry,
can't think of a better term.
But if I did the same thing to cube2:
cmds.parent("cube2", world=True)
I wi
Hi Justin,
Sorry for the late reply.
It works like a charm, thanks!
On Thursday, February 16, 2017 at 8:04:50 PM UTC-8, Justin Israel wrote:
>
> Untested, but that looks to be almost exactly the same logic as what I
> gave you for tracking the counts for each user/product. But instead of
> tr
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. F
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:1
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.
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
Quick questions here :
How do you properly destroy your objects and MScriptutils.. ?
Any optimization tricks ?
Finally how many of you guys use Python API 2.O ?
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubs