1 | //////////////////////////////////////////////////////////////////////////////// |
---|
2 | // blendshape.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 _BLENDSHAPE_H |
---|
19 | #define _BLENDSHAPE_H |
---|
20 | |
---|
21 | #include "mayaExportLayer.h" |
---|
22 | #include "paramList.h" |
---|
23 | #include "animation.h" |
---|
24 | #include "vertex.h" |
---|
25 | |
---|
26 | namespace OgreMayaExporter |
---|
27 | { |
---|
28 | // Blend Shape Class |
---|
29 | class BlendShape |
---|
30 | { |
---|
31 | public: |
---|
32 | // Constructor |
---|
33 | BlendShape(); |
---|
34 | // Destructor |
---|
35 | ~BlendShape(); |
---|
36 | // Clear blend shape data |
---|
37 | void clear(); |
---|
38 | // Load blend shape deformer from Maya |
---|
39 | MStatus load(MObject &blendShapeObj); |
---|
40 | // Load blend shape poses |
---|
41 | MStatus loadPoses(MDagPath& meshDag,ParamList ¶ms,std::vector<vertex> &vertices, |
---|
42 | long numVertices,long offset=0,long targetIndex=0); |
---|
43 | //load a blend shape animation track |
---|
44 | Track loadTrack(float start,float stop,float rate,ParamList& params,int startPoseId); |
---|
45 | // Get blend shape deformer name |
---|
46 | MString getName(); |
---|
47 | // Get blend shape poses |
---|
48 | std::vector<pose>& getPoses(); |
---|
49 | // Set maya blend shape deformer envelope |
---|
50 | void setEnvelope(float envelope); |
---|
51 | // Restore maya blend shape deformer original envelope |
---|
52 | void restoreEnvelope(); |
---|
53 | // Public members |
---|
54 | MFnBlendShapeDeformer* m_pBlendShapeFn; |
---|
55 | |
---|
56 | protected: |
---|
57 | // Internal methods |
---|
58 | //load a blend shape pose |
---|
59 | MStatus loadPose(MDagPath& meshDag,ParamList ¶ms,std::vector<vertex> &vertices, |
---|
60 | long numVertices,long offset=0,MString poseName=""); |
---|
61 | //load a blend shape animation keyframe |
---|
62 | vertexKeyframe loadKeyframe(float time,ParamList& params,int startPoseId); |
---|
63 | |
---|
64 | // Protected members |
---|
65 | //original values to restore after export |
---|
66 | float m_origEnvelope; |
---|
67 | std::vector<float> m_origWeights; |
---|
68 | //blend shape poses |
---|
69 | std::vector<pose> m_poses; |
---|
70 | //blend shape target (shared geometry or submesh) |
---|
71 | target m_target; |
---|
72 | int m_index; |
---|
73 | }; |
---|
74 | |
---|
75 | |
---|
76 | } // end namespace |
---|
77 | |
---|
78 | #endif |
---|