Skip to content

Instantly share code, notes, and snippets.

@taikomatsu
Last active February 2, 2023 08:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taikomatsu/0d437959619034a943a17f2646d3712f to your computer and use it in GitHub Desktop.
Save taikomatsu/0d437959619034a943a17f2646d3712f to your computer and use it in GitHub Desktop.
Export Maya Camera Warp to .clip file
from pymel.core import *
start = int(playbackOptions(q=True, min=True))
end = int(playbackOptions(q=True, max=True))
fps = 24
tracklength = end-start+1
clipfile = 'path/to/your_clip/scenewarp.clip'
time = PyNode('time1')
vals = []
rawvals = []
for f in range(start, end+1):
vals.append(time.outTime.get(t=f))
rawvals.append(f)
with open(clipfile, 'w') as f:
f.write('{\n')
f.write(f' rate = {fps}\n')
f.write(f' start = {start-1}\n')
f.write(f' tracklength = {tracklength}\n')
f.write(' tracks = 2\n')
f.write(' {\n')
f.write(' name = outTime\n')
f.write(' data = ')
for o in vals:
f.write(f' {o}')
f.write('\n')
f.write(' }\n\n')
f.write(' {\n')
f.write(' name = unwarpedTime\n')
f.write(' data = ')
for o in rawvals:
f.write(f' {o}')
f.write('\n')
f.write(' }\n')
f.write('}')
print('# Done')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment