Complete Maya Programming (Volume II) Companion Files

Files Description | Building Plugins under Windows | Building Plugins under Linux | Book Website

 

Files Description


The companion files include all the source code for the plugin and MEL examples. The subdirectories are as follows:

Directory

Contents

\Plugins

The source code (.cpp, .h), Microsoft Visual C++ .NET project files (.vcproj), Linux makefiles (Makefile) for all the example plugins

\Scenes

All the example Maya scenes (.ma)

\MEL Scripts

All the MEL scripts (.mel)

 

Building Plugins under Windows


Minimum Requirements

In order to create Maya plugins the following are needed

 

Compiling Example Plugins

  1. Go to the subdirectory of the plugin you want to compile, e.g. \Plugins\CurveInfo1
  2. Double-click on the project workspace file, e.g. CurveInfo1.vcproj

    Visual C++ will load the project and show the plugin source code files.

  3. Select Project | Properties from the main menu.
  4. In the Configuration Properties list click on the C/C++ item.
  5. Click on the General item.
  6. The Additional Include Directories setting contains a list of directories containing header files (.h), e.g.

    .;"D:\Program Files\Alias\Maya5.0\include\"

    Add the Maya include directory to the end of the list. Be sure to enclose it in quotes (") and use a semicolon (;) to separate it from the last directory. For example, if your Maya includes files are located in the directory C:\Alias\Maya\Include then it would be added to the list as follows

    .;"D:\Program Files\Alias\Maya5.0\include\";"C:\Alias\Maya\Include"

  7. In the Configuration Properties list click on the Linker item.
  8. Click on the General item.
  9. The Additional Library Directories setting contains a list of directories containing library files (.lib), e.g.

    "D:\Program Files\Alias\Maya5.0\lib"

    Add the Maya library directory to the list. Be sure to enclose it in quotes (") and use a semicolon (;) to separate it from the last directory. For example, if your Maya library files are located in the directory C:\Alias\Maya\lib then it would be added to the list as follows

    "D:\Program Files\Alias\Maya5.0\lib";"C:\Alias\Maya\lib"

  10. Click on the OK button.

    The project settings are updated.

  11. Select Build | Build Solution from the main menu.

    The plugin will be compiled.

 

Building Plugins under Linux


Minimum Requirements

In order to create Maya plugins the following are needed

 

Compiling Example Plugins

Compiling the example plugins under Linux is done using makefiles.

  1. Open a terminal/shell.

    In order to compile the plugins, the makefiles need to know where your installation of Maya is located. The environment variable $MAYA_LOCATION is typically set to the Maya directory.

  2. To see if this environment variable is set correctly, execute the following:

    ~> echo $MAYA_LOCATION

    The Maya directory should be displayed. If it isn't you need to set the environment variable $MAYA_LOCATION to the Maya directory.

  3. Go to the directory where the companion files were unzipped to.
  4. Go to the Plugins subdirectory.

    The Plugins directory contains a makefile that will compile and link all the example plugins.

  5. Execute the following:

    ~> make

    All the plugins will then be compiled. If you want to compile the plugins individually simply go the subdirectory containing the particular plugin and then execute make. This will make the plugin in the current directory.