MCPcopy Create free account
hub / github.com/KhronosGroup/OpenCOLLADA / writeTranslateConnections

Method writeTranslateConnections

dae2ma/src/DAE2MAAnimationImporter.cpp:1833–1907  ·  view source on GitHub ↗

------------------------------

Source from the content-addressed store, hash-verified

1831
1832 //------------------------------
1833 void AnimationImporter::writeTranslateConnections (
1834 const COLLADAFW::Transformation* transformation,
1835 const COLLADAFW::AnimationList::AnimationBindings& animationBindings,
1836 const MayaDM::Transform* transform )
1837 {
1838 COLLADAFW::Translate* translate = ( COLLADAFW::Translate* )transformation;
1839 COLLADABU::Math::Vector3 translation = translate->getTranslation ();
1840
1841 // Get the maya file.
1842 FILE* file = getDocumentImporter ()->getFile ();
1843
1844 // Get the animation curves of the current animation list.
1845 size_t numAnimationBindings = animationBindings.getCount ();
1846 for ( size_t i=0; i<numAnimationBindings; ++i )
1847 {
1848 const COLLADAFW::AnimationList::AnimationBinding& animationBinding = animationBindings [i];
1849
1850 // Get the animation curve element of the current animation id.
1851 const COLLADAFW::UniqueId& animationId = animationBinding.animation;
1852 const std::vector<MayaDM::AnimCurve*>* animCurves = findMayaDMAnimCurves ( animationId );
1853 if ( animCurves == 0 ) continue;
1854
1855 // Connect all animation curves of the current animation.
1856 size_t animationCurveCount = animCurves->size ();
1857 for ( size_t curveIndex=0; curveIndex<animationCurveCount; ++curveIndex )
1858 {
1859 const MayaDM::AnimCurve* animCurve = (*animCurves) [curveIndex];
1860 MayaDM::AnimCurveTL* animCurveTL = (MayaDM::AnimCurveTL*) animCurve;
1861
1862 // Connect the animation curve and the current transform node.
1863 // connectAttr "pCube1_translateX.output" "pCube1.translateX";
1864 const COLLADAFW::AnimationList::AnimationClass& animationClass = animationBinding.animationClass;
1865 switch ( animationClass )
1866 {
1867 case COLLADAFW::AnimationList::POSITION_X:
1868 connectAttr ( file, animCurveTL->getOutput (), transform->getTranslateX () );
1869 break;
1870 case COLLADAFW::AnimationList::POSITION_Y:
1871 connectAttr ( file, animCurveTL->getOutput (), transform->getTranslateY () );
1872 break;
1873 case COLLADAFW::AnimationList::POSITION_Z:
1874 connectAttr ( file, animCurveTL->getOutput (), transform->getTranslateZ () );
1875 break;
1876 case COLLADAFW::AnimationList::POSITION_XYZ:
1877 {
1878 if ( animationCurveCount == 1 )
1879 {
1880 connectAttr ( file, animCurveTL->getOutput (), transform->getTranslate () );
1881 }
1882 else
1883 {
1884 switch ( curveIndex )
1885 {
1886 case 0:
1887 connectAttr ( file, animCurveTL->getOutput (), transform->getTranslateX () );
1888 break;
1889 case 1:
1890 connectAttr ( file, animCurveTL->getOutput (), transform->getTranslateY () );

Callers

nothing calls this directly

Calls 8

getFileMethod · 0.45
getCountMethod · 0.45
sizeMethod · 0.45
getOutputMethod · 0.45
getTranslateXMethod · 0.45
getTranslateYMethod · 0.45
getTranslateZMethod · 0.45
getTranslateMethod · 0.45

Tested by

no test coverage detected