It works fine for me in both 2008 and 2009. How do you know that it's skipping the first flag. Does the 'help' command not display it?
On Fri, May 29, 2009 at 17:09, Eric Pavey <[email protected]> wrote: > > This is probably a long shot, but I thought I'd ask in case anyone > else has ran into this: > > First off, I'm new to the API, but have a good grasp on mel and > Python. I'm going through the Complete Maya Programming book and re- > writing the plugin examples as scripted plugins. So far, so good... > > Here's the problem: I'm making a syntax for my command so I can > capture and process the flags, pretty much like the book shows (if you > have it, page 319): > > �...@staticmethod > def newSyntax(): > syntax = om.MSyntax() > syntax.addFlag(Posts3Cmd.numberFlag, Posts3Cmd.numberFlagLong, > om.MSyntax.kLong) > syntax.addFlag(Posts3Cmd.radiusFlag, Posts3Cmd.radiusFlagLong, > om.MSyntax.kDouble) > syntax.addFlag(Posts3Cmd.heightFlag, Posts3Cmd.heightFlagLong, > om.MSyntax.kDouble) > return syntax > > The bug is this: The first .addFlag applied is ignored by Maya. When > I run the command, it will completely skip whatever flag is listed > first. If I reorder the above syntax.addFlag methods, I can easily > change the behavior. The fix is a total hack: > > �...@staticmethod > def newSyntax(): > syntax = om.MSyntax() > syntax.addFlag("-d", "-dummy", om.MSyntax.kNoArg) > syntax.addFlag(Posts3Cmd.numberFlag, Posts3Cmd.numberFlagLong, > om.MSyntax.kLong) > syntax.addFlag(Posts3Cmd.radiusFlag, Posts3Cmd.radiusFlagLong, > om.MSyntax.kDouble) > syntax.addFlag(Posts3Cmd.heightFlag, Posts3Cmd.heightFlagLong, > om.MSyntax.kDouble) > return syntax > > I simply make a dummy syntax as the first one, and now everything > works quite happily. > Huh? This can't possibly be right. Look familiar to anyone? > > thanks > > > > -- -deane --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/python_inside_maya -~----------~----~----~----~------~----~------~--~---
