Skip to content

Commit

Permalink
Merge pull request #115 from LumaPictures/pr/fixSetScaleTranslate_in_…
Browse files Browse the repository at this point in the history
…enableReadAnimatedValues

fix check for scalePivotTranslate when enableReadAnimatedValues is changed
  • Loading branch information
fabal authored Sep 19, 2018
2 parents 0ea6dd3 + 9f99922 commit c4f4495
Showing 1 changed file with 36 additions and 26 deletions.
62 changes: 36 additions & 26 deletions lib/AL_USDMaya/AL/usdmaya/nodes/TransformationMatrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1899,33 +1899,38 @@ void TransformationMatrix::enableReadAnimatedValues(bool enabled)
// of nothing. This will call my code that will magically construct the transform ops in the right order.
if(enabled)
{
const MVector nullVec(0, 0, 0);
const MVector oneVec(1.0, 1.0, 1.0);
const MPoint nullPoint(0, 0, 0);
const MQuaternion nullQuat(0, 0, 0, 1.0);

if(!pushPrimToMatrix())
{
if(primHasTranslation() || translation() != MVector::zero)
translateBy(MVector::zero);
if(primHasTranslation() || translation() != nullVec)
translateBy(nullVec);

if(primHasScale() || scale() != MVector::one)
scaleBy(MVector::one);
if(primHasScale() || scale() != oneVec)
scaleBy(oneVec);

if(primHasShear() || shear() != MVector::zero)
shearBy(MVector::zero);
if(primHasShear() || shear() != nullVec)
shearBy(nullVec);

if(primHasScalePivot() || scalePivot() != MPoint::origin)
if(primHasScalePivot() || scalePivot() != nullPoint)
setScalePivot(scalePivot(), MSpace::kTransform, false);

if(primHasScalePivot() || scalePivot() != MPoint::origin)
if(primHasScalePivotTranslate() || scalePivotTranslation() != nullVec)
setScalePivotTranslation(scalePivotTranslation(), MSpace::kTransform);

if(primHasRotatePivot() || rotatePivot() != MPoint::origin)
if(primHasRotatePivot() || rotatePivot() != nullPoint)
setRotatePivot(rotatePivot(), MSpace::kTransform, false);

if(primHasRotatePivotTranslate() || rotatePivotTranslation() != MVector::zero)
if(primHasRotatePivotTranslate() || rotatePivotTranslation() != nullVec)
setRotatePivotTranslation(rotatePivotTranslation(), MSpace::kTransform);

if(primHasRotation() || rotation() != MQuaternion::identity)
rotateBy(MQuaternion::identity);
if(primHasRotation() || rotation() != nullQuat)
rotateBy(nullQuat);

if(primHasRotateAxes() || rotateOrientation() != MQuaternion::identity)
if(primHasRotateAxes() || rotateOrientation() != nullQuat)
setRotateOrientation(rotateOrientation(), MSpace::kTransform, false);
}
else
Expand Down Expand Up @@ -1963,33 +1968,38 @@ void TransformationMatrix::enablePushToPrim(bool enabled)
// of nothing. This will call my code that will magically construct the transform ops in the right order.
if(enabled && getTimeCode() == UsdTimeCode::Default())
{
const MVector nullVec(0, 0, 0);
const MVector oneVec(1.0, 1.0, 1.0);
const MPoint nullPoint(0, 0, 0);
const MQuaternion nullQuat(0, 0, 0, 1.0);

if(!pushPrimToMatrix())
{
if(primHasTranslation() || translation() != MVector::zero)
translateBy(MVector::zero);
if(primHasTranslation() || translation() != nullVec)
translateBy(nullVec);

if(primHasScale() || scale() != MVector::one)
scaleBy(MVector::one);
if(primHasScale() || scale() != oneVec)
scaleBy(oneVec);

if(primHasShear() || shear() != MVector::zero)
shearBy(MVector::zero);
if(primHasShear() || shear() != nullVec)
shearBy(nullVec);

if(primHasScalePivot() || scalePivot() != MPoint::origin)
if(primHasScalePivot() || scalePivot() != nullPoint)
setScalePivot(scalePivot(), MSpace::kTransform, false);

if(primHasScalePivotTranslate() || scalePivotTranslation() != MPoint::origin)
if(primHasScalePivotTranslate() || scalePivotTranslation() != nullVec)
setScalePivotTranslation(scalePivotTranslation(), MSpace::kTransform);

if(primHasRotatePivot() || rotatePivot() != MPoint::origin)
if(primHasRotatePivot() || rotatePivot() != nullPoint)
setRotatePivot(rotatePivot(), MSpace::kTransform, false);

if(primHasRotatePivotTranslate() || rotatePivotTranslation() != MVector::zero)
if(primHasRotatePivotTranslate() || rotatePivotTranslation() != nullVec)
setRotatePivotTranslation(rotatePivotTranslation(), MSpace::kTransform);

if(primHasRotation() || rotation() != MQuaternion::identity)
rotateBy(MQuaternion::identity);
if(primHasRotation() || rotation() != nullQuat)
rotateBy(nullQuat);

if(primHasRotateAxes() || rotateOrientation() != MQuaternion::identity)
if(primHasRotateAxes() || rotateOrientation() != nullQuat)
setRotateOrientation(rotateOrientation(), MSpace::kTransform, false);
}
else
Expand Down

0 comments on commit c4f4495

Please sign in to comment.