Plugin problems

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  06 June 2003
Plugin problems

I can get the Hello World plugin to compile and I seem to be able to make a .mll file fine, however when I try to load it in Maya, I get the error

Error: initializePlugin function could not be found in plug-in (helloWorld)

Anyone have any ideas?
 
  06 June 2003
You are compiling it for the right version of Maya?

Also are you trying to load it using the command line (it might not be in the correct path - env variables), or using the Plug-in Manager?
 
  06 June 2003
Is this the helloWorldCmd.cpp file from the plugins dir?

Just taken a look at it - it's using DeclareSimpleCommand() to initialise it....

Not entirely sure how this works, but try using the following stuff for setting it all up properly:

#include <maya/MSimple.h>
#include <maya/MGlobal.h>

class helloWorldCmd : public MPxCommand
{
public:
    helloWorldCmd(); // The Constructor - run when this class is created
    virtual ~helloWorldCmd(); // The Destructor - run when it's restroyed
    MStatus doIt( const MArgList& );
    MStatus redoIt();
    MStatus undoIt();
    bool isUndoable() const;
    static void* creator();
}

// The actual creator - the code in here will be run when the class is created
helloWorldCmd::helloWorldCmd()
{
}

// The destructor - again, will be run when the class is destroyed.
helloWorldCmd::~helloWorldCmd()
{
}

// This function is called to create the class in the first place
void* helloWorldCmd::creator()
{
    return new helloWorldCmd();
}

// This code will be run when the command is called. In this, I've
// printed "Hello World" both to the output (Output Window in
// Windows, and terminal in Linux)
MStatus helloWorldCmd::doIt( const MArgList& argList )
{
    printf("Hello World\n"); // Print "Hello World" to the output window or command line
    MGlobal::displayInfo("Hello World"); // Print "Hello World" to the script history window

    return MS::kSuccess;
}

// This function would be used if the command was defined as
// undoable (see below) - it would be called when a redo was
// requested - this command would often be called at the end
// of doIt()
MStatus helloWorldCmd::redoIt()
{
    return MS::kSuccess;
}

// This function would be used if the command was defined as
// undoable (see below) - it does exactly what it says on the tin - 
// undoes the command...
MStatus helloWorldCmd::undoIt()
{
    return MS::kSuccess;
}

// If we want this command to be undoable, we return 'true', otherwise, return 'false'
bool helloWorldCmd::isUndoable() const
{
    return false;
}

// This is a global function (notice the lack of a 'helloWorldCmd::'
// before the function name) - this is the function that is first called
// when the plugin loads - this tells the plugin what functions can
// be used, and what the name for the command is...
MStatus initialisePlugin( MObject obj )
{
    MStatus status;
    MFnPlugin plugin( obj, "Your name or company name", "plugin version");

    status = plugin.registerCommand( "helloWorld", helloWorldCmd::creator );
    if(!status)
    {
        status.perror("registerCommand - helloWorld");
        return status;
    }
    return status;
}


Sorry if that looks slightly long and complicated - the functions to worry about are the doIt and initialise functions - the rest are just the ones that are needed by the system, that don't really do anything

Anyway, I hope that's at least slightly helpful.... If, for any reason, it doesn't work (it should, but I just typed it straight in - didn't actually try to run it), do say and I'll try and write something more comprehensible.
__________________
Hugh Macdonald
nvizible

Last edited by Hugh : 06 June 2003 at 07:54 AM.
 
  06 June 2003
Ok I tried to get the same error.

And I did by omitting the line #include <maya/MGlobal.h>
after #include <maya/MSimple.h>

Last edited by brooklyn : 06 June 2003 at 08:04 AM.
 
  06 June 2003
Thanks for the help. I'll try them when I get home. The Hello World I was trying was the one from the developer's toolkit help.

#include <maya/MSimple.h>
DeclareSimpleCommand( helloWorld, "Alias|Wavefront", "5.0");
MStatus helloWorld::doIt( const MArgList& )
{
printf("Hello World\n");
return MS::kSuccess;
}

Hopefully adding MGlobal is all it needs.

Thanks again for all the help.

Last edited by ajk48n : 06 June 2003 at 02:24 PM.
 
  01 January 2006
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 03:31 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.