Believe you are looking for self.setResult(cam)

Set the value of the result to be returned by the command.

*Name:* setResult(value)
*Parameters:* value - bool, int, float, string, sequence of numerics or
sequence of strings
*Returns:* None
*Description:* Set the value of the result to be returned by the command.

On Thu, Jun 20, 2019, 9:11 AM Russel Rehmund <russel.rehm...@gmail.com>
wrote:

> Anyone know how to properly work this?  Any examples or links to
> documentation would be appreciated.
>
> I'm trying to return a string from my command plugin, though I'm not even
> sure it's possible.  The string is the name of a camera that I've created.
>
> I'd like to be able to do this:
>
> camera = cmds.my_command()
>
>
> Here's my initialize function:
>
> def initializePlugin(mobject):
>     mplugin = omMPx.MFnPlugin(mobject, author, version, 'Any')
>     try:
>         cam = mplugin.registerCommand(kPluginCmdName, cmdCreator,
> syntaxCreator)
>         log.info("Successfully registered plugin:
> {0}".format(kPluginCmdName))
>         if cam:
>             return cam
>     except Exception as e:
>         log.critical("Failed to register command:
> {0}".format(kPluginCmdName))
>         log.critical(traceback.format_exc(e))
>         raise
>
> My doIt function:
>
>     def doIt(self, args):
>         """ Command execution. """
>         arg_data = om.MArgDatabase(self.syntax(), args)
>
>        ... flags parsing
>
>         # Run the turntable code here.
>         cam = main(...)
>         return cam
>
> Am I missing something here?
>
> --
> 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 python_inside_maya+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/da684b50-5c6d-425c-a87b-e9f902ec0414%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/da684b50-5c6d-425c-a87b-e9f902ec0414%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 python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAL6_5Q9hPwjb03Wo2gLrvyBVxbC1ndsfn6mZtWSZ4qWZhUqahQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to