-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathpathswapper.py
More file actions
53 lines (42 loc) · 1.69 KB
/
Copy pathpathswapper.py
File metadata and controls
53 lines (42 loc) · 1.69 KB
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
newShotNumber = ""
newVersion = ""
fullPath = ""
allReads = []
each = []
#Get path to new sequence
p = nuke.Panel('Pathswapper')
p.addFilenameSearch('Path to new seq', "choose seq")
p.addButton('Cancel')
p.addButton('Update all read nodes')
ret = p.show()
fullPath = str(p.value('Path to beauty')[:-10])
newShotNumber = str(fullPath.split('_sh')[2])[:4]
newVersion = str(fullPath.split('_v')[2])[:3]
print "Updating all read nodes to shot "+ str(newShotNumber) +" v"+ str(newVersion)
for a in nuke.allNodes():
if 'FILEPATH_BG' in a['name'].value():
print "Hello"
for a in nuke.allNodes():
if 'Read' in a['name'].value():
if 'Lighting' in a['file'].value():
file = str(a.knob('file').getValue())
oldShotNumber = str(file.split('_sh')[2])[:4]
oldVersion = str(file.split('_v')[2])[:3]
file = file.replace(str(oldShotNumber), str(newShotNumber))
file = file.replace(str(oldVersion), str(newVersion))
#Apply paths
newFile = a.knob('file').setValue(file)
print str(file)
for a in nuke.allNodes():
if 'FILEPATH_BG' in a['name'].value():
print "FILEPATH_BG found"
file = str(a.knob('label').getValue())
print file
oldShotNumber = str(file.split('_sh')[2])[:4]
oldVersion = str(file.split('_v')[1])[:3]
file = file.replace(str(oldShotNumber), str(newShotNumber))
file = file.replace(str(oldVersion), str(newVersion))
#Apply paths
newFile = a.knob('label').setValue(file)
print str(file)
#To Do - put it all in a module with arguements instead of brute-forcing the nuke.allNodes() file / label split-position setup as above.