Viewer Lock v1.7

This location is for Registered Users Only.
Perhaps you need to login or register.
Contributor: Matt Roe
Lock a viewer's inputs to desired nodes and prevent annoying accidental reassignments.
12.2, 12.1, 12.0, 11.3, 11.2, 11.1, 11.0, 10.5, 10 or later
Linux, Mac, Windows
21 Sep 2022

What is Viewer Lock?

Don't you hate it when your viewer's not connected to the nodes you think it's connected to? Like when you're rotoing and you're trying to A/B between the plate and the comp, but the roto node's overlay has hijacked Nuke's focus and now you're looking at some random roto node?

Usually when I ask people this, they say no. But I sure do, so I made this.

Viewer Lock is a tool that allows you to lock viewer inputs to nodes, so that they're always assigned to what you think they're assigned to. I've been using this personally for several years now and thought I'd share it in case there were people out there who also have this fairly niche problem.

Annotation 2019-08-09 014138

Usage instructions

Press Shift+V to open the Viewer Lock panel, or, if you already have one open, to bring it to focus.

The left row of checkboxes show which inputs are in use. Uncheck them to unassign the input. The right row of checkboxes show which inputs are locked. Check them to lock the input to the node it's currently assigned to, or to uncheck them to unlock. The checkboxes at the top unassign all inputs and lock/unlock all inputs, respectively.

You can also use shortcuts:

  • Ctrl+Alt+(number) will lock the input to the selected node, or reassign a locked input to the selected node.
  • Ctrl+Shift+(number) will unlock the input and assign it to the selected node as normal.
  • Ctrl+Alt+V and Ctrl+Shift+V will lock and unlock all inputs respectively.

I haven't tested this on a Mac, so there may be some weirdness that I haven't accounted for, but it should work. I'll test on a Mac when I am able to.

This is not yet updated for Python 3 / Nuke 13.
This will not work with non-commercial Nuke because of Python restrictions. :(

Installation instructions

Unzip the file and move the contents to your .nuke folder, keeping the contents of the viewerLock folder inside that folder. If you already have a file, combine it with this one.

Pipeline considerations?

Rather than a custom node, Viewer Lock is a Python script that is called by updateUI and knobChanged callbacks and simply intercepts viewer hotkeys and reassigns viewer node inputs to make sure everything stays connected to where the user wants it to be. It works (almost) entirely independently of the Nuke script and so using it has no impact on users who don't have it installed and may need to pick up your script.

The only changes that Viewer Lock makes to a script is adding hidden checkbox knobs to viewer nodes to keep track of lock states between Nuke sessions. Without Viewer Lock they have no function and can't interfere with a script -- you won't even know they're there! 

What's new

  • Hotfix to better match default nuke behaviour. Selected nodes in the node graph should no longer hijack unlocked inputs when the viewer window is selected and a viewer hotkey (0-9) is pressed. Thanks James Rowell for pointing this out!

Coming up

  • A Python 3 update whenever my studio switches to Nuke 13!
  • Along with that update I hope to do some code cleanup and bug squashing so email me at [email protected] with any bugs and crashes you come across, along with instructions to replicate the bug if possible and the version of Nuke you're using
Copyright 2022 Matt Roe Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Please login in order to download these files.


0 # Pratheesh Chandran 2019-08-09 10:11
awesome...thank s Matt
0 # Matt Roe 2019-08-09 12:34
Glad you like it Pratheesh!
0 # Alejandra Esquerro 2020-10-18 18:26
Hey Matt, this is an awesome tool!! Thanks for publishing it.
I am having a problem with mac though. Even though I can use the GUI without issues during work time, when I quit nuke there is an issue. It doesn't tell me what is the problem, although in Terminal I get this message: Warning: Re-registering an existing pixelformat.
Disk cache /var/tmp/nuke-u 501/ViewerCache /??: 24MB (1% of 10240MB) used in 2 files.

I'm not sure that message is related though.
Any idea what may be wrong? I'm happy to help with the testing!

0 # Matt Roe 2020-11-15 03:05
Bummer, unfortunately I don't have a Mac to troubleshoot this. Does the GUI at least remember the lock states when you reopen a script?

I'll see if I can source a Mac for the next release and get this sorted next year. Thanks for letting me know!
0 # Harikrishnan S 2020-12-09 14:27
its awesome Matt !!! I was looking for this from long time....!!! Thanks a lot !!!
0 # Lars Wemmje 2020-12-09 23:04
This one has Useful Nukepedia Tool written all over it ;-)
I have been looking for this for a very long time.
Awesome Job!!!
0 # Laurence Drouilly 2022-04-13 22:04
I want to use ViewerLock, but when I try to connect a viewer, I have this message:
'module' object has no attribute 'connect'
Is there something I have to define somewhere?
Can someone help me with that?
0 # Laurence Drouilly 2022-04-14 00:43
Also have the error:
name 'addVLPanel' is not defined
0 # Laurence Drouilly 2022-04-14 01:13
Forget it! I made it work :-)
0 # Matt Roe 2022-09-21 11:40
Glad to hear it Laurence! Apologies for not replying sooner!
0 # Wes Heo 2022-04-22 19:15
I had this installed studio-wide, but had to disable it because it was causing Nuke to crash on startup with some scripts, even when Viewers were deleted on script load. It was used on Linux and Nuke 12.2v3 and 12.2v9.

It's a shame because I really liked it.
0 # Matt Roe 2022-09-21 08:38
Hey Wes, sorry to hear this was causing issues (and sorry for the delay in replying). Viewer Lock is overdue a code refactor and bug squash and I'd appreciate any extra info you have on this, e.g. error messages or common features of the scripts that were crashing.
0 # James Rowell 2022-09-01 13:34
Looks like a nice tool, unfortunately it causes default nuke behavior to be incorrect in how it handles viewer inputs. I assume this is a bug with the plugin, hopefully it can be fixed.

Here's the bug. If this plugin is installed (and assuming you haven't used the lock feature) then if you have different viewer inputs connected up to various nodes, then shift focus to the viewer window (eg. click in it), and toggle between your connections, then IF there is a node selected in the node graph then the first viewer channel you toggle to FLIPS to that node. It should have remained connected to whatever it was before you started toggling between viewer inputs.

Not knowing about this plugin, nor that it was installed at a studio I've been working with recently, I struggled with this bug for two months. We thought it was a bug with nuke. Finally we tracked it down to this plugin being installed and uninstalled it yesterday.

If this bug can be fixed then for sure this should be a standard tool installed everywhere!
0 # Matt Roe 2022-09-21 08:36
Hey James, sorry about this, the goal is definitely to emulate default Nuke behaviour so I appreciate the feedback. I'll fix this with a small update ASAP.
0 # Matt Roe 2022-09-21 12:41
Just updated with a quick change that should make it behave more like default Nuke. Thanks again for bringing this up.

You have no rights to post comments

We have 2447 guests and 48 members online