Thursday, May 01, 2008

Maya 2008 Plugin development - Part 1

Building plugins for Maya allows both Game Developers and Artist to customize Maya and speed up the workflow.

So far, doing some reading and research, I found there are two ways to develop Maya plugins: Using a traditional compiled VC++ .mll plugin or by using Python.

I will start this research by building a simple plugin using Visual Studio 2005 (Visual Studio 8)

1. Start by installing the Plugin Wizard

First step is to setup the Visual Studio environment. Fortunately, Maya includes a Plugin Wizard for Visual Studio 8 (aka Visual Studio 2005) so you can create them easily.
Plugin wizard is found in the following location:


Of course, you can follow the readme instructions, but there's a little change you should do in order to have the plugin working.

a. Unzip the file

a.1 This is the new Step:

Edit the MayaPluginWizard.vsz file, and change the following line:
(For Some reason wizard developers forgot to update this for Visual studio 2005 Developers)

b. Copy the following files:

MayaPluginWizard.vsdir MayaPluginWizard.vsz MayaPluginWizard.ico

To \VC\VCProjects

c. Copy the MayaPluginWizard folder to \VC\VCWizards

2. Create plugin in Visual Stuio

(This is a sample check box.)???

Is there something missing to finish in this Wizard?

Create a new project, as usual, and click OK. The wizard will show you the screen above. Then you should choose the options you want. By clicking Next you must select the type of plugin you want to create and the Command Name for this plugin (This is the entry point of the plugin in Maya; that is the command you write when calling the plugin)

That's all, you are ready to write your plugin. Please note the Wizard will setup the project so you only have to build the project and the .mll file will be created.

3. Install Plugin in Maya

Open Maya (of course) and go to Window->Preferences->Plugin Manager, click Browse and find the plugin you just created. It should be marked as "Loaded". Check "Auto Load" if you want the plugin to be loaded everytime you start Maya.

4. Execute the Plugin

Open the Script Editor and excecute the command you just created. This is the result from mine:

// Result: MysimpleMelCommand command was successfully excecuted

That's all. I hope it works for you.

Some Sources:


Jozart said...

Hi, I'm a newbie to developing Plug-Ins in Maya and I've found this extremely helpful! I couldn't get things to work using the instructions included with Maya - your information about the changes needed was just what I needed... thank you!

spigi said...

I did all the steps mentioned here, but was not successful when trying to compile a simple helloWorld program, gettin 20 errors like:

1>myCmdCmd.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall MPxCommand::MPxCommand(void)" (__imp_??0MPxCommand@@QAE@XZ) referenced in function "public: __thiscall myCmd::myCmd(void)" (??0myCmd@@QAE@XZ)

1>myCmdCmd.obj : error LNK2001: unresolved external symbol "public: virtual class MStatus __thiscall MPxCommand::undoIt(void)" (?undoIt@MPxCommand@@UAE?AVMStatus@@XZ)

which libraries should I choose to be linked in the third step? only 'Foundation' and 'OpenMaya' ?

Thanks, sp

Fabian Mejia said...

the plug-in wizard should add the appropriate libraries to your project. Please check the following link, there are some clues on your issue.

Anonymous said...

i am new here and loved the forum don't know if i am posting in the right place..
just wanted to say hi and i hope that i will have good time here