-
Notifications
You must be signed in to change notification settings - Fork 0
/
contactSheetTest.py
80 lines (68 loc) · 2.51 KB
/
contactSheetTest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/env python
# coding:utf-8
""":mod: contactSheetTest - 2018.06
===================================
.. module:: contactSheetTest
:platform: Unix
:synopsis: module idea
.. moduleauthor:: duda
"""
import nuke
from nukeCore.nodes import sequenceGroup
from sgtkLib import tkutil, tkm
from PyQt4.QtGui import *
from PyQt4.QtCore import *
_USER_ = os.environ['USER']
_OUTIMAGEPATH_ = '/s/prodanim/asterix2/_sandbox/'+_USER_
tk, sgw, project = tkutil.getTk(fast=True, scriptName=_USER_)
sg = sgw._sg
def findShotsInSequence(seq='s1300',dict=False):
filters = [
['project', 'is', {'type':'Project', 'id':project.id}],
['code','is',seq]
]
res = {}
seqShots =[]
#get all the name of the shots and masters from the sequence
for v in sg.find('Sequence',filters,['entity','shots']):
if not 'Shots' in res:
tmp = v['shots']
for item in tmp:
seqShots.append(item['name'])
res['Shots'] = sorted(seqShots)
if dict:
return res
else:
return sorted(seqShots)
def createNukeFile(seq = 's0060',shName=True,outFile = '/tmp/tmp.tif',task = 'compo_comp'):
nbShots = len(findShotsInSequence(seq,False))
intNb = nbShots/5
floatNb = nbShots/5.0
if floatNb-intNb > 0:
intNb += 1
sequenceGroupNode = sequenceGroup.create()
sequenceGroupNode['sequence'].setValue(seq)
sequenceGroupNode['task'].setValue(task)
sequenceGroupNode['outputMode'].setValue('contactSheet')
sequenceGroupNode['Rebuild'].execute()
# a.knob('Rebuild').execute()
sequenceGroupNode['RowCol'].setValue([intNb, 5])
sequenceGroupNode['Resolution'].setValue([5*2048,intNb*858])
if shName:
sequenceGroupNode['showName'].setValue(True)
else:
sequenceGroupNode['showName'].setValue(False)
colorConvertNode = nuke.nodes.OCIOColorSpace(in_colorspace="Linear", out_colorspace="Lut")
#colorConvertNode = nuke.nodes.OCIOColorSpace( out_colorspace="Lut")
colorConvertNode.setInput(0,sequenceGroupNode)
writeNode = nuke.nodes.Write(name = seq + "WriteLutBurn", colorspace = "linear", file_type = "tiff",file =outFile+'/'+seq+'.tif')
writeNode['datatype'].setValue('16 bit')
#writeNode['views'].setValue('left left')
writeNode.setInput(0,colorConvertNode)
nuke.scriptSave('/tmp/tmp.nk')
print 'done'
nuke.execute(writeNode, 1, 1)
def main():
createNukeFile(seq='s0390', shName=True, outFile= _OUTIMAGEPATH_, task='compo_comp')
if __name__ == '__main__':
main()