View Full Version : registerUI from Python API
rendermaniac 11-27-2009, 09:16 AM Does anyone know how to use registerUI in a plugin written in Python so that you can call a MEL script when the plugin is loaded?
I had assumed plugin.registerUI("myMELproc", "", "", "") would work, but it seems to want pointers, and I couldn't find an example in the devkit examples.
thanks
Simon
|
|
rendermaniac
12-03-2009, 10:54 PM
I take it that no one has done this then.
It seems incredibly painful using strings in Maya Python.
Keilun
12-04-2009, 05:45 PM
If you look at the documentation for MFnPlugin::registerUI, it has it marked "NO_SCRIPT_SUPPORT". These designate methods in the Maya API that do not have equivalent Python bindings.
I don't believe there is an equivalent at the moment. You could effectively do this yourself by calling your MEL script's creation/destruction procs at the end/start of your initializePlugin/uninitializePlugin routines, unless there's some dependency I'm unaware of.
lalobr
12-05-2009, 08:53 AM
Simon, afaik registerUI expects a python function. To call a mel function one could do:
...
pluginFn.registerUI(pythonCreateUI, pythonDeleteUI)
...
def pythonCreateUI():
OpenMaya.MGlobal.executeCommand('melCreateUI')
def pythonDeleteUI():
OpenMaya.MGlobal.executeCommand('melDeleteUI')
I guess is that Autodesk thought whoever writes a python plugin would rather write a python UI?
Cheers,
Lalo.
rendermaniac
12-29-2009, 10:16 PM
Thanks. trust me to miss the giant capital letters spelling that out! I have called my function directly which seems to work. I had assumed that registerUI was a "proper" way to do things. Oh well - seems to work.
thanks for the replies
Simon
CGTalk Moderation
12-29-2009, 10:16 PM
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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.