diff --git a/DaVinci Resolve/ACES Transforms/ODT/ACES2 Candidates rev009/ACES2 CandidateA rev009 Rec2100 (Rec709 sim).dctl b/DaVinci Resolve/ACES Transforms/ODT/ACES2 Candidates rev009/ACES2 CandidateA rev009 Rec2100 (Rec709 sim).dctl index cf3a1fb..6f0caec 100644 --- a/DaVinci Resolve/ACES Transforms/ODT/ACES2 Candidates rev009/ACES2 CandidateA rev009 Rec2100 (Rec709 sim).dctl +++ b/DaVinci Resolve/ACES Transforms/ODT/ACES2 Candidates rev009/ACES2 CandidateA rev009 Rec2100 (Rec709 sim).dctl @@ -1,6 +1,5 @@ DEFINE_ACES_PARAM(IS_PARAMETRIC_ACES_TRANSFORM: 0) - __DEVICE__ float lin_to_ACEScct(float in) { if (in <= 0.0078125f) { return 10.5402377416545f * in + 0.0729055341958355f; diff --git a/DaVinci Resolve/ACES Transforms/ODT/ACES2 Candidates rev009/ACES2 CandidateA rev009 Rec2100.dctl b/DaVinci Resolve/ACES Transforms/ODT/ACES2 Candidates rev009/ACES2 CandidateA rev009 Rec2100.dctl index 82dc0e6..bdaf09e 100644 --- a/DaVinci Resolve/ACES Transforms/ODT/ACES2 Candidates rev009/ACES2 CandidateA rev009 Rec2100.dctl +++ b/DaVinci Resolve/ACES Transforms/ODT/ACES2 Candidates rev009/ACES2 CandidateA rev009 Rec2100.dctl @@ -1,6 +1,5 @@ DEFINE_ACES_PARAM(IS_PARAMETRIC_ACES_TRANSFORM: 0) - __DEVICE__ float lin_to_ACEScct(float in) { if (in <= 0.0078125f) { return 10.5402377416545f * in + 0.0729055341958355f; @@ -25,7 +24,6 @@ __DEVICE__ float3 transform(int p_Width, int p_Height, int p_X, int p_Y, float p } - DEFINE_CUBE_LUT(DRTLUT) { TITLE "Generated by Foundry::LUT" diff --git a/DaVinci Resolve/ACES Transforms/ODT/ACES2 Candidates rev009/ACES2 CandidateB rev009 Rec2100 (Rec709 sim).dctl b/DaVinci Resolve/ACES Transforms/ODT/ACES2 Candidates rev009/ACES2 CandidateB rev009 Rec2100 (Rec709 sim).dctl index 2681870..deca886 100644 --- a/DaVinci Resolve/ACES Transforms/ODT/ACES2 Candidates rev009/ACES2 CandidateB rev009 Rec2100 (Rec709 sim).dctl +++ b/DaVinci Resolve/ACES Transforms/ODT/ACES2 Candidates rev009/ACES2 CandidateB rev009 Rec2100 (Rec709 sim).dctl @@ -1,6 +1,5 @@ DEFINE_ACES_PARAM(IS_PARAMETRIC_ACES_TRANSFORM: 0) - __DEVICE__ float lin_to_ACEScct(float in) { if (in <= 0.0078125f) { return 10.5402377416545f * in + 0.0729055341958355f; @@ -25,7 +24,6 @@ __DEVICE__ float3 transform(int p_Width, int p_Height, int p_X, int p_Y, float p } - DEFINE_CUBE_LUT(DRTLUT) { TITLE "Generated by Foundry::LUT" diff --git a/DaVinci Resolve/ACES Transforms/ODT/ACES2 Candidates rev009/ACES2 CandidateB rev009 Rec2100.dctl b/DaVinci Resolve/ACES Transforms/ODT/ACES2 Candidates rev009/ACES2 CandidateB rev009 Rec2100.dctl index 8acd643..1585a44 100644 --- a/DaVinci Resolve/ACES Transforms/ODT/ACES2 Candidates rev009/ACES2 CandidateB rev009 Rec2100.dctl +++ b/DaVinci Resolve/ACES Transforms/ODT/ACES2 Candidates rev009/ACES2 CandidateB rev009 Rec2100.dctl @@ -1,6 +1,5 @@ DEFINE_ACES_PARAM(IS_PARAMETRIC_ACES_TRANSFORM: 0) - __DEVICE__ float lin_to_ACEScct(float in) { if (in <= 0.0078125f) { return 10.5402377416545f * in + 0.0729055341958355f; diff --git a/DaVinci Resolve/ACES Transforms/ODT/ACES2 Candidates rev009/ACES2 CandidateB rev009 Rec709.dctl b/DaVinci Resolve/ACES Transforms/ODT/ACES2 Candidates rev009/ACES2 CandidateB rev009 Rec709.dctl index 4ac606c..d31816b 100644 --- a/DaVinci Resolve/ACES Transforms/ODT/ACES2 Candidates rev009/ACES2 CandidateB rev009 Rec709.dctl +++ b/DaVinci Resolve/ACES Transforms/ODT/ACES2 Candidates rev009/ACES2 CandidateB rev009 Rec709.dctl @@ -1,6 +1,5 @@ DEFINE_ACES_PARAM(IS_PARAMETRIC_ACES_TRANSFORM: 0) - __DEVICE__ float lin_to_ACEScct(float in) { if (in <= 0.0078125f) { return 10.5402377416545f * in + 0.0729055341958355f; @@ -25,7 +24,6 @@ __DEVICE__ float3 transform(int p_Width, int p_Height, int p_X, int p_Y, float p } - DEFINE_CUBE_LUT(DRTLUT) { TITLE "Generated by Foundry::LUT" diff --git a/DaVinci Resolve/ACES Transforms/ODT/ACES2 Candidates rev009/ACES2 CandidateC rev009 Rec2100 (Rec709 sim).dctl b/DaVinci Resolve/ACES Transforms/ODT/ACES2 Candidates rev009/ACES2 CandidateC rev009 Rec2100 (Rec709 sim).dctl index 7b1fd33..1dfa326 100644 --- a/DaVinci Resolve/ACES Transforms/ODT/ACES2 Candidates rev009/ACES2 CandidateC rev009 Rec2100 (Rec709 sim).dctl +++ b/DaVinci Resolve/ACES Transforms/ODT/ACES2 Candidates rev009/ACES2 CandidateC rev009 Rec2100 (Rec709 sim).dctl @@ -1,6 +1,5 @@ DEFINE_ACES_PARAM(IS_PARAMETRIC_ACES_TRANSFORM: 0) - __DEVICE__ float lin_to_ACEScct(float in) { if (in <= 0.0078125f) { return 10.5402377416545f * in + 0.0729055341958355f; @@ -28,7 +27,6 @@ __DEVICE__ float3 transform(int p_Width, int p_Height, int p_X, int p_Y, float p } - DEFINE_CUBE_LUT(DRTLUT) { TITLE "Generated by Foundry::LUT" diff --git a/DaVinci Resolve/ACES Transforms/ODT/ACES2 Candidates rev009/ACES2 CandidateC rev009 Rec2100.dctl b/DaVinci Resolve/ACES Transforms/ODT/ACES2 Candidates rev009/ACES2 CandidateC rev009 Rec2100.dctl index 31e5d71..16b100e 100644 --- a/DaVinci Resolve/ACES Transforms/ODT/ACES2 Candidates rev009/ACES2 CandidateC rev009 Rec2100.dctl +++ b/DaVinci Resolve/ACES Transforms/ODT/ACES2 Candidates rev009/ACES2 CandidateC rev009 Rec2100.dctl @@ -1,6 +1,5 @@ DEFINE_ACES_PARAM(IS_PARAMETRIC_ACES_TRANSFORM: 0) - __DEVICE__ float lin_to_ACEScct(float in) { if (in <= 0.0078125f) { return 10.5402377416545f * in + 0.0729055341958355f; @@ -28,7 +27,6 @@ __DEVICE__ float3 transform(int p_Width, int p_Height, int p_X, int p_Y, float p } - DEFINE_CUBE_LUT(DRTLUT) { TITLE "Generated by Foundry::LUT" diff --git a/DaVinci Resolve/ACES Transforms/ODT/ACES2 Candidates rev009/ACES2 CandidateC rev009 Rec709.dctl b/DaVinci Resolve/ACES Transforms/ODT/ACES2 Candidates rev009/ACES2 CandidateC rev009 Rec709.dctl index ac73ad4..00679ff 100644 --- a/DaVinci Resolve/ACES Transforms/ODT/ACES2 Candidates rev009/ACES2 CandidateC rev009 Rec709.dctl +++ b/DaVinci Resolve/ACES Transforms/ODT/ACES2 Candidates rev009/ACES2 CandidateC rev009 Rec709.dctl @@ -1,6 +1,5 @@ DEFINE_ACES_PARAM(IS_PARAMETRIC_ACES_TRANSFORM: 0) - __DEVICE__ float lin_to_ACEScct(float in) { if (in <= 0.0078125f) { return 10.5402377416545f * in + 0.0729055341958355f; @@ -28,7 +27,6 @@ __DEVICE__ float3 transform(int p_Width, int p_Height, int p_X, int p_Y, float p } - DEFINE_CUBE_LUT(DRTLUT) { TITLE "Generated by Foundry::LUT" diff --git a/python/lutWriteNodeCode.py b/python/lutWriteNodeCode.py index ce4ec29..96acb2d 100644 --- a/python/lutWriteNodeCode.py +++ b/python/lutWriteNodeCode.py @@ -18,18 +18,10 @@ def cubeToCub(cubePath,cubPath): inputCubePath = cubePath ouputCubPath = cubPath - - - - # read the cube with open(inputCubePath) as f: lines = f.readlines() - - - - # header tlHeader = '''# Truelight Cube v2.1 # iDims 3 @@ -37,27 +29,14 @@ def cubeToCub(cubePath,cubPath): # width 65 65 65\n # Cube''' - - - - # footer tlFooter = '''\n# end\n''' - - - - - LUTlines = lines[2:] LUTlines = [x.replace('\n','').split(' ') for x in LUTlines] LUTlines = [[float(i) for i in x] for x in LUTlines] LUTlines = [[str(i) for i in x] for x in LUTlines] - - - - ## remove decimal from 0.0 and 1.0 for i, x in enumerate(LUTlines): for j, a in enumerate(x): @@ -66,35 +45,19 @@ def cubeToCub(cubePath,cubPath): if '1.0' == a: LUTlines[i][j] = '1' - - - - # reconstruct the cube string stringLUTlines = [] for line in LUTlines: stringLUTlines.append(' '.join(line)) newLUTStringBlock = '\n'.join(stringLUTlines) - - - - # join it all up outputContents = tlHeader + '\n' + newLUTStringBlock + '\n' + tlFooter - - - - # check directory for outputCubPath exists, if not, create it if not os.path.exists(os.path.dirname(ouputCubPath)): os.makedirs(os.path.dirname(ouputCubPath)) - - - - # write the file with open(ouputCubPath, 'w') as f: f.write(outputContents) @@ -165,6 +128,9 @@ def bakeCandidateLUTfromNode(node): shutil.copy(cubePath,cubePathClean) + # read contents of cube file + with open(cubePathClean) as f: + cubelines = f.readlines() @@ -172,6 +138,9 @@ def bakeCandidateLUTfromNode(node): with open(dctltemplatePath) as f: lines = f.readlines() newLines = [x.replace('replace.cube',cubeNameClean) for x in lines] + # replace the string REPLACE_WITH_CUBE_DATA with the contents of cubelines + newLines = [x.replace('REPLACE_WITH_CUBE_DATA',''.join(cubelines)) for x in newLines] + with open(dctlPath, 'w') as f: f.write(''.join(newLines)) @@ -186,10 +155,14 @@ def bakeCandidateLUTfromNode(node): # copy cubePath to ocioCubePath shutil.copy(cubePath,ocioCubePath) - # remove original cube if it isnt the same as the clean version - if cubePathClean != cubePath: - # delete cubeName + # # remove original cube if it isnt the same as the clean version + # if cubePathClean != cubePath: + # # delete cubeName + # os.remove(cubePath) + if os.path.exists(cubePath): os.remove(cubePath) + if os.path.exists(cubePathClean): + os.remove(cubePathClean) diff --git a/resources/ACES_ApplyLUT_Template_AP0.dctl b/resources/ACES_ApplyLUT_Template_AP0.dctl index 86b8e32..f4e2bbf 100644 --- a/resources/ACES_ApplyLUT_Template_AP0.dctl +++ b/resources/ACES_ApplyLUT_Template_AP0.dctl @@ -1,6 +1,4 @@ DEFINE_ACES_PARAM(IS_PARAMETRIC_ACES_TRANSFORM: 0) -DEFINE_LUT(DRTLUT, replace.cube) - __DEVICE__ float lin_to_ACEScct(float in) { if (in <= 0.0078125f) { @@ -24,3 +22,8 @@ __DEVICE__ float3 transform(int p_Width, int p_Height, int p_X, int p_Y, float p return res; } + + +DEFINE_CUBE_LUT(DRTLUT) +{ +REPLACE_WITH_CUBE_DATA} \ No newline at end of file diff --git a/resources/ACES_ApplyLUT_Template_APS4.dctl b/resources/ACES_ApplyLUT_Template_APS4.dctl index 8a1880c..a6eaf54 100644 --- a/resources/ACES_ApplyLUT_Template_APS4.dctl +++ b/resources/ACES_ApplyLUT_Template_APS4.dctl @@ -1,6 +1,4 @@ DEFINE_ACES_PARAM(IS_PARAMETRIC_ACES_TRANSFORM: 0) -DEFINE_LUT(DRTLUT, replace.cube) - __DEVICE__ float lin_to_ACEScct(float in) { if (in <= 0.0078125f) { @@ -27,3 +25,8 @@ __DEVICE__ float3 transform(int p_Width, int p_Height, int p_X, int p_Y, float p return res; } + + +DEFINE_CUBE_LUT(DRTLUT) +{ +REPLACE_WITH_CUBE_DATA} \ No newline at end of file