Created
April 25, 2017 15:08
-
-
Save taikomatsu/022cb0a0c679d30a8edddd8e4df3be74 to your computer and use it in GitHub Desktop.
Remove expressions from file knob on all Reads in Nuke.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import nuke | |
import os.path | |
reads = nuke.allNodes('Read') | |
err_cnt = 0 | |
for i, r in enumerate(reads): | |
raw = r.knob('file').getValue() | |
evaluated = r.knob('file').getEvaluatedValue() | |
full_path = '{}/{}'.format(os.path.dirname(evaluated), os.path.basename(raw)) | |
try: | |
r.knob('file').setValue(full_path) | |
print('[Info] {}:\n"{}"->\n"{}"\n\n'.format(r.name(), raw, full_path)) | |
except Exception, e: | |
print(e) | |
print('[Error] Skipp: {}'.format(r.name())) | |
err_cnt += 1 | |
if err_cnt == 0: | |
print('# Done all successfully.') | |
else: | |
print('# Error has occured. Please check log.') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment