PDA

View Full Version : a reload all read nodes script that actually works?


cgbeige
03-02-2011, 10:35 PM
I've tried all the scripts from around the interweb and none of them seem to work with Nuke 6. It's driving me crazy.

alexx
03-03-2011, 08:09 AM
hmm.. have a try:


import nuke

nodes = nuke.allNodes()

for node in nodes:
if node.Class() == "Read":
node.knob("reload").execute()

cgbeige
03-04-2011, 01:47 AM
heh - nice. That works. For some reason, none of the others do. I guess they are out of date for Nuke 6 or something.

Thanks. Where do you store scripts to load them with a single command?

andrewhake
03-17-2011, 12:04 AM
You keep them in your .Nuke directory, and modify your menu.py to reference them.

I recommend looking to get your Nuke prefs setup in your Dropbox so they are easily backed up and easy to use on any system.

In your actual ~/.Nuke directory you just need a one line init.py referencing the DropBox location:

## andrewhake init.py

# add Dropbox nuke path
nuke.pluginAddPath('/Users/andrew/Dropbox/data/nuke')

And in your DropBox Nuke directory an init.py to properly reference its directories:

# add Dropbox nuke plugin paths
nuke.pluginAddPath('./gizmos')
nuke.pluginAddPath('./icons')
nuke.pluginAddPath('./plugins')
nuke.pluginAddPath('./python')
nuke.pluginAddPath('./tcl')

# J_Ops
#
# Created by Jack Binks on 14/02/2010.
# Copyright (c) 2010 Jack Binks. All rights reserved.
nuke.pluginAddPath("./plugins/J_Ops/ndk")
nuke.pluginAddPath("./plugins/J_Ops/icons")
nuke.pluginAddPath("./plugins/J_Ops/py")


And of course your menu.py to actually make the customizations, menus, etc.

So to use this script from the toolbar, you can save the script in the proper folder if you are keeping things organized:

# Reload all ReadNodes

import nuke

def reloadRead():
nodes = nuke.allNodes()

for node in nodes:
if node.Class() == "Read":
node.knob("reload").execute()

And in your menu.py add something like:

# reloadRead
import reloadRead
o_O.addCommand('reloadRead', 'reloadRead.reloadRead()', icon='reloadRead.png')

(o_O) is the name of my custom menu I am adding this to.

And here is an icon ;)

http://andrewandoru.com/images/reloadRead.png

CGTalk Moderation
03-17-2011, 12:04 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.