Repository navigation
Expand file tree
/
Copy pathallSwitchesOff.py
More file actions
69 lines (30 loc) · 1.37 KB
/
Copy pathallSwitchesOff.py
File metadata and controls
69 lines (30 loc) · 1.37 KB
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
import nuke
#-------------------------------------------#
# #
# Turns them all off #
# #
#-------------------------------------------#
def SwitchOFF():
"""
turns all the switches off
"""
def hex_color_to_int(hexValue):
return int(hexValue+'00', 16)
with nuke.root():
for i in nuke.allNodes():
if i['name'].value().startswith('OnOff_Switch'):
i['tile_color'].setValue(hex_color_to_int("eb4034"))
i.knob('label').setValue("OFF")
i.knob('off_btn').setLabel("""<p style="color:#eb4034">OFF</p>""")
i.knob('on_btn').setLabel("""<p style="color:#878787">ON</p>""")
i.knob('disable').setValue(0)
group_nodes = [node for node in nuke.allNodes() if node.Class() == 'Group']
for group in group_nodes:
switch_nodes = [node for node in nuke.allNodes(recurseGroups=True) if node.Class() == 'Switch']
for i in switch_nodes:
if i['name'].value().startswith('cm_Switch'):
i.knob('which').setValue(0)
i['tile_color'].setValue(hex_color_to_int("eb4034"))
i.knob('disable').setValue(0)
with nuke.root():
SwitchOFF()