Huh - good to know. Anyone filed a bug report yet?
- Paul On Mon, Sep 21, 2009 at 1:50 AM, Olivier Renouard <[email protected]> wrote: > At least the cause of the error has been identified, there seems to be an > incorrect wrap of multi use flags MSyntax in Python : > > http://www.3delight.com/en/modules/PunBB/viewtopic.php?pid=8600#p8600 > > Drake wrote: > > The current MTOR in RenderMan Studio 2 still doesn't provide python > binding and there must be some reason but I didn't check it with their > technical guys. I guess it is not in priority list. But there is prman > (the renderer) for python started from prman 14.0 and we have > experienced on it by developed a re-lighting tool based on prman's new > re-lighting framework. Python binding works well except some re- > lighting bug. > > - Drake > > On Sep 18, 12:07 am, Paul Molodowitch <[email protected]> wrote: > > > Well, glad you got that sorted out. =) > > Still, I'm a little surprised that the PRMan plugin didn't also supply > a python version of mtor - generally speaking, as long as the plugin > is implemented "properly" - ie, uses MSyntax for it's command arg > processing - it should make both a python and mel command. > > - Paul > > On Thu, Sep 17, 2009 at 3:41 AM, Drake <[email protected]> wrote: > > > > Hey Paul, > > > Thx a lot for the detailed explanation. During the tracing of pymel's > Mel class, I did notice the different handling of mel commands and mel > functions and I didn't realize that I have found the solution yet. > PRMan's mtor is command-styled and I would use pymel.mel.mtor > ('control', 'getvalue', '-sync') for them. > > > Sometimes, it is too convenient to use pymel such that we made some > very fundamental mistakes~ > > > -- Drake > > > On Sep 17, 12:04 am, Paul Molodowitch <[email protected]> wrote: > > > Hey drake - > First of all, for commands from plugins, BOTH a python command and a > mel command should be made. So, both of these should be valid: > > > // From mel: > mtor(...) > > > # From python: > import maya.cmds > maya.cmds.mtor(...) > > > Also, if you encounter problems with pymel.mel's wrapping, you can > always fall back on the the default maya.mel.eval, which just > evaluates a mel string: > > > import maya.mel > maya.mel.eval('mtor ...') > > > Thus far, I've just talked about stuff in maya's standard python/mel > - now onto pymel. Note that I don't have access to Renderman myself, > so I can't give definitive answers on the mtor command, but this > should point you in the right direction. > > > In pymel, you can access the maya.cmds python function as normal: > > > import pymel > pymel.mtor(...) > > > Note, however, that if you did something like this: > > > from pymel import * > loadPlugin('mtor.so') > mtor(...) > > > ...you would get: > > > # NameError: name 'mtor' is not defined # > > > The reason here is that when you did the 'from pymel import *', the > 'mtor' command was not defined - you will have to either re-import * > into your namespace, or use pymel.mtor > > > Making a guess at the syntax for the mtor command, the best way to > invoke the command you were looking for would probably be something > like this: > > > mtor('control', 'getvalue', sync=True) > > > If, for some reason, you have to use the MEL version of the command, > note that pymel's 'mel' wraps things using the 'function' syntax of > the mel command, not the 'command' syntax. If you're not clear on the > difference between the two, here's an example: > > > // mel command syntax: > xform -q -translation; > // mel function syntax: > xform("-q", "-translation"); > > > Thus, the correct way to invoke this command from pymel.mel would also be: > > > pymel.mel.xform("-q", "-translation"); > > > So, if you had to call mtor from python using the mel version, you > would likely do something like this: > > > pymel.mel.mtor('control', 'getvalue', '-sync') > > > Finally, as a last fallback, you can use pymel.mel.eval, which is just > a wrapper for the standard maya.mel.eval: > > > pymel.mel.eval('mtor control getvalue -sync') > > > On Wed, Sep 16, 2009 at 4:48 AM, Drake <[email protected]> wrote: > > > It's a lovely design to use 'mel.ooxx(...)' to invoke mel function as > 'ooxx ...' but we encountered one special case as Pixar's mtor > function. In mel, mtor's function works like these: > > > mtor control getvalue -sync; > mtor control getvalue -rg dspyName; > mtor control setvalue -rg "dspyQuantizeOne" -value $ooxx; > ... > > > We could not directly make it work through pymel as following: > > > mel.mtor("control getvalue -sync") > > > Therefore, I did my own dirty hack on Mel class to make the above code > snippet work. I am wondering what is the suggested way to invoke some > mel functions like 'mtor'? > > > -- Drake > > > > > > > -- > Olivier Renouard > > > > --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/python_inside_maya -~----------~----~----~----~------~----~------~--~---
