I never understood why the "connections" flag results in the given object always being first in the returned connection pairs. It seems to make the results pointless when doing both a source and destination query since you don't know which is which. Can you make two calls to listConnections which one being s=True/d=False and the other being s=False/d=True?
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAD%3DwhWOu67u5Zjx-ukeD6iokVpeecCY66ChfCfhN1b39s0xNWw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
I never understood why the "connections" flag results in the given object always being first in the returned connection pairs.
objattr = 'VRayMtl1.color'
# Guess work
src = cmds.listConnections(attr, p=True, s=True, d=False)
dst = cmds.listConnections(attr, p=True, s=False, d=True)
if src != None:
print src, '->', objattr
if dst != None:
print objattr, '->', dst
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3_YXhaqHTc1TsqTnub%3Dup%3D_NPVfrE5j6j%2BmJ%3DB2e3jFw%40mail.gmail.com.
Looks good to me.
Depending on your use-case, you might find that about half of the information you store about connections is duplicated due to A being connected to B, but B also being connected to A. It’s a fairly common problem in graph theory, here’s some interesting reads about possible solutions and their pros and cons.
Best,
Marcus
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOBA%2BmSqSfZsBk_MgOnG67dgjbuw_zsEDPPZc2wrbWw6sA%40mail.gmail.com.
Yea it would depend on whether you are interested solely on resolving the nodes, or if you are more concerned about resolving the relationships. NodeA could have and edge to NodeB, and. NodeB could have a different edge to NodeA. They both relate to each other, and while the Node references are the same, the edges in the graph are unique.
As long as you are maintaining an index of nodes and using the same references, you shouldn't end up duplicating data.
You could also check out this library, which can handle letting you just loop over connections and throwing nodes and edges at it, and it will manage the graph
It comes with a bunch of graph algorithms to traverse and evaluate stuff.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAD%3DwhWNVH4vsf2qz7Nq1%3D4UOdNCoSZcS%3Daq0itL3dp4fC%2B0O4Q%40mail.gmail.com.