I’m trying to use scriptOp to grab a frame whenever a custom pulse is pressed (this will be automated eventually) but having some trouble integrating the code. I used the code from the snippet but it doesn’t seem to be quite right…any tips out there? I know i could use cache, but i need to keep saving images and create a long final image, so this seemed like the best first step. The code returns: File “/project1/script4_callbacks”, line 24, in onPulse
NameError: name ‘scriptOp’ is not defined
# called whenever custom pulse parameter is pushed
def onPulse(par):
print('pulsed: ',par.name)
if par.name == 'Frame':
print('Frame Pulsed')
inputTex = scriptOp.inputs[0]
# copying the input texture into a numpy array
nA = inputTex.numpyArray(delayed=True)
# the first time numpyArray is called, None will be returned since
# the delayed flag is set. This prevents a hang but also you need
# to take care of this manually.
# output final texture
scriptOp.copyNumpyArray(nA)
return