MSimple.h and DeclareSimpleCommand

All plug-ins need to implement the initializePlugin(), uninitializePlugin(), and creator() functions.

The DeclareSimpleCommand() macro replaces initializePlugin(), uninitializePlugin(), and creator() in simple plug-ins so you do not have to implement these functions yourself.

DeclareSimpleCommand() takes three arguments: the plug-in class, the owner of the plug-in, and the version.

DeclareSimpleCommand( helloWorld, "Autodesk", "2019");

DeclareSimpleCommand() cannot be used to create an undoable command. Because only undoable commands should modify the scene, DeclareSimpleCommand() should only be used to create commands that query the scene or print messages to the script editor. It should not be used to create commands that modify the scene in any way.

Important:

If you create a non-undoable command that modifies the scene, it will break Maya's undo capability.

You need to include MSimple.h to use DeclareSimpleCommand().

Note:

Plug-ins that implements several features, such as dependency graph nodes and commands, cannot use DeclareSimpleCommand().