-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnet-render-paths.py
74 lines (51 loc) · 1.43 KB
/
net-render-paths.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
"""Name-en-US: NetRender Paths
Description-en-US: NetRender Paths :: Updates the render save paths to match the file name with no path.
NetRenderPaths v0.2 (August 14, 2011)
copyright Donovan Keith, 2011
License: MIT
Written for CINEMA 4D R12.048
KNOWN BUGS:
Doesn't clean up "Render Settings" names, so if the user has a "/" in the name
you'll end up with a render error.
"""
import os
import sys
import c4d
from c4d import gui
import wave
debug = False
def printName(atom):
print(atom.GetName())
def getNextItem(item):
if item is None:
return None
if item.GetDown():
return item.GetDown()
while not item.GetNext() and item.GetUp():
item = item.GetUp()
return item.GetNext()
def main():
"""
"""
if debug:
print("main()")
# Get Doc Path
doc_path = doc.GetDocumentPath()
# Ensure file is saved
if doc_path == "":
gui.MessageDialog("Please save document first.")
return False
# Get Doc Name
doc_filename = doc.GetDocumentName()
doc_name = os.path.splitext(doc_filename)[0]
# Retrieve the render data
render_data = doc.GetFirstRenderData()
# Update all render data entries
while (render_data):
render_data[c4d.RDATA_PATH] = doc_name
render_data[c4d.RDATA_MULTIPASS_FILENAME] = doc_name
render_data = getNextItem(render_data)
c4d.EventAdd()
pass
if __name__ == "__main__":
main()