-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathAEOpenVDBToPolygonsTemplate.mel
66 lines (53 loc) · 1.92 KB
/
AEOpenVDBToPolygonsTemplate.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
58
59
60
61
62
63
64
global proc AEOpenVDBToPolygonsTemplate( string $nodeAttr )
{
editorTemplate -beginScrollLayout;
{
editorTemplate -beginLayout "OpenVDB To Polygons Settings" -collapse 0;
editorTemplate -beginNoOptimize;
{
editorTemplate -callCustom "newOpenVDBToPolygonsGridSelection" "replaceOpenVDBToPolygonsGridSelection" "vdbAllGridNames";
editorTemplate -addSeparator;
editorTemplate -addControl "isovalue";
editorTemplate -addControl "adaptivity";
}
editorTemplate -endNoOptimize;
editorTemplate -endLayout;
editorTemplate -addExtraControls;
}
editorTemplate -endScrollLayout;
}
global proc newOpenVDBToPolygonsGridSelection(string $attr)
{
optionMenu
-label "VDB Grid Name:"
-width 300
-changeCommand ("updateOpenVDBToPolygonsGridSelection( \""+$attr+"\" )")
vdbGridNameMenu;
replaceOpenVDBToPolygonsGridSelection($attr);
}
global proc replaceOpenVDBToPolygonsGridSelection(string $attr)
{
//connectControl vdbGridNameMenu $attr;
// Clear old items
{
string $items[] = `optionMenu -q -ill vdbGridNameMenu`;
string $item;
for ($item in $items) deleteUI $item;
}
// Add new items
{
string $currentGridNames = `getAttr $attr`;
$currentGridNames = "* " + $currentGridNames;
string $gridNames[];
tokenize $currentGridNames " " $gridNames;
string $name;
for ($name in $gridNames) menuItem -l $name -parent vdbGridNameMenu;
}
/// @todo re-select previous item if it exists, don't update VdbSelectedGridNames if the same item is selectd.
}
global proc updateOpenVDBToPolygonsGridSelection(string $attr)
{
string $selectedGrid = `optionMenu -q -value vdbGridNameMenu`;
string $selectionAttr = plugNode($attr) + ".VdbSelectedGridNames";
setAttr -type "string" $selectionAttr $selectedGrid;
}