1 | //////////////////////////////////////////////////////////////////////////////// |
---|
2 | // ogreExporter.h |
---|
3 | // Author : Francesco Giordana |
---|
4 | // Start Date : January 13, 2005 |
---|
5 | // Copyright : (C) 2006 by Francesco Giordana |
---|
6 | // Email : fra.giordana@tiscali.it |
---|
7 | //////////////////////////////////////////////////////////////////////////////// |
---|
8 | |
---|
9 | /********************************************************************************* |
---|
10 | * * |
---|
11 | * This program is free software; you can redistribute it and/or modify * |
---|
12 | * it under the terms of the GNU Lesser General Public License as published by * |
---|
13 | * the Free Software Foundation; either version 2 of the License, or * |
---|
14 | * (at your option) any later version. * |
---|
15 | * * |
---|
16 | **********************************************************************************/ |
---|
17 | |
---|
18 | #ifndef OGRE_EXPORTER_H |
---|
19 | #define OGRE_EXPORTER_H |
---|
20 | |
---|
21 | #include "mesh.h" |
---|
22 | #include "particles.h" |
---|
23 | #include "mayaExportLayer.h" |
---|
24 | #include <maya/MPxCommand.h> |
---|
25 | #include <maya/MFnPlugin.h> |
---|
26 | |
---|
27 | namespace OgreMayaExporter |
---|
28 | { |
---|
29 | class OgreExporter : public MPxCommand |
---|
30 | { |
---|
31 | public: |
---|
32 | // public methods |
---|
33 | OgreExporter(); |
---|
34 | virtual ~OgreExporter(){}; |
---|
35 | static void* creator(); |
---|
36 | MStatus doIt(const MArgList& args); |
---|
37 | bool isUndoable() const; |
---|
38 | MStatus translateNode(MDagPath& dagPath); |
---|
39 | MStatus writeAnim(MFnAnimCurve& anim); |
---|
40 | MStatus writeCamera(MFnCamera& camera); |
---|
41 | MStatus writeOgreData(); |
---|
42 | |
---|
43 | private: |
---|
44 | // private members |
---|
45 | MStatus stat; |
---|
46 | ParamList m_params; |
---|
47 | Mesh* m_pMesh; |
---|
48 | MaterialSet* m_pMaterialSet; |
---|
49 | MSelectionList m_selList; |
---|
50 | MTime m_curTime; |
---|
51 | |
---|
52 | void exit(); |
---|
53 | }; |
---|
54 | |
---|
55 | |
---|
56 | |
---|
57 | |
---|
58 | /********************************************************************************************* |
---|
59 | * INLINE Functions * |
---|
60 | *********************************************************************************************/ |
---|
61 | // Standard constructor |
---|
62 | inline OgreExporter::OgreExporter() |
---|
63 | { |
---|
64 | MGlobal::displayInfo("Translating scene to OGRE format"); |
---|
65 | } |
---|
66 | |
---|
67 | // Routine for creating the plug-in |
---|
68 | inline void* OgreExporter::creator() |
---|
69 | { |
---|
70 | return new OgreExporter(); |
---|
71 | } |
---|
72 | |
---|
73 | // It tells that this command is not undoable |
---|
74 | inline bool OgreExporter::isUndoable() const |
---|
75 | { |
---|
76 | MGlobal::displayInfo("Command is not undoable"); |
---|
77 | return false; |
---|
78 | } |
---|
79 | |
---|
80 | // Routine for registering the command within Maya |
---|
81 | MStatus initializePlugin( MObject obj ) |
---|
82 | { |
---|
83 | MStatus status; |
---|
84 | MFnPlugin plugin( obj, "OgreExporter", "7.0", "Any"); |
---|
85 | status = plugin.registerCommand( "ogreExport", OgreExporter::creator ); |
---|
86 | if (!status) { |
---|
87 | status.perror("registerCommand"); |
---|
88 | return status; |
---|
89 | } |
---|
90 | |
---|
91 | return status; |
---|
92 | } |
---|
93 | |
---|
94 | // Routine for unregistering the command within Maya |
---|
95 | MStatus uninitializePlugin( MObject obj) |
---|
96 | { |
---|
97 | MStatus status; |
---|
98 | MFnPlugin plugin( obj ); |
---|
99 | status = plugin.deregisterCommand( "ogreExport" ); |
---|
100 | if (!status) { |
---|
101 | status.perror("deregisterCommand"); |
---|
102 | return status; |
---|
103 | } |
---|
104 | |
---|
105 | return status; |
---|
106 | } |
---|
107 | |
---|
108 | } //end namespace |
---|
109 | #endif |
---|