A post about maya API enviroment setup

2008-05-04


A post about maya API enviroment setup

Hi all! I'm preparing to develope some API...or try to do that _ I've got microsoft visual c++ .NET 2003 (v7.1), so, does anybody can link me a tutorial to develope my first .mll? I don't need programming hints, only how to configure Visual C++ and maya! thanks for your attention

A post about maya API enviroment setup

Hi all! I'm preparing to develope some API...or try to do that _ I've got microsoft visual c++ .NET 2003 (v7.1), so, does anybody can link me a tutorial to develope my first .mll? I don't need programming hints, only how to configure Visual C++ and maya! thanks for your attention

Hi, welcome.

Try the following changes:

General:

  1. In Extras->Options->Projects->VC++-Directories

add "C:\Program Files\Maya6.0\include" to include files,

add "C:\Program Files\Maya6.0\lib" to library files.

Per Project:

  1. In Project->Properties->Konfigurationproperties->Linker->CommandLine

add "/export:initializePlugin" and "/export:uninitializePlugin"

  1. In  Project->Properties->Konfigurationproperties->Linker->General

set Output File to "C:\Program Files\Maya6.0\bin\plug-ins\plugin_name.mll"

In the main cpp file add below #include "stdafx.h":

#pragma comment(lib, "Foundation.lib")

#pragma comment(lib, "OpenMaya.lib")

// ... Any other library that needs to be included #include <maya/MFnPlugin.h>

In your stdafx.h file you might want to add the following:

----------------------------------------------------- stdfx.h #define _BOOL

#include <maya/MGlobal.h>

#include <maya/MString.h>

#include <maya/MStringArray.h>

#include <maya/MEventMessage.h>

#include <maya/MUiMessage.h>

#include <maya/M3dView.h>

#include <maya/MFnNurbsCurve.h>

#include <maya/MFnUnitAttribute.h>

#include <maya/MItMeshPolygon.h>

#include <maya/MFnMesh.h>

#include <maya/MDistance.h>

#include <maya/MPxContextCommand.h>

#include <maya/MPxContext.h>

#include <maya/MEvent.h>

#include <maya/MCursor.h>

#include <maya/MFloatMatrix.h>

#include <maya/MPxModelEditorCommand.h>

#include <maya/MPx3dModelView.h>

#include <maya/MFStream.h>

#include <maya/MPxFileTranslator.h>

#include <maya/MStatus.h>

#include <maya/MPxCommand.h>

#include <maya/MSyntax.h>

#include <maya/MArgDatabase.h>

#include <maya/MFnComponent.h>

#include <maya/MFnSingleIndexedComponent.h>

#include <maya/MSyntax.h>

#include <maya/MArgParser.h>

#include <maya/MArgDatabase.h>

#include <maya/MDagModifier.h>

#include <maya/MDGModifier.h>

#include <maya/MDagMessage.h>

#include <maya/MModelMessage.h>

#include <maya/MAnimMessage.h>

#include <maya/MTime.h>

#include <maya/MAnimControl.h>

#include <maya/MIOStream.h>

#include <maya/MPxToolCommand.h>

#include <maya/MArgList.h>

#include <maya/MGlobal.h>

#include <maya/MItSelectionList.h>

#include <maya/MPoint.h>

#include <maya/MVector.h>

#include <maya/MDagPath.h>

#include <maya/MFnTransform.h>

#include <maya/MItCurveCV.h>

#include <maya/MItSurfaceCV.h>

#include <maya/MItMeshVertex.h>

#include <maya/MPxSelectionContext.h>

#include <maya/MPxContextCommand.h>

#include <maya/M3dView.h>

#include <maya/MFnCamera.h>

#include <maya/MCommandResult.h>

#include < maya/MGlobal.h >

#include < maya/M3dView.h >

#include < maya/MPxLocatorNode.h >

#include < maya/MPxSurfaceShape.h >

#include < maya/MPxSurfaceShapeUI.h >

#include < maya/MPxTransform.h >

#include < maya/MPxTransformationMatrix.h >

