Announcements

Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.

Strange Results Querying Attribute Connections and Shading Groups

rkovach
Enthusiast
Enthusiast

Strange Results Querying Attribute Connections and Shading Groups

rkovach
Enthusiast
Enthusiast

When I query connections to a Shading Group, I get a list like so:

 

cmds.listConnections('pCubeShape1', type='shadingEngine', connections=True)
['pCubeShape1.compInstObjGroups.compObjectGroups[0]','phong1SG']

So first issue, is that I passed the connection flag, but I did not get the expected Destination Attribute. I expected to get: 

'phong1SG.dagSetMembers[1]'

But I only got the Node Name.

The second problem is that the returned Attribute on the Shape Node isn't actually a valid Attribute. The real Attribute connected to the Shading Group is:

'pCubeShape1.compInstObjGroups[0].compObjectGroups[0]'


Does anyone have experience with this, is it expected? is it a bug?
Thanks.

0 Likes
Reply
Accepted solutions (1)
384 Views
2 Replies
Replies (2)

Kahylan
Advisor
Advisor
Accepted solution

Hi!

 

Your command is missing the "plugs" (p) flag, which gives you the exact connected attributes if set to true.

This should take care of your first problem.

Now the second problem I couldn't check, because I could not find the attribute ".compInstObj[0].compObjectGroups[0]" on my shape so I couldn't reproduce your setup.

But It is normal that Maya neglects the first indicator ([0]) in attibutes with ancestry and most attribute related commandsrun without a problem with the name given by listConnections. If you should run into problems with that anyways, you can always query the exact attriubteName by feeding the name given form listConnections intro the attributeName command this command will not neglect the fist indicator.

 

import maya.cmds as cmds

conn = cmds.listConnections('pCubeShape1', type='shadingEngine', c=True, p = True)
connSh = cmds.attributeName(conn[0], l = True, lf = False)

 

I hope this helps!

 

0 Likes

rkovach
Enthusiast
Enthusiast

That solved my issue, I did need the exact Attribute name so I could Disconnect the Attributes, using the "attributeName" command got me what I needed.

Thanks!

 

0 Likes