UnboundLocalError: local variable 'readlgt' referenced before assignment
UnboundLocalError: local variable 'readlgt' referenced before assignment
我正在使用 Foundry Nuke,我遇到了这个问题:
这是我的程序:
def testing(*args):
for a in nuke.allNodes('Read'):
if 'lighting' in a ['name'].value():
readlgt = a
if 'GI' in a['name'].value():
# global readGI
readGI = a
mergelgt = nuke.nodes.Merge2(operation='plus')
mergelgt.connectInput(0, readlgt)
mergelgt.connectInput(1, readGI)
testing()
试试这个:
import nuke
readlgt = nuke.nodes.Read(file="~/Desktop/file1.##.exr", name="readlgt")
readGI = nuke.nodes.Read(file="~/Desktop/file2.##.exr", name="readGI")
def testing():
for a in nuke.allNodes('Read'):
if 'lighting' in a['name'].value():
a = readlgt
if 'GI' in a['name'].value():
a = readGI
mergelgt = nuke.nodes.Merge2(operation='plus')
for these in nuke.allNodes():
these.setSelected(True)
mergelgt.setInput(0, readlgt)
mergelgt.setInput(1, readGI)
testing()
我正在使用 Foundry Nuke,我遇到了这个问题:
这是我的程序:
def testing(*args):
for a in nuke.allNodes('Read'):
if 'lighting' in a ['name'].value():
readlgt = a
if 'GI' in a['name'].value():
# global readGI
readGI = a
mergelgt = nuke.nodes.Merge2(operation='plus')
mergelgt.connectInput(0, readlgt)
mergelgt.connectInput(1, readGI)
testing()
试试这个:
import nuke
readlgt = nuke.nodes.Read(file="~/Desktop/file1.##.exr", name="readlgt")
readGI = nuke.nodes.Read(file="~/Desktop/file2.##.exr", name="readGI")
def testing():
for a in nuke.allNodes('Read'):
if 'lighting' in a['name'].value():
a = readlgt
if 'GI' in a['name'].value():
a = readGI
mergelgt = nuke.nodes.Merge2(operation='plus')
for these in nuke.allNodes():
these.setSelected(True)
mergelgt.setInput(0, readlgt)
mergelgt.setInput(1, readGI)
testing()