def menuCommand(self, command, catagories) : selItem = str(self.ui.ref_listWidget.currentItem().text()) filePath = '%s/%s' % (self.asset.getPath('ref'), selItem) if os.path.exists(filePath) : if catagories == 'Open' : if command == 'Open' : hook.openFile(filePath) if command == 'Open as work file' : workFile = self.asset.nextVersion() hook.openFile(filePath) hook.save(workFile) if catagories == 'Import' : if command == 'Import' : hook.importFile(filePath) if command == 'Import to new file' : hook.newFile() hook.importFile(filePath) if catagories == 'Reference' : namespace = self.asset.name() if command == 'Reference' : hook.createReference(namespace, filePath) if command == 'Reference to new file' : hook.newFile() hook.createReference(namespace, filePath) else : self.messageBox('Error', 'File %s not exists' % filePath)
def menuCommand2(self, command, path) : if os.path.exists(path) : if command == 'Open file' : hook.openFile(path) if command == 'Open in Explorer' : path = path.replace('/', '\\') subprocess.Popen(r'explorer /select,"%s"' % path) if command == 'Copy Path' : mayaTools.copyToClipboard(path) else : self.messageBox('Error', '%s not found' % path)