def unlockOTLbyNode(node = None): """Calls unlockOTL with the selected node""" if node != None: if not isDigitalAsset(node): ui.infoWindow("Not a Digital Asset.") else: reply = ui.warningWindow('WARNING! You are unlocking the Database! \n If you are being dumb, please click \n CANCEL!') if reply == 0: libraryPath = node.type().definition().libraryFilePath() filename = os.path.basename(libraryPath) #TODO save this somewhere unlockOTL(filename) else: ui.infoWindow('Thank you for being safe. \n If you have question please talk to someone in charge.')
def unlockLightingFile(): print("unlockLightingFile") shotPaths = glob.glob(os.path.join(os.environ['SHOTS_DIR'], '*')) selections = [] for sp in shotPaths: selections.append(os.path.basename(sp)) selections.sort() answer = ui.listWindow(selections, wmessage='Select shot file to unlock:') if answer: answer = answer[0] toUnlock = os.path.join(os.environ['SHOTS_DIR'], selections[answer], 'lighting') if amu.isLocked(toUnlock): reply = ui.warningWindow('Are you sure you want to unlock this file?') if reply == 0: hou.hipFile.save() hou.hipFile.clear() amu.unlock(toUnlock) ui.infoWindow('Lighting file unlocked') else: ui.infoWindow('Lighting file already unlocked') return