README.md

maya-plugin-handler

Status

The code is in early stages and hasn't be tested with complex production
plugins. It works in the basic tests but might fail in other scenarios.

Also, note that not all functions are tested in the tests. It is a lot of work
to create an example of every Maya MPx class in order to test the registration
properly.

Why?

The standard way of writing the initializePlugin and uninitializePlugin
functions for a Maya plugin generally requires very similar code in each when
it comes to registering and deregistering parts of your plugin.

It seems reasonable to try to combine these so that you only have to write one
function and it can be used for both registering and deregistering.

How?

There are two approaches taken here.

PluginHandler.hh provides InitializePluginHandler and
UninitializePluginHandler classes which share a PluginHandler base class
and so can be treated polymorphically.

OpinionatedPluginHandler.hh provides InitializeOpinionatedPluginHandler
and UninitializeOpinionatedPluginHandler which are designed be used with a
templated function in a minimalist way which relies on the classes that are
being registered providing adequate information as static member variables.

For arguments that have defaults in the Maya API it is not necessary to provide
static members. Their presence is detected and defaults are used as a fall back
if they are not there.

The advantage here is that the registration code is minimal and it enforces a
convention for how to name and specify some details, like the creator function
and syntax functions, however some registration details are not needed anywhere
else so having them as static members of the classes seems a little
unnecessary.