def readShot(): import shotgun shotcode = nuke.getInput('Shot Code') s = shotgun.getShotData(shotcode, ['Source clip', 'Cut In', 'Cut Out']) (clipName, crc) = s['Source clip'].strip().split(':') results = nuke.spotlight(clipName) if results: for readPath in results: if sha1(open(readPath).read()).hexdigest() == crc: readPath = nuke.pacify(readPath) nuke.createNode('Read','file %s' % readPath) rangeStr = 'first_frame %s last_frame %i' % (s['Cut In'],int(s['Cut Out']-1)) nuke.createNode('FrameRange',rangeStr) else: nuke.message('Cannot locate clip %s' % clipName)
def updateShotgunStatus(): import shotgun stats = {"In_Progress":"ip", "On_Hold":"hld", "Final":"fin"} scriptPath = re.sub(r'/',r'\\',nuke.root().name()) scriptName = os.path.split(scriptPath)[-1].split('.')[0] shotcode = scriptName.split("__")[0] try: shot = shotgun.getShotData(shotcode,'Status') print shot['Status'] except Exception as e: nuke.message("Can't figure out Shot Code from script name!") return None p = nuke.Panel('Update Status: %s' % shotcode) p.addEnumerationPulldown('Status', " ".join(stats.keys())) if p.show()==1: stat = p.value('Status') try: shotgun.updateShot(shotcode, 'Status', stats[stat]) nuke.message("Update OK!") except Exception: nuke.message("Update failed!") else: pass