-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.py
More file actions
49 lines (38 loc) · 1.33 KB
/
Copy pathinit.py
File metadata and controls
49 lines (38 loc) · 1.33 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
import os
import nuke
print("Inside Nuke init.py script")
# Import Script
nuke.scriptReadFile("ACES-Convert_Image_to_mov_and_more.nk")
# Get Input and Output paths
imageInputPath = os.environ["RATZ_ImageInputPath"]
imageOutputPath = os.environ["RATZ_ImageOutputPath"]
isSequence = os.environ["RATZ_IsSequence"] == "True"
isSRGB = os.environ["RATZ_IsSRGB"] == "True"
writeNodeNumber = "1"
if(isSequence):
writeNodeNumber = "2"
if(isSequence and isSRGB):
writeNodeNumber = "3"
# Adjust Read Node Input File
readNode = nuke.toNode("Read"+writeNodeNumber)
if(isSequence):
# path = imageInputPath
path = os.path.dirname(imageInputPath)
for seq in nuke.getFileNameList(path):
if "#" in seq:
readNode.knob("file").fromUserText(path + "/" + seq)
print("sequence choosen: " + seq)
else:
readNode.knob("file").fromUserText(imageInputPath)
# Adjust Write Node Output File
writeNode = nuke.toNode("Write"+writeNodeNumber)
writeNode.knob("file").setValue(imageOutputPath)
# Set Frame Range
frameRangeFrom = 1 if not isSequence else int(os.environ["RATZ_FrameRangeFrom"])
frameRangeTo = 1 if not isSequence else int(os.environ["RATZ_FrameRangeTo"])
# Render
print("")
print("----- Start exporting -----")
nuke.execute("Write"+writeNodeNumber,frameRangeFrom,frameRangeTo)
print("")
print("----- Script Done -----")