def discard(): filePath = cmds.file(q=True, sceneName=True) if not filePath: return dlgResult = showWarningDialog() if dlgResult == 'Yes': # get discard directory before opening new file toDiscard = os.path.join(amu.getUserCheckoutDir(), os.path.basename(os.path.dirname(filePath))) if (amu.isCheckedOutCopyFolder(toDiscard)): cmds.file(force=True, new=True) #open new file amu.discard(toDiscard) # discard changes else: cmds.confirmDialog( title='Invalid Command', message= 'This is not a checked out file. There is nothing to discard.', button=['Ok'], defaultButton='Ok', cancelButton='Ok', dismissString='Ok') elif dlgResult == 'Brent': brent.go() else: cmds.confirmDialog(title='Discard Cancelled', message='Thank you for being responsible.', button=['Ok'], defaultButton='Ok', cancelButton='Ok', dismissString='Ok')
def discard(filePath=cmds.file(q=True, sceneName=True)): if not filePath: return print filePath dlgResult = showWarningDialog() if dlgResult == "Yes": # get discard directory before opening new file toDiscard = os.path.join(amu.getUserCheckoutDir(), os.path.basename(os.path.dirname(filePath))) if amu.isCheckedOutCopyFolder(toDiscard): cmds.file(force=True, new=True) # open new file amu.discard(toDiscard) # discard changes else: cmds.confirmDialog( title="Invalid Command", message="This is not a checked out file. There is nothing to discard.", button=["Ok"], defaultButton="Ok", cancelButton="Ok", dismissString="Ok", ) elif dlgResult == "Brent": brent.go() else: cmds.confirmDialog( title="Discard Cancelled", message="Thank you for being responsible.", button=["Ok"], defaultButton="Ok", cancelButton="Ok", dismissString="Ok", )
def discardLightingFile(): filepath = hou.hipFile.path() # TODO print (filepath) if ( hou.ui.displayMessage( "YOU ARE ABOUT TO IRREVOKABLY DISCARD ALL CHANGES YOU HAVE MADE. " "Please think this through very carefully.\n " "Are you sure you want to discard " "your changes?", buttons=("Yes", "No"), default_choice=1, title="Discard Confirmation", ) == 0 ): toDiscard = os.path.join(amu.getUserCheckoutDir(), os.path.basename(os.path.dirname(filepath))) if amu.isCheckedOutCopyFolder(toDiscard): hou.hipFile.clear() amu.discard(toDiscard) else: hou.ui.displayMessage( "This is not a checked out file. There is nothing to discard", title="Invalid Command" ) else: hou.ui.displayMessage("Thank you for being responsible.", title="Discard Cancelled")
def discard(): filePath=cmds.file(q=True, sceneName=True) if not filePath: return dlgResult = showWarningDialog() if dlgResult == 'Yes': # get discard directory before opening new file toDiscard = os.path.join(amu.getUserCheckoutDir(), os.path.basename(os.path.dirname(filePath))) if(amu.isCheckedOutCopyFolder(toDiscard)): cmds.file(force=True, new=True) #open new file amu.discard(toDiscard) # discard changes else: cmds.confirmDialog( title = 'Invalid Command' , message = 'This is not a checked out file. There is nothing to discard.' , button = ['Ok'] , defaultButton = 'Ok' , cancelButton = 'Ok' , dismissString = 'Ok') elif dlgResult == 'Brent': return else: cmds.confirmDialog( title = 'Discard Cancelled' , message = 'Thank you for being responsible.' , button = ['Ok'] , defaultButton = 'Ok' , cancelButton = 'Ok' , dismissString = 'Ok')
def discardLightingFile(): filepath = hou.hipFile.path() #TODO print(filepath) if hou.ui.displayMessage( 'YOU ARE ABOUT TO IRREVOKABLY DISCARD ALL CHANGES YOU HAVE MADE. ' 'Please think this through very carefully.\n ' 'Are you sure you want to discard ' 'your changes?', buttons=( 'Yes', 'No', ), default_choice=1, title='Discard Confirmation') == 0: toDiscard = os.path.join(amu.getUserCheckoutDir(), os.path.basename(os.path.dirname(filepath))) if amu.isCheckedOutCopyFolder(toDiscard): hou.hipFile.clear() amu.discard(toDiscard) else: hou.ui.displayMessage( 'This is not a checked out file. There is nothing to discard', title='Invalid Command') else: hou.ui.displayMessage('Thank you for being responsible.', title='Discard Cancelled')
def is_shot_checked_out(): file_path = get_file_path() if file_path: toDiscard = get_checkin_path() if amu.isCheckedOutCopyFolder(toDiscard): # If it's checked out by the user, then we're good. return True else: return False else: return False
def is_shot_checked_out(): file_path = get_file_path() if file_path: toDiscard = get_checkin_path() if amu.isCheckedOutCopyFolder(toDiscard): # If it's checked out by the user, then we're good. return True else: return False else: return False
def discard(node = None): if not isDigitalAsset(node): hou.ui.displayMessage("Not a Digital Asset.") else: libraryPath = node.type().definition().libraryFilePath() filename = os.path.basename(libraryPath) toDiscard = os.path.dirname(libraryPath) if amu.isCheckedOutCopyFolder(toDiscard): switchOPLibraries(libraryPath, os.path.join(OTLDIR, filename)) node.matchCurrentDefinition() amu.discard(toDiscard) hou.ui.displayMessage("Revert Successful!")
def discard(): file_path = get_file_path() if file_path: toDiscard = get_checkin_path() if amu.isCheckedOutCopyFolder(toDiscard): if show_confirm_dialog(): nuke.scriptClear() amu.discard(toDiscard) else: show_dialog('ERROR: Not checked out.') else: show_dialog('ERROR: Not a file.')
def discard(node=None): if not isDigitalAsset(node): hou.ui.displayMessage("Not a Digital Asset.") else: libraryPath = node.type().definition().libraryFilePath() filename = os.path.basename(libraryPath) toDiscard = os.path.dirname(libraryPath) if amu.isCheckedOutCopyFolder(toDiscard): switchOPLibraries(libraryPath, os.path.join(OTLDIR, filename)) node.matchCurrentDefinition() amu.discard(toDiscard) hou.ui.displayMessage("Revert Successful!")
def go(): currentFile = cmd.file(query=True, sceneName=True) filePath = os.path.join(amu.getUserCheckoutDir(), os.path.basename(os.path.dirname(currentFile))) if(amu.isCheckedOutCopyFolder(filePath)): cmd.file(save=True, force=True) dialog = RollbackDialog() dialog.show() else: cmd.confirmDialog( title = 'Invalid Command' , message = 'This is not a checked out file. There is nothing to rollback.' , button = ['Ok'] , defaultButton = 'Ok' , cancelButton = 'Ok' , dismissString = 'Ok')
def go(): currentFile = cmd.file(query=True, sceneName=True) filePath = os.path.join(amu.getUserCheckoutDir(), os.path.basename(os.path.dirname(currentFile))) if(amu.isCheckedOutCopyFolder(filePath)): cmd.file(save=True, force=True) dialog = RollbackDialog() dialog.show() else: cmd.confirmDialog( title = 'Invalid Command' , message = 'This is not a checked out file. There is nothing to rollback.' , button = ['Ok'] , defaultButton = 'Ok' , cancelButton = 'Ok' , dismissString = 'Ok')
def discardLightingFile(): filepath = hou.hipFile.path() #TODO print(filepath) if hou.ui.displayMessage('YOU ARE ABOUT TO IRREVOKABLY DISCARD ALL CHANGES YOU HAVE MADE. ' 'Please think this through very carefully.\n ' 'Are you sure you want to discard ' 'your changes?' , buttons=('Yes','No',) , default_choice=1 , title='Discard Confirmation') == 0: toDiscard = os.path.join(amu.getUserCheckoutDir(), os.path.basename(os.path.dirname(filepath))) if amu.isCheckedOutCopyFolder(toDiscard): hou.hipFile.clear() amu.discard(toDiscard) else: hou.ui.displayMessage('This is not a checked out file. There is nothing to discard', title='Invalid Command') else: hou.ui.displayMessage('Thank you for being responsible.', title='Discard Cancelled')
checkInDest = amu.getCheckinDest(filePath) v = str(self.current_item.text()) checkinPath = os.path.join(checkInDest, "src", v) checkinName = os.path.join(checkinPath, os.path.basename(ORIGINAL_FILE_NAME)) print checkinName if os.path.exists(checkinName): cmd.file(checkinName, force=True, open=True) else: self.show_no_file_dialog() def go(): dialog = RollbackDialog() dialog.show() if __name__ == "__main__": filePath = os.path.join(amu.getUserCheckoutDir(), os.path.basename(os.path.dirname(ORIGINAL_FILE_NAME))) if amu.isCheckedOutCopyFolder(filePath): cmd.file(save=True, force=True) go() else: cmd.confirmDialog( title="Invalid Command", message="This is not a checked out file. There is nothing to rollback.", button=["Ok"], defaultButton="Ok", cancelButton="Ok", dismissString="Ok", )