-
Notifications
You must be signed in to change notification settings - Fork 5
/
AEOpenVDBReadTemplate.mel
84 lines (73 loc) · 2.23 KB
/
AEOpenVDBReadTemplate.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
global proc AEOpenVDBReadTemplate( string $nodeAttr )
{
editorTemplate -beginScrollLayout;
{
editorTemplate -beginLayout "OpenVDB Read File" -collapse 0;
{
editorTemplate -callCustom "importVDBFilePathNew" "importVDBFilePathReplace" "VdbFilePath";
}
editorTemplate -endLayout;
editorTemplate -addExtraControls;
}
editorTemplate -endScrollLayout;
}
global proc importVDBFilePathNew( string $attr )
{
global int $gAttributeEditorTemplateLabelWidth;
rowLayout
-numberOfColumns 3
-columnWidth3 $gAttributeEditorTemplateLabelWidth 175 35
-columnAttach3 "right" "both" "both"
-columnAlign3 "left" "left" "center"
-rowAttach 1 "both" 0
-rowAttach 2 "both" 0
-rowAttach 3 "both" 0
importVDBFilePathLayout;
{
text
-label "VDB File Path"
-annotation "This is the VDB file."
importVDBFilePathLabel;
textField
-fileName ""
-insertionPosition 0
-editable true
-annotation "The VDB file path."
importVDBFilePathField;
button
-label "..."
-align "center"
-command ""
-annotation "Browse for the VDB file."
importVDBFilePathButton;
setParent ..;
}
importVDBFilePathReplace( $attr );
}
global proc importVDBFilePathReplace( string $attr )
{
setParent importVDBFilePathLayout;
connectControl importVDBFilePathField $attr;
button -e
-command ("browseForVDBFile( \""+$attr+"\" )")
importVDBFilePathButton;
setParent ..;
}
global proc browseForVDBFile( string $filePathAttr )
{
string $currentFilePath = `getAttr $filePathAttr`;
string $currentFilePathDir = dirname( $currentFilePath );
if( $currentFilePath != "" )
{
if( filetest( "-d", $currentFilePath ) == 1 )
{
$currentFilePathDir = $currentFilePath;
}
}
string $singleFilter = "VDB Files (*.vdb)";
string $path[] = `fileDialog2 -ds 2 -cap "VDB File" -dir $currentFilePathDir -ff $singleFilter -fm 1`;
if (size($path) > 0)
{
setAttr -type "string" $filePathAttr $path[0];
}
}