-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathUninstall Snap Ground.py
63 lines (48 loc) · 1.99 KB
/
Uninstall Snap Ground.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
# Author : AWACS
# Time : 2020/09/03
import os
import shutil
try:
import maya.mel
import maya.cmds as cmds
isMaya = True
except ImportError:
isMaya = False
def onMayaDroppedPythonFile(*args, **kwargs):
pass
def MayaDropRemove():
"""Drag and drop this file into the scene executes the file."""
dic_script = {
"author_folder" : "AWACS",
"Contain_Folder" : "Snap_to_Ground",
"Script_folder" : "Snap_to_Ground",
"Script_module_import" : "Snap_Ground",
"Script_name" : "Snap_to_Ground",
"Script_Shelf_icon" : "icon.jpg" ,
"imageOverlayLabel":"",
"Script_annotation" :
"A drop to ground script tool ",
}
Popup_Dialog = True
User_script_dir = cmds.internalVar(userScriptDir=1)
author_folder_dir = os.path.join( User_script_dir , dic_script["author_folder"])
Script_folder_fullpath = os.path.join( author_folder_dir , dic_script["Script_folder"])
if os.path.isdir( Script_folder_fullpath ):
shutil.rmtree( Script_folder_fullpath )
confirmDialog_message = "{Script_name} has been Removed From your software, \
you can remove the command from shelf now".format( Script_name = dic_script["Script_name"])
print (confirmDialog_message)
if Popup_Dialog:
cmds.confirmDialog( title='Uninstall Success', message=confirmDialog_message, button=['OK'] )
else :
confirmDialog_message = "No such path , Nothing good to remove or unistall or whatever"
print (confirmDialog_message)
if Popup_Dialog:
cmds.confirmDialog( title='Uninstall Failed', message=confirmDialog_message, button=['OK'] )
return
# check if there is any thing ,if not remove entire author_folder
# print (os.listdir ( author_folder_dir ) )
if len( os.listdir ( author_folder_dir ) ) < 1:
shutil.rmtree( author_folder_dir )
if isMaya:
MayaDropRemove()