[692] | 1 |
|
---|
| 2 | #ifndef PARAMLIST_H
|
---|
| 3 | #define PARAMLIST_H
|
---|
| 4 |
|
---|
| 5 | #include "mayaExportLayer.h"
|
---|
| 6 |
|
---|
| 7 | namespace OgreMayaExporter
|
---|
| 8 | {
|
---|
| 9 |
|
---|
| 10 | typedef struct clipInfoTag
|
---|
| 11 | {
|
---|
| 12 | double start; //start time of the clip
|
---|
| 13 | double stop; //end time of the clip
|
---|
| 14 | double rate; //sample rate of anim curves, -1 means auto
|
---|
| 15 | MString name; //clip name
|
---|
| 16 | } clipInfo;
|
---|
| 17 |
|
---|
| 18 | typedef enum
|
---|
| 19 | {
|
---|
| 20 | NPT_CURFRAME,
|
---|
| 21 | NPT_BINDPOSE,
|
---|
| 22 | NPT_FRAME
|
---|
| 23 | } NeutralPoseType;
|
---|
| 24 |
|
---|
| 25 | /***** Class ParamList *****/
|
---|
| 26 | class ParamList
|
---|
| 27 | {
|
---|
| 28 | public:
|
---|
| 29 | // class members
|
---|
| 30 | bool exportMesh, exportMaterial, exportAnimCurves, exportCameras, exportAll, exportVBA,
|
---|
| 31 | exportVertNorm, exportVertCol, exportVertColWhite, exportTexCoord, exportCamerasAnim,
|
---|
| 32 | exportSkeleton, exportAnims, exportMeshBin, exportSkelBin, exportWorldCoords, useSharedGeom,
|
---|
| 33 | lightingOff, copyTextures, exportParticles;
|
---|
| 34 |
|
---|
| 35 | MString meshFilename, skeletonFilename, materialFilename, animFilename, camerasFilename, matPrefix,
|
---|
| 36 | texOutputDir, particlesFilename;
|
---|
| 37 |
|
---|
| 38 | std::ofstream outMesh, outMaterial, outAnim, outCameras, outSkeleton, outParticles;
|
---|
| 39 |
|
---|
| 40 | MStringArray writtenMaterials;
|
---|
| 41 |
|
---|
| 42 | std::vector<clipInfo> clipList;
|
---|
| 43 |
|
---|
| 44 | NeutralPoseType neutralPoseType;
|
---|
| 45 | long neutralPoseFrame; // frame to use as neutral pose (in case NPT_FRAME is the neutral pose type)
|
---|
| 46 |
|
---|
| 47 | // constructor
|
---|
| 48 | ParamList() {
|
---|
| 49 | exportMesh = false;
|
---|
| 50 | exportMaterial = false;
|
---|
| 51 | exportSkeleton = false;
|
---|
| 52 | exportAnims = false;
|
---|
| 53 | exportAnimCurves = false;
|
---|
| 54 | exportCameras = false;
|
---|
| 55 | exportParticles = false;
|
---|
| 56 | exportMeshBin = false;
|
---|
| 57 | exportSkelBin = false;
|
---|
| 58 | exportAll = false;
|
---|
| 59 | exportWorldCoords = false;
|
---|
| 60 | exportVBA = false;
|
---|
| 61 | exportVertNorm = false;
|
---|
| 62 | exportVertCol = false;
|
---|
| 63 | exportVertColWhite = false;
|
---|
| 64 | exportTexCoord = false;
|
---|
| 65 | exportCamerasAnim = false;
|
---|
| 66 | useSharedGeom = false;
|
---|
| 67 | lightingOff = false;
|
---|
| 68 | copyTextures = false;
|
---|
| 69 | meshFilename = "";
|
---|
| 70 | skeletonFilename = "";
|
---|
| 71 | materialFilename = "";
|
---|
| 72 | animFilename = "";
|
---|
| 73 | camerasFilename = "";
|
---|
| 74 | particlesFilename = "";
|
---|
| 75 | matPrefix = "";
|
---|
| 76 | texOutputDir = "";
|
---|
| 77 | clipList.clear();
|
---|
| 78 | neutralPoseType = NPT_CURFRAME; // set default to current frame
|
---|
| 79 | neutralPoseFrame = 0;
|
---|
| 80 | }
|
---|
| 81 |
|
---|
| 82 | ParamList& operator=(ParamList& source) {
|
---|
| 83 | exportMesh = source.exportMesh;
|
---|
| 84 | exportMaterial = source.exportMaterial;
|
---|
| 85 | exportSkeleton = source.exportSkeleton;
|
---|
| 86 | exportAnims = source.exportAnims;
|
---|
| 87 | exportAnimCurves = source.exportAnimCurves;
|
---|
| 88 | exportCameras = source.exportCameras;
|
---|
| 89 | exportAll = source.exportAll;
|
---|
| 90 | exportWorldCoords = source.exportWorldCoords;
|
---|
| 91 | exportVBA = source.exportVBA;
|
---|
| 92 | exportVertNorm = source.exportVertNorm;
|
---|
| 93 | exportVertCol = source.exportVertCol;
|
---|
| 94 | exportVertColWhite = source.exportVertColWhite;
|
---|
| 95 | exportTexCoord = source.exportTexCoord;
|
---|
| 96 | exportCamerasAnim = source.exportCamerasAnim;
|
---|
| 97 | exportMeshBin = source.exportMeshBin;
|
---|
| 98 | exportSkelBin = source.exportSkelBin;
|
---|
| 99 | exportParticles = source.exportParticles;
|
---|
| 100 | useSharedGeom = source.useSharedGeom;
|
---|
| 101 | lightingOff = source.lightingOff;
|
---|
| 102 | copyTextures = source.copyTextures;
|
---|
| 103 | meshFilename = source.meshFilename;
|
---|
| 104 | skeletonFilename = source.skeletonFilename;
|
---|
| 105 | materialFilename = source.materialFilename;
|
---|
| 106 | animFilename = source.animFilename;
|
---|
| 107 | camerasFilename = source.camerasFilename;
|
---|
| 108 | particlesFilename = source.particlesFilename;
|
---|
| 109 | matPrefix = source.matPrefix;
|
---|
| 110 | texOutputDir = source.texOutputDir;
|
---|
| 111 | clipList.resize(source.clipList.size());
|
---|
| 112 | for (int i=0; i< clipList.size(); i++)
|
---|
| 113 | {
|
---|
| 114 | clipList[i].name = source.clipList[i].name;
|
---|
| 115 | clipList[i].start = source.clipList[i].start;
|
---|
| 116 | clipList[i].stop = source.clipList[i].stop;
|
---|
| 117 | clipList[i].rate = source.clipList[i].rate;
|
---|
| 118 | }
|
---|
| 119 | neutralPoseType = source.neutralPoseType;
|
---|
| 120 | neutralPoseFrame = source.neutralPoseFrame;
|
---|
| 121 | return *this;
|
---|
| 122 | }
|
---|
| 123 |
|
---|
| 124 | // destructor
|
---|
| 125 | ~ParamList() {
|
---|
| 126 | if (outMesh)
|
---|
| 127 | outMesh.close();
|
---|
| 128 | if (outMaterial)
|
---|
| 129 | outMaterial.close();
|
---|
| 130 | if (outSkeleton)
|
---|
| 131 | outSkeleton.close();
|
---|
| 132 | if (outAnim)
|
---|
| 133 | outAnim.close();
|
---|
| 134 | if (outCameras)
|
---|
| 135 | outCameras.close();
|
---|
| 136 | if (outParticles)
|
---|
| 137 | outParticles.close();
|
---|
| 138 | }
|
---|
| 139 | // method to pars arguments and set parameters
|
---|
| 140 | void parseArgs(const MArgList &args);
|
---|
| 141 | // method to open files for writing
|
---|
| 142 | MStatus openFiles();
|
---|
| 143 | // method to close open output files
|
---|
| 144 | MStatus closeFiles();
|
---|
| 145 | };
|
---|
| 146 |
|
---|
| 147 | }; //end namespace
|
---|
| 148 |
|
---|
| 149 | #endif |
---|