It seems maya can't always (or never) delete nodes that are in use. I had situations when maya crashed when I was loading a scene file which contained unknown nodes (unknown plug-in nodes). Actually I had to find out that the reason of the crashing is that a certain plug-in was not installed on my computer. Scene with Arnold nodes can produce crash when you want to load into a maya without installed Arnold plug-in.
So there is a need to delete plug-in nodes manually...or with a python script.
The main command is:
cmds.pluginInfo("Mayatomr", q = 1, dependNode = 1)
With argument "Mayatomr" it will list all the Mental Ray plug-in nodes. Or "mtoa" would list all Arnold specific nodes. Of course even if the plug-in is loaded this command returns something only if there is at least one node of that plug-in in the current maya scene.
Here is a function for removing plug-in specific nodes:
def RemovePluginNodes(PlugIn = "mtoa", Verbose = 1):
'''
DESCRIPTION
Remove nodes of the given plug-in.
INPUT ARGUMENTS
- string - PlugIn - Name of the plug-in. You can check the exact (maya) name of the plug-in in the Maya Plug-in Manager.
For eg.: Mental Ray plugin file: Mayatomr.mll -> "Mayatomr"
- int - Verbose - provide extra information about the process
RETURN
None
'''
plugInNodeTypeList = cmds.pluginInfo(PlugIn, q = 1, dependNode = 1)
for plugInNodeType in plugInNodeTypeList :
existingPlugInNodeList = cmds.ls(type = plugInNodeType)
if existingPlugInNodeList:
cmds.delete(existingPlugInNodeList)
if Verbose:
print "Deleted nodes:\t%s" % existingPlugInNodeList
I haven't tested extensively so give it a try and let me know your experience.