def open_selected(*args): proj = ai.AssetInfo() # if no file then warn and skip selFile = cmds.textScrollList(widgets["filesTSL"], q=True, si=True)[0] if selFile == "No Files": cmds.warning("No files available to open!") return () # construct the paths tab, phase, assetPath, assetFiles = [None, None, None, None] selTab = cmds.tabLayout(widgets["assetsTab"], q=True, st=True) if selTab != "STGS": tab, phase, assetPath, assetFiles = get_asset_info(proj) else: tab, phase, assetPath, assetFiles = get_stage_info(proj) selIndex = cmds.textScrollList(widgets["filesTSL"], q=True, sii=True)[0] filePath = os.path.join(assetPath, assetFiles[selIndex - 1]) # check mods, if so then. . changed = cmds.file(q=True, modified=True) svState = True if changed: svState = save_current_dialog() if svState: of.run(filePath) else: return ()
def openFile(*args, **kwargs): reload(osf) osf.run()