#include < maya/MDrawRequest.h >

#include < maya/MTypeId.h > #include < maya/MString.h > #include < maya/MVector.h >

#include < maya/MColor.h >

#include < maya/MPlug.h >

#include < maya/MDataBlock.h >

#include < maya/MDataHandle.h >

#include < maya/MFnNumericAttribute.h >

#include < maya/MFnTypedAttribute.h >

#include < maya/MDagPath.h >

#include < maya/MFnDagNode.h >

#include < maya/MFnTransform.h >

#include < maya/MEventMessage.h >

#include < maya/MSelectionList.h >

#include < maya/MPxCommand.h >

#include < maya/MArgList.h >

#include < maya/MFnCamera.h >

#include < maya/MItSelectionList.h >

#include < maya/MEulerRotation.h >

#include < maya/MNodeMessage.h >

#include < maya/MFnMatrixAttribute.h >

#include < maya/MStringArray.h >

#include < maya/MSceneMessage.h >

#include < maya/MFileIO.h >

#include < maya/MFnCompoundAttribute.h >

#include < maya/MConditionMessage.h >

#include < maya/MDGMessage.h >

#include < maya/MIOStream.h >

#include < maya/MPxSurfaceShape.h >

#include < maya/MPxSurfaceShapeUI.h >

#include < maya/MFnNumericAttribute.h >

#include < maya/MFnEnumAttribute.h >

#include < maya/MPoint.h >

#include < maya/MPlug.h >

#include < maya/MDrawData.h >

#include < maya/MDrawRequest.h >

#include < maya/MSelectionMask.h >

#include < maya/MSelectionList.h >

#include < maya/MDagPath.h >

#include < maya/MMaterial.h >

#include < maya/MMatrix.h >

#include < maya/MPlugArray.h >

#include < maya/MIntArray.h >

#include < maya/MPointArray.h >

#include < maya/MFnMessageAttribute.h >

void p(char *message, ... );

----------------------------------------------------- stdfx.h

in your stdafx.cpp you might want to add

----------------------------------------------------- stdfx.cpp

void p(char *message, ... )

{

char tempBuffer[10000];

va_list args;

va_start(args, message);

vsprintf( tempBuffer, message, args );

va_end(args);

MGlobal::displayInfo( MString( tempBuffer ) );

}

----------------------------------------------------- stdfx.cpp

In your maya shelf:

add a button containing the following mel code

catch( loadPlugin "C:/Program Files/Maya6.0/bin/plug-ins/plugin_name.mll");

add a button containing the following mel code

file -f -new;

unloadPlugin "plugin_name";

Probably somethings missing, so if you find something to add, please feel free to do it.

Post Extras: Print Post Subject     Re: start to develope maya APInew [re: Daniel_Faust] Posted by    winniethetwo (Few Posts) Posted on    06/16/05 02:20 AM

so...I have to install V C++ before maya, isn't it?and then follow your instructions...


http://www.moksha3d.com

a useful CG board!

Post Extras: Print Post Subject     Re: start to develope maya APInew [re: winniethetwo] Posted by    Daniel_Faust (Posting A Bit) Posted on    06/16/05 02:40 AM

It does not matter which one you install first.

I did a fresh install a couple of days ago, first VC++.NET and then Maya. Mayas installation did not alter any of the General Preferences in VC++.NET, so I had to add the stuff I mentioned under General by hand.

In the "C:\Program Files\Maya6.0\devkit\pluginwizard" directory there is a zip file containing a Wizard for VS.NET and a txt file explaining how to use it. The wizard will take off most of the work that are on a per Project basis.

I don't think that the wizards include all the headers for you, but you might start to feel that it's a bit easier to include all of them in a central file right from the beginning instead of letting your flow break because you need to add a new include.

The printf-like p( "%d text", counter ); function is also a nice timesaver, you can build variations from it to print errors or warnings or to the output window.

The mel code in the shelf is something the wizard will not add for you, but it also saves you a lot of time once it has been set up.

Edited by Daniel_Faust (06/16/05 02:43 AM)

Post Extras: Print Post