And for a bunch of doubles, you'll need to return either an MDoubleArray with setResult or call appendToResult several times with each value.
On Wed, Mar 10, 2010 at 4:52 PM, Chad Vernon <[email protected]> wrote: > In MPxCommand, doIt() is supposed to return an MStatus. In order to get > the actual command to return something, use the setResult() or > appendToResult() methods. > > > On Wed, Mar 10, 2010 at 3:44 PM, ranxerox <[email protected]> wrote: > >> >> hey all, I've been writing a command plugin which does come >> calculations based on it's input and returns a vector back to the >> script which was calling it. It's been a while since I've written a >> plugin and I've never written one in python so please excuse the >> simplicity of the question but I haven't found my answer in the >> documentation so as a last resort I'll post it here. >> >> this is the end of my "doIt" method for my class derived from >> OpenMayaMPx.MPxCommand, I am trying to return the vector 'vecDegrees' >> back to the python script which is calling this command: >> >> retval = OpenMaya.MScriptUtil() >> >> retval.createFromDouble(vecDegrees[0],vecDegrees[1],vecDegrees[2],0) >> retvalFltPtr = retval.asFloat4Ptr() >> return retvalFltPtr >> >> from gleaning the documentation I guessed that this was the correct >> way to do it, but I am still getting an error from the calling script >> which is trying to index the return value, it says 'NoneType' object >> is unsubscriptable, so I guess I'm still returning a NoneType >> object. >> >> is this the correct way to return a value from a scripted command >> plugin ? I tried various methods (such as appendToResult) but got >> various errors and the documentation is really not very helpful. Any >> help would be much appreciated for this seemingly simple task. >> >> thanks >> >> -Greg >> >> -- >> http://groups.google.com/group/python_inside_maya > > > -- http://groups.google.com/group/python_inside_maya
