Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instantiate AWDGeomUtil crashes Maya 2014 #5

Closed
velenoise opened this issue Feb 6, 2014 · 2 comments
Closed

Instantiate AWDGeomUtil crashes Maya 2014 #5

velenoise opened this issue Feb 6, 2014 · 2 comments

Comments

@velenoise
Copy link

I'm trying to put together a basic Maya AWD exporter, based on the available 3dMax exporter, but when I instantiate an AWDGeomUtil the software crashes immediately. To test the issue, I set a blank exporter (code attached), with a single instantiation on the writer function, and it still crashes.

#include <maya/MStatus.h>
#include <maya/MFnPlugin.h>
#include <maya/MString.h>
#include <maya/MStringArray.h>
#include <maya/MPxFileTranslator.h>
#include <maya/MGlobal.h>
#include <maya/MPlug.h>

#include <string.h>
#include <vector>

#include "awd.h"
#include "geomutil.h"

using namespace std;

class BlankPlugin : public MPxFileTranslator {
public:

    BlankPlugin () {};

    virtual            ~BlankPlugin () {};

    bool haveReadMethod() const { return false; }

    bool haveWriteMethod() const { return true; }

    bool haveReferenceMethod() const { return false; }

    bool haveNamespaceSupport()    const { return true; }

    static void* creator();

    MString defaultExtension () const;

    bool canBeOpened() const { return false; }

    MStatus writer ( const MFileObject& file,
                                        const MString& optionsString,
                             MPxFileTranslator::FileAccessMode mode);

private:

};

void* BlankPlugin::creator()
{
    return new BlankPlugin();
}

MStatus BlankPlugin::writer ( const MFileObject& file,
                                const MString& options,
                                MPxFileTranslator::FileAccessMode mode)
{
    AWDGeomUtil util;  // if this line gets removed it doesn't crash
    return MS::kSuccess;
}

MString BlankPlugin::defaultExtension () const
{
    return "awd";
}

MStatus initializePlugin( MObject obj )
{
    MStatus   status;
    MFnPlugin plugin( obj, PLUGIN_COMPANY, "3.0", "Any");

    status =  plugin.registerFileTranslator( "Tester",
                                        "",
                                        BlankPlugin::creator,
                                        "",
                                        "",
                                        true );
    if (!status) 
    {
        status.perror("registerFileTranslator");
        return status;
    }

    return status;
}

MStatus uninitializePlugin( MObject obj )
{
    MStatus   status;
    MFnPlugin plugin( obj );

    status =  plugin.deregisterFileTranslator( "Tester" );
    if (!status)
    {
        status.perror("deregisterFileTranslator");
        return status;
    }

    return status;
}

Using Maya 2014 on Mac OSX 10.7.5

@velenoise
Copy link
Author

I managed to work around it. The problem was the variable num_idx_lists wasn't being initialized, so it exploded on the destructor. I'll be running a couple more tests, and later send a pull request on it.

@80prozent
Copy link
Member

The GeomUtil has gotten a major refactor.

It now allows for export of multiple materials / subMeshes per mesh.

Have a look at the 3dsmax exporter to see how it should be used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants