Last active
September 13, 2020 20:18
-
-
Save taikomatsu/9c25ad20d4d53e4e9afb0791483c9451 to your computer and use it in GitHub Desktop.
Convert .acv exported from AE to ColorLookup in Nuke.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# import acv | |
import struct | |
filepath = 'C:/users/hoge/curve.acv' | |
luts = [] | |
with open(filepath, 'rb') as f: | |
header = f.read(4) | |
for i in range(len('mrgba')): | |
ncvs = struct.unpack('>BB', f.read(2))[1] | |
ipairs = [struct.unpack('>BBBB', f.read(4))[1::2] for k in range(ncvs)] | |
pairs = [(ix/255., iy/255.) for iy, ix in ipairs] | |
luts.append(pairs) | |
# set value to ColorLookup | |
node = nuke.createNode('ColorLookup') | |
lut_knob = node.knob('lut') | |
for i, lut in enumerate(luts): | |
for x, y in lut: | |
lut_knob.setValueAt(y, x, i) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment