Announcements

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

Community
Maya Programming
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya SDK topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Strange Results Querying Attribute Connections and Shading Groups

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
rkovach
384 Views, 2 Replies

Strange Results Querying Attribute Connections and Shading Groups

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.

2 REPLIES 2
Message 2 of 3
Kahylan
in reply to: rkovach

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!

 

Message 3 of 3
rkovach
in reply to: rkovach

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!

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report