Skip to content

Instantly share code, notes, and snippets.

@shrimo
Last active May 25, 2020 15:39
Show Gist options
  • Save shrimo/98692f72bf81dd6b6001e0b488503e15 to your computer and use it in GitHub Desktop.
Save shrimo/98692f72bf81dd6b6001e0b488503e15 to your computer and use it in GitHub Desktop.
Daily view (Load the latest version of daily)
"""
Load the latest version of daily
import sys
module_path = '/home/shrimo/Desktop/course/vfx_dev/nuke'
if module_path not in sys.path:
sys.path.append(module_path)
import daily_view
reload(daily_view)
daily_view.main()
"""
import os
import nuke
def main():
first_frame = nuke.root().firstFrame()
last_frame = nuke.root().lastFrame()
for n in nuke.allNodes('WriteTank'):
if n.Class() == 'WriteTank':
print 'WriteTank'
file = os.path.basename(n['cached_path'].getValue())
directory = os.path.dirname(n['cached_path'].getValue())
only_name = file.split('.')
mov_file = os.path.join(directory, only_name[0]+'.'+only_name[1]+'.mov')
if os.path.isfile(mov_file):
print mov_file
read = nuke.createNode('Read')
read['name'].setValue('daily->'+only_name[0]+only_name[1])
read['file'].setValue(mov_file)
read['first'].setValue(first_frame)
read['last'].setValue(last_frame)
read['origfirst'].setValue(first_frame)
read['origlast'].setValue(last_frame)
else:
nuke.message('Write to MOV file')
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment