Пример #1
0
def rename(node = None):
    """Renames the selected node. EXACTLY ONE node may be selected, and it MUST be a digital asset.
        The node must already exist in the database.
    """
    if node != None:
        if not isDigitalAsset(node):
            hou.ui.displayMessage("Not a Digital Asset.")
        else:
            if isContainer(node):
                oldlibraryPath = node.type().definition().libraryFilePath()
                oldfilename = os.path.basename(oldlibraryPath)
                oldAssetName = oldfilename.split('.')[0]
                assetDirPath = os.path.join(ASSETSDIR, oldAssetName)

                dependents = getAssetDependents(oldAssetName)

                if dependents:
                    hou.ui.displayMessage('The following assets are depenent on this asset: \n\n'+printList(dependents)+'\nModify these assets first before attempting to rename again!!', title='Can NOT rename!', severity=hou.severityType.Error)
                    return

                nodeDir = os.path.join(os.environ['ASSETS_DIR'], oldAssetName, 'otl')
                info = amu.getVersionedFolderInfo(nodeDir);
                if info[0] == "":
                    if passwordWindow('r3n@m3p@ssw0rd', 'Enter the rename password...'):
                        resp = hou.ui.readInput("Enter the New Operator Label", title="Rename OTL")
                        if resp != None and resp[1].strip() != '':
                            name = formatName(resp[1])
                            newfilename = name.replace(' ', '_')
                            newfilepath = os.path.join(OTLDIR, newfilename+'.otl')
                            oldfilepath = os.path.join(OTLDIR, oldAssetName+'.otl')
                            if os.path.exists(newfilepath):
                                hou.ui.displayMessage("Asset by that name already exists. Cannot rename asset.", title='Asset Name', severity=hou.severityType.Error)
                            elif not amu.canRename(assetDirPath, newfilename):
                                hou.ui.displayMessage("Asset checked out in Maya. Cannot rename asset.", title='Asset Name', severity=hou.severityType.Error)
                            else:
                                node.type().definition().copyToHDAFile(newfilepath, new_name=newfilename, new_menu_name=name)
                                hou.hda.installFile(newfilepath, change_oplibraries_file=True)
                                newnode = hou.node(new_asset_methods.determineHPATH()).createNode(newfilename)
                                node.destroy()
                                hou.hda.uninstallFile(oldlibraryPath, change_oplibraries_file=False)
                                subprocess.check_call( ['rm','-f',oldlibraryPath] )
                                amu.renameAsset(assetDirPath, newfilename)
                                
                                newNodeDir = os.path.join(os.environ['ASSETS_DIR'], newfilename, 'otl')
                                newStableNode = newfilename + '_otl_stable.otl' 
                                newOldStableNode = oldAssetName + '_otl_stable.otl' 
                                newDest = os.path.join(newNodeDir, 'stable', newStableNode)
                                newOldDest = os.path.join(newNodeDir, 'stable', newOldStableNode)
                                os.remove(newOldDest)
                                shutil.move(newfilepath,newDest)
                                os.symlink(newDest, newfilepath)

                                
                else:
                    logname, realname = amu.lockedBy(info[0].encode('utf-8'))
                    whoLocked = 'User Name: ' + logname + '\nReal Name: ' + realname + '\n'
                    errstr = 'Cannot checkout asset. Locked by: \n\n' + whoLocked
                    hou.ui.displayMessage(errstr, title='Asset Locked', severity=hou.severityType.Error)
    else:
        hou.ui.displayMessage("Select EXACTLY one node.")
