ECToo / pymel

Automatically exported from code.google.com/p/pymel
0 stars 0 forks source link

missing callBackId #255

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I get the following error:

<pre>
// Error: line 0: (kInvalidParameter): No element at given index
# Traceback (most recent call last):
pymel/core/__init__.py", line 105, in addPluginPyNodes
#     _api.MEventMessage.removeCallback( id )
# RuntimeError: (kInvalidParameter): No element at given index // 
// Warning: line 0: Failed to call script callback // 
</pre>

PyMel tries to remove a callback but the callback ID does not exist anymore. 
This happens when I
1. import pymel.core as pm
2. load a scene which requires a plugin which loads several nodes
3. open a new file (even when just creating an empty scene)

It does not happen when I load the plugin manually before loading the file.

This is the PyMel code:
<pre>
        def addPluginPyNodes(*args):
            try:
                id = _pluginData[pluginName]['callbackId']
                if id is not None:
                    _api.MEventMessage.removeCallback( id )
                    if hasattr(id, 'disown'):
                        id.disown()
</pre>

I added this line to fix this issue: 

_pluginData[pluginName]['callbackId'] = None

I don't really understand why the addPluginPyNodes is called when the callback 
is not there anymore... 

Maya version: 2011.5x64
OS: Red Hat 5.3, 64bits
PyMel: 1.0.3

Original issue reported on code.google.com by kjelle.a...@gmail.com on 23 Aug 2011 at 2:04