forked from lookbothways/vfxTools
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtransferPresets
More file actions
57 lines (41 loc) · 1.97 KB
/
Copy pathtransferPresets
File metadata and controls
57 lines (41 loc) · 1.97 KB
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
# Transfer Presets tool. By Ewan Laidlaw. 181018
# For sharing presets between artist - needs to have the presets path env variable set by pipeline
"""
Improvements to make:
* Get project from shotgun
"""
import maya.cmds as cmds
import os
import shutil
import getpass
User=getpass.getuser()
HomeDirectory="/home/"+User+"/maya/2017/presets/attrPresets"
Project="CUR"
#ShareDirectory=str(("/mnt/pipeline/ATK_PIPELINE/maya/modules/"+Project+"/presets/attrPresets/"+presetType))
def exportFiles(HomeDirectory):
export_dir = cmds.fileDialog2(fm=1, dialogStyle=2, cap='Select preset to export', okCaption='Select',cc="cancel",ff="*.mel*",dir=HomeDirectory)
path=str(export_dir)
path=path.lstrip("[u'")
path=path.rstrip("']")
pathList=path.split("/")
count=len(pathList)
presetType=pathList[(count-2)]
#Check if folder for preset type exists in project
if not os.path.isdir("/mnt/pipeline/ATK_PIPELINE/maya/modules/"+Project+"/presets/attrPresets/"+presetType):
os.makedirs(("/mnt/pipeline/ATK_PIPELINE/maya/modules/"+Project+"/presets/attrPresets/"+presetType))
print(presetType)
#Check if preset version exists
fileName=pathList[(count-1)]
if not os.path.exists("/mnt/pipeline/ATK_PIPELINE/maya/modules/"+Project+"/presets/attrPresets/"+presetType+"/"+fileName):
shutil.copy(path,"/mnt/pipeline/ATK_PIPELINE/maya/modules/"+Project+"/presets/attrPresets/"+presetType)
print(fileName)
print("FILE COPIED")
else:
###version up preset in sharded drive###
#exists=os.path.exists(("/mnt/pipeline/ATK_PIPELINE/maya/modules/CUR/presets/attrPresets/"presetType+"/"+fileName+".mel")):
#while exists = True:
#versionNumb+=1
cmds.confirmDialog(b="OK",m="A file with this name already exists in the shared drive, please rename/version up your preset",t="Name Clash")
return
return
exportFiles(HomeDirectory)