def rename(node = None):
    """Renames the selected node. EXACTLY ONE node may be selected, and it MUST be a digital asset.
        The node must already exist in the database.
    """
    updateDB()
    if node != None:
        if not isDigitalAsset(node):
            ui.infoWindow("Not a Digital Asset.")
        else:
            if isContainer(node):
                oldlibraryPath = node.type().definition().libraryFilePath()
                oldfilename = os.path.basename(oldlibraryPath)
                oldAssetName = oldfilename.split('.')[0]
                assetDirPath = os.path.join(ASSETSDIR, oldAssetName)

                dependents = getAssetDependents(oldAssetName)

                if dependents:
                    ui.infoWindow('The following assets are depenent on this asset: \n\n'+printList(dependents)+'\nModify these assets first before attempting to rename again!!', wtitle='Can NOT rename!', msev=messageSeverity.Error)
                    return

                info = getFileInfo(oldfilename)
                if not info[2]:
                    if ui.passwordWindow('r3n@m3p@ssw0rd', wmessage='Enter the rename password...'):
                        resp = ui.inputWindow("Enter the New Operator Label", wtitle="Rename OTL")
                        if resp != None and resp.strip() != '':
                            name = formatName(resp)
                            newfilename = name.replace(' ', '_')
                            newfilepath = os.path.join(OTLDIR, newfilename+'.otl')
                            if os.path.exists(newfilepath):
                                ui.infoWindow("Asset by that name already exists. Cannot rename asset.", wtitle='Asset Name', msev=messageSeverity.Error)
                            elif not amu.canRename(assetDirPath, newfilename):
                                ui.infoWindow("Asset checked out in Maya. Cannot rename asset.", wtitle='Asset Name', msev=messageSeverity.Error)
                            else:
                                node.type().definition().copyToHDAFile(newfilepath, new_name=newfilename, new_menu_name=name)
                                hou.hda.installFile(newfilepath, change_oplibraries_file=True)
                                newnode = hou.node(determineHPATH()).createNode(newfilename)
                                node.destroy()
                                hou.hda.uninstallFile(oldlibraryPath, change_oplibraries_file=False)
                                subprocess.check_call( ['rm','-f',oldlibraryPath] )
                                amu.renameAsset(assetDirPath, newfilename)
                else:
                    logname, realname = amu.lockedBy(info[3].encode('utf-8'))
                    whoLocked = 'User Name: ' + logname + '\nReal Name: ' + realname + '\n'
                    errstr = 'Cannot checkout asset. Locked by: \n\n' + whoLocked
                    ui.infoWindow(errstr, wtitle='Asset Locked', msev=messageSeverity.Error)
    else:
        ui.infoWindow("Select EXACTLY one node.")
Пример #3
0
def rename(node = None):
    """Renames the selected node. EXACTLY ONE node may be selected, and it MUST be a digital asset.
        The node must already exist in the database.
    """
    updateDB()
    if node != None:
        if not isDigitalAsset(node):
            ui.infoWindow("Not a Digital Asset.")
        else:
            if isContainer(node):
                oldlibraryPath = node.type().definition().libraryFilePath()
                oldfilename = os.path.basename(oldlibraryPath)
                oldAssetName = oldfilename.split('.')[0]
                assetDirPath = os.path.join(ASSETSDIR, oldAssetName)

                dependents = getAssetDependents(oldAssetName)

                if dependents:
                    ui.infoWindow('The following assets are depenent on this asset: \n\n'+printList(dependents)+'\nModify these assets first before attempting to rename again!!', wtitle='Can NOT rename!', msev=messageSeverity.Error)
                    return

                info = getFileInfo(oldfilename)
                if not info[2]:
                    if ui.passwordWindow('r3n@m3p@ssw0rd', wmessage='Enter the rename password...'):
                        resp = ui.inputWindow("Enter the New Operator Label", wtitle="Rename OTL")
                        if resp != None and resp.strip() != '':
                            name = formatName(resp)
                            newfilename = name.replace(' ', '_')
                            newfilepath = os.path.join(OTLDIR, newfilename+'.otl')
                            if os.path.exists(newfilepath):
                                ui.infoWindow("Asset by that name already exists. Cannot rename asset.", wtitle='Asset Name', msev=messageSeverity.Error)
                            elif not amu.canRename(assetDirPath, newfilename):
                                ui.infoWindow("Asset checked out in Maya. Cannot rename asset.", wtitle='Asset Name', msev=messageSeverity.Error)
                            else:
                                node.type().definition().copyToHDAFile(newfilepath, new_name=newfilename, new_menu_name=name)
                                hou.hda.installFile(newfilepath, change_oplibraries_file=True)
                                newnode = hou.node(determineHPATH()).createNode(newfilename)
                                node.destroy()
                                hou.hda.uninstallFile(oldlibraryPath, change_oplibraries_file=False)
                                subprocess.check_call( ['rm','-f',oldlibraryPath] )
                                amu.renameAsset(assetDirPath, newfilename)
                else:
                    logname, realname = amu.lockedBy(info[3].encode('utf-8'))
                    whoLocked = 'User Name: ' + logname + '\nReal Name: ' + realname + '\n'
                    errstr = 'Cannot checkout asset. Locked by: \n\n' + whoLocked
                    ui.infoWindow(errstr, wtitle='Asset Locked', msev=messageSeverity.Error)
    else:
        ui.infoWindow("Select EXACTLY one node.")
Пример #4
0
def rename():
    """Renames the selected node. EXACTLY ONE node may be selected, and it MUST be a digital asset.
        The node must already exist in the database.
    """
    updateDB()
    node = getSelectedNode()
    if node != None:
        if not isDigitalAsset(node):
            hou.ui.displayMessage("Not a Digital Asset.")
        else:
            if isContainer(node):
                oldlibraryPath = node.type().definition().libraryFilePath()
                oldfilename = os.path.basename(oldlibraryPath)
                oldAssetName = oldfilename.split('.')[0]
                assetDirPath = os.path.join(ASSETSDIR, oldAssetName)
                info = getFileInfo(oldfilename)
                if not info[2]:
                    pok, presp = hou.ui.readMultiInput("Enter the rename password...", input_labels=('Password:'******'OK', 'Cancel'), title="Rename Password")
                    presp = presp[0]
                    if pok != 0 or presp != 'r3n@m3p@ssw0rd':
                        hou.ui.displayMessage("Incorrect password. Better luck next time.", title='Incorrect Password', severity=hou.severityType.Error)
                        return
                    ok, resp = hou.ui.readInput("Enter the New Operator Label", buttons=('OK', 'Cancel'), title="Rename OTL")
                    if ok == 0 and resp.strip() != '':
                        name = formatName(resp)
                        newfilename = name.replace(' ', '_')
                        newfilepath = os.path.join(OTLDIR, newfilename+'.otl')
                        if os.path.exists(newfilepath):
                            hou.ui.displayMessage("Asset by that name already exists. Cannot rename asset.", title='Asset Name', severity=hou.severityType.Error)
                        elif not amu.canRename(assetDirPath, newfilename):
                            hou.ui.displayMessage("Asset checked out in Maya. Cannot rename asset.", title='Asset Name', severity=hou.severityType.Error)
                        else:
                            node.type().definition().copyToHDAFile(newfilepath, new_name=newfilename, new_menu_name=name)
                            hou.hda.installFile(newfilepath, change_oplibraries_file=True)
                            newnode = hou.node(determineHPATH()).createNode(newfilename)
                            node.destroy()
                            hou.hda.uninstallFile(oldlibraryPath, change_oplibraries_file=False)
                            os.system('rm -f '+oldlibraryPath)
                            amu.renameAsset(assetDirPath, newfilename)
                else:
                    hou.ui.displayMessage(lockedBy(info[3].encode('utf-8')))
            
    else:
        hou.ui.displayMessage("Select EXACTLY one node.")
def rename():
    """Renames the selected node. EXACTLY ONE node may be selected, and it MUST be a digital asset.
        The node must already exist in the database.
    """
    updateDB()
    node = getSelectedNode()
    if node != None:
        if not isDigitalAsset(node):
            ui.infoWindow("Not a Digital Asset.")
        else:
            if isContainer(node):
                oldlibraryPath = node.type().definition().libraryFilePath()
                oldfilename = os.path.basename(oldlibraryPath)
                oldAssetName = oldfilename.split('.')[0]
                assetDirPath = os.path.join(ASSETSDIR, oldAssetName)
                info = getFileInfo(oldfilename)
                if not info[2]:
                    if ui.passwordWindow('r3n@m3p@ssw0rd', wmessage='Enter the rename password...'):
                        resp = ui.inputWindow("Enter the New Operator Label", wtitle="Rename OTL")
                        if resp != None and resp.strip() != '':
                            name = formatName(resp)
                            newfilename = name.replace(' ', '_')
                            newfilepath = os.path.join(OTLDIR, newfilename+'.otl')
                            if os.path.exists(newfilepath):
                                ui.infoWindow("Asset by that name already exists. Cannot rename asset.", wtitle='Asset Name', msev=messageSeverity.Error)
                            elif not amu.canRename(assetDirPath, newfilename):
                                ui.infoWindow("Asset checked out in Maya. Cannot rename asset.", wtitle='Asset Name', msev=messageSeverity.Error)
                            else:
                                node.type().definition().copyToHDAFile(newfilepath, new_name=newfilename, new_menu_name=name)
                                hou.hda.installFile(newfilepath, change_oplibraries_file=True)
                                newnode = hou.node(determineHPATH()).createNode(newfilename)
                                node.destroy()
                                hou.hda.uninstallFile(oldlibraryPath, change_oplibraries_file=False)
                                os.system('rm -f '+oldlibraryPath)
                                amu.renameAsset(assetDirPath, newfilename)
                else:
                    ui.infoWindow(lockedBy(info[3].encode('utf-8')))
    else:
        ui.infoWindow("Select EXACTLY one node.")
Пример #6
0
    def rename(self):
        print 'The rename function is not complete yet!';
	if not (self.current_item is None):
		currentlySelected = self.current_item.text()
		print 'currentlySelected:' + currentlySelected;
		dirPath = '';
		if self.context_tabs.currentIndex() == 1:
			dirPath = amu.getProductionDir() + '/previs/';
		else:
			dirPath = amu.getProductionDir() + '/shots/';

		coPath = dirPath + currentlySelected + '/animation';
		coPath = str(coPath);
		print 'coPath: ' + coPath;
		if not amu.isVersionedFolder(coPath):
			raise Exception("Not a versioned folder.");

		nodeInfo = ConfigParser();
		nodeInfo.read(os.path.join(coPath, ".nodeInfo"));
		if nodeInfo.get("Versioning", "locked") == "False":
			password = cmd.promptDialog(
				    title='Rename password check',
				    message='Enter password:'******'OK','Cancel'],
				    defaultButton='OK',
				    dismissString='Cancel',
				sf = False);
			if password == 'OK':
				if (cmd.promptDialog(query=True, text=True) == 'r3n@m3p@ssw0rd'):
					confirm = cmd.promptDialog(
						    title='Rename',
						    message='What would you like to rename the file?',
						    button=['OK','Cancel'],
						    defaultButton='OK',
						    dismissString='Cancel',
						sf = False);
					if confirm == 'OK':
						newName = cmd.promptDialog(query=True, text=True);
						print newName;
						

						#check if the newName is already used by another shot
						newNameTaken = False;
						shots = os.listdir(dirPath);
						for s in shots:
							print 'shot: ' + s;
							if (s == newName):
								newNameTaken = True;
								print 'Name <' + s + '> is already taken';
						if not newNameTaken:
							dirPath = dirPath + currentlySelected;
					
							#check /animation folder
							animDirPath = str(dirPath + '/animation');
							if amu.canRename(animDirPath):
								print 'anim rename';
								''' The renameVersionedFiles() method only searches for *.mb files.
								If other types of files need to be changed, just copy the code from
								the renameVersionedFiles() method in asset_manager/utilities.py and
								change the file extension from *.mb to whatever files type you need.'''
								renameFiles(self, animDirPath, currentlySelected, newName);

							#check /compositing folder
							compDirPath = str(dirPath + '/compositing');
							if amu.canRename(compDirPath):
								print 'comp rename';
								renameFiles(self, compDirPath, currentlySelected, newName);

							#check /lighting folder
							lightDirPath = str(dirPath + '/lighting');
							if amu.canRename(lightDirPath):
								print 'lighting rename' ;
								renameFiles(self, lightDirPath, currentlySelected, newName);
							print 'dirPath: ' + dirPath;
							amu.renameFolder(str(dirPath), newName);

							# refresh context
							tempContext = self.contexts[self.context_tabs.currentIndex()];
							tempContext.take_item(tempContext.tree.currentRow());
							tempContext.add_item(newName);
						else:
							newMessage = str('The name <' + newName + '> is already taken. Did not rename.');
							cmd.confirmDialog(
								title='Cancelled rename',
								message=newMessage,
								button=['Yes'],
								defaultButton='Yes',
								cancelButton='Yes',
								dismissString='Yes')
					else:
						return;
				else:
					newMessage = str('Wrong password. Did not rename shot <' + currentlySelected + '>');
					cmd.confirmDialog(
						title='Cancelled rename',
						message=newMessage,
						button=['Yes'],
						defaultButton='Yes',
						cancelButton='Yes',
						dismissString='Yes')
		else:
			newMessage = str('Part is currently checked out. Did not rename shot <' + currentlySelected + '>');
			cmd.confirmDialog(
				title='Cancelled rename',
				message=newMessage,
				button=['Yes'],
				defaultButton='Yes',
				cancelButton='Yes',
				dismissString='Yes')
Пример #7
0
    def rename(self):
        print 'The rename function is not complete yet!';
	if not (self.current_item is None):
		currentlySelected = self.current_item.text()
		print 'currentlySelected:' + currentlySelected;
		dirPath = '';
		if self.context_tabs.currentIndex() == 1:
			dirPath = amu.getProductionDir() + '/previs/';
		else:
			dirPath = amu.getProductionDir() + '/shots/';

		coPath = dirPath + currentlySelected + '/animation';
		coPath = str(coPath);
		print 'coPath: ' + coPath;
		if not amu.isVersionedFolder(coPath):
			raise Exception("Not a versioned folder.");

		nodeInfo = ConfigParser();
		nodeInfo.read(os.path.join(coPath, ".nodeInfo"));
		if nodeInfo.get("Versioning", "locked") == "False":
			password = cmd.promptDialog(
				    title='Rename password check',
				    message='Enter password:'******'OK','Cancel'],
				    defaultButton='OK',
				    dismissString='Cancel',
				sf = False);
			if password == 'OK':
				if (cmd.promptDialog(query=True, text=True) == 'r3n@m3p@ssw0rd'):
					confirm = cmd.promptDialog(
						    title='Rename',
						    message='What would you like to rename the file?',
						    button=['OK','Cancel'],
						    defaultButton='OK',
						    dismissString='Cancel',
						sf = False);
					if confirm == 'OK':
						newName = cmd.promptDialog(query=True, text=True);
						print newName;
						

						#check if the newName is already used by another shot
						newNameTaken = False;
						shots = os.listdir(dirPath);
						for s in shots:
							print 'shot: ' + s;
							if (s == newName):
								newNameTaken = True;
								print 'Name <' + s + '> is already taken';
						if not newNameTaken:
							dirPath = dirPath + currentlySelected;
					
							#check /animation folder
							animDirPath = str(dirPath + '/animation');
							if amu.canRename(animDirPath):
								print 'anim rename';
								''' The renameVersionedFiles() method only searches for *.mb files.
								If other types of files need to be changed, just copy the code from
								the renameVersionedFiles() method in asset_manager/utilities.py and
								change the file extension from *.mb to whatever files type you need.'''
								renameFiles(self, animDirPath, currentlySelected, newName);

							#check /compositing folder
							compDirPath = str(dirPath + '/compositing');
							if amu.canRename(compDirPath):
								print 'comp rename';
								renameFiles(self, compDirPath, currentlySelected, newName);

							#check /lighting folder
							lightDirPath = str(dirPath + '/lighting');
							if amu.canRename(lightDirPath):
								print 'lighting rename' ;
								renameFiles(self, lightDirPath, currentlySelected, newName);
							print 'dirPath: ' + dirPath;
							amu.renameFolder(str(dirPath), newName);

							# refresh context
							tempContext = self.contexts[self.context_tabs.currentIndex()];
							tempContext.take_item(tempContext.tree.currentRow());
							tempContext.add_item(newName);
						else:
							newMessage = str('The name <' + newName + '> is already taken. Did not rename.');
							cmd.confirmDialog(
								title='Cancelled rename',
								message=newMessage,
								button=['Yes'],
								defaultButton='Yes',
								cancelButton='Yes',
								dismissString='Yes')
					else:
						return;
				else:
					newMessage = str('Wrong password. Did not rename shot <' + currentlySelected + '>');
					cmd.confirmDialog(
						title='Cancelled rename',
						message=newMessage,
						button=['Yes'],
						defaultButton='Yes',
						cancelButton='Yes',
						dismissString='Yes')
		else:
			newMessage = str('Part is currently checked out. Did not rename shot <' + currentlySelected + '>');
			cmd.confirmDialog(
				title='Cancelled rename',
				message=newMessage,
				button=['Yes'],
				defaultButton='Yes',
				cancelButton='Yes',
				dismissString='Yes')
