-
Notifications
You must be signed in to change notification settings - Fork 2
/
Drop_me_in_the_maya_viewport.mel
41 lines (35 loc) · 1.2 KB
/
Drop_me_in_the_maya_viewport.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
// this script will create a button on your current shelf
// that when clicked, will open the Frame Helper window
//
// Copyright (c) 2022 Moreau Christophe moreau.vfx@gmail.com
global proc string MayaFramingAssistant() {
string $whatIs = `whatIs MayaFramingAssistant`;
string $path = `substring $whatIs 25 999`;
string $filename = `substitute "/Drop_me_in_the_maya_viewport.mel" $path ""`;;
return $filename;
}
global proc MayaFramingAssistant_install()
{
string $path = MayaFramingAssistant();
//print $path;
string $cmd = ("import os" + "\n" +
"import sys" + "\n" +
"scriptPath = r'" + $path + "'\n" +
"if scriptPath not in sys.path:" + "\n" +
" sys.path.insert(0, scriptPath)" + "\n" +
"import MayaFramingAssistant" + "\n" +
"MayaFramingAssistant.main()");
string $icon = $path + "/gui/" + "frame_32x32.ico";
print $icon;
global string $gShelfTopLevel;
setParent `shelfTabLayout -query -selectTab $gShelfTopLevel`;
if( `filetest -r $icon` )
{
shelfButton -command $cmd -stp "python" -image $icon;
}
else
{
shelfButton -command $cmd -stp "python" -imageOverlayLabel "Maya Framing Assistant";
}
}
MayaFramingAssistant_install();