AL_USDMaya  0.16.6
USD to Maya Bridge
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
AnimationTranslator.h
1 #pragma once
2 #include "AL/usdmaya/fileio/translators/DgNodeTranslator.h"
3 
4 #include "maya/MPlug.h"
5 #include <vector>
6 #include <utility>
7 
8 #include "pxr/usd/usd/stage.h"
9 
10 namespace AL {
11 namespace usdmaya {
12 namespace fileio {
13 
14 typedef std::pair<MPlug, UsdAttribute> PlugAttrPair;
15 typedef std::vector<PlugAttrPair> PlugAttrVector;
16 typedef std::pair<PlugAttrPair, float> PlugAttrScaledPair;
17 typedef std::vector<PlugAttrScaledPair> PlugAttrScaledVector;
18 
19 //----------------------------------------------------------------------------------------------------------------------
22 //----------------------------------------------------------------------------------------------------------------------
24 {
31  static bool isAnimated(const MObject& node, const MObject& attr, const bool assumeExpressionIsAnimated = true)
32  { return isAnimated(MPlug(node, attr), assumeExpressionIsAnimated); }
33 
39  static bool isAnimated(MPlug attr, bool assumeExpressionIsAnimated = true);
40 
46  inline void addPlug(const MPlug& plug, const UsdAttribute& attribute, const bool assumeExpressionIsAnimated)
47  {
48  if(isAnimated(plug, assumeExpressionIsAnimated))
49  m_animatedPlugs.emplace_back(std::make_pair(plug, attribute));
50  }
51 
58  inline void addPlug(const MPlug& plug, const UsdAttribute& attribute, const float scale, const bool assumeExpressionIsAnimated)
59  {
60  if(isAnimated(plug, assumeExpressionIsAnimated))
61  m_scaledAnimatedPlugs.emplace_back(std::make_pair(std::make_pair(plug, attribute), scale));
62  }
63 
66  void exportAnimation(const ExporterParams& params);
67 
68 private:
69  PlugAttrVector m_animatedPlugs;
70  PlugAttrScaledVector m_scaledAnimatedPlugs;
71 };
72 
73 //----------------------------------------------------------------------------------------------------------------------
74 } // fileio
75 } // usdmaya
76 } // AL
77 //----------------------------------------------------------------------------------------------------------------------
parameters for the exporter. These parameters are constructed by any command or file translator that ...
Definition: ExportParams.h:17
static bool isAnimated(const MObject &node, const MObject &attr, const bool assumeExpressionIsAnimated=true)
returns true if the attribute is animated
Definition: AnimationTranslator.h:31
void exportAnimation(const ExporterParams &params)
After the scene has been exported, call this method to export the animation data on various attribute...
void addPlug(const MPlug &plug, const UsdAttribute &attribute, const float scale, const bool assumeExpressionIsAnimated)
add a plug to the animation translator (if the plug is animated)
Definition: AnimationTranslator.h:58
void addPlug(const MPlug &plug, const UsdAttribute &attribute, const bool assumeExpressionIsAnimated)
add a plug to the animation translator (if the plug is animated)
Definition: AnimationTranslator.h:46
A utility class to help with exporting animated plugs from maya.
Definition: AnimationTranslator.h:23