PDA

View Full Version : Maya plug in building


nottoshabi
06-19-2007, 07:45 PM
I just took 2 semesters in C++ using DevC++. By Bloodshed its a free C++ program. My question is: Can I use this to write Maya plug in or do I have to switch to Visual Basic? And if so wich version? And do I have to have anything special to instal so that Maya would read the plug ins?

trancor
06-20-2007, 03:16 AM
Open up a plugin in notepad and just rummage through it. Maya is built out of MEL, every window you see, every tool you use. Sure mel is different then c++, but it's only easier. Having functions built in. But you can still go the long route and make your own functions like I do. No need for visual basic, no need for code warrior, no need for borland, but sure an api like that would help for checking you code, but mel syntax is sort of like php or java syntax, real easy.

nottoshabi
06-20-2007, 05:42 AM
Thanks trancor. Mll and dll files can't be opened in note pad or word pad. I know what your talking about woth mell files. When you start to get into tool developement you need to work with C. That was the question I was asking not aboout mell.

-Vormav-
06-20-2007, 06:01 AM
If you're on Windows (and since you're using bloodshed, I'm assuming you are?) you need Microsoft Visual Studio. You'd need at least vs2k3, but get ahold of 2005 if you can. I believe some people have gotten the free Express version working, but I've never tried it myself.
As of Maya 8.5, Maya ships with a complete set of Python bindings for the API as well, which will let you do pretty much anything you could do with C++. You might consider going that route, at least to ease the learning process a bit.

trancor
06-20-2007, 08:46 AM
sorry, my mistake then. Thought you could though. I guess I haven't really tried making full fledge plugins, only those scripts to the shelf and what not. My teacher said everything in maya is made with mel and anything you would ever want to make could be done through mel (he worked on making maya) so I kinda just figured.

Robert Bateman
06-20-2007, 09:45 AM
My teacher said everything in maya is made with mel and anything you would ever want to make could be done through mel (he worked on making maya) so I kinda just figured.

however mel is written in C++ within the Maya API. In the mel command reference all commands marked with 'M' next to them, are scripts. All others are implimented in C++.

The entire GUI of Maya is written with mel (with the mel commands and GUI items like buttons having been written in C++). So you can use mel to entirely re-build Maya's GUI if you really want to. All node types within maya, and all openGL rendering in the viewport is also written in C++. It's true that 99% of the time mel will suffice for most tasks, however when Maya *cannot* do what you need, then you have to use the Maya API to extend it.

plug-ins are all written in C++ and you load the mll files in the plugin manager (normally with a certain amount of mel to glue it into the GUI nicely).

