The default hotkey bindings use nukescripts.connect_selected_to_viewer(), which in turn calls nuke.connectViewer(), so it's more than a simple setInput call. Have a look at the function in nukescripts/misc.py to give you a clearer idea of the logic.

-Nathan


-----Original Message----- From: Gustaf Nilsson
Sent: Thursday, October 11, 2012 3:23 AM
To: nuke-python@support.thefoundry.co.uk
Subject: [Nuke-python] switch to input in viewer

ohai

i want the 1/2/3/4/5... keys to only connect the selected node to
Viewer1, not any other viewers, so i wrote this:

nuke.menu('Nuke').addCommand('Gusty/Connect to Viewer1 -  1',
'nuke.toNode("Viewer1").setInput(0, nuke.selectedNode())

and then i do this for all the numbers.

it works, but the problem is that if viewer1 is set to input 1 and i
select a node and hit "2" then the viewer connects its second input to
the node as expected, but it doesnt actually show/switch to that input
-- i have to go to the viewer1 tab and hit two again to show it.

ideas?

G

--
■ ■ ■ ■ ■ ■ ■ ■ ■ ■
_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to