2 #include "AL/usdmaya/TransformOperation.h"
4 #include "maya/MPxTransformationMatrix.h"
6 #include "pxr/usd/usdGeom/xform.h"
7 #include "pxr/usd/usdGeom/xformCommonAPI.h"
20 :
public MPxTransformationMatrix
25 std::vector<UsdGeomXformOp> m_xformops;
26 std::vector<TransformOperation> m_orderedOps;
30 MEulerRotation m_rotationTweak;
31 MVector m_translationTweak;
33 MPoint m_scalePivotTweak;
34 MVector m_scalePivotTranslationTweak;
35 MPoint m_rotatePivotTweak;
36 MVector m_rotatePivotTranslationTweak;
37 MQuaternion m_rotateOrientationTweak;
40 MVector m_scaleFromUsd;
41 MEulerRotation m_rotationFromUsd;
42 MVector m_translationFromUsd;
43 MVector m_shearFromUsd;
44 MPoint m_scalePivotFromUsd;
45 MVector m_scalePivotTranslationFromUsd;
46 MPoint m_rotatePivotFromUsd;
47 MVector m_rotatePivotTranslationFromUsd;
48 MQuaternion m_rotateOrientationFromUsd;
51 MVector m_localTranslateOffset;
54 void insertTranslateOp();
57 void insertScalePivotOp();
58 void insertScalePivotTranslationOp();
59 void insertRotateOp();
60 void insertRotatePivotOp();
61 void insertRotatePivotTranslationOp();
62 void insertRotateAxesOp();
67 kAnimatedScale = 1 << 0,
68 kAnimatedRotation = 1 << 1,
69 kAnimatedTranslation = 1 << 2,
70 kAnimatedMatrix = 1 << 3,
71 kAnimatedShear = 1 << 4,
75 kFromMayaSchema = 1 << 9,
78 kPrimHasScale = 1 << 16,
79 kPrimHasRotation = 1 << 17,
80 kPrimHasTranslation = 1 << 18,
81 kPrimHasShear = 1 << 19,
82 kPrimHasScalePivot = 1 << 20,
83 kPrimHasScalePivotTranslate = 1 << 21,
84 kPrimHasRotatePivot = 1 << 22,
85 kPrimHasRotatePivotTranslate = 1 << 23,
86 kPrimHasRotateAxes = 1 << 24,
87 kPrimHasPivot = 1 << 25,
88 kPrimHasTransform = 1 << 26,
90 kPushToPrimEnabled = 1 << 28,
91 kInheritsTransform = 1 << 29,
93 kPushPrimToMatrix = 1 << 30,
94 kReadAnimatedValues = 1 << 31,
96 kAnimationMask = kAnimatedScale | kAnimatedRotation | kAnimatedTranslation | kAnimatedMatrix
100 bool internal_readVector(MVector& result,
const UsdGeomXformOp& op) {
return readVector(result, op,
getTimeCode()); }
101 bool internal_readShear(MVector& result,
const UsdGeomXformOp& op) {
return readShear(result, op,
getTimeCode()); }
102 bool internal_readPoint(MPoint& result,
const UsdGeomXformOp& op) {
return readPoint(result, op,
getTimeCode()); }
103 bool internal_readRotation(MEulerRotation& result,
const UsdGeomXformOp& op) {
return readRotation(result, op,
getTimeCode()); }
105 bool internal_readMatrix(MMatrix& result,
const UsdGeomXformOp& op) {
return readMatrix(result, op,
getTimeCode()); }
107 bool internal_pushVector(
const MVector& result, UsdGeomXformOp& op) {
return pushVector(result, op,
getTimeCode()); }
108 bool internal_pushPoint(
const MPoint& result, UsdGeomXformOp& op) {
return pushPoint(result, op,
getTimeCode()); }
109 bool internal_pushRotation(
const MEulerRotation& result, UsdGeomXformOp& op) {
return pushRotation(result, op,
getTimeCode()); }
110 void internal_pushDouble(
const double result, UsdGeomXformOp& op) {
pushDouble(result, op,
getTimeCode()); }
111 bool internal_pushShear(
const MVector& result, UsdGeomXformOp& op) {
return pushShear(result, op,
getTimeCode()); }
112 bool internal_pushMatrix(
const MMatrix& result, UsdGeomXformOp& op) {
return pushMatrix(result, op,
getTimeCode()); }
121 static bool readVector(MVector& result,
const UsdGeomXformOp& op, UsdTimeCode timeCode = UsdTimeCode::Default());
128 static bool readShear(MVector& result,
const UsdGeomXformOp& op, UsdTimeCode timeCode = UsdTimeCode::Default());
135 static bool readPoint(MPoint& result,
const UsdGeomXformOp& op, UsdTimeCode timeCode = UsdTimeCode::Default());
142 static bool readRotation(MEulerRotation& result,
const UsdGeomXformOp& op, UsdTimeCode timeCode = UsdTimeCode::Default());
148 static double readDouble(
const UsdGeomXformOp& op, UsdTimeCode timeCode = UsdTimeCode::Default());
155 static bool readMatrix(MMatrix& result,
const UsdGeomXformOp& op, UsdTimeCode timeCode = UsdTimeCode::Default());
162 static bool pushVector(
const MVector& input, UsdGeomXformOp& op, UsdTimeCode timeCode = UsdTimeCode::Default());
169 static bool pushPoint(
const MPoint& input, UsdGeomXformOp& op, UsdTimeCode timeCode = UsdTimeCode::Default());
176 static bool pushRotation(
const MEulerRotation& input, UsdGeomXformOp& op, UsdTimeCode timeCode = UsdTimeCode::Default());
183 static void pushDouble(
const double input, UsdGeomXformOp& op, UsdTimeCode timeCode = UsdTimeCode::Default());
190 static bool pushShear(
const MVector& input, UsdGeomXformOp& op, UsdTimeCode timeCode = UsdTimeCode::Default());
197 static bool pushMatrix(
const MMatrix& input, UsdGeomXformOp& op, UsdTimeCode timeCode = UsdTimeCode::Default());
204 static MPxTransformationMatrix*
creator();
240 { m_localTranslateOffset = localTranslateOffset; }
244 inline const UsdPrim&
prim()
const
253 {
return (kAnimationMask & m_flags) != 0; }
257 {
return (kAnimatedScale & m_flags) != 0; }
261 {
return (kAnimatedShear & m_flags) != 0; }
265 {
return (kAnimatedTranslation & m_flags) != 0; }
269 {
return (kAnimatedRotation & m_flags) != 0; }
273 {
return (kAnimatedMatrix & m_flags) != 0; }
277 {
return (kPrimHasScale & m_flags) != 0; }
281 {
return (kPrimHasRotation & m_flags) != 0; }
285 {
return (kPrimHasTranslation & m_flags) != 0; }
289 {
return (kPrimHasShear & m_flags) != 0; }
293 {
return (kPrimHasScalePivot & m_flags) != 0; }
297 {
return (kPrimHasScalePivotTranslate & m_flags) != 0; }
301 {
return (kPrimHasRotatePivot & m_flags) != 0; }
305 {
return (kPrimHasRotatePivotTranslate & m_flags) != 0; }
309 {
return (kPrimHasRotateAxes & m_flags) != 0; }
313 {
return (kPrimHasPivot & m_flags) != 0; }
317 {
return (kPrimHasTransform & m_flags) != 0; }
321 {
return (kReadAnimatedValues & m_flags) != 0; }
325 {
return (kPushToPrimEnabled & m_flags) != 0; }
329 {
return (kPushPrimToMatrix & m_flags) != 0; }
353 MStatus translateTo(
const MVector &vector, MSpace::Space = MSpace::kTransform)
override;
354 MStatus translateBy(
const MVector &vector, MSpace::Space = MSpace::kTransform)
override;
357 MStatus scaleTo(
const MVector &, MSpace::Space = MSpace::kTransform)
override;
358 MStatus scaleBy(
const MVector &, MSpace::Space = MSpace::kTransform)
override;
361 MStatus shearTo(
const MVector& shear, MSpace::Space = MSpace::kTransform)
override;
362 MStatus shearBy(
const MVector& shear, MSpace::Space = MSpace::kTransform)
override;
365 MStatus setScalePivot(
const MPoint &, MSpace::Space = MSpace::kTransform,
bool balance =
true)
override;
366 MStatus setScalePivotTranslation(
const MVector &vector, MSpace::Space = MSpace::kTransform)
override;
369 MStatus setRotatePivot(
const MPoint &, MSpace::Space = MSpace::kTransform,
bool balance =
true)
override;
370 MStatus setRotatePivotTranslation(
const MVector &vector, MSpace::Space = MSpace::kTransform)
override;
373 MStatus setRotationOrder(MTransformationMatrix::RotationOrder,
bool preserve =
true)
override;
376 MStatus rotateTo(
const MQuaternion &q, MSpace::Space = MSpace::kTransform)
override;
377 MStatus rotateBy(
const MQuaternion &q, MSpace::Space = MSpace::kTransform)
override;
378 MStatus rotateTo(
const MEulerRotation &e, MSpace::Space = MSpace::kTransform)
override;
379 MStatus rotateBy(
const MEulerRotation &e, MSpace::Space = MSpace::kTransform)
override;
380 MStatus setRotateOrientation(
const MQuaternion &q, MSpace::Space = MSpace::kTransform,
bool balance =
true)
override;
381 MStatus setRotateOrientation(
const MEulerRotation &euler, MSpace::Space = MSpace::kTransform,
bool balance =
true)
override;
384 MMatrix asMatrix()
const;
385 MMatrix asMatrix(
double percent)
const;