Package mrv :: Package maya :: Package nt :: Class PluginDB
[hide private]
[frames] | no frames]

Class PluginDB

source code

object --+    
         |    
      dict --+
             |
            PluginDB

Simple container keeping information about the loaded plugins, namely the node types they register.

As PyMel code has shown, we cannot rely on pluginLoaded and unloaded callbacks, which is why we just listen to plugin changed events, and figure out the differences ourselves.

Currently we are only interested in the registered node types, which is why we are on mrv.maya.nt level, not on mrv.maya level

Instance Methods [hide private]
new empty dictionary

__init__(self)
Upon initialization, we will parse the currently loaded plugins and register them.
source code
 
plugin_registry_changed(self, *args)
Called by maya to indicate something has changed.
source code
 
plugin_loaded(self, pluginName)
Retrieve plugin information from a plugin named pluginName, which is assumed to be loaded.
source code
 
plugin_unloaded(self, pluginName)
Remove all node types registered by pluginName unless they have been registered by a third party.
source code

Inherited from dict: __cmp__, __contains__, __delitem__, __eq__, __ge__, __getattribute__, __getitem__, __gt__, __iter__, __le__, __len__, __lt__, __ne__, __new__, __repr__, __setitem__, __sizeof__, clear, copy, fromkeys, get, has_key, items, iteritems, iterkeys, itervalues, keys, pop, popitem, setdefault, update, values

Inherited from object: __delattr__, __format__, __reduce__, __reduce_ex__, __setattr__, __str__, __subclasshook__

Class Variables [hide private]

Inherited from dict: __hash__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 
Upon initialization, we will parse the currently loaded plugins and register them. Additionally we register our event to stay in the loop if anything changes.
Returns:
new empty dictionary

Overrides: object.__init__

plugin_registry_changed(self, *args)

source code 
Called by maya to indicate something has changed. We will diff the returned plugin information with our own database to determine which plugin was added or removed, to make the appropriate calls

plugin_loaded(self, pluginName)

source code 

Retrieve plugin information from a plugin named pluginName, which is assumed to be loaded. Currently the nodetypes found are added to the node-type tree to make them available. The plugin author is free to add specialized types to the tree afterwards, overwriting the default ones.

We loosely determine the inheritance by differentiating them into types suggested by MFn::kPlugin<Name>Node

plugin_unloaded(self, pluginName)

source code 

Remove all node types registered by pluginName unless they have been registered by a third party. We cannot assume that they listen to these events, hence we just keep the record as it will not harm.

In any way, we will remove any record of the plugin from our db