void TbsAnimObj::GetAnimKeys( INode* pNode, TMesh* pMesh) { BOOL bPosAnim; BOOL bRotAnim; BOOL bScaleAnim; m_iDeltaTick = m_Scene.iTickPerFrame; if(CheckForAnimation(pNode, bPosAnim, bRotAnim, bScaleAnim)) { if( bPosAnim ) { DumpPosSample( pNode, pMesh); } if( bRotAnim ) { DumpRotSample( pNode, pMesh ); } if( bScaleAnim ) { DumpScaleSample( pNode, pMesh ); } } // Export the visibility track Control* visCont = pNode->GetVisController(); if (visCont) { DumpFloatKeys(visCont, pMesh); } }
void bgAnimMax::GetAnimKeys(INode* pNode, bgMesh* pMesh) { BOOL bPosAnim; BOOL bRotAnim; BOOL bSclAnim; m_iDeltaTick = m_Scene.iTickPerFrame; if (CheckForAnimation(pNode, bPosAnim, bRotAnim, bSclAnim)) { if (bPosAnim) { pMesh->PosTrack.clear(); DumpPosSample(pNode, pMesh); } if (bRotAnim) { pMesh->RotTrack.clear(); DumpRotSample(pNode, pMesh); } if (bSclAnim) { pMesh->SclTrack.clear(); DumpSclSample(pNode, pMesh); } } Control* AlpCont = pNode->GetVisController(); if (AlpCont) { pMesh->AlpTrack.clear(); DumpFloatKeys(AlpCont, pMesh); } }
// Get hold of the transform controllers for the node... void AsciiExp::ExportAnimKeys(INode* node, int indentLevel) { TSTR indent = GetIndent(indentLevel); BOOL bPosAnim; BOOL bRotAnim; BOOL bScaleAnim; BOOL bDoKeys = FALSE; // We can only export keys if all TM controllers are "known" to us. // The reason for that is that some controllers control more than what // they should. Consider a path position controller, if you turn on // follow and banking, this position controller will also control // rotation. If a node that had a path position controller also had a // TCB rotation controller, the TCB keys would not describe the whole // rotation of the node. // For that reason we will only export keys if all controllers // position, rotation and scale are linear, hybrid (bezier) or tcb. if (!GetAlwaysSample()) { Control* pC = node->GetTMController()->GetPositionController(); Control* rC = node->GetTMController()->GetRotationController(); Control* sC = node->GetTMController()->GetScaleController(); if (IsKnownController(pC) && IsKnownController(rC) && IsKnownController(sC)) { bDoKeys = TRUE; } } Interface14 *iface = GetCOREInterface14(); UINT codepage = iface-> DefaultTextSaveCodePage(true); TSTR nodeName = FixupName(node->GetName()); const char* nodeName_locale = nodeName.ToCP(codepage); if (bDoKeys) { // Only dump the track header if any of the controllers have keys if (node->GetTMController()->GetPositionController()->NumKeys() || node->GetTMController()->GetRotationController()->NumKeys() || node->GetTMController()->GetScaleController()->NumKeys()) { _ftprintf(pStream, _T("%s\t%s {\n"), indent.data(), ID_TM_ANIMATION); _ftprintf(pStream, _T("%s\t\t%s \"%hs\"\n"), indent.data(), ID_NODE_NAME, nodeName_locale); DumpPosKeys(node->GetTMController()->GetPositionController(), indentLevel); DumpRotKeys(node->GetTMController()->GetRotationController(), indentLevel); DumpScaleKeys(node->GetTMController()->GetScaleController(), indentLevel); _ftprintf(pStream, _T("%s\t}\n"), indent.data()); } } else if (CheckForAnimation(node, bPosAnim, bRotAnim, bScaleAnim)) { _ftprintf(pStream, _T("%s\t%s {\n"), indent.data(), ID_TM_ANIMATION); _ftprintf(pStream, _T("%s\t\t%s \"%hs\"\n"), indent.data(), ID_NODE_NAME, nodeName_locale); if (bPosAnim) { DumpPosSample(node, indentLevel); } if (bRotAnim) { DumpRotSample(node, indentLevel); } if (bScaleAnim) { DumpScaleSample(node, indentLevel); } _ftprintf(pStream, _T("%s\t}\n"), indent.data()); } }
// Get hold of the transform controllers for the node... void XsiExp::ExportAnimKeys( INode * node, int & animHit) { // Targets are actually geomobjects, but we will export them // from the camera and light objects, so we skip them here. // Object * obj = node->EvalWorldState(GetStaticFrame()).obj; if (!obj || obj->ClassID() == Class_ID( TARGET_CLASS_ID, 0)) { return; } TSTR indent = GetIndent(1); BOOL bPosAnim, bRotAnim, bScaleAnim, bDoKeys = FALSE; TCHAR * name = FixupName( node->GetName()); BOOL isBone = obj->ClassID() == Class_ID(BONE_CLASS_ID, 0) ? TRUE : FALSE; if (isBone) { // bone anims get passed to children if (!node->GetParentNode() || node->GetParentNode()->IsRootNode()) { // can't anim top bone return; } node = node->GetParentNode(); } // We can only export keys if all TM controllers are "known" to us. // The reason for that is that some controllers control more than what // they should. Consider a path position controller, if you turn on // follow and banking, this position controller will also control // rotation. If a node that had a path position controller also had a // TCB rotation controller, the TCB keys would not describe the whole // rotation of the node. // For that reason we will only export keys if all controllers // position, rotation and scale are linear, hybrid (bezier) or tcb. if (!GetAlwaysSample()) { Control* pC = node->GetTMController()->GetPositionController(); Control* rC = node->GetTMController()->GetRotationController(); Control* sC = node->GetTMController()->GetScaleController(); if (IsKnownController(pC) && IsKnownController(rC) && IsKnownController(sC)) { bDoKeys = TRUE; } } if (bDoKeys) { // Only dump the track header if any of the controllers have keys if (node->GetTMController()->GetPositionController()->NumKeys() > 1 || node->GetTMController()->GetRotationController()->NumKeys() > 1 || node->GetTMController()->GetScaleController()->NumKeys() > 1) { if (!animHit) { fprintf(pStream,"AnimationSet {\n"); animHit = TRUE; } fprintf(pStream,"%sAnimation anim-%s {\n", indent.data(), name ); indent = GetIndent(2); fprintf(pStream,"%s{frm-%s}\n", indent.data(), name ); DumpRotKeys( node, 1); DumpPosKeys( node, 1); DumpScaleKeys( node, 1); indent = GetIndent(1); fprintf(pStream,"%s}\n\n", indent.data()); } } else if (CheckForAnimation(node, bPosAnim, bRotAnim, bScaleAnim)) { if (!animHit) { fprintf(pStream,"AnimationSet {\n"); animHit = TRUE; } fprintf(pStream,"%sAnimation anim-%s {\n", indent.data(), name ); indent = GetIndent(2); fprintf(pStream,"%s{frm-%s}\n", indent.data(), name ); DumpRotKeys( node, 1); DumpPosKeys( node, 1); DumpScaleKeys( node, 1); fprintf(pStream,"%s}\n", indent.data()); } }