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

Method writeRotateConnections

dae2ma/src/DAE2MAAnimationImporter.cpp:1541–1688  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1539
1540 //------------------------------
1541 void AnimationImporter::writeRotateConnections (
1542 const COLLADAFW::Transformation* transformation,
1543 const MayaTransform::TransformPhase& transformPhase,
1544 const bool isJointTransform,
1545 const COLLADAFW::AnimationList::AnimationBindings& animationBindings,
1546 const MayaDM::Transform* transform )
1547 {
1548 // Get the maya file.
1549 FILE* file = getDocumentImporter ()->getFile ();
1550
1551 // Write the current rotation in a quaternion and
1552 // multiplicate with the existing rotation.
1553 COLLADAFW::Rotate* rotation = ( COLLADAFW::Rotate* )transformation;
1554 COLLADABU::Math::Vector3& axis = rotation->getRotationAxis ();
1555
1556 // Get the animation curves of the current animated element.
1557 size_t numAnimationBindings = animationBindings.getCount ();
1558 for ( size_t i=0; i<numAnimationBindings; ++i )
1559 {
1560 // Get the animation curve element of the current animation id.
1561 const COLLADAFW::AnimationList::AnimationBinding& animationBinding = animationBindings [i];
1562 const COLLADAFW::UniqueId& animationId = animationBinding.animation;
1563 const std::vector<MayaDM::AnimCurve*>* animationCurves = findMayaDMAnimCurves ( animationId );
1564 if ( animationCurves == 0 ) continue;
1565
1566 // TODO
1567 size_t firstIndex = animationBinding.firstIndex;
1568
1569 // Connect all animation curves of the current animation.
1570 size_t animationCurveCount = animationCurves->size ();
1571 for ( size_t curveIndex=0; curveIndex<animationCurveCount; ++curveIndex )
1572 {
1573 const MayaDM::AnimCurve* animCurve = (*animationCurves) [curveIndex];
1574 MayaDM::AnimCurveTA* animCurveTA = (MayaDM::AnimCurveTA*) animCurve;
1575
1576 // Connect the animation curve and the current transform node.
1577 // connectAttr "pCube1_translateX.output" "pCube1.translateX";
1578 const COLLADAFW::AnimationList::AnimationClass& animationClass = animationBinding.animationClass;
1579 switch ( animationClass )
1580 {
1581 case COLLADAFW::AnimationList::ANGLE:
1582 {
1583 switch ( transformPhase )
1584 {
1585 case MayaTransform::PHASE_JOINT_ORIENT1:
1586 case MayaTransform::PHASE_JOINT_ORIENT2:
1587 case MayaTransform::PHASE_JOINT_ORIENT3:
1588 {
1589 if ( !isJointTransform )
1590 {
1591 std::cerr << " Can't connect rotate animation, about the transform is not a joint node!" << std::endl;
1592 return;
1593 }
1594 if ( COLLADABU::Math::Vector3::UNIT_X == axis )
1595 {
1596 connectAttr ( file, animCurveTA->getOutput (), ((MayaDM::Joint*)transform)->getJointOrientX () );
1597 }
1598 else if ( COLLADABU::Math::Vector3::UNIT_Y == axis )

Callers

nothing calls this directly

Calls 15

getJointOrientXMethod · 0.80
getJointOrientYMethod · 0.80
getJointOrientZMethod · 0.80
getRotateAxisXMethod · 0.80
getRotateAxisYMethod · 0.80
getRotateAxisZMethod · 0.80
getJointOrientMethod · 0.80
getFileMethod · 0.45
getCountMethod · 0.45
sizeMethod · 0.45
getOutputMethod · 0.45
getRotateXMethod · 0.45

Tested by

no test coverage detected