Re: [Maya-Python] Selects only the group nodes

2016-08-31 Thread likage
I will keep a lookout again. Perhaps it is a mistake on my part.. But in case if anyone chance upon this thread, I managed to get groups' selection by using 2 sets.. transform_set = set(cmds.listRelatives(cmds.ls(transforms=True), ap=True, ni =True)) mesh_set = set(cmds.listRelatives(cmds.ls(typ=

Re: [Maya-Python] Selects only the group nodes

2016-08-31 Thread Justin Israel
On Thu, Sep 1, 2016 at 10:29 AM likage wrote: > Also, why is it that sometimes I got this error: > # Error: 'list' object is not callable > # Traceback (most recent call last): > # File "", line 14, in > # File "", line 3, in test > # TypeError: 'list' object is not callable # > > that is st

Re: [Maya-Python] Selects only the group nodes

2016-08-31 Thread likage
Also, why is it that sometimes I got this error: # Error: 'list' object is not callable # Traceback (most recent call last): # File "", line 14, in # File "", line 3, in test # TypeError: 'list' object is not callable # that is stemming from the list(set(...))? There are items within my sce

Re: [Maya-Python] Selects only the group nodes

2016-08-31 Thread likage
@Geordie Forgotten to mention but it does not seems to be working, fyi On Monday, August 29, 2016 at 10:07:01 PM UTC-7, Geordie Martinez wrote: > > whoops. forgot markdown. > > import maya.cmds as mc > > sel = list(set([x for x in mc.listRelatives(mc.ls(assemblies=True), ad=True, > type='transf

Re: [Maya-Python] Selects only the group nodes

2016-08-30 Thread Justin Israel
On Wed, Aug 31, 2016 at 10:24 AM Marcus Ottosson wrote: > I am only expecting groups > > I think the reason Justin was asking this, was because in Maya, there is > no concept of “group”, only “transforms without shape”. You can prove this > to yourself, by deleting the shape from any transform, s

Re: [Maya-Python] Selects only the group nodes

2016-08-30 Thread Marcus Ottosson
I am only expecting groups I think the reason Justin was asking this, was because in Maya, there is no concept of “group”, only “transforms without shape”. You can prove this to yourself, by deleting the shape from any transform, such as a sphere or locator and witness it become what you refer to

Re: [Maya-Python] Selects only the group nodes

2016-08-30 Thread Justin Israel
On Wed, Aug 31, 2016 at 10:16 AM likage wrote: > @justin > I am only expecting groups, and hence I am not expecting any pSphere1 or > locator1 in this case. > Right. So your original solution would not work correctly in this case, because it would return transforms for other objects as well >

Re: [Maya-Python] Selects only the group nodes

2016-08-30 Thread likage
@justin I am only expecting groups, and hence I am not expecting any pSphere1 or locator1 in this case. @Kurian That works great! Just wanted to ask is using *list* and *set* necessary? I tried removing them and they worked too -- You received this message because you are subscribed to the Goog

Re: [Maya-Python] Selects only the group nodes

2016-08-29 Thread Geordie Martinez
whoops. forgot markdown. import maya.cmds as mc sel = list(set([x for x in mc.listRelatives(mc.ls(assemblies=True), ad=True, type='transform') if not mc.listRelatives(x,type="shape")]))print sel ​ On Mon, Aug 29, 2016 at 10:06 PM, Geordie Martinez < geordiemarti...@gmail.com> wrote: > here's a

Re: [Maya-Python] Selects only the group nodes

2016-08-29 Thread Geordie Martinez
here's a way to do it without getting duplicates. ```python import maya.cmds as mc sel = list(set([x for x in mc.listRelatives(mc.ls(assemblies=True), ad=True, type='transform') if not mc.listRelatives(x,type="shape")])) print sel ``` try this see if it works. On Mon, Aug 29, 2016 at 6:25 PM, J

Re: [Maya-Python] Selects only the group nodes

2016-08-29 Thread Justin Israel
On Tue, Aug 30, 2016 at 12:56 PM likage wrote: > I am trying to grab only the group nodes within the hierarchy as shown in > the screenshot.. > Is a group node considered any transform that has a child? That is, would you expect to get pSphere1 or locator1 back in your results if they had child

Re: [Maya-Python] Selects only the group nodes

2016-08-29 Thread Kurian O.S
You can use set to filter duplicate's ( although its not duplicate its because you are using all parents = True) sel = list(set(cmds.listRelatives(cmds.ls(transforms=True), ap=True, ni=True))) print sel This should give back you what you expecting On Mon, Aug 29, 2016 at 5:56 PM, likage wrote:

[Maya-Python] Selects only the group nodes

2016-08-29 Thread likage
I am trying to grab only the group nodes within the hierarchy as shown in the screenshot.. While I use this code: sel = cmds.listRelatives(cmds.ls(transforms=True), ap=True, ni=True) print sel It is giving me the following results: [u'Group_1', u'Group_2', u'Group_2', u'Group_2', u'Group_2', u'