1 |
|
---|
2 | #ifndef OGRE_EXPORTER_H
|
---|
3 | #define OGRE_EXPORTER_H
|
---|
4 |
|
---|
5 | #include "mesh.h"
|
---|
6 | #include "particles.h"
|
---|
7 | #include "mayaExportLayer.h"
|
---|
8 | #include <maya/MPxCommand.h>
|
---|
9 | #include <maya/MFnPlugin.h>
|
---|
10 |
|
---|
11 | namespace OgreMayaExporter
|
---|
12 | {
|
---|
13 | class OgreExporter : public MPxCommand
|
---|
14 | {
|
---|
15 | public:
|
---|
16 | // public methods
|
---|
17 | OgreExporter();
|
---|
18 | virtual ~OgreExporter(){};
|
---|
19 | static void* creator();
|
---|
20 | MStatus doIt(const MArgList& args);
|
---|
21 | bool isUndoable() const;
|
---|
22 | MStatus translateNode(MDagPath& dagPath);
|
---|
23 | MStatus writeAnim(MFnAnimCurve& anim);
|
---|
24 | MStatus writeCamera(MFnCamera& camera);
|
---|
25 |
|
---|
26 | private:
|
---|
27 | // private members
|
---|
28 | MStatus stat;
|
---|
29 | ParamList m_params;
|
---|
30 | Mesh* m_pMesh;
|
---|
31 | MaterialSet* m_pMaterialSet;
|
---|
32 |
|
---|
33 | void exit();
|
---|
34 | };
|
---|
35 |
|
---|
36 |
|
---|
37 |
|
---|
38 |
|
---|
39 | /*********************************************************************************************
|
---|
40 | * INLINE Functions *
|
---|
41 | *********************************************************************************************/
|
---|
42 | // Standard constructor
|
---|
43 | inline OgreExporter::OgreExporter()
|
---|
44 | {
|
---|
45 | MGlobal::displayInfo("Translating scene to OGRE format");
|
---|
46 | }
|
---|
47 |
|
---|
48 | // Routine for creating the plug-in
|
---|
49 | inline void* OgreExporter::creator()
|
---|
50 | {
|
---|
51 | return new OgreExporter();
|
---|
52 | }
|
---|
53 |
|
---|
54 | // It tells that this command is not undoable
|
---|
55 | inline bool OgreExporter::isUndoable() const
|
---|
56 | {
|
---|
57 | MGlobal::displayInfo("Command is not undoable");
|
---|
58 | return false;
|
---|
59 | }
|
---|
60 |
|
---|
61 | // Routine for registering the command within Maya
|
---|
62 | MStatus initializePlugin( MObject obj )
|
---|
63 | {
|
---|
64 | MStatus status;
|
---|
65 | MFnPlugin plugin( obj, "OgreExporter", "6.5", "Any");
|
---|
66 | status = plugin.registerCommand( "ogreExport", OgreExporter::creator );
|
---|
67 | if (!status) {
|
---|
68 | status.perror("registerCommand");
|
---|
69 | return status;
|
---|
70 | }
|
---|
71 |
|
---|
72 | return status;
|
---|
73 | }
|
---|
74 |
|
---|
75 | // Routine for unregistering the command within Maya
|
---|
76 | MStatus uninitializePlugin( MObject obj)
|
---|
77 | {
|
---|
78 | MStatus status;
|
---|
79 | MFnPlugin plugin( obj );
|
---|
80 | status = plugin.deregisterCommand( "ogreExport" );
|
---|
81 | if (!status) {
|
---|
82 | status.perror("deregisterCommand");
|
---|
83 | return status;
|
---|
84 | }
|
---|
85 |
|
---|
86 | return status;
|
---|
87 | }
|
---|
88 |
|
---|
89 | } //end namespace
|
---|
90 | #endif |
---|