-
Notifications
You must be signed in to change notification settings - Fork 1
/
mighty_wires_toggle.mel
57 lines (48 loc) · 1.95 KB
/
mighty_wires_toggle.mel
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
// Wires deformer toggle script
// Olivier Ladeuix
// v1.1 == modified the tokenize command line
// v1.0 == 2020/05/05
// to be used with the AnimSquad rigs
// save it in your Script folder or just drag it on your shelf
// To use it, just select one of the controls to grab the namespace, then launch the script ideally through a button or hotkey
// Start of the script
{
// Variables declaration
// Declaration of wires deformers to toggle as an array
$nodes = {"wire3","wire4","wire5","wire6","wire9","wire10"};
string $selectionArray[];
string $namespace_selection[];
int $SquadWireAttr;
// Selection grabber and namespace identification
$selectionArray = `ls -sl -fl`;
tokenize ($selectionArray[0], ":", $namespace_selection);
// Capturing the current state of wire3
$SquadWireAttr = `getAttr ($namespace_selection[0] + ":wire3.envelope")` ;
// Creation of the head up display. We start by deleting any existing Wies HUD
headsUpDisplay -rem HUDwiresVis;
headsUpDisplay -section 1 -block 0 -blockSize "medium" -label "Wires : Enabled" -labelFontSize "large" HUDwiresVis;
// Start of the toggle function and loop through the array
if ($SquadWireAttr == 1)
{
for( $node in $nodes ) {
setAttr ($namespace_selection[0] + ":" + $node + ".envelope") 0;
print( $node + " disabled \n" );
};
print "/// Wires disabled ///";
// Updating the Wires HUD
headsUpDisplay -rem HUDwiresVis;
headsUpDisplay -section 1 -block 0 -blockSize "medium" -label "Wires : Disabled" -labelFontSize "large" HUDwiresVis;
}
else
{
for( $node in $nodes ) {
setAttr ($namespace_selection[0] + ":" + $node + ".envelope") 1;
print( $node + " enabled \n" );
};
print "/// Wires enabled ///";
// Updating the Wires HUD
headsUpDisplay -rem HUDwiresVis;
headsUpDisplay -section 1 -block 0 -blockSize "medium" -label "Wires : Enabled" -labelFontSize "large" HUDwiresVis;
} ;
}
// End of the script