AL_USDMaya  0.16.6
USD to Maya Bridge
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Transform.h
1 #pragma once
2 #include "AL/usdmaya/Common.h"
3 #include "AL/maya/NodeHelper.h"
4 #include "maya/MPxTransform.h"
5 
6 namespace AL {
7 namespace usdmaya {
8 namespace nodes {
9 
10 //----------------------------------------------------------------------------------------------------------------------
12 // transform type directly from inside Maya. It works by providing a custom MPxTransform node which uses a
61 //----------------------------------------------------------------------------------------------------------------------
62 class Transform
63  : public MPxTransform,
64  public maya::NodeHelper
65 {
66 public:
67 
68  //--------------------------------------------------------------------------------------------------------------------
69  // Type Info & Registration
70  //--------------------------------------------------------------------------------------------------------------------
71  AL_MAYA_DECLARE_NODE();
72 
73  //--------------------------------------------------------------------------------------------------------------------
74  // Input Attributes
75  //--------------------------------------------------------------------------------------------------------------------
76  AL_DECL_ATTRIBUTE(primPath);
77  AL_DECL_ATTRIBUTE(inStageData);
78  AL_DECL_ATTRIBUTE(time);
79  AL_DECL_ATTRIBUTE(timeOffset);
80  AL_DECL_ATTRIBUTE(timeScalar);
81  AL_DECL_ATTRIBUTE(localTranslateOffset);
82  AL_DECL_ATTRIBUTE(pushToPrim);
83  AL_DECL_ATTRIBUTE(readAnimatedValues);
84 
85  //--------------------------------------------------------------------------------------------------------------------
86  // Output Attributes
87  //--------------------------------------------------------------------------------------------------------------------
88  AL_DECL_ATTRIBUTE(outStageData);
89  AL_DECL_ATTRIBUTE(outTime);
90 
91  //--------------------------------------------------------------------------------------------------------------------
93  //--------------------------------------------------------------------------------------------------------------------
94 
98  { return reinterpret_cast<TransformationMatrix*>(transformationMatrixPtr()); }
99 
103  UsdPrim getUsdPrim(MDataBlock& dataBlock) const;
104 
107  MPxNode::SchedulingType schedulingType() const override
108  { return kParallel; }
109 
110 private:
111 
112  //--------------------------------------------------------------------------------------------------------------------
114  //--------------------------------------------------------------------------------------------------------------------
115 
116  MStatus validateAndSetValue(const MPlug& plug, const MDataHandle& handle, const MDGContext& context) override;
117  MPxTransformationMatrix* createTransformationMatrix() override;
118  MStatus connectionMade(const MPlug &plug, const MPlug &otherPlug, bool asSrc) override;
119  MStatus connectionBroken(const MPlug &plug, const MPlug &otherPlug, bool asSrc) override;
120  MStatus compute(const MPlug &plug, MDataBlock &datablock) override;
121  void postConstructor() override;
122 
123  //--------------------------------------------------------------------------------------------------------------------
125  //--------------------------------------------------------------------------------------------------------------------
126 
127  void updateTransform(MDataBlock& dataBlock);
128  bool isStageValid() const;
129 
130  //--------------------------------------------------------------------------------------------------------------------
132  //--------------------------------------------------------------------------------------------------------------------
133 
162 
184 
185  //--------------------------------------------------------------------------------------------------------------------
187  //--------------------------------------------------------------------------------------------------------------------
188 
203 };
204 
205 //----------------------------------------------------------------------------------------------------------------------
206 } // nodes
207 } // usdmaya
208 } // AL
209 //----------------------------------------------------------------------------------------------------------------------
MPxNode::SchedulingType schedulingType() const override
Enable parallel evaluation.
Definition: Transform.h:107
UsdPrim getUsdPrim(MDataBlock &dataBlock) const
query the usd prim that this transform represents, from the specified data block
TransformationMatrix * transform() const
returns the transformation matrix for this transform node
Definition: Transform.h:97
This class provides a transformation matrix that allows you to apply tweaks over some read only trans...
Definition: TransformationMatrix.h:19
The AL::usdmaya::nodes::Transform node is a custom transform node that allows you to manipulate a USD...
Definition: Transform.h:62
This is a little helper object designed to reduce the amount of boilerplate GUI code you need to jump...
Definition: NodeHelper.h:175