We've got some extra menu items to "Localise Selected", etc. The scripts
for that are:
# Add these in to the menu:
cache = menubar.findItem('Cache')
if cache:
localCache = cache.findItem('Local File Cache')
if localCache:
localCache.addCommand("Cache Update All", "myNuke.myDoLocalise(1)", "")
localCache.addCommand("Cache Update Selected",
"myNuke.myDoLocalise(0)", "")
# Have this in myNuke.py:
def myDoLocalise(localiseAll):
'''Support localizing all or the selected read nodes, including inside
groups'''
rootNode = nuke.root()
readKnobList = []
nodeList = []
if localiseAll:
nodeList = nuke.allNodes(group=rootNode)
else:
nodeList = nuke.selectedNodes()
for n in nodeList:
# This handles if you have read nodes inside a group
if n.Class() == 'Group':
readNodes = n.nodes()
else:
readNodes = [n]
for rn in readNodes:
readKnob = nuke.getReadFileKnob(rn)
if readKnob != None:
fileVal = readKnob.getValue()
if nuke.localisationEnabled(readKnob):
readKnobList.append(readKnob)
nuke.localiseFiles(readKnobList)
From: chrissowa
<[email protected]<mailto:[email protected]>>
Reply-To:
<[email protected]<mailto:[email protected]>>
Date: Mon, 2 Jul 2012 13:16:55 +0100
To:
<[email protected]<mailto:[email protected]>>
Subject: [Nuke-python] Re: Use "Local File Cache -> Update all" with Pytho
well if i run the statement doLocalise(1) in the nuke scripteditor it ll work.
But building in this statement in a python function in a python module and then
having code like this in a custom node with pythonbutton wont work:
##############
import xyz
xyz.doit()
##############
doit():
doLocalise(1)
How can i understand what functions are "really scriptable" and what functions
are not usable in separate pythomodules?
_______________________________________________ Nuke-python mailing list
[email protected]<mailto:[email protected]>,
http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python