Node editor connections - python


#1

Hi, I often find myself scripting the creation of node based networks. Within Maya’s node editor window I am able to hover my mouse over any connection between two nodes and receive a helpful message revealing the connections. I would like to query this text somehow via python/mel (mostly so i can save myself the trouble of typing out the connection or connections).

Ideally i could select and query the connection itself, and not either of the two nodes. I know I can run a listConnections command on one of the nodes, but I specifically want what is listed in that particular connection. Seems like i should be able to get at it. I also tried working with the nodeEditor command, but I may have using that incorrectly, no results there. Wondering if anyone might be able to help me out, or even confirm that this isnt possible.


#2

I can’t find any way to query this, only the current selection (which is usually synced with the main selection anyway).

I wish the node editor had better ways to copy this sort of thing, eg. right-click a node or plug and copy its DG path, or select a connection and hit ^C and copy the input and output plugs for that connection.

(Apparently you can MMB-drag nodes into the script editor and get their paths, but that’s the easiest one to get. Plug paths are what I want most frequently…)