Пример #8
0
def rename(node=None):
    """Renames the selected node. EXACTLY ONE node may be selected, and it MUST be a digital asset.
        The node must already exist in the database.
    """
    if node != None:
        if not isDigitalAsset(node):
            hou.ui.displayMessage("Not a Digital Asset.")
        else:
            if isContainer(node):
                oldlibraryPath = node.type().definition().libraryFilePath()
                oldfilename = os.path.basename(oldlibraryPath)
                oldAssetName = oldfilename.split('.')[0]
                assetDirPath = os.path.join(ASSETSDIR, oldAssetName)

                dependents = getAssetDependents(oldAssetName)

                if dependents:
                    hou.ui.displayMessage(
                        'The following assets are depenent on this asset: \n\n'
                        + printList(dependents) +
                        '\nModify these assets first before attempting to rename again!!',
                        title='Can NOT rename!',
                        severity=hou.severityType.Error)
                    return

                nodeDir = os.path.join(os.environ['ASSETS_DIR'], oldAssetName,
                                       'otl')
                info = amu.getVersionedFolderInfo(nodeDir)
                if info[0] == "":
                    if passwordWindow('r3n@m3p@ssw0rd',
                                      'Enter the rename password...'):
                        resp = hou.ui.readInput("Enter the New Operator Label",
                                                title="Rename OTL")
                        if resp != None and resp[1].strip() != '':
                            name = formatName(resp[1])
                            newfilename = name.replace(' ', '_')
                            newfilepath = os.path.join(OTLDIR,
                                                       newfilename + '.otl')
                            oldfilepath = os.path.join(OTLDIR,
                                                       oldAssetName + '.otl')
                            if os.path.exists(newfilepath):
                                hou.ui.displayMessage(
                                    "Asset by that name already exists. Cannot rename asset.",
                                    title='Asset Name',
                                    severity=hou.severityType.Error)
                            elif not amu.canRename(assetDirPath, newfilename):
                                hou.ui.displayMessage(
                                    "Asset checked out in Maya. Cannot rename asset.",
                                    title='Asset Name',
                                    severity=hou.severityType.Error)
                            else:
                                node.type().definition().copyToHDAFile(
                                    newfilepath,
                                    new_name=newfilename,
                                    new_menu_name=name)
                                hou.hda.installFile(
                                    newfilepath, change_oplibraries_file=True)
                                newnode = hou.node(
                                    new_asset_methods.determineHPATH(
                                    )).createNode(newfilename)
                                node.destroy()
                                hou.hda.uninstallFile(
                                    oldlibraryPath,
                                    change_oplibraries_file=False)
                                subprocess.check_call(
                                    ['rm', '-f', oldlibraryPath])
                                amu.renameAsset(assetDirPath, newfilename)

                                newNodeDir = os.path.join(
                                    os.environ['ASSETS_DIR'], newfilename,
                                    'otl')
                                newStableNode = newfilename + '_otl_stable.otl'
                                newOldStableNode = oldAssetName + '_otl_stable.otl'
                                newDest = os.path.join(newNodeDir, 'stable',
                                                       newStableNode)
                                newOldDest = os.path.join(
                                    newNodeDir, 'stable', newOldStableNode)
                                os.remove(newOldDest)
                                shutil.move(newfilepath, newDest)
                                os.symlink(newDest, newfilepath)

                else:
                    logname, realname = amu.lockedBy(info[0].encode('utf-8'))
                    whoLocked = 'User Name: ' + logname + '\nReal Name: ' + realname + '\n'
                    errstr = 'Cannot checkout asset. Locked by: \n\n' + whoLocked
                    hou.ui.displayMessage(errstr,
                                          title='Asset Locked',
                                          severity=hou.severityType.Error)
    else:
        hou.ui.displayMessage("Select EXACTLY one node.")
