View Full Version : HelloWorld maya API

09 September 2005, 12:35 AM
I tried programming in the Maya API once before, but couldn't figure out how to set up the build environment properly on Windows since I didn't have MS Visual Studio .NET 2003 Professional and the Maya documentation is not specific enough to explain how to do things if you don't have that..., I bought Microsoft Visual blagh blagh, and have compiled my first API plugin and successfully loaded it into Maya. This already makes me a little happy.

#include <maya/MSimple.h>
#include <maya/MIOStream.h>
DeclareSimpleCommand( helloWorld, "Alias", "7.0");
MStatus helloWorld::doIt( const MArgList& )
cout << "Hello World\n";
return MS::kSuccess;

Here is the code. Yes, it's the tutorial code. So, I can load the plugin into Maya successfully...and I can execute the command "helloWorld" by simply typing it's name into the Maya command line, but I do not get any "Hello World" output. No output in the command line, command feedback line, or script editor, or popup.

Since there were no errors and since this is an official example, I expect it to work...and I'm still not convinced that it's NOT working somebody please tell me, where SHOULD I be seeing the output?


EDIT: Ok, I figured it out. The output goes to the "output window" but doesn't open the output window if it's closed. So, my problem is solved. However, I am curious if there is an efficient way to simply open the output window after it has been closed aside from doing specific maya commands that open it as a side effect.

09 September 2005, 01:48 PM
Personally, I never look at the Output window, because it can't be cleared (at least in a multi-platform clean way) and therefore it quickly becomes impossible to manage the slog of information that shows up there.

Instead, I use MGlobal::displayInfo/Warning/Error and I do the traces through the script editor.

Christian Laforte
Maya API Consultant

09 September 2005, 06:19 PM
Thanks for the tip

Robert Bateman
09 September 2005, 12:10 PM
although i'd disagree cos i write all of my debugging output into the Output window, and user messages to the script editor.

09 September 2005, 12:24 AM
Well... if you want to get in subjective arguments then I won't get involved. But in any case, my point about the fact that the output window cannot easily be cleared (at least not in a cross-platform way) remains.

Christian Laforte
Maya API Consultant

CGTalk Moderation
09 September 2005, 12:24 AM
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.