-
Notifications
You must be signed in to change notification settings - Fork 8
/
install_plugin.py
96 lines (89 loc) · 3.16 KB
/
install_plugin.py
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
85
86
87
88
89
90
91
92
93
94
95
96
"""
Copyright (C) <2010> Autin L.
This file ePMV_git/install_plugin.py is part of ePMV.
ePMV is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ePMV is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ePMV. If not, see <http://www.gnu.org/licenses/gpl-3.0.html>.
"""
import os
import sys
MGL_ROOT=""
doit=True
try :
import ePMV
path = ePMV.__path__[0]
print("path",path)
# print os.path.abspath(path)
os.chdir(os.path.abspath(path))
os.chdir('../')
MGL_ROOT = os.path.abspath(os.curdir)
doit=False
except:
doit=True
#print MGL_ROOT
if doit :
ismaya = False
try :
import maya
ismaya=True
except:
ismaya=False
if ismaya:
import maya.cmds as cmds
MGL_ROOT = cmds.fileDialog2(fileMode=3, dialogStyle=1,
cap="what is the MGLToolsPckgs directory?")
print(MGL_ROOT)
#verify if its MGLToolsPCkgs or the up dir
MGL_ROOT = str(MGL_ROOT[0])
print(MGL_ROOT)
if MGL_ROOT.find("MGLToolsPckgs") == -1:
if not os.path.exists(MGL_ROOT+os.sep+"MGLToolsPckgs"):
MGL_ROOT = cmds.fileDialog2(fileMode=3, dialogStyle=1,
cap="what is the MGLToolsPckgs directory?")
MGL_ROOT = str(MGL_ROOT[0])
else:
print(__file__)
curpath = os.path.abspath(__file__) #this should give pathtoMGL/MGLToolsPckgs/ePMV/install.py
# print "find",curpath.find("MGLToolsPckgs")
if curpath.find("MGLToolsPckgs") == -1 : #cant find MGLToolsPCkgs
# print "yes"
import Blender
txt = Blender.Text.Get(__file__)
curpath = txt.getFilename()
# print "curpath",curpath
# print os.path.dirname(curpath)
if os.path.isfile(curpath):
os.chdir(os.path.dirname(curpath))
else :
os.chdir(os.path.abspath(curpath))
os.chdir('../')
MGL_ROOT = os.path.abspath(os.curdir)
# print "dir",dir
print(MGL_ROOT)
sys.path.append( MGL_ROOT )
from ePMV.installer import Installer
print("MGL",MGL_ROOT)
if __name__ == '__main__':
print(__name__)
import os
import sys
# print __file__
# curpath = os.path.abspath(__file__) #this should give pathtoMGL/MGLToolsPckgs/ePMV/install.py
os.chdir(MGL_ROOT)
os.chdir('../')
MGL_ROOT = os.path.abspath(os.curdir)
print(MGL_ROOT)
inst = Installer(mgl=MGL_ROOT)
if sys.platform == 'win32':
inst.patchPMV()
from ePMV.installer import InstGui
gui = InstGui(title="Install ePMV")
gui.setup(inst=inst,mgl=MGL_ROOT)
gui.display()