void	SMDImporter::CreateChainFromThisNode( SMDNode* in_pNode, XSI::X3DObject in_Parent, int from)
{
	
	XSI::ChainRoot myChainRoot;
	SMDKey *l_pKey = in_pNode->GetKey (0);

	for (int c=from;c<in_pNode->m_pChildren.GetUsed();c++)
	{

		XSI::MATH::CVector3 position;
		XSI::MATH::CVector3 positioneff;
		if ( l_pKey )
		{
			position = GetGlobalPosition ( in_pNode );
			positioneff = position;
			positioneff.PutX ( positioneff.GetX() + 1.0f );
		}

		if (!myChainRoot.IsValid() )
		{
			LPWSTR l_wszModelName;
			DSA2W(&l_wszModelName,in_pNode->m_szName);
			
			in_Parent.Add3DChain(	position,
				positioneff,
				XSI::MATH::CVector3(0,0,1),
				l_wszModelName,
				myChainRoot);
		}

		SMDNode* bone = in_pNode->m_pChildren[c];

		while ( bone != NULL )
		{
			LPWSTR l_wszBoneName;
			DSA2W(&l_wszBoneName,bone->m_szName);

			SMDKey *l_pBKey = bone->GetKey (0);
			XSI::ChainBone myChainBone1;
			myChainRoot.AddBone(GetGlobalPosition(bone),XSI::siChainBonePin,l_wszBoneName,myChainBone1);

			if ( !bone->m_pChildren.GetUsed() )
			{
				bone = NULL;
			} else {

				if ( bone->m_pChildren.GetUsed() > 1 )
				{
					for (int s=1;s<bone->m_pChildren.GetUsed();s++)
					{
						CreateChainFromThisNode( bone, myChainBone1, s);
					}
				}

				bone = bone->GetChild(0);
			}
		}
	}

}
//****************************************************************************************
// function			: ComputeBaseOffset
// description		: compute the position based on the percentage along the bone
// with an added offset. 
//
// vOffeset			: vector3, offset to add to final position
// dtBone2LPose			: double, percentage along bone length where 0 <= v <= 100
// dtBone2LPose			: double, bone length
//
// return value	:	SIVector3 
//****************************************************************************************
void CAxisInterpOp::ComputeBaseOffset( XSI::MATH::CVector3& rvBaseOffset, double dBonePerc, double dBoneLen )
{	
	double delta = 0;

	if ( dBonePerc != 0 ) {
		delta = dBonePerc / 100.0;
	}

	// move the position a percentage along the bone length	
	rvBaseOffset.PutX( rvBaseOffset.GetX() + ( dBoneLen * delta ) );

}