List children but ignore shape nodes (python)


#1

Hi,
I’m using the list command in python to try and return the children of a node. I want to ignore the shape node so I’ve tried shapes = False but it makes no difference, I keep getting the nodes shape node in the list.

Can someone give me an example of how to do this please?
Thanks for reading,
Dan


#2

Hi Dan.
There are different ways to filter these. What type of nodes should your final list include and what is the goal of your script?


#3

Hi, for getting children of a node, you can use cmds.listRelatives, by give it a flag type=“nodetype”, you could filter the children by node type.

for example: following code gets the children of “nodename” and only return transform node, so it will no include any shapes.

cmds.listRelatives("nodename", children=True, type="transform")

#4

Thanks both for the reply, I’ll try your example. many thanks


#5

I’ve got some blendshape geo under a group so was trying to collect the children of that group.