def getExistingFile(): test_path = os.path.normpath(config['test_file_path']) new_file = PipelineActions.getFileFromPath(test_path) if new_file: user = User(config['user']) comment = 'wumbada' print new_file.getPath() try: new_file.versionUp(user, comment) print new_file.getPath() except ValueError as message: print message quit()
# pipeline modules # config from config import config # helpers from helpers.dir_helper import ensurePath from helpers.maya_helper import setWorkspace, getWorkspace # actions from actions import PipelineActions # models from models import Asset, User, MayaFile if __name__ == '__main__': # browse for file to open file_path_list = cmds.fileDialog2(fileFilter = '*.ma', fileMode = 1) # if a path is returned if file_path_list: file_path = file_path_list[0] # get managed file from selected file path new_file = PipelineActions.getFileFromPath(os.path.normpath(file_path)) # if selected file is managed file, open that file and set the workspace to current asset directory if new_file: if cmds.file(new_file.getPath(), open = True, force = True): # set workspace setWorkspace(new_file.getAppPath())