-
Notifications
You must be signed in to change notification settings - Fork 1
/
mightyRigPublish.py
53 lines (39 loc) · 1.54 KB
/
mightyRigPublish.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
## mighty_rig_publish.py
## v 1 This version.
###### How to Use ##################
## This script is to back up and export the current mGear file
## and save/rename it into a Publish children folder
## The script will simply delete the guide group
##
## Copy the mightyRigPublish.py file into your script folder
##
## Call the script by the procedure name
## mightyRigPublish()
## TODO
## Look for Publish folder and create one if doesn't exist
import os
import pymel.core as pm
import maya.cmds as cmds
def mightyRigPublish():
## Get workfile name
basename = os.path.basename(pm.sceneName())
## Get filename without extenstion
filename = os.path.splitext(basename)[0]
## Get directory
directory = os.path.dirname(pm.sceneName())
print ( directory )
## Save workfile
cmds.file ( save=True, type='mayaAscii' )
print ( '\n ////////////////////////// Current file backed up as: ' + basename + '/////////////////////' )
## Rename publish file
cmds.file ( rename = 'Scenes/Publish/' + filename + '_PUBLISH' )
#### Deleting the mGear guids
cmds.delete ( 'guide' )
## Save publish file
cmds.file ( save=True, type='mayaAscii' )
print ( '\n//////////////////// 1. scene renamed to *_PUBLISH /////////////////\n' )
print ( '//////////////////// Rig published /////////////////\n' )
## Reopen work file
print ( '//////////////////// Reopening workfile /////////////////\n' )
cmds.file ( basename, o = True )
mightyRigPublish()