示例#1
0
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);		
	}
}
示例#2
0
// 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());
	}
}