forked from jedypod/nuke-colortools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHueRotate.nk
41 lines (41 loc) · 1.08 KB
/
HueRotate.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
set cut_paste_input [stack 0]
push $cut_paste_input
Group {
name HueRotate
addUserKnob {20 HueRotate_tab l HueRotate}
addUserKnob {22 minus l - T "n = nuke.thisNode()\nrot = n\['rotate']\nrot.setValue(rot.getValue()-30)" +STARTLINE}
addUserKnob {22 plus l + -STARTLINE T "n = nuke.thisNode()\nrot = n\['rotate']\nrot.setValue(rot.getValue()+30)"}
addUserKnob {7 rotate t "hue angle in degrees to rotate input colors" R 0 360}
}
Input {
inputs 0
name Input
xpos -40
ypos 20
}
Expression {
temp_name0 M
temp_expr0 max(r,g,b)
temp_name1 C
temp_expr1 M-min(r,g,b)
temp_name2 H
temp_expr2 ((C==0?0:r==M?((g-b)/C+6)%6:g==M?(b-r)/C+2:b==M?(r-g)/C+4:0)+shift)%6
temp_name3 X
temp_expr3 C*(1-fabs(H%2-1))
expr0 (H<1?C:H<2?X:H<3?0:H<4?0:H<5?X:C)+min(r,g,b)
expr1 (H<1?X:H<2?C:H<3?C:H<4?X:H<5?0:0)+min(r,g,b)
expr2 (H<1?0:H<2?0:H<3?X:H<4?C:H<5?C:X)+min(r,g,b)
expr3 H
name Expression
xpos -40
ypos 52
addUserKnob {20 HueRotate_tab l HueRotate}
addUserKnob {7 shift R 0 6}
shift {{6*radians(rotate)/pi/2}}
}
Output {
name Output
xpos -40
ypos 80
}
end_group