def process( call, *args): # Selection intialSelection = cmds.ls(selection=True, flatten=True) selections = intialSelection[:] # Input Values from UI inputName = ['placeholder'] # needs to be a list fed into it to work inputName[0] = cmds.textField("inputField", q=True, text = True) old = cmds.textField("replaceField", q=True, text = True) new = cmds.textField("withField", q=True, text = True) # Assign the Rename Class D = Rename(selections, inputName ) if old: # if there is data in the replaceField txt box, then run the replacement code for i in range( len (selections) ): findTxt = D.reFunction(D.getAfterNamespace(i), old) replacementName = D.getAfterNamespace(i)[ : findTxt [0][0] ] + new + D.getAfterNamespace(i)[ findTxt [0][1] : ] cmds.rename(selections[i], D.getNamespace(i) + replacementName) else: for i in range( len (selections) ): X = D.processNamespace(i) if X == ':': X = '::' # This prevents the root namespace from getting lost in the cutoff [:-1] use X[:-1] instead of D.processNamespace(i) [:-1] if cmds.namespace(exists = X [:-1] ) != True: # creates new namespace if doesn't already exist print ' creating new namespace' cmds.namespace(addNamespace = X [:-1] ) # create namespace if doesn't already exist cmds.rename( D.selection[i] , ':' + D.processNamespace(i) + D.processRename(i) ) cmds.namespace(set = ':') # set namespace back to root so any new object created is under the root if call == 'NA': cmds.warning('no exit call, window stays open') elif call == 'exit': cmds.warning('exit called, closing rename window') cmds.evalDeferred('cmds.deleteUI("renameUI")') #cmds.deleteUI(window)
def __init__(self): Rename.__init__(self) ## MASTER PATHS self.userName = os.path.expanduser("~") self.systemLocation = self.userName + '\\Copy\\GHOST\\CINEMATIC_SCRIPTS\\' ## PROGRAMS self.vlc = '"C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe"' self.djv = '"C:\\Program Files (x86)\\djv 0.8.3\\bin\\djv_convert"' self.ffmpeg = self.systemLocation + "programs\\FFMPEG\\ffmpeg" self.ffprobe = self.systemLocation + "programs\\FFMPEG\\ffprobe" self.redline = '"C:\\Program Files\\REDCINE-X PRO 64-bit\\REDline"' self.vdub = self.systemLocation + "programs\\vDub\\vdub64.exe" self.mencoder = self.systemLocation + "programs\\MPlayer\\mencoder" ## FOLDER LOCATIONS self.libraries = self.systemLocation + "libraries" self.images = self.systemLocation + "images" self.files = self.systemLocation + "libraries\\files" self.scripts = self.userName +"\\Documents\\GitHub\\JR_Video\\scripts" self.settings = self.userName +"\\Documents\\GitHub\\JR_Video\\settings" self.sequences = self.systemLocation + "test\\sequences" self.TKicon = self.userName +"\\Documents\\GitHub\\JR_Video\\icons\\icon.ico" # CACHE ITEMS self.BRC = '' self.windowOpen = 1 ## SETTINGS self.movie_ext = ('.mov', '.R3D', '.MXF', '.mp4', '.MP4' , '.avi') self.image_ext = ('.jpg','.tiff','.png', '.tga', '.exr') # VDUB COMPRESSION self.compression = ( self.settings + '\\vDub_compression\\vDub_avi_compression.vcf', self.settings + '\\vDub_compression\\vDub_avi_compression_custom_01.vcf', self.settings + '\\vDub_compression\\vDub_avi_compression_custom_02.vcf', self.settings + '\\vDub_compression\\vDub_avi_compression_23976.vcf' ) # PRORES self.prores = { 'ProRes422_Proxy': 0, 'ProRes422_LT':1, 'ProRes422_Normal':2, 'ProRes422_HQ':3 }
def __init__(self): # System is already initialized in the Projects class UI.__init__(self) Rename.__init__(self) System.__init__(self)
def __init__(self): Rename.__init__(self)