Пример #9
0
def rename(node=None):
    """Renames the selected node. EXACTLY ONE node may be selected, and it MUST be a digital asset.
        The node must already exist in the database.
    """
    updateDB()
    if node != None:
        if not isDigitalAsset(node):
            hou.ui.displayMessage("Not a Digital Asset.")
        else:
            if isContainer(node):
                oldlibraryPath = node.type().definition().libraryFilePath()
                oldfilename = os.path.basename(oldlibraryPath)
                oldAssetName = oldfilename.split(".")[0]
                assetDirPath = os.path.join(ASSETSDIR, oldAssetName)

                dependents = getAssetDependents(oldAssetName)

                if dependents:
                    hou.ui.displayMessage(
                        "The following assets are depenent on this asset: \n\n"
                        + printList(dependents)
                        + "\nModify these assets first before attempting to rename again!!",
                        title="Can NOT rename!",
                        severity=hou.severityType.Error,
                    )
                    return

                info = getFileInfo(oldfilename)
                if not info[2]:
                    # TODO: replace ui function
                    if ui.passwordWindow("r3n@m3p@ssw0rd", "Enter the rename password..."):
                        resp = hou.ui.displayMessage("Enter the New Operator Label", title="Rename OTL")
                        if resp != None and resp.strip() != "":
                            name = formatName(resp)
                            newfilename = name.replace(" ", "_")
                            newfilepath = os.path.join(OTLDIR, newfilename + ".otl")
                            if os.path.exists(newfilepath):
                                hou.ui.displayMessage(
                                    "Asset by that name already exists. Cannot rename asset.",
                                    title="Asset Name",
                                    severity=hou.severityType.Error,
                                )
                            elif not amu.canRename(assetDirPath, newfilename):
                                hou.ui.displayMessage(
                                    "Asset checked out in Maya. Cannot rename asset.",
                                    title="Asset Name",
                                    severity=hou.severityType.Error,
                                )
                            else:
                                node.type().definition().copyToHDAFile(
                                    newfilepath, new_name=newfilename, new_menu_name=name
                                )
                                hou.hda.installFile(newfilepath, change_oplibraries_file=True)
                                newnode = hou.node(determineHPATH()).createNode(newfilename)
                                node.destroy()
                                hou.hda.uninstallFile(oldlibraryPath, change_oplibraries_file=False)
                                subprocess.check_call(["rm", "-f", oldlibraryPath])
                                amu.renameAsset(assetDirPath, newfilename)
                else:
                    logname, realname = amu.lockedBy(info[3].encode("utf-8"))
                    whoLocked = "User Name: " + logname + "\nReal Name: " + realname + "\n"
                    errstr = "Cannot checkout asset. Locked by: \n\n" + whoLocked
                    hou.ui.displayMessage(errstr, title="Asset Locked", severity=hou.severityType.Error)
    else:
        hou.ui.displayMessage("Select EXACTLY one node.")