On Wed, Oct 25, 2017, 11:52 PM Rémi Deletrain <[email protected]>
wrote:

> Hi everyone,
>
> I try to create au plugin with MPxCommand.
>
> I have classic code found on MSyntax api class exemple. My code:
> MSyntax SSDRCommands::newSyntax() {
>
> MStatus status;
> MSyntax syntax;
>
> syntax.addFlag(kShortShapeName, kLongShapeName, MSyntax::kString);
> CHECK_MSTATUS_AND_RETURN(status, syntax);
> syntax.addFlag(kShortNumJoints, kLongNumJoints, MSyntax::kLong);
> CHECK_MSTATUS_AND_RETURN(status, syntax);
> syntax.addFlag(kShortMaxInfluences, kLongMaxInfluences, MSyntax::kLong);
> CHECK_MSTATUS_AND_RETURN(status, syntax);
> syntax.addFlag(kShortNumIterations, kLongNumIterations, MSyntax::kLong);
> CHECK_MSTATUS_AND_RETURN(status, syntax);
> syntax.addFlag(kShortStartTime, kLongStartTime, MSyntax::kDouble);
> CHECK_MSTATUS_AND_RETURN(status, syntax);
> syntax.addFlag(kShortEndTime, kLongEndTime, MSyntax::kDouble);
> CHECK_MSTATUS_AND_RETURN(status, syntax);
>
> syntax.useSelectionAsDefault(false);
>
> return syntax;
>
> }
>
>
> MStatus return false, but I don't understand why...
> Anyone have a solution ?
>

There is no point to using an MStatus and calls to CHECK_MSTATUS_AND_RETURN
here. None of your function calls ever accept a status to ever change its
state. So you are just checking the state of the default constructed
MStatus every time. However, the default constructor for MStatus should
initialize it to kSuccess which should make the check pass each time
anyways. So I am not sure what you mean when you say it returns "false". It
should just make it to the end of the function and return your MSyntax as
expected.



-- 
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/4e85d611-7477-45c5-91bc-3c7e69b847b2%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/4e85d611-7477-45c5-91bc-3c7e69b847b2%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA1a5LjZwWJqkLFmZryPaUuzPrvOfG5YXuGgP4YkG24SVg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to