Exemplo n.º 1
0
void AnimationController::mapAnimRes( uint32 node, uint32 stage )
{
	static std::string maskStart, maskEnd;
	
	_dirty = true;
	
	AnimationResource *animRes = _animStages[stage].anim;
	if( animRes == 0x0 )
	{	
		_nodeList[node].animEntities[stage] = 0x0;
		return;
	}

	// Animation mask
	bool includeNode = true;

	if( _animStages[stage].startNodeNameId != 0 )
	{
		includeNode = false;
		
		IAnimatableNode *animNode = _nodeList[node].node;
		while( animNode != 0x0 )
		{
			if( hashName( animNode->getANName().c_str() ) == _animStages[stage].startNodeNameId )
			{
				includeNode = true;
				break;
			}
			animNode = animNode->getANParent();
		}
	}
	
	// Find node in animation resource if not masked out
	if( includeNode )
	{
		uint32 nameId = hashName( _nodeList[node].node->getANName().c_str() );
		_nodeList[node].animEntities[stage] = animRes->findEntity( nameId );
	}
	else
	{
		_nodeList[node].animEntities[stage] = 0x0;
	}
}
Exemplo n.º 2
0
void ModelNode::updateStageAnimations( uint32 stage, const string &startNode )
{
	AnimationResource *anim = _animStages[stage]->anim;
	if( anim == 0x0 )
	{	
		for( size_t i = 0, s = _nodeList.size(); i < s; ++i ) 
		{
			_nodeList[i].animEntities[stage] = 0x0;
		}
		
		return;
	}

	// Find animation resource entries for nodes
	for( size_t i = 0, s = _nodeList.size(); i < s; ++i )
	{
		bool includeNode = true;
		
		if( startNode != "" )
		{
			includeNode = false;
			
			SceneNode *node = _nodeList[i].node;
			while( node->getType() != SceneNodeTypes::Model )
			{
				if( node->getName() == startNode )
				{
					includeNode = true;
					break;
				}
				node = node->getParent();
			}
		}
		
		if( includeNode )
			_nodeList[i].animEntities[stage] = anim->findEntity( _nodeList[i].node->getParamstr( SceneNodeParams::Name ) );
		else
			_nodeList[i].animEntities[stage] = 0x0;
	}
}