Bug - nodeEditor's selectNode flag broken when using addNode in the same script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
When I use cmds.nodeEditor() in a script, it seems that any selectNode flags simply get ignored if they immediately follow an addNode command. It only seems to be ignored if the addNode flag results in an update to the node editor. (So running the script again sometimes works).
This is quite a bad bug, since many of the nodeEditor commands rely on using the selection in the window (such as the rootsFromSelection flag). If I cannot update the selection, then I cannot use these commands.
An example here, requires that the node editor is open. This script should make a sphere, add it to the node editor, deselect, and then reselect it.
sphere = cmds.polySphere()
cmds.select(cl=1)
cmds.nodeEditor('nodeEditorPanel1NodeEditorEd', rootNode='', e=1) #clear the editor
cmds.nodeEditor('nodeEditorPanel1NodeEditorEd', addNode=sphere, e=1) #add the sphere nodes to the graph
cmds.nodeEditor('nodeEditorPanel1NodeEditorEd', selectNode='', e=1) #clear the selection
cmds.nodeEditor('nodeEditorPanel1NodeEditorEd', selectNode=sphere, e=1)#select the sphere nodes
The result is that no nodes are selected after running. However if you re-run just the selectNode lines, the selection will be updated just fine.
Am I missing something here, or is this just straight up broken? I'm in Maya 2018.2 and this is a python script.
For some context, I'm trying to create a script to graph upstream/downstream connections to a single attribute of a node, instead of the whole thing. This relies heavily on the rootsFromSelection and selectNode flags, but without proper selection editing, I'm pretty much stuck. Is there any other way to achieve this?