def arguments(cls, arglist, selection=True): """ Rturn the contents of arglist as a list of strings. If <selection> is True, the arglist will be populated with Maya selection """ syntax = MSyntax() syntax.setObjectType(MSyntax.kStringObjects) syntax.useSelectionAsDefault(selection) adb = MArgDatabase(syntax, arglist) return adb.getObjectStrings()
def objects(cls, arglist, selection=True): """ Returns the contents of arglist as an MSelectionList. If <selection> is True, uses the maya selection as the default. Note this does no error handling, if the argList has a bad object name a RuntimeError will be raised """ syntax = MSyntax() syntax.setObjectType(MSyntax.kSelectionList) syntax.useSelectionAsDefault(selection) try: adb = MArgDatabase(syntax, arglist) return adb.getObjectList() except RuntimeError as e: raise RuntimeError("could not parse argument list", cls.arguments(arglist))
def parse(self, arglist): return MArgDatabase(self.syntax(), arglist)