------------------------------
| 1689 | |
| 1690 | //------------------------------ |
| 1691 | void AnimationImporter::writeScaleConnections ( |
| 1692 | const COLLADAFW::Transformation* transformation, |
| 1693 | const COLLADAFW::AnimationList::AnimationBindings& animationBindings, |
| 1694 | const MayaDM::Transform* transform ) |
| 1695 | { |
| 1696 | // Get the scale. |
| 1697 | COLLADAFW::Scale* scale = ( COLLADAFW::Scale* )transformation; |
| 1698 | |
| 1699 | // Get the maya file. |
| 1700 | FILE* file = getDocumentImporter ()->getFile (); |
| 1701 | |
| 1702 | // Get the animation curves of the current animated element. |
| 1703 | size_t numAnimationBindings = animationBindings.getCount (); |
| 1704 | for ( size_t i=0; i<numAnimationBindings; ++i ) |
| 1705 | { |
| 1706 | // Get the animation curve element of the current animation id. |
| 1707 | const COLLADAFW::AnimationList::AnimationBinding& animationBinding = animationBindings [i]; |
| 1708 | const COLLADAFW::UniqueId& animationId = animationBinding.animation; |
| 1709 | const std::vector<MayaDM::AnimCurve*>* animCurves = findMayaDMAnimCurves ( animationId ); |
| 1710 | if ( animCurves == 0 ) continue; |
| 1711 | |
| 1712 | // Connect all animation curves of the current animation. |
| 1713 | size_t animationCurveCount = animCurves->size (); |
| 1714 | for ( size_t curveIndex=0; curveIndex<animationCurveCount; ++curveIndex ) |
| 1715 | { |
| 1716 | const MayaDM::AnimCurve* animCurve = (*animCurves) [curveIndex]; |
| 1717 | MayaDM::AnimCurveTL* animCurveTU = (MayaDM::AnimCurveTL*) animCurve; |
| 1718 | |
| 1719 | // Connect the animation curve and the current transform node. |
| 1720 | // connectAttr "pCube1_translateX.output" "pCube1.translateX"; |
| 1721 | const COLLADAFW::AnimationList::AnimationClass& animationClass = animationBinding.animationClass; |
| 1722 | switch ( animationClass ) |
| 1723 | { |
| 1724 | case COLLADAFW::AnimationList::POSITION_X: |
| 1725 | connectAttr ( file, animCurveTU->getOutput (), transform->getScaleX() ); |
| 1726 | break; |
| 1727 | case COLLADAFW::AnimationList::POSITION_Y: |
| 1728 | connectAttr ( file, animCurveTU->getOutput (), transform->getScaleY() ); |
| 1729 | break; |
| 1730 | case COLLADAFW::AnimationList::POSITION_Z: |
| 1731 | connectAttr ( file, animCurveTU->getOutput (), transform->getScaleZ() ); |
| 1732 | break; |
| 1733 | case COLLADAFW::AnimationList::POSITION_XYZ: |
| 1734 | if ( animationCurveCount == 1 ) |
| 1735 | { |
| 1736 | connectAttr ( file, animCurveTU->getOutput (), transform->getScale() ); |
| 1737 | } |
| 1738 | else |
| 1739 | { |
| 1740 | switch ( curveIndex ) |
| 1741 | { |
| 1742 | case 0: |
| 1743 | connectAttr ( file, animCurveTU->getOutput (), transform->getScaleX() ); |
| 1744 | break; |
| 1745 | case 1: |
| 1746 | connectAttr ( file, animCurveTU->getOutput (), transform->getScaleY() ); |
| 1747 | break; |
| 1748 | case 2: |