registerUI in Python?

registerUI in Python?

Anonymous
Not applicable
453 Views
1 Reply
Message 1 of 2

registerUI in Python?

Anonymous
Not applicable
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
0 Likes
454 Views
1 Reply
Reply (1)
Message 2 of 2

ryanltrowbridge
Participant
Participant
You can not use that function in Python:

http://download.autodesk.com/us/maya/2010help/API/class_m_fn_plugin.html

registerUI (const MString &creationProc, const MString &deletionProc, const MString &creationBatchProc="", const MString &deletionBatchProc="")
NO SCRIPT SUPPORT.

The key words are NO SCRIPT SUPPORT.

Despite that you can already do this with a scriptJob. Weird example follows:

import maya.cmds as cmds

window = cmds.window( title="Long Name", iconName='Short Name', widthHeight=(200, 25) )
cmds.columnLayout( adjustableColumn=True )
cmds.button( label='Close', command=('cmds.deleteUI(\"' + window + '\", window=True)') )
cmds.setParent( '..' )
cmds.showWindow( window )


def dostuff():
cmds.sphere()

jobNum = cmds.scriptJob( protected=True, uiDeleted= )



Ryan
www.rtrowbridge.com/blog
Character TD
NaughtyDog
0 Likes