Unloading the mental ray plugin

275 views
Skip to first unread message

Sylvain Delhomme

unread,
Jun 30, 2014, 11:58:15 AM6/30/14
to python_in...@googlegroups.com
Hi,

I'm trying to 'properly' unload the mental ray plugin from Maya using the following code:

# reset renderer
cmds.setAttr('defaultRenderGlobals.currentRenderer', 'mayaSoftware', type='string')
cmds.renderer('mentalRay', unregisterRenderer=True, edit=True)
cmds.flushUndo()
# all mental ray node type
nodeTypes = cmds.pluginInfo('Mayatomr', query=True, dependNode=True)
nodes = cmds.ls(type=nodeTypes); # print nodes
cmds.delete(nodes)
cmds.flushUndo()

However, the following command always return False:

cmds.pluginInfo('Mayatomr', query=True, unloadOk=True)

If I try to manually unload the plugin, an error message is displayed but the services in use list is empty:

Services provided by this plug-in are

currently in use.

[...]

The following services are in use:



Any ideas?






damon shelton

unread,
Jun 30, 2014, 12:13:46 PM6/30/14
to python_in...@googlegroups.com
cmds.pluginInfo('Mayatomr', query=True, loaded=True)


--
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/8063f9e1-7657-4f1c-b8ee-61a6c830e618%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sylvain Delhomme

unread,
Jul 1, 2014, 4:37:36 AM7/1/14
to python_in...@googlegroups.com
cmds.pluginInfo('Mayatomr', query=True, loaded=True)
# Result: True #

But my question is about unloading rather than checking the state of mental ray :)


Le lundi 30 juin 2014 18:13:46 UTC+2, damonshelton a écrit :
cmds.pluginInfo('Mayatomr', query=True, loaded=True)
On Mon, Jun 30, 2014 at 8:58 AM, Sylvain Delhomme <s...@mikrosimage.eu> wrote:
Hi,

I'm trying to 'properly' unload the mental ray plugin from Maya using the following code:

# reset renderer
cmds.setAttr('defaultRenderGlobals.currentRenderer', 'mayaSoftware', type='string')
cmds.renderer('mentalRay', unregisterRenderer=True, edit=True)
cmds.flushUndo()
# all mental ray node type
nodeTypes = cmds.pluginInfo('Mayatomr', query=True, dependNode=True)
nodes = cmds.ls(type=nodeTypes); # print nodes
cmds.delete(nodes)
cmds.flushUndo()

However, the following command always return False:

cmds.pluginInfo('Mayatomr', query=True, unloadOk=True)

If I try to manually unload the plugin, an error message is displayed but the services in use list is empty:

Services provided by this plug-in are

currently in use.

[...]

The following services are in use:



Any ideas?






--
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+unsub...@googlegroups.com.

Fredrik Averpil

unread,
Jul 2, 2014, 4:02:47 AM7/2/14
to python_in...@googlegroups.com
I've been trying to do the same thing but I never succeeded. I made the assumption mental ray is too deeply integrated in AE templates throughout the scene and so it cannot be unloaded. Not sure if that's the case though.

Regards,
Fredrik



--
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_m...@googlegroups.com.

Sylvain Delhomme

unread,
Jul 2, 2014, 5:26:39 AM7/2/14
to python_in...@googlegroups.com
Thanks Fredrik

So did you decide to force unload mental ray? I'm concerned about scene corruption or even Maya crash.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.

Fredrik Averpil

unread,
Jul 2, 2014, 5:49:34 AM7/2/14
to python_in...@googlegroups.com
No, we just leave it there. Mental ray lingers in basically all our scenes because it doesn't seem to be any good way of cleaning it out once and for all.

Regards,
Fredrik



To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/50c62a94-8c3f-4b15-ba94-a0043a1e49b8%40googlegroups.com.

Anthony Tan

unread,
Jul 3, 2014, 7:05:25 AM7/3/14
to Sylvain Delhomme, python_in...@googlegroups.com

You're not too far off with regards to MR being a bit more deeply hooked than expected, I'm not across all the details but if you have a look at the release notes for 2010 and 2011 (i didnt have later release notesmhere but i'll bet it's still the case going forwards..) you'll find this:

"Unable to unload an MPxNode plug-in if MPxData is specified

If a MPxNode plug-in creates an MPxData in its initialize() method, you will receive a warning that the plug-in is in use when trying to unload it even if you have not created a node. This is because the proxy MPxData type is in use."

A bit more over at

http://around-the-corner.typepad.com/adn/2013/01/never-ever-use-unloadplugin-force.html

but it kinda boils down to - once your scene touches a plugin Maya will have hooked into it to the point where you can't safely unhook it. Joy! 😀

Reply all
Reply to author
Forward
0 new messages