PDA

View Full Version : question about create MArgDatabase object


VisionOfEra
10-23-2005, 04:43 PM
Hi,all.Its my first post here.

Iam studying the maya API,and I have a question when I see the example about using MSyntax and MArgDatabase in MPxConmmand.They said,
create a static member function like:

static MSyntax newSyntax(){.......}

and in doIt menthod,I need an instance of MArgDatabase,initialize it with this way :

MArgDatabase argData(syntax(),args);

and my question is: What the hell is syntax()?because it seen I have never defined it ---I even have no knowledge about it,Is it a fuction return an MSyntax object?Or an object Maya generated?
I have to guess it just some kind format MayaApi require to do. But I really wanna to know the reason exactly.

Robert Bateman
11-02-2005, 05:26 PM
maya will call your newSyntax() function ONCE after your plugin has been loaded. This gives maya the info for it's help command.

syntax() is a MEMBER function of MPxCommand that returns to you the SINGLE INSTANCE of the syntax object that maya has created. This stops your plugin having a copy of what maya already has.

The MArgDatabase simply uses the info contained in the SINGLE MSyntax object in order to correctly parse the imcomming arguments.

VisionOfEra
11-04-2005, 02:23 AM
I have know it ,but thank you.

CGTalk Moderation
11-04-2005, 02:23 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.