Returning the current selected connection in Node Editor?

by Voxel posted 1112 days ago | 2 comments

I'm coding a bit of ui in PyMel to make connecting nodes on the fly a bit easier, and I'm curious if anyone knows a way to return the nodes/plugs information based on a selection of the connection curves in the node editor. There doesn't seem to be a lot of examples in the documentation for the node editor, and everything I've tried so far is giving me nothing. It looks like the node editor is one of the few windows PyMel doesn't have a dedicated class for.

by robberyman posted 1096 days ago

Pymel NodeEditor

Maya Help on NodeEditor

import pymel.core as pm

# Get list of nodeEditors,
ne = pm.getPanel(scriptType='nodeEditorPanel')

# Then we can query the node editor for say, all nodes in view of main nodeEditor, 
nodeList = pm.nodeEditor('{}NodeEditorEd'.format(ne[0]), q=True, getNodeList=True)

By the looks of it one should be able to get this from either the "highlightList" or "selectionList" but I didn't manage to get it work. Hope you solve it because I gave up on something similar.

by vshotarov posted 1106 days ago

I remember some time ago I had a look at things that I can do in the node editor, but I didn't find a lot, so I kind of left it there. That being said, I'd imagine that you could be able to retrieve some information using PySide.

Unfortunately, I doubt there is an easy to use interface for it anywhere in pymel or cmds, but if you find anything, please share it.