forked from jedypod/nuke-colortools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGamutConvert_live.nk
77 lines (77 loc) · 24.5 KB
/
GamutConvert_live.nk
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
75
76
77
set cut_paste_input [stack 0]
push $cut_paste_input
Group {
name GamutConvert_live
tile_color 0xbd91c9ff
label "\[if \{\[value invert]\} \{return \"\[value dst_colorspace_name] to \[value src_colorspace_name]\"\} else \{return \"\[value src_colorspace_name] to \[value dst_colorspace_name]\"\}]"
addUserKnob {20 GamutConvert_tab l GamutConvert}
addUserKnob {26 gamut_chromaticities_label l " " T "<b>SRC Gamut Chromaticity Coordinates</b>"}
addUserKnob {35 src_presets l preset M {gamut/ACES "knobs this \{rxy \{0.73470 0.26530\} gxy \{0.00000 1.00000\} bxy \{0.00010 -0.07700\} wxy \{0.32168 0.33767\} src_colorspace_name \{ACES\}\}" gamut/ACEScg "knobs this \{rxy \{0.713 0.293\} gxy \{0.165 0.830\} bxy \{0.128 0.044\} wxy \{0.32168 0.33767\} src_colorspace_name \{ACEScg\}\}" "gamut/Filmlight E-Gamut" "knobs this \{ rxy \{0.8 0.3177\} gxy \{0.18 0.9\} bxy \{0.065 -0.0805\} wxy \{0.3127 0.329\} src_colorspace_name \{Filmlight E-Gamut\}\}" "gamut/DaVinci WG" "knobs this \{ rxy \{0.8 0.3130\} gxy \{0.1682 0.9877\} bxy \{0.079 -0.1155\} wxy \{0.3127 0.329\} src_colorspace_name \{DaVinci WG\}\}" gamut/Rec709 "knobs this \{rxy \{0.64000 0.33000\} gxy \{0.30000 0.60000\} bxy \{0.15000 0.06000\} wxy \{0.3127 0.329\} src_colorspace_name \{Rec709\}\}" gamut/Rec2020 "knobs this \{rxy \{0.70800 0.29200\} gxy \{0.17000 0.79700\} bxy \{0.13100 0.04600\} wxy \{0.3127 0.329\} src_colorspace_name \{Rec2020\}\}" gamut/P3D60 "knobs this \{rxy \{0.68000 0.32000\} gxy \{0.26500 0.69000\} bxy \{0.15000 0.06000\} wxy \{0.32168 0.33767\} src_colorspace_name \{P3D60\}\}" gamut/P3D65 "knobs this \{rxy \{0.68000 0.32000\} gxy \{0.26500 0.69000\} bxy \{0.15000 0.06000\} wxy \{0.3127 0.329\} src_colorspace_name \{P3D65\}\}" gamut/P3DCI "knobs this \{rxy \{0.68000 0.32000\} gxy \{0.26500 0.69000\} bxy \{0.15000 0.06000\} wxy \{0.314 0.351\} src_colorspace_name \{P3DCI\}\}" "gamut/Arri AlexaWideGamut" "knobs this \{rxy \{0.68400 0.31300\} gxy \{0.22100 0.84800\} bxy \{0.08610 -0.10200\} wxy \{0.3127 0.329\} src_colorspace_name \{Arri AlexaWideGamut\}\}" gamut/REDDRAGONcolor "knobs this \{rxy \{0.753044222785 0.327830576682\} gxy \{0.299570228481 0.700699321956\} bxy \{0.079642066735 -0.0549379510888\} wxy \{0.321683187724 0.337673316035\} src_colorspace_name \{REDDRAGONcolor\}\}" gamut/REDDRAGONcolor2 "knobs this \{rxy \{0.753044491143 0.327831029513\} gxy \{0.299570490451 0.700699415614\} bxy \{0.145011584278 0.0510971250879\} wxy \{0.321683210353 0.337673610062\} src_colorspace_name \{REDDRAGONcolor2\}\}" gamut/REDcolor "knobs this \{rxy \{0.699747001291 0.329046930313\} gxy \{0.304264039024 0.623641145129\} bxy \{0.134913961296 0.0347174412813\} wxy \{0.321683289449 0.337673447208\} src_colorspace_name \{REDcolor\}\}" gamut/REDcolor2 "knobs this \{rxy \{0.878682510476 0.32496400741\} gxy \{0.300888714367 0.679054755791\} bxy \{0.0953986946056 -0.0293793268343\} wxy \{0.321683289449 0.337673447208\} src_colorspace_name \{REDcolor2\}\}" gamut/REDcolor3 "knobs this \{rxy \{0.701181035906 0.329014155583\} gxy \{0.300600304652 0.683788834269\} bxy \{0.108154455624 -0.00868817578666\} wxy \{0.321683210353 0.337673610062\} src_colorspace_name \{REDcolor3\}\}" gamut/REDcolor4 "knobs this \{rxy \{0.701180591892 0.329013699116\} gxy \{0.300600395529 0.683788824257\} bxy \{0.145331946229 0.0516168036226\} wxy \{0.321683289449 0.337673447208\} src_colorspace_name \{REDcolor4\}\}" gamut/REDWideGamutRGB "knobs this \{rxy \{0.780308 0.304253\} gxy \{0.121595 1.493994\} bxy \{0.095612 -0.084589\} wxy \{0.3127 0.329\} src_colorspace_name \{REDWideGamutRGB\}\}" "gamut/GoPro Protune Native" "knobs this \{rxy \{0.69848046 0.19302645\} gxy \{0.32955538 1.02459662\} bxy \{0.10844263 -0.03467857\} wxy \{0.3127 0.329\} src_colorspace_name \{GoPro Protune Native\}\}" gamut/CanonCinemaGamut "knobs this \{rxy \{0.74 0.27\} gxy \{0.17 1.14\} bxy \{0.08 -0.1\} wxy \{0.3127 0.329\} src_colorspace_name \{CanonCinemaGamut\}\}" gamut/SonySGamut "knobs this \{rxy \{0.73 0.28\} gxy \{0.14 0.855\} bxy \{0.1 -0.05\} wxy \{0.3127 0.329\} src_colorspace_name \{SonySGamut\}\}" gamut/SonySGamut3Cine "knobs this \{rxy \{0.766 0.275\} gxy \{0.225 0.8\} bxy \{0.089 -0.087\} wxy \{0.3127 0.329\} src_colorspace_name \{SonySGamut3Cine\}\}" gamut/PanasonicVGamut "knobs this \{rxy \{0.730 0.280\} gxy \{0.165 0.840\} bxy \{0.100 -0.030\} wxy \{0.3127 0.329\} src_colorspace_name \{PanasonicVGamut\}\}" "gamut/DJI D-Gamut" "knobs this \{rxy \{0.71 0.31\} gxy \{0.21 0.88\} bxy \{0.09 -0.08\} wxy \{0.3127 0.329\} src_colorspace_name \{DJI D-Gamut\}\}" "gamut/Fujifilm F-Gamut" "knobs this \{rxy \{0.70800 0.29200\} gxy \{0.17000 0.79700\} bxy \{0.13100 0.04600\} wxy \{0.3127 0.329\} src_colorspace_name \{Fujifilm F-Gamut\}\}" gamut/BMDFilmV1 "knobs this \{rxy \{0.9173 0.2502\} gxy \{0.2833 1.7072\} bxy \{0.0856 -0.0708\} wxy \{0.3135 0.3305\} src_colorspace_name \{BMDFilmV1\}\}" gamut/BMD4kFilmV1 "knobs this \{rxy \{0.7422 0.2859\} gxy \{0.4140 1.3035\} bxy \{0.0342 -0.0833\} wxy \{0.3135 0.3305\} src_colorspace_name \{BMD4kFilmV1\}\}" gamut/BMD4kFilmV3 "knobs this \{rxy \{1.0625 0.3948\} gxy \{0.3689 0.7775\} bxy \{0.0956 -0.0332\} wxy \{0.3135 0.3305\} src_colorspace_name \{BMD4kFilmV3\}\}" gamut/BMD46kFilmV1 "knobs this \{rxy \{0.9175 0.2983\} gxy \{0.2983 1.2835\} bxy \{0.0756 -0.0860\} wxy \{0.3127 0.329\} src_colorspace_name \{BMD46kFilmV1\}\}" gamut/BMD46kFilmV3 "knobs this \{rxy \{0.8608 0.3689\} gxy \{0.3282 0.6156\} bxy \{0.0783 -0.0233\} wxy \{0.3127 0.329\} src_colorspace_name \{BMD46kFilmV3\}\}" gamut/BMDWideGamutV4 "knobs this \{rxy \{0.7177 0.3171\} gxy \{0.2280 0.8616\} bxy \{0.1006 -0.0820\} wxy \{0.3127 0.329\} src_colorspace_name \{BMDWideGamutV4\}\}" "gamut/AdobeRGB\t" "knobs this \{rxy \{0.6400 0.3300\} gxy \{0.2100 0.7100\} bxy \{0.1500 0.0600\} wxy \{0.3127 0.329\} src_colorspace_name \{AdobeRGB\}\}" gamut/AdobeWideGamutRGB "knobs this \{rxy \{0.7347 0.2653\} gxy \{0.1152 0.8264\} bxy \{0.1566 0.0177\} wxy \{0.3457 0.3585\} src_colorspace_name \{AdobeWideGamutRGB\}\}" gamut/ROMM "knobs this \{rxy \{7.34700000e-01 2.65300000e-01\} gxy \{1.59600000e-01 8.40400000e-01\} bxy \{3.66000000e-02 1.00000000e-04\} wxy \{0.3457 0.3585\} src_colorspace_name \{ROMM\}\}" gamut/RIMM "knobs this \{rxy \{7.34700000e-01 2.65300000e-01\} gxy \{1.59600000e-01 8.40400000e-01\} bxy \{3.66000000e-02 1.00000000e-04\} wxy \{0.3457 0.3585\} src_colorspace_name \{RIMM\}\}" gamut/ERIMM "knobs this \{rxy \{7.34700000e-01 2.65300000e-01\} gxy \{1.59600000e-01 8.40400000e-01\} bxy \{3.66000000e-02 1.00000000e-04\} wxy \{0.3457 0.3585\} src_colorspace_name \{ERIMM\}\}" gamut/ProPhotoRGB "knobs this \{rxy \{0.734699 0.265301\} gxy \{0.159597 0.840403\} bxy \{0.036598 0.000105\} wxy \{0.345704 0.358540\} src_colorspace_name \{ProPhotoRGB\}\}" gamut/RusselRGB "knobs this \{rxy \{0.6900 0.3100\} gxy \{0.1800 0.7700\} bxy \{0.1000 0.0200\} wxy \{0.33243 0.34744\} src_colorspace_name \{RusselRGB\}\}" gamut/SharpRGB "knobs this \{rxy \{0.6898 0.3206\} gxy \{0.0736 0.9003\} bxy \{0.1166 0.0374\} wxy \{0.33333333 0.33333333\} src_colorspace_name \{SharpRGB\}\}" gamut/AppleRGB "knobs this \{rxy \{0.6250 0.3400\} gxy \{0.2800 0.5950\} bxy \{0.1550 0.0700\} wxy \{0.3127 0.329\} src_colorspace_name \{AppleRGB\}\}" gamut/BestRGB "knobs this \{rxy \{0.735191637630662 0.264808362369338\} gxy \{0.215336134453781 0.774159663865546\} bxy \{0.130122950819672 0.034836065573770\} wxy \{0.3457 0.3585\} src_colorspace_name \{BestRGB\}\}" "gamut/XYZ D60" "knobs this \{rxy \{1 0\} gxy \{0 1\} bxy \{0 0\} wxy \{0.32162624 0.337737\} src_colorspace_name \{XYZ D60\}\}" "gamut/XYZ D65" "knobs this \{rxy \{1 0\} gxy \{0 1\} bxy \{0 0\} wxy \{0.3127 0.329\} src_colorspace_name \{XYZ D65\}\}" "gamut/XYZ E" "knobs this \{rxy \{1 0\} gxy \{0 1\} bxy \{0 0\} wxy \{0.333333333333 0.333333333333\} src_colorspace_name \{XYZ E\}\}" "" ""}}
addUserKnob {41 rxy l r T _knobchanged_.rxy}
addUserKnob {41 gxy l g T _knobchanged_.gxy}
addUserKnob {41 bxy l b T _knobchanged_.bxy}
addUserKnob {41 wxy l w T _knobchanged_.wxy}
addUserKnob {1 src_colorspace_name l src +DISABLED}
addUserKnob {26 ""}
addUserKnob {26 dst_gamut_chromaticities_label l " " T "<b>DST Gamut Chromaticity Coordinates</b>"}
addUserKnob {35 dst_presets l preset M {gamut/ACES "knobs this \{drxy \{0.73470 0.26530\} dgxy \{0.00000 1.00000\} dbxy \{0.00010 -0.07700\} dwxy \{0.32168 0.33767\} dst_colorspace_name \{ACES\}\}" gamut/ACEScg "knobs this \{drxy \{0.713 0.293\} dgxy \{0.165 0.830\} dbxy \{0.128 0.044\} dwxy \{0.32168 0.33767\} dst_colorspace_name \{ACEScg\}\}" "gamut/Filmlight E-Gamut" "knobs this \{ drxy \{0.8 0.3177\} dgxy \{0.18 0.9\} dbxy \{0.065 -0.0805\} dwxy \{0.3127 0.329\} dst_colorspace_name \{Filmlight E-Gamut\}\}" "gamut/DaVinci WG" "knobs this \{ drxy \{0.8 0.3130\} dgxy \{0.1682 0.9877\} dbxy \{0.079 -0.1155\} dwxy \{0.3127 0.329\} dst_colorspace_name \{DaVinci WG\}\}" gamut/Rec709 "knobs this \{drxy \{0.64000 0.33000\} dgxy \{0.30000 0.60000\} dbxy \{0.15000 0.06000\} dwxy \{0.3127 0.329\} dst_colorspace_name \{Rec709\}\}" gamut/Rec2020 "knobs this \{drxy \{0.70800 0.29200\} dgxy \{0.17000 0.79700\} dbxy \{0.13100 0.04600\} dwxy \{0.3127 0.329\} dst_colorspace_name \{Rec2020\}\}" gamut/P3D60 "knobs this \{drxy \{0.68000 0.32000\} dgxy \{0.26500 0.69000\} dbxy \{0.15000 0.06000\} dwxy \{0.32168 0.33767\} dst_colorspace_name \{P3D60\}\}" gamut/P3D65 "knobs this \{drxy \{0.68000 0.32000\} dgxy \{0.26500 0.69000\} dbxy \{0.15000 0.06000\} dwxy \{0.3127 0.329\} dst_colorspace_name \{P3D65\}\}" gamut/P3DCI "knobs this \{drxy \{0.68000 0.32000\} dgxy \{0.26500 0.69000\} dbxy \{0.15000 0.06000\} dwxy \{0.314 0.351\} dst_colorspace_name \{P3DCI\}\}" "gamut/Arri AlexaWideGamut" "knobs this \{drxy \{0.68400 0.31300\} dgxy \{0.22100 0.84800\} dbxy \{0.08610 -0.10200\} dwxy \{0.3127 0.329\} dst_colorspace_name \{Arri AlexaWideGamut\}\}" gamut/REDDRAGONcolor "knobs this \{drxy \{0.753044222785 0.327830576682\} dgxy \{0.299570228481 0.700699321956\} dbxy \{0.079642066735 -0.0549379510888\} dwxy \{0.321683187724 0.337673316035\} dst_colorspace_name \{REDDRAGONcolor\}\}" gamut/REDDRAGONcolor2 "knobs this \{drxy \{0.753044491143 0.327831029513\} dgxy \{0.299570490451 0.700699415614\} dbxy \{0.145011584278 0.0510971250879\} dwxy \{0.321683210353 0.337673610062\} dst_colorspace_name \{REDDRAGONcolor2\}\}" gamut/REDcolor "knobs this \{drxy \{0.699747001291 0.329046930313\} dgxy \{0.304264039024 0.623641145129\} dbxy \{0.134913961296 0.0347174412813\} dwxy \{0.321683289449 0.337673447208\} dst_colorspace_name \{REDcolor\}\}" gamut/REDcolor2 "knobs this \{drxy \{0.878682510476 0.32496400741\} dgxy \{0.300888714367 0.679054755791\} dbxy \{0.0953986946056 -0.0293793268343\} dwxy \{0.321683289449 0.337673447208\} dst_colorspace_name \{REDcolor2\}\}" gamut/REDcolor3 "knobs this \{drxy \{0.701181035906 0.329014155583\} dgxy \{0.300600304652 0.683788834269\} dbxy \{0.108154455624 -0.00868817578666\} dwxy \{0.321683210353 0.337673610062\} dst_colorspace_name \{REDcolor3\}\}" gamut/REDcolor4 "knobs this \{drxy \{0.701180591892 0.329013699116\} dgxy \{0.300600395529 0.683788824257\} dbxy \{0.145331946229 0.0516168036226\} dwxy \{0.321683289449 0.337673447208\} dst_colorspace_name \{REDcolor4\}\}" gamut/REDWideGamutRGB "knobs this \{drxy \{0.780308 0.304253\} dgxy \{0.121595 1.493994\} dbxy \{0.095612 -0.084589\} dwxy \{0.3127 0.329\} dst_colorspace_name \{REDWideGamutRGB\}\}" "gamut/GoPro Protune Native" "knobs this \{drxy \{0.69848046 0.19302645\} dgxy \{0.32955538 1.02459662\} dbxy \{0.10844263 -0.03467857\} dwxy \{0.3127 0.329\} dst_colorspace_name \{GoPro Protune Native\}\}" gamut/CanonCinemaGamut "knobs this \{drxy \{0.74 0.27\} dgxy \{0.17 1.14\} dbxy \{0.08 -0.1\} dwxy \{0.3127 0.329\} dst_colorspace_name \{CanonCinemaGamut\}\}" gamut/SonySGamut "knobs this \{drxy \{0.73 0.28\} dgxy \{0.14 0.855\} dbxy \{0.1 -0.05\} dwxy \{0.3127 0.329\} dst_colorspace_name \{SonySGamut\}\}" gamut/SonySGamut3Cine "knobs this \{drxy \{0.766 0.275\} dgxy \{0.225 0.8\} dbxy \{0.089 -0.087\} dwxy \{0.3127 0.329\} dst_colorspace_name \{SonySGamut3Cine\}\}" gamut/PanasonicVGamut "knobs this \{drxy \{0.730 0.280\} dgxy \{0.165 0.840\} dbxy \{0.100 -0.030\} dwxy \{0.3127 0.329\} dst_colorspace_name \{PanasonicVGamut\}\}" "gamut/DJI D-Gamut" "knobs this \{drxy \{0.71 0.31\} dgxy \{0.21 0.88\} dbxy \{0.09 -0.08\} dwxy \{0.3127 0.329\} dst_colorspace_name \{DJI D-Gamut\}\}" "gamut/Fujifilm F-Gamut" "knobs this \{drxy \{0.70800 0.29200\} dgxy \{0.17000 0.79700\} dbxy \{0.13100 0.04600\} dwxy \{0.3127 0.329\} dst_colorspace_name \{Fujifilm F-Gamut\}\}" gamut/BMDFilmV1 "knobs this \{drxy \{0.9173 0.2502\} dgxy \{0.2833 1.7072\} dbxy \{0.0856 -0.0708\} dwxy \{0.3135 0.3305\} dst_colorspace_name \{BMDFilmV1\}\}" gamut/BMD4kFilmV1 "knobs this \{drxy \{0.7422 0.2859\} dgxy \{0.4140 1.3035\} dbxy \{0.0342 -0.0833\} dwxy \{0.3135 0.3305\} dst_colorspace_name \{BMD4kFilmV1\}\}" gamut/BMD4kFilmV3 "knobs this \{drxy \{1.0625 0.3948\} dgxy \{0.3689 0.7775\} dbxy \{0.0956 -0.0332\} dwxy \{0.3135 0.3305\} dst_colorspace_name \{BMD4kFilmV3\}\}" gamut/BMD46kFilmV1 "knobs this \{drxy \{0.9175 0.2983\} dgxy \{0.2983 1.2835\} dbxy \{0.0756 -0.0860\} dwxy \{0.3127 0.329\} dst_colorspace_name \{BMD46kFilmV1\}\}" gamut/BMD46kFilmV3 "knobs this \{drxy \{0.8608 0.3689\} dgxy \{0.3282 0.6156\} dbxy \{0.0783 -0.0233\} dwxy \{0.3127 0.329\} dst_colorspace_name \{BMD46kFilmV3\}\}" gamut/BMDWideGamutV4 "knobs this \{drxy \{0.7177 0.3171\} dgxy \{0.2280 0.8616\} dbxy \{0.1006 -0.0820\} dwxy \{0.3127 0.329\} dst_colorspace_name \{BMDWideGamutV4\}\}" "gamut/AdobeRGB\t" "knobs this \{drxy \{0.6400 0.3300\} dgxy \{0.2100 0.7100\} dbxy \{0.1500 0.0600\} dwxy \{0.3127 0.329\} dst_colorspace_name \{AdobeRGB\}\}" gamut/AdobeWideGamutRGB "knobs this \{drxy \{0.7347 0.2653\} dgxy \{0.1152 0.8264\} dbxy \{0.1566 0.0177\} dwxy \{0.3457 0.3585\} dst_colorspace_name \{AdobeWideGamutRGB\}\}" gamut/ROMM "knobs this \{drxy \{7.34700000e-01 2.65300000e-01\} dgxy \{1.59600000e-01 8.40400000e-01\} dbxy \{3.66000000e-02 1.00000000e-04\} dwxy \{0.3457 0.3585\} dst_colorspace_name \{ROMM\}\}" gamut/RIMM "knobs this \{drxy \{7.34700000e-01 2.65300000e-01\} dgxy \{1.59600000e-01 8.40400000e-01\} dbxy \{3.66000000e-02 1.00000000e-04\} dwxy \{0.3457 0.3585\} dst_colorspace_name \{RIMM\}\}" gamut/ERIMM "knobs this \{drxy \{7.34700000e-01 2.65300000e-01\} dgxy \{1.59600000e-01 8.40400000e-01\} dbxy \{3.66000000e-02 1.00000000e-04\} dwxy \{0.3457 0.3585\} dst_colorspace_name \{ERIMM\}\}" gamut/ProPhotoRGB "knobs this \{drxy \{0.734699 0.265301\} dgxy \{0.159597 0.840403\} dbxy \{0.036598 0.000105\} dwxy \{0.345704 0.358540\} dst_colorspace_name \{ProPhotoRGB\}\}" gamut/RusselRGB "knobs this \{drxy \{0.6900 0.3100\} dgxy \{0.1800 0.7700\} dbxy \{0.1000 0.0200\} dwxy \{0.33243 0.34744\} dst_colorspace_name \{RusselRGB\}\}" gamut/SharpRGB "knobs this \{drxy \{0.6898 0.3206\} dgxy \{0.0736 0.9003\} dbxy \{0.1166 0.0374\} dwxy \{0.33333333 0.33333333\} dst_colorspace_name \{SharpRGB\}\}" gamut/AppleRGB "knobs this \{drxy \{0.6250 0.3400\} dgxy \{0.2800 0.5950\} dbxy \{0.1550 0.0700\} dwxy \{0.3127 0.329\} dst_colorspace_name \{AppleRGB\}\}" gamut/BestRGB "knobs this \{drxy \{0.735191637630662 0.264808362369338\} dgxy \{0.215336134453781 0.774159663865546\} dbxy \{0.130122950819672 0.034836065573770\} dwxy \{0.3457 0.3585\} dst_colorspace_name \{BestRGB\}\}" "gamut/XYZ D60" "knobs this \{drxy \{1 0\} dgxy \{0 1\} dbxy \{0 0\} dwxy \{0.32162624 0.337737\} dst_colorspace_name \{XYZ D60\}\}" "gamut/XYZ D65" "knobs this \{drxy \{1 0\} dgxy \{0 1\} dbxy \{0 0\} dwxy \{0.3127 0.329\} dst_colorspace_name \{XYZ D65\}\}" "gamut/XYZ E" "knobs this \{drxy \{1 0\} dgxy \{0 1\} dbxy \{0 0\} dwxy \{0.333333333333 0.333333333333\} dst_colorspace_name \{XYZ E\}\}" "" ""}}
addUserKnob {41 drxy l r T _knobchanged_.drxy}
addUserKnob {41 dgxy l g T _knobchanged_.dgxy}
addUserKnob {41 dbxy l b T _knobchanged_.dbxy}
addUserKnob {41 dwxy l w T _knobchanged_.dwxy}
addUserKnob {1 dst_colorspace_name l dst +DISABLED}
addUserKnob {26 ""}
addUserKnob {26 chromatic_adaptation_label l " " T "<b>Chromatic Adaptation</b>"}
addUserKnob {41 cat_method l method T _knobchanged_.cat_method}
addUserKnob {26 ""}
addUserKnob {41 invert T _knobchanged_.invert}
addUserKnob {22 create_matrix_node l "Create Matrix" t "Create ColorMatrix node with the current values." T "node = nuke.thisNode()\n\nnuke.root().begin()\n_ = \[n.setSelected(False) for n in nuke.allNodes(recurseGroups=True)]\nm = nuke.createNode('ColorMatrix')\nm\['matrix'].setValue(node\['matrix'].getValue())\nm.setXYpos(node.xpos()-120, node.ypos())\nsrc_name = node\['src_colorspace_name'].getValue()\ndst_name = node\['dst_colorspace_name'].getValue()\nif node\['invert'].getValue():\n label = '\{1\} to \{0\}'.format(src_name, dst_name)\nelse:\n label = '\{0\} to \{1\}'.format(src_name, dst_name)\n\nm\['label'].setValue(label)" +STARTLINE}
addUserKnob {41 matrix T ColorMatrix.matrix}
addUserKnob {22 clear l Clear T "n = nuke.thisNode()\nn\['matrix'].setValue(\[1,0,0,0,1,0,0,0,1])\nn\['label'].setValue('')" +STARTLINE}
addUserKnob {22 show_matrix l Show t "Show matrix values in a popup window for copying." T "node = nuke.thisNode()\nshow_4x4 = node\['show_matrix_4x4'].getValue()\nshow_commas = node\['show_matrix_commas'].getValue()\n\nif show_commas:\n sep = ', '\nelse:\n sep = ' '\n\nmtx = \[format(i, '.8f') for i in node\['matrix'].getValue()]\n\nif show_4x4:\n z = \['0']\n mtx = mtx\[0:3] + z + mtx\[3:6] + z + mtx\[6:9] + z*4 + \['1']\n\nnuke.message(sep.join(mtx))" +STARTLINE}
addUserKnob {6 show_matrix_4x4 l "show 4x4" t "present values in a 4x4 matrix (useful for ocio)" -STARTLINE}
addUserKnob {6 show_matrix_commas l "show comma sep" t "show matrix comma separated." -STARTLINE}
addUserKnob {22 save_spimtx l "Save spimtx" T "# inspired by ColorMatrixPlus by hpd\ndef write_spimtx(mtx_node, spimtx_file):\n mtx_vals = mtx_node\['matrix'].getValue()\n with open(spimtx_file, \"w\") as f:\n f.write( \"%3.6f %3.6f %3.6f 0.0\\n\" % (\n mtx_vals\[0], mtx_vals\[1], mtx_vals\[2]) )\n f.write( \"%3.6f %3.6f %3.6f 0.0\\n\" % (\n mtx_vals\[3], mtx_vals\[4], mtx_vals\[5]) )\n f.write( \"%3.6f %3.6f %3.6f 0.0\\n\" % (\n mtx_vals\[6], mtx_vals\[7], mtx_vals\[8]) )\n\nnode = nuke.thisNode()\nfilepath = nuke.getFilename('Save Matrix', '*.spimtx')\n\nif filepath:\n if not filepath.endswith('.spimtx'):\n filepath = filepath + '.spimtx'\n write_spimtx(node, filepath)" +STARTLINE}
addUserKnob {22 load_spimtx l "Load spimtx" -STARTLINE T "# Inspired by ColorMatrixPlus by hpd\ndef load_spimtx(spimtx, mtx_node):\n with open( spimtx, 'r') as file:\n lines = file.readlines()\n matrix_values = list()\n for line in lines:\n matrix_values.extend( map(float, line.strip().split(' ')\[0:3]) )\n mtx_node\['matrix'].setValue(matrix_values)\n\nspimtx = nuke.getFilename('Load SPIMTX', '*.spimtx')\nif spimtx:\n load_spimtx( spimtx, nuke.thisNode() )\n"}
}
Input {
inputs 0
name Input
xpos -40
ypos 206
}
Dot {
name _knobchanged_
knobChanged "import nuke\nfloat3 = nuke.math.Vector3\nfloat3x3 = nuke.math.Matrix3\n\ndef transpose(m):\n # Transpose (swap rows and columns) of a nuke.math.Matrix3\n return float3x3(m\[0], m\[1], m\[2], m\[3], m\[4], m\[5], m\[6], m\[7], m\[8])\n\ndef set_matrix(m):\n # Populate a nuke.math.Matrix3 with a 3x3 python list (either 3x3 or 1x9)\n if len(m) is 3 and \[isinstance(r, list) for r in m]:\n m = sum(m, \[])\n o = float3x3(m\[0], m\[3], m\[6], m\[1], m\[4], m\[7], m\[2], m\[5], m\[8])\n return o\n\ndef diag(v):\n # Create a diagonal 3x3 matrix from a 1x3 vector\n return float3x3(v\[0], 0, 0, 0, v\[1], 0, 0, 0, v\[2])\n\n\ndef xyY_to_XYZ(xyY):\n # Convert an xyY chromaticity value to XYZ\n x = xyY\[0]\n y = xyY\[1]\n if len(xyY) is 2:\n # Assume an xy chromaticity coordinate, use default Y\n Y = 1.0\n else:\n Y = xyY\[2]\n XYZ = float3(x * Y / max(y, 1e-10), Y, (1.0 - x - y) * Y / max(y, 1e-10))\n return XYZ\n\n\ndef calc_cat(src_xy, dst_xy, cat_method='cat02'):\n # Calculate Von Kries chromatic adaptation transform matrix,\n # given a source and destination illuminant and CAT method.\n # Illuminant is given as xy chromaticity coordinates. \n # CAT method is the name of one of the below cone response matrices.\n\n crmtxs = \{\n \"bianco\": \[\[0.8752, 0.2787, -0.1539], \[-0.8904, 1.8709, 0.0195], \[-0.0061, 0.0162, 0.9899]],\n \"bianco_pc\": \[\[0.6489, 0.3915, -0.0404], \[-0.3775, 1.3055, 0.072], \[-0.0271, 0.0888, 0.9383]],\n \"bradford\": \[\[0.8951, 0.2664, -0.1614], \[-0.7502, 1.7135, 0.0367], \[0.0389, -0.0685, 1.0296]],\n \"cat02\": \[\[0.7328, 0.4296, -0.1624], \[-0.7036, 1.6975, 0.0061], \[0.003, 0.0136, 0.9834]],\n \"cat02_brill_cat\": \[\[0.7328, 0.4296, -0.1624], \[-0.7036, 1.6975, 0.0061], \[0.0, 0.0, 1.0]],\n \"cmccat2000\": \[\[0.7982, 0.3389, -0.1371], \[-0.5918, 1.5512, 0.0406], \[0.0008, 0.0239, 0.9753]],\n \"cmccat97\": \[\[0.8951, -0.7502, 0.0389], \[0.2664, 1.7135, 0.0685], \[-0.1614, 0.0367, 1.0296]],\n \"fairchild\": \[\[0.8562, 0.3372, -0.1934], \[-0.836, 1.8327, 0.0033], \[0.0357, -0.0469, 1.0112]],\n \"sharp\": \[\[1.2694, -0.0988, -0.1706], \[-0.8364, 1.8006, 0.0357], \[0.0297, -0.0315, 1.0018]],\n \"von_kries\": \[\[0.40024, 0.7076, -0.08081], \[-0.2263, 1.16532, 0.0457], \[0.0, 0.0, 0.91822]],\n \"xyz_scaling\": \[\[1.0, 0.0, 0.0], \[0.0, 1.0, 0.0], \[0.0, 0.0, 1.0]]\n \}\n \n cat_method = cat_method.lower().replace(' ', '_')\n # Return identity matrix if no match\n if cat_method not in crmtxs.keys():\n m = float3x3()\n m.makeIdentity()\n return m\n\n crmtx = set_matrix(crmtxs\[cat_method])\n\n # Get XYZ values from xy chromaticity coordinates\n src_XYZ = xyY_to_XYZ(src_xy)\n dst_XYZ = xyY_to_XYZ(dst_xy)\n\n # Calculate source and destination cone response matrices\n src_crmtx = transpose(crmtx) * src_XYZ\n dst_crmtx = transpose(crmtx) * dst_XYZ\n\n von_kries_matrix = diag(dst_crmtx / src_crmtx)\n cat_mtx = float3x3()\n cat_mtx = crmtx * (von_kries_matrix * crmtx.inverse())\n return cat_mtx\n\n\ndef calc_npm(chr):\n # Calculate a normalized primaries matrix from the specified chromaticity coordinates,\n # given 2x4 list of xy chromaticity coordinates: red, green, blue, and white\n def xy_to_xyz(xy):\n return float3(xy\[0], xy\[1], 1.0 - xy\[0] - xy\[1])\n rxyz, gxyz, bxyz, wxyz = map(xy_to_xyz, chr)\n wy = chr\[3]\[1]\n wxyz = float3(wxyz.x / wy, wxyz.y / wy, wxyz.z / wy)\n np_mtx = float3x3(rxyz\[0], gxyz\[0], bxyz\[0],\n rxyz\[1], gxyz\[1], bxyz\[1],\n rxyz\[2], gxyz\[2], bxyz\[2])\n wscale = np_mtx.inverse() * wxyz \n np_mtx = transpose(np_mtx * diag(wscale))\n return np_mtx\n\n\ndef start():\n node = nuke.thisGroup()\n \n identity_mtx = float3x3()\n identity_mtx.makeIdentity()\n\n invert = node\['invert'].getValue()\n cat_method = node\['cat_method'].value()\n\n src_chr = \[node\[k].getValue() for k in \['rxy', 'gxy', 'bxy', 'wxy']]\n dst_chr = \[node\[k].getValue() for k in \['drxy', 'dgxy', 'dbxy', 'dwxy']]\n\n rgb_to_xyz = calc_npm(src_chr)\n xyz_to_rgb = calc_npm(dst_chr).inverse() \n\n cat_mtx = calc_cat(src_chr\[3], dst_chr\[3], cat_method)\n\n mtx = (rgb_to_xyz * cat_mtx) * xyz_to_rgb\n\n if invert:\n mtx = mtx.inverse()\n\n node\['matrix'].setValue(mtx)\n\n\nif __name__=='__main__':\n start()"
tile_color 0x5b0000
xpos -6
ypos 258
addUserKnob {20 Knobs}
addUserKnob {12 rxy l r t "Red xy chromaticity coordinates in CIE 1931 colorspace."}
addUserKnob {12 gxy l g t "Green xy chromaticity coordinates in CIE 1931 colorspace."}
addUserKnob {12 bxy l b t "Blue xy chromaticity coordinates in CIE 1931 colorspace."}
addUserKnob {12 wxy l w t "Whitepoint xy chromaticity coordinates in CIE 1931 colorspace."}
addUserKnob {12 drxy l r t "Red xy chromaticity coordinates in CIE 1931 colorspace."}
addUserKnob {12 dgxy l g t "Green xy chromaticity coordinates in CIE 1931 colorspace."}
addUserKnob {12 dbxy l b t "Blue xy chromaticity coordinates in CIE 1931 colorspace."}
addUserKnob {12 dwxy l w t "Whitepoint xy chromaticity coordinates in CIE 1931 colorspace."}
addUserKnob {4 cat_method l method t "Choose the chromatic adaptation method for adapting whitepoint." M {cat02 bradford cmccat2000 xyz_scaling none "" fairchild bianco cat02_brill_cat bianco_pc cmccat97 sharp von_kries}}
cat_method cat02
addUserKnob {6 invert t "Invert direction of matrix." +STARTLINE}
}
ColorMatrix {
matrix {
{1 0 0}
{0 1 0}
{0 0 1}
}
name ColorMatrix
xpos -40
ypos 302
}
Output {
name Output
xpos -40
ypos 350
}
end_group