Anyhow, just download the free Visual C++ Express Edition, and also the Windows Platform SDK (if you need to do any openGL rendering for your locators), and you will have all you need to start writing Maya plugins (you'll need to set up the paths to the platform SDK within the VC directories of the main prefs). No other compiler will do i'm afraid (other than the obvious variations of VC2003, 2005 etc).

nottoshabi
06-22-2007, 05:43 AM
Robert Bateman > I got the VB 2005 the free edition of the MS web site. Now I'm having a little bit of trouble finding the SDK that would work with maya.

Robert Bateman
06-22-2007, 09:31 AM
http://www.microsoft.com/downloads/details.aspx?FamilyId=A55B6B43-E24F-4EA3-A93E-40C0EC4F68E5&displaylang=en

install it then goto tools->options. Then add the include and lib dirs within the projects & solutions->VC++ directories. You can also add the paths to the maya API include and lib dirs there.

nottoshabi
06-22-2007, 09:36 PM
Robert. Where do I sinstall them in the projects & solutions?

I see a:
Proects Location.
Project Template Location.
Item Template Location.
Wich is wich?

Robert Bateman
06-22-2007, 10:19 PM
! Install visual C++ 2005 express edition ! Visual Basic isn't going to help you write Maya plugins in C++.

nottoshabi
06-22-2007, 10:48 PM
What? Ok wait back up.

I install VB, I dowloaded the SDK. ( Now I'm trying to add the include and lib dirs within the projects & solutions->VC++ directories. You can also add the paths to the maya API include and lib dirs there. ) I can't seem to connect that.

Per-Anders
06-22-2007, 11:48 PM
There's no point in installing VB you cannot compile or edit C++ code using VB. VB = Visual Basic which is an IDE for a totally different programming language (Visual Basic), instead you need to install VC++ which is Visual C++. The Maya API and SDK is not compatible or written in Visual Basic, instead it is written in C++ so you will need to download and install Visual C++ Express and probably then the Platform SDK before attempting to create a Maya plugin project file.

nottoshabi
06-22-2007, 11:57 PM
Does the SDK differ between VS and VC++? And if yes where can I find the SDK for VC++?

-Vormav-
06-23-2007, 04:32 AM
VC++ is a component of VS - it's Visual Studio in C++ mode. So, the SDK is the same.

Now as for setting up the directories, within VC++/VS, go to Tools->Options->Projects and Solutions->VC++ Directories. You can get to the library and include paths from the menu under "show directories for" within that page. The PlatformSDK might automatically add itself to your paths, but if not you'll need to add both the SDK's 'lib' and 'include' folder to the corresponding path types within that window.
Just as a general tip, only setup the paths for the Platform SDK there (generally, [Platform_SDK_Install_Dir]/Lib and [Platform_SDK_Install_Dir]/include). Setup the paths for the Maya devkit lib/include files within your project settings (Right click on the project->properties, includes are set in c/c++->general->'additional include directories', and library dependencies are set in linker->input->additional dependencies, as well as their include paths in linker->general->'additional library directories').
You may want to take the time to create a couple environment variables to ease that last process.

Robert Bateman
06-23-2007, 07:50 PM
you've got the SDK for C++. However it does not work with Visual Basic, just get the visuall C++ compiler and use that.... go here

http://msdn.microsoft.com/vstudio/express/downloads/

and get the yellow one that says C++..... It will all make sense then....

nottoshabi
06-26-2007, 01:41 AM
Thansk guys. I'm inching throw this like a good little noob. I just can't seem to get this last part. (Maya devkit) The directions your giving me are those in Maya or in C++? Cause in C++ I don't see project so I can't right click on anything under Project Settings. I tryed right clicking on Project Settings and it wont do anything.

Thanks

Setup the paths for the Maya devkit lib/include files within your project settings (Right click on the project->properties, includes are set in c/c++->general->'additional include directories', and library dependencies are set in linker->input->additional dependencies, as well as their include paths in linker->general->'additional library directories').
You may want to take the time to create a couple environment variables to ease that last process.

-Vormav-
06-26-2007, 03:21 AM
You have to create a project first. Just create a new project (file->new->project), and once created, access its properties through the Project->properties menu, or from the right-click menu in the solution explorer. But none of those options will appear until after you've created the project.

nottoshabi
06-27-2007, 08:56 PM
Ok I'm a little confused about something. Once I created the project in the properties under C++/general/aditional include directories. It should read like this "C:\Program Files\Autodesk\Maya8.5\include" Right?

and library dependencies are set in linker->input->additional dependencies. Now what goes here? Cause I dont see library dependencies or additional dependencies there. But there is a Link Library Dependencis. That is only YES or NO not an actuall ink.

as well as their include paths in linker->general->'additional library directories'). And what should go here? The same includes as in the (C++/general/aditional include directories)?

-Vormav-
06-28-2007, 07:02 PM
and library dependencies are set in linker->input->additional dependencies. Now what goes here? Cause I dont see library dependencies or additional dependencies there. But there is a Link Library Dependencis. That is only YES or NO not an actuall ink.

Add some source files to your project. 'Additional dependencies' will just be a text input where you specify the libraries you need to compile with (IE, OpenMaya.lib, etc.)

as well as their include paths in linker->general->'additional library directories'). And what should go here? The same includes as in the (C++/general/aditional include directories)?[/QUOTE]
No.. The path to the libraries.. IE Maya8.5/lib

nottoshabi
06-28-2007, 08:05 PM
Ok great thanks. Did you guys get the Maya Plugin Wizard integrated in to VisualC? In David Gould book Complete Maya Programing V1. He talks about using the Maya Plugin Wizard. Have you guys got that to work?

-Vormav-
06-29-2007, 12:58 AM
Yes, but I wouldn't bother. It doesn't take a lot of time to manually create anything the wizard creates for you, and you'll learn your way around the api much quicker if you do just do it yourself.

nottoshabi
07-02-2007, 10:13 PM
Thanks for all your help. I got it to work.

Jyles
06-15-2008, 04:03 AM
Hi guys

I too am struggling to get my environment setup. I've followed all the tutorials I could get my hands on and searched repeatedly to try and find a solution but have come up empty.

Originally i was setting my project up from scratch but had no luck so i'm now using the maya plugin wizard. However I keep running into the same errors when compiling.

Just to clarify I have
-set my include dir & lib dir 's for - Maya8.5 & the SDK
-I've added REQUIRE_IOSTREAM & NT_PLUGIN to pre-processor
-Code Generation to Multi-Threaded
-changed the output to mll instead of dll
-Added the following dependencies:
Foundation.lib OpenMaya.lib OpenMayaUI.lib OpenMayaAnim.lib OpenMayaFX.lib OpenMayaRender.lib Image.lib libMocap.lib libMDtAPI.lib OpenGL32.lib

But I cant get any plugins to build, I've tried the hello world, the basic wizard solution & some of the plugins that come in the devkit, my errors are always along the lines of:

c:\Program Files\Autodesk\Maya8.5\include\maya/MTypes.h(20) : error C2146: syntax error : missing ';' before identifier 'initializePlugin'
1>c:\Program Files\Autodesk\Maya8.5\include\maya/MTypes.h(20) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\Program Files\Autodesk\Maya8.5\include\maya/MTypes.h(20) : error C2065: 'MObject' : undeclared identifier
1>c:\Program Files\Autodesk\Maya8.5\include\maya/MTypes.h(20) : error C2146: syntax error : missing ')' before identifier 'obj'
1>c:\Program Files\Autodesk\Maya8.5\include\maya/MTypes.h(20) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\Program Files\Autodesk\Maya8.5\include\maya/MTypes.h(20) : error C2059: syntax error : ')'

It seems to think there are syntax errors in most of the maya header files, but obviously it's somethign to do with my setup.. Any got any ideas?

Cheers
Jyles

Buexe
06-15-2008, 11:41 AM
If you open a .sln from the devkit dir ( setting lib and include dirs right ) you should be able to compile them. Maybe check those and/or use them as templates for your stuff.

Jyles
06-15-2008, 12:00 PM
If you open a .sln from the devkit dir ( setting lib and include dirs right ) you should be able to compile them. Maybe check those and/or use them as templates for your stuff.

Hey Thanks for the reply- Unfortunately I have tried this, simply opening the sln and compiling results in the same errors listed above. I haven't actually tried creating or modifying any of my own code yet.

When I open the devkit sln files it converts it to version 8 of Visual Studio, is it possible this is my problem. I'm presuming the code in the maya8.5 examples & '.h' files is written for Visual Studio 7? Could there be compatiblity issues?

But I'm just guessing.

Appreciate any help

Jyles
06-16-2008, 02:47 AM
Would it help if I said that this is the section of code causing problems:

MLL_EXPORT MStatus initializePlugin( MObject obj )
{
MStatus status = MS::kSuccess;
MFnPlugin plugin( obj, "MyPlugin", "1.0", "Any");

return status;
}

That is taken directly from %MAYA_LOCATION%/include/maya/mtypes.h

Jyles
06-16-2008, 09:39 AM
Ok so for future reference I fixed it, the solution u ask?

Step1: Install Maya 2008
Step2: Link to the newer header files

lol I want that day of my life back.

Strange though becuase all the research suggested Visual C++ 2005 should work fine with Maya 8.5. Oh well

J

Robert Bateman
06-16-2008, 11:43 AM
Strange though becuase all the research suggested Visual C++ 2005 should work fine with Maya 8.5. Oh well

It does. I've been compiling maya 6.5, 7, 8.0, 8.5 and 2008 plug-ins in VC++ 2005 with zero problems for a few years...

Jyles
06-16-2008, 12:22 PM
Any ideas then why it was spitting out syntax errors previously? Just for interests sake

Keep in mind that when it successfully compiled all I had changed was the additional includes from maya8.5/include to maya2008/include.

It's good to know these things.

CGTalk Moderation
06-16-2008, 12:22 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.