- renamed "bone" anims and associated structures to generic "node" anims. Breaking change, sorry for that.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@166 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
pull/1/head
ulfjorensen 2008-09-30 13:05:48 +00:00
parent 832f9cf672
commit 8925813026
15 changed files with 140 additions and 145 deletions

View File

@ -222,8 +222,8 @@ void ASEImporter::BuildAnimations()
this->pcScene->mNumAnimations = 1;
this->pcScene->mAnimations = new aiAnimation*[1];
aiAnimation* pcAnim = this->pcScene->mAnimations[0] = new aiAnimation();
pcAnim->mNumBones = iNum;
pcAnim->mBones = new aiBoneAnim*[iNum];
pcAnim->mNumChannels = iNum;
pcAnim->mChannels = new aiNodeAnim*[iNum];
pcAnim->mTicksPerSecond = this->mParser->iFrameSpeed * this->mParser->iTicksPerFrame;
iNum = 0;
@ -233,36 +233,36 @@ void ASEImporter::BuildAnimations()
if ((*i).bSkip)continue;
if ((*i).mAnim.akeyPositions.size() > 1 || (*i).mAnim.akeyRotations.size() > 1)
{
aiBoneAnim* pcBoneAnim = pcAnim->mBones[iNum++] = new aiBoneAnim();
pcBoneAnim->mBoneName.Set((*i).mName);
aiNodeAnim* pcNodeAnim = pcAnim->mChannels[iNum++] = new aiNodeAnim();
pcNodeAnim->mNodeName.Set((*i).mName);
// copy position keys
if ((*i).mAnim.akeyPositions.size() > 1 )
{
pcBoneAnim->mNumPositionKeys = (unsigned int) (*i).mAnim.akeyPositions.size();
pcBoneAnim->mPositionKeys = new aiVectorKey[pcBoneAnim->mNumPositionKeys];
pcNodeAnim->mNumPositionKeys = (unsigned int) (*i).mAnim.akeyPositions.size();
pcNodeAnim->mPositionKeys = new aiVectorKey[pcNodeAnim->mNumPositionKeys];
::memcpy(pcBoneAnim->mPositionKeys,&(*i).mAnim.akeyPositions[0],
pcBoneAnim->mNumPositionKeys * sizeof(aiVectorKey));
::memcpy(pcNodeAnim->mPositionKeys,&(*i).mAnim.akeyPositions[0],
pcNodeAnim->mNumPositionKeys * sizeof(aiVectorKey));
for (unsigned int qq = 0; qq < pcBoneAnim->mNumPositionKeys;++qq)
for (unsigned int qq = 0; qq < pcNodeAnim->mNumPositionKeys;++qq)
{
double dTime = pcBoneAnim->mPositionKeys[qq].mTime;
double dTime = pcNodeAnim->mPositionKeys[qq].mTime;
pcAnim->mDuration = std::max(pcAnim->mDuration,dTime);
}
}
// copy rotation keys
if ((*i).mAnim.akeyRotations.size() > 1 )
{
pcBoneAnim->mNumRotationKeys = (unsigned int) (*i).mAnim.akeyPositions.size();
pcBoneAnim->mRotationKeys = new aiQuatKey[pcBoneAnim->mNumPositionKeys];
pcNodeAnim->mNumRotationKeys = (unsigned int) (*i).mAnim.akeyPositions.size();
pcNodeAnim->mRotationKeys = new aiQuatKey[pcNodeAnim->mNumPositionKeys];
::memcpy(pcBoneAnim->mRotationKeys,&(*i).mAnim.akeyRotations[0],
pcBoneAnim->mNumRotationKeys * sizeof(aiQuatKey));
::memcpy(pcNodeAnim->mRotationKeys,&(*i).mAnim.akeyRotations[0],
pcNodeAnim->mNumRotationKeys * sizeof(aiQuatKey));
for (unsigned int qq = 0; qq < pcBoneAnim->mNumRotationKeys;++qq)
for (unsigned int qq = 0; qq < pcNodeAnim->mNumRotationKeys;++qq)
{
double dTime = pcBoneAnim->mRotationKeys[qq].mTime;
double dTime = pcNodeAnim->mRotationKeys[qq].mTime;
pcAnim->mDuration = std::max(pcAnim->mDuration,dTime);
}
}

View File

@ -97,11 +97,11 @@ void ConvertToLHProcess::Execute( aiScene* pScene)
for( unsigned int a = 0; a < pScene->mNumAnimations; a++)
{
aiAnimation* anim = pScene->mAnimations[a];
for( unsigned int b = 0; b < anim->mNumBones; b++)
for( unsigned int b = 0; b < anim->mNumChannels; b++)
{
aiBoneAnim* boneAnim = anim->mBones[b];
if( strcmp( boneAnim->mBoneName.data, pScene->mRootNode->mName.data) == 0)
ProcessAnimation( boneAnim);
aiNodeAnim* nodeAnim = anim->mChannels[b];
if( strcmp( nodeAnim->mNodeName.data, pScene->mRootNode->mName.data) == 0)
ProcessAnimation( nodeAnim);
}
}
DefaultLogger::get()->debug("ConvertToLHProcess finished");
@ -139,7 +139,7 @@ void ConvertToLHProcess::ProcessMesh( aiMesh* pMesh)
// ------------------------------------------------------------------------------------------------
// Converts the given animation to LH coordinates.
void ConvertToLHProcess::ProcessAnimation( aiBoneAnim* pAnim)
void ConvertToLHProcess::ProcessAnimation( aiNodeAnim* pAnim)
{
// position keys
for( unsigned int a = 0; a < pAnim->mNumPositionKeys; a++)

View File

@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "BaseProcess.h"
struct aiMesh;
struct aiBoneAnim;
struct aiNodeAnim;
namespace Assimp
{
@ -114,7 +114,7 @@ protected:
* work in local space and can therefore be left untouched.
* @param pAnim The bone animation to transform
*/
void ProcessAnimation( aiBoneAnim* pAnim);
void ProcessAnimation( aiNodeAnim* pAnim);
//! true if the transformation matrix for the OGL-to-DX is
//! directly used to transform all vertices.

View File

@ -713,10 +713,10 @@ void Importer::GetMemoryRequirements(aiMemoryInfo& in) const
in.animations += sizeof(aiAnimation);
// add all bone anims
for (unsigned int a = 0; a < pc->mNumBones;++a)
for (unsigned int a = 0; a < pc->mNumChannels; ++a)
{
const aiBoneAnim* pc2 = pc->mBones[i];
in.animations += sizeof(aiBoneAnim);
const aiNodeAnim* pc2 = pc->mChannels[i];
in.animations += sizeof(aiNodeAnim);
in.animations += pc2->mNumPositionKeys * sizeof(aiVectorKey);
in.animations += pc2->mNumScalingKeys * sizeof(aiVectorKey);
in.animations += pc2->mNumRotationKeys * sizeof(aiQuatKey);

View File

@ -470,17 +470,17 @@ void MD5Importer::LoadMD5AnimFile ()
pScene->mNumAnimations = 1;
pScene->mAnimations = new aiAnimation*[1];
aiAnimation* anim = pScene->mAnimations[0] = new aiAnimation();
anim->mNumBones = (unsigned int)animParser.mAnimatedBones.size();
anim->mBones = new aiBoneAnim*[anim->mNumBones];
for (unsigned int i = 0; i < anim->mNumBones;++i)
anim->mNumChannels = (unsigned int)animParser.mAnimatedBones.size();
anim->mChannels = new aiNodeAnim*[anim->mNumChannels];
for (unsigned int i = 0; i < anim->mNumChannels;++i)
{
aiBoneAnim* bone = anim->mBones[i] = new aiBoneAnim();
bone->mBoneName = aiString( animParser.mAnimatedBones[i].mName );
aiNodeAnim* node = anim->mChannels[i] = new aiNodeAnim();
node->mNodeName = aiString( animParser.mAnimatedBones[i].mName );
// allocate storage for the keyframes
bone->mNumPositionKeys = bone->mNumRotationKeys = (unsigned int)animParser.mFrames.size();
bone->mPositionKeys = new aiVectorKey[bone->mNumPositionKeys];
bone->mRotationKeys = new aiQuatKey[bone->mNumPositionKeys];
node->mNumPositionKeys = node->mNumRotationKeys = (unsigned int)animParser.mFrames.size();
node->mPositionKeys = new aiVectorKey[node->mNumPositionKeys];
node->mRotationKeys = new aiQuatKey[node->mNumPositionKeys];
}
// 1 tick == 1 frame
@ -493,12 +493,12 @@ void MD5Importer::LoadMD5AnimFile ()
if (!(*iter).mValues.empty())
{
// now process all values in there ... read all joints
aiBoneAnim** pcAnimBone = anim->mBones;
aiNodeAnim** pcAnimNode = anim->mChannels;
MD5::BaseFrameDesc* pcBaseFrame = &animParser.mBaseFrames[0];
for (AnimBoneList::const_iterator
iter2 = animParser.mAnimatedBones.begin(),
iterEnd2 = animParser.mAnimatedBones.end();
iter2 != iterEnd2;++iter2,++pcAnimBone,++pcBaseFrame)
iter2 != iterEnd2;++iter2,++pcAnimNode,++pcBaseFrame)
{
if((*iter2).iFirstKeyIndex >= (*iter).mValues.size())
{
@ -508,7 +508,7 @@ void MD5Importer::LoadMD5AnimFile ()
}
const float* fpCur = &(*iter).mValues[(*iter2).iFirstKeyIndex];
aiBoneAnim* pcCurAnimBone = *pcAnimBone;
aiNodeAnim* pcCurAnimBone = *pcAnimNode;
aiVectorKey* vKey = pcCurAnimBone->mPositionKeys++;
// translation on the x axis
@ -557,11 +557,11 @@ void MD5Importer::LoadMD5AnimFile ()
}
// undo our offset computations
for (unsigned int i = 0; i < anim->mNumBones;++i)
for (unsigned int i = 0; i < anim->mNumChannels;++i)
{
aiBoneAnim* bone = anim->mBones[i];
bone->mPositionKeys -= bone->mNumPositionKeys;
bone->mRotationKeys -= bone->mNumPositionKeys;
aiNodeAnim* node = anim->mChannels[i];
node->mPositionKeys -= node->mNumPositionKeys;
node->mRotationKeys -= node->mNumPositionKeys;
}
}

View File

@ -1734,12 +1734,12 @@ void MDLImporter::BuildOutputAnims_3DGS_MDL7(
pcAnim->mDuration = std::max(pcAnim->mDuration, (double)
apcBonesOut[i]->pkeyPositions[qq].mTime);
}
++pcAnim->mNumBones;
++pcAnim->mNumChannels;
}
}
if (pcAnim->mDuration)
{
pcAnim->mBones = new aiBoneAnim*[pcAnim->mNumBones];
pcAnim->mChannels = new aiNodeAnim*[pcAnim->mNumChannels];
unsigned int iCnt = 0;
for (uint32_t i = 0; i < pcHeader->bones_num;++i)
@ -1748,24 +1748,24 @@ void MDLImporter::BuildOutputAnims_3DGS_MDL7(
{
const MDL::IntBone_MDL7* const intBone = apcBonesOut[i];
aiBoneAnim* const pcBoneAnim = pcAnim->mBones[iCnt++] = new aiBoneAnim();
pcBoneAnim->mBoneName = aiString( intBone->mName );
aiNodeAnim* const pcNodeAnim = pcAnim->mChannels[iCnt++] = new aiNodeAnim();
pcNodeAnim->mNodeName = aiString( intBone->mName );
// allocate enough storage for all keys
pcBoneAnim->mNumPositionKeys = (unsigned int)intBone->pkeyPositions.size();
pcBoneAnim->mNumScalingKeys = (unsigned int)intBone->pkeyPositions.size();
pcBoneAnim->mNumRotationKeys = (unsigned int)intBone->pkeyPositions.size();
pcNodeAnim->mNumPositionKeys = (unsigned int)intBone->pkeyPositions.size();
pcNodeAnim->mNumScalingKeys = (unsigned int)intBone->pkeyPositions.size();
pcNodeAnim->mNumRotationKeys = (unsigned int)intBone->pkeyPositions.size();
pcBoneAnim->mPositionKeys = new aiVectorKey[pcBoneAnim->mNumPositionKeys];
pcBoneAnim->mScalingKeys = new aiVectorKey[pcBoneAnim->mNumPositionKeys];
pcBoneAnim->mRotationKeys = new aiQuatKey[pcBoneAnim->mNumPositionKeys];
pcNodeAnim->mPositionKeys = new aiVectorKey[pcNodeAnim->mNumPositionKeys];
pcNodeAnim->mScalingKeys = new aiVectorKey[pcNodeAnim->mNumPositionKeys];
pcNodeAnim->mRotationKeys = new aiQuatKey[pcNodeAnim->mNumPositionKeys];
// copy all keys
for (unsigned int qq = 0; qq < pcBoneAnim->mNumPositionKeys;++qq)
for (unsigned int qq = 0; qq < pcNodeAnim->mNumPositionKeys;++qq)
{
pcBoneAnim->mPositionKeys[qq] = intBone->pkeyPositions[qq];
pcBoneAnim->mScalingKeys[qq] = intBone->pkeyScalings[qq];
pcBoneAnim->mRotationKeys[qq] = intBone->pkeyRotations[qq];
pcNodeAnim->mPositionKeys[qq] = intBone->pkeyPositions[qq];
pcNodeAnim->mScalingKeys[qq] = intBone->pkeyScalings[qq];
pcNodeAnim->mRotationKeys[qq] = intBone->pkeyRotations[qq];
}
}
}

View File

@ -176,10 +176,10 @@ void OptimizeGraphProcess::FindLockedNodes(aiNode* node)
for (unsigned int i = 0; i < pScene->mNumAnimations;++i)
{
aiAnimation* pani = pScene->mAnimations[i];
for (unsigned int a = 0; a < pani->mNumBones;++a)
for (unsigned int a = 0; a < pani->mNumChannels;++a)
{
aiBoneAnim* pba = pani->mBones[a];
if (pba->mBoneName == node->mName)
aiNodeAnim* pba = pani->mChannels[a];
if (pba->mNodeName == node->mName)
{
// this node is locked
node->mNumChildren |= AI_OG_UINT_MSB;

View File

@ -42,7 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file Implementation of the RAW importer class */
// internal headers
#include "RAWLoader.h"
#include "RawLoader.h"
#include "MaterialSystem.h"
#include "ParsingUtils.h"
#include "fast_atof.h"

View File

@ -535,10 +535,10 @@ void SMDImporter::CreateOutputAnimations()
aiAnimation*& anim = this->pScene->mAnimations[0] = new aiAnimation();
anim->mDuration = this->dLengthOfAnim;
anim->mNumBones = iNumBones;
anim->mNumChannels = iNumBones;
anim->mTicksPerSecond = 25.0; // FIXME: is this correct?
aiBoneAnim** pp = anim->mBones = new aiBoneAnim*[anim->mNumBones];
aiNodeAnim** pp = anim->mChannels = new aiNodeAnim*[anim->mNumChannels];
// now build valid keys
unsigned int a = 0;
@ -548,12 +548,10 @@ void SMDImporter::CreateOutputAnimations()
{
if (!(*i).bIsUsed)continue;
aiBoneAnim* p = pp[a] = new aiBoneAnim();
aiNodeAnim* p = pp[a] = new aiNodeAnim();
// copy the name of the bone
p->mBoneName.length = (*i).mName.length();
::memcpy(p->mBoneName.data,(*i).mName.c_str(),p->mBoneName.length);
p->mBoneName.data[p->mBoneName.length] = '\0';
p->mNodeName.Set( i->mName);
p->mNumRotationKeys = (unsigned int) (*i).sAnim.asKeys.size();
if (p->mNumRotationKeys)

View File

@ -418,24 +418,24 @@ void ValidateDSProcess::Validate( const aiAnimation* pAnimation)
this->Validate(&pAnimation->mName);
// validate all materials
if (pAnimation->mNumBones)
if (pAnimation->mNumChannels)
{
if (!pAnimation->mBones)
if (!pAnimation->mChannels)
{
this->ReportError("aiAnimation::mBones is NULL (aiAnimation::mNumBones is %i)",
pAnimation->mBones);
this->ReportError("aiAnimation::mChannels is NULL (aiAnimation::mNumChannels is %i)",
pAnimation->mNumChannels);
}
for (unsigned int i = 0; i < pAnimation->mNumBones;++i)
for (unsigned int i = 0; i < pAnimation->mNumChannels;++i)
{
if (!pAnimation->mBones[i])
if (!pAnimation->mChannels[i])
{
this->ReportError("aiAnimation::mBones[%i] is NULL (aiAnimation::mNumBones is %i)",
i,pAnimation->mNumBones);
this->ReportError("aiAnimation::mChannels[%i] is NULL (aiAnimation::mNumChannels is %i)",
i, pAnimation->mNumChannels);
}
this->Validate(pAnimation, pAnimation->mBones[i]);
this->Validate(pAnimation, pAnimation->mChannels[i]);
}
}
else this->ReportError("aiAnimation::mNumBones is 0. At least one bone animation channel must be there.");
else this->ReportError("aiAnimation::mNumChannels is 0. At least one node animation channel must be there.");
// Animation duration is allowed to be zero in cases where the anim contains only a single key frame.
// if (!pAnimation->mDuration)this->ReportError("aiAnimation::mDuration is zero");
@ -653,9 +653,9 @@ void ValidateDSProcess::Validate( const aiTexture* pTexture)
}
// ------------------------------------------------------------------------------------------------
void ValidateDSProcess::Validate( const aiAnimation* pAnimation,
const aiBoneAnim* pBoneAnim)
const aiNodeAnim* pNodeAnim)
{
this->Validate(&pBoneAnim->mBoneName);
this->Validate(&pNodeAnim->mNodeName);
#if 0
// check whether there is a bone with this name ...
@ -665,103 +665,103 @@ void ValidateDSProcess::Validate( const aiAnimation* pAnimation,
aiMesh* mesh = this->mScene->mMeshes[i];
for (unsigned int a = 0; a < mesh->mNumBones;++a)
{
if (mesh->mBones[a]->mName == pBoneAnim->mBoneName)
if (mesh->mBones[a]->mName == pNodeAnim->mBoneName)
goto __break_out;
}
}
__break_out:
if (i == this->mScene->mNumMeshes)
{
this->ReportWarning("aiBoneAnim::mBoneName is \"%s\". However, no bone with this name was found",
pBoneAnim->mBoneName.data);
this->ReportWarning("aiNodeAnim::mBoneName is \"%s\". However, no bone with this name was found",
pNodeAnim->mBoneName.data);
}
if (!pBoneAnim->mNumPositionKeys && !pBoneAnim->mNumRotationKeys && !pBoneAnim->mNumScalingKeys)
if (!pNodeAnim->mNumPositionKeys && !pNodeAnim->mNumRotationKeys && !pNodeAnim->mNumScalingKeys)
{
this->ReportWarning("A bone animation channel has no keys");
}
#endif
// otherwise check whether one of the keys exceeds the total duration of the animation
if (pBoneAnim->mNumPositionKeys)
if (pNodeAnim->mNumPositionKeys)
{
if (!pBoneAnim->mPositionKeys)
if (!pNodeAnim->mPositionKeys)
{
this->ReportError("aiBoneAnim::mPositionKeys is NULL (aiBoneAnim::mNumPositionKeys is %i)",
pBoneAnim->mNumPositionKeys);
this->ReportError("aiNodeAnim::mPositionKeys is NULL (aiNodeAnim::mNumPositionKeys is %i)",
pNodeAnim->mNumPositionKeys);
}
double dLast = -0.1;
for (unsigned int i = 0; i < pBoneAnim->mNumPositionKeys;++i)
for (unsigned int i = 0; i < pNodeAnim->mNumPositionKeys;++i)
{
if (pBoneAnim->mPositionKeys[i].mTime > pAnimation->mDuration)
if (pNodeAnim->mPositionKeys[i].mTime > pAnimation->mDuration)
{
this->ReportError("aiBoneAnim::mPositionKeys[%i].mTime (%.5f) is larger "
this->ReportError("aiNodeAnim::mPositionKeys[%i].mTime (%.5f) is larger "
"than aiAnimation::mDuration (which is %.5f)",i,
(float)pBoneAnim->mPositionKeys[i].mTime,
(float)pNodeAnim->mPositionKeys[i].mTime,
(float)pAnimation->mDuration);
}
if (pBoneAnim->mPositionKeys[i].mTime <= dLast)
if (pNodeAnim->mPositionKeys[i].mTime <= dLast)
{
this->ReportWarning("aiBoneAnim::mPositionKeys[%i].mTime (%.5f) is smaller "
this->ReportWarning("aiNodeAnim::mPositionKeys[%i].mTime (%.5f) is smaller "
"than aiAnimation::mPositionKeys[%i] (which is %.5f)",i,
(float)pBoneAnim->mPositionKeys[i].mTime,
(float)pNodeAnim->mPositionKeys[i].mTime,
i-1, (float)dLast);
}
dLast = pBoneAnim->mPositionKeys[i].mTime;
dLast = pNodeAnim->mPositionKeys[i].mTime;
}
}
// rotation keys
if (pBoneAnim->mNumRotationKeys)
if (pNodeAnim->mNumRotationKeys)
{
if (!pBoneAnim->mRotationKeys)
if (!pNodeAnim->mRotationKeys)
{
this->ReportError("aiBoneAnim::mRotationKeys is NULL (aiBoneAnim::mNumRotationKeys is %i)",
pBoneAnim->mNumRotationKeys);
this->ReportError("aiNodeAnim::mRotationKeys is NULL (aiNodeAnim::mNumRotationKeys is %i)",
pNodeAnim->mNumRotationKeys);
}
double dLast = -0.1;
for (unsigned int i = 0; i < pBoneAnim->mNumRotationKeys;++i)
for (unsigned int i = 0; i < pNodeAnim->mNumRotationKeys;++i)
{
if (pBoneAnim->mRotationKeys[i].mTime > pAnimation->mDuration)
if (pNodeAnim->mRotationKeys[i].mTime > pAnimation->mDuration)
{
this->ReportError("aiBoneAnim::mRotationKeys[%i].mTime (%.5f) is larger "
this->ReportError("aiNodeAnim::mRotationKeys[%i].mTime (%.5f) is larger "
"than aiAnimation::mDuration (which is %.5f)",i,
(float)pBoneAnim->mRotationKeys[i].mTime,
(float)pNodeAnim->mRotationKeys[i].mTime,
(float)pAnimation->mDuration);
}
if (pBoneAnim->mRotationKeys[i].mTime <= dLast)
if (pNodeAnim->mRotationKeys[i].mTime <= dLast)
{
this->ReportWarning("aiBoneAnim::mRotationKeys[%i].mTime (%.5f) is smaller "
this->ReportWarning("aiNodeAnim::mRotationKeys[%i].mTime (%.5f) is smaller "
"than aiAnimation::mRotationKeys[%i] (which is %.5f)",i,
(float)pBoneAnim->mRotationKeys[i].mTime,
(float)pNodeAnim->mRotationKeys[i].mTime,
i-1, (float)dLast);
}
dLast = pBoneAnim->mRotationKeys[i].mTime;
dLast = pNodeAnim->mRotationKeys[i].mTime;
}
}
// scaling keys
if (pBoneAnim->mNumScalingKeys)
if (pNodeAnim->mNumScalingKeys)
{
if (!pBoneAnim->mScalingKeys)
if (!pNodeAnim->mScalingKeys)
{
this->ReportError("aiBoneAnim::mScalingKeys is NULL (aiBoneAnim::mNumScalingKeys is %i)",
pBoneAnim->mNumScalingKeys);
this->ReportError("aiNodeAnim::mScalingKeys is NULL (aiNodeAnim::mNumScalingKeys is %i)",
pNodeAnim->mNumScalingKeys);
}
double dLast = -0.1;
for (unsigned int i = 0; i < pBoneAnim->mNumScalingKeys;++i)
for (unsigned int i = 0; i < pNodeAnim->mNumScalingKeys;++i)
{
if (pBoneAnim->mScalingKeys[i].mTime > pAnimation->mDuration)
if (pNodeAnim->mScalingKeys[i].mTime > pAnimation->mDuration)
{
this->ReportError("aiBoneAnim::mScalingKeys[%i].mTime (%.5f) is larger "
this->ReportError("aiNodeAnim::mScalingKeys[%i].mTime (%.5f) is larger "
"than aiAnimation::mDuration (which is %.5f)",i,
(float)pBoneAnim->mScalingKeys[i].mTime,
(float)pNodeAnim->mScalingKeys[i].mTime,
(float)pAnimation->mDuration);
}
if (pBoneAnim->mScalingKeys[i].mTime <= dLast)
if (pNodeAnim->mScalingKeys[i].mTime <= dLast)
{
this->ReportWarning("aiBoneAnim::mScalingKeys[%i].mTime (%.5f) is smaller "
this->ReportWarning("aiNodeAnim::mScalingKeys[%i].mTime (%.5f) is smaller "
"than aiAnimation::mScalingKeys[%i] (which is %.5f)",i,
(float)pBoneAnim->mScalingKeys[i].mTime,
(float)pNodeAnim->mScalingKeys[i].mTime,
i-1, (float)dLast);
}
dLast = pBoneAnim->mScalingKeys[i].mTime;
dLast = pNodeAnim->mScalingKeys[i].mTime;
}
}
}

View File

@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
struct aiBone;
struct aiMesh;
struct aiAnimation;
struct aiBoneAnim;
struct aiNodeAnim;
struct aiTexture;
struct aiMaterial;
struct aiNode;
@ -152,7 +152,7 @@ protected:
* @param pBoneAnim Input bone animation
*/
void Validate( const aiAnimation* pAnimation,
const aiBoneAnim* pBoneAnim);
const aiNodeAnim* pBoneAnim);
// -------------------------------------------------------------------
/** Validates a node and all of its subnodes

View File

@ -420,15 +420,15 @@ void XFileImporter::CreateAnimations( aiScene* pScene, const XFile::Scene* pData
// duration will be determined by the maximum length
nanim->mDuration = 0;
nanim->mTicksPerSecond = pData->mAnimTicksPerSecond;
nanim->mNumBones = (unsigned int)anim->mAnims.size();
nanim->mBones = new aiBoneAnim*[nanim->mNumBones];
nanim->mNumChannels = (unsigned int)anim->mAnims.size();
nanim->mChannels = new aiNodeAnim*[nanim->mNumChannels];
for( unsigned int b = 0; b < anim->mAnims.size(); b++)
{
const XFile::AnimBone* bone = anim->mAnims[b];
aiBoneAnim* nbone = new aiBoneAnim;
nbone->mBoneName.Set( bone->mBoneName);
nanim->mBones[b] = nbone;
aiNodeAnim* nbone = new aiNodeAnim;
nbone->mNodeName.Set( bone->mBoneName);
nanim->mChannels[b] = nbone;
// apply the LH->RH conversion if the animation affects the root bone
bool isRootAnim = (bone->mBoneName == pScene->mRootNode->mName.data);

View File

@ -69,14 +69,11 @@ struct aiQuatKey
/** Describes the animation of a single node. The name specifies the bone/node which is affected by this
* animation channel. The keyframes are given in three separate series of values, one each for
* position, rotation and scaling.
* <br>
* NOTE: The name "BoneAnim" is misleading. This structure is also used to describe
* the animation of regular nodes on the node graph. They needn't be nodes.
*/
struct aiBoneAnim
struct aiNodeAnim
{
/** The name of the bone affected by this animation. */
C_STRUCT aiString mBoneName;
/** The name of the node affected by this animation. */
C_STRUCT aiString mNodeName;
/** The number of position keys */
unsigned int mNumPositionKeys;
@ -100,14 +97,14 @@ struct aiBoneAnim
C_STRUCT aiVectorKey* mScalingKeys;
#ifdef __cplusplus
aiBoneAnim()
aiNodeAnim()
{
mNumPositionKeys = 0; mPositionKeys = NULL;
mNumRotationKeys= 0; mRotationKeys = NULL;
mNumScalingKeys = 0; mScalingKeys = NULL;
}
~aiBoneAnim()
~aiNodeAnim()
{
if (mNumPositionKeys)
delete [] mPositionKeys;
@ -119,7 +116,7 @@ struct aiBoneAnim
#endif // __cplusplus
};
/** An animation consists of keyframe data for a number of bones. For each bone affected by the animation
/** An animation consists of keyframe data for a number of nodes. For each node affected by the animation
* a separate series of data is given.
*/
struct aiAnimation
@ -134,28 +131,28 @@ struct aiAnimation
/** Ticks per second. 0 if not specified in the imported file */
double mTicksPerSecond;
/** The number of bone animation channels. Each channel affects a single bone. */
unsigned int mNumBones;
/** The bone animation channels. Each channel affects a single bone. The array
* is mNumBones in size.
/** The number of bone animation channels. Each channel affects a single node. */
unsigned int mNumChannels;
/** The node animation channels. Each channel affects a single node. The array
* is mNumChannels in size.
*/
C_STRUCT aiBoneAnim** mBones;
C_STRUCT aiNodeAnim** mChannels;
#ifdef __cplusplus
aiAnimation()
{
mDuration = 0;
mTicksPerSecond = 0;
mNumBones = 0; mBones = NULL;
mNumChannels = 0; mChannels = NULL;
}
~aiAnimation()
{
if (mNumBones)
if (mNumChannels)
{
for( unsigned int a = 0; a < mNumBones; a++)
delete mBones[a];
delete [] mBones;
for( unsigned int a = 0; a < mNumChannels; a++)
delete mChannels[a];
delete [] mChannels;
}
}
#endif // __cplusplus

View File

@ -45,7 +45,7 @@ void JNIEnvironment::_assimp::_BoneAnim::Initialize()
JNIEnvironment::Get()->ThrowNativeError("Unable to load all fields of class assimp.BoneAnim");
}
// ------------------------------------------------------------------------------------------------
void JNIEnvironment::_assimp::_BoneAnim::Fill(jobject obj,const aiBoneAnim* pcSrc)
void JNIEnvironment::_assimp::_BoneAnim::Fill(jobject obj,const aiNodeAnim* pcSrc)
{
JNIEnv* pc = JNIEnvironment::Get()->GetThread()->m_pcEnv;

View File

@ -335,7 +335,7 @@ public:
struct _BoneAnim : public _Base
{
void Initialize();
AIJ_SET_INPUT_TYPE(aiBoneAnim);
AIJ_SET_INPUT_TYPE(aiNodeAnim);
//! Represents the JNI interface to class assimp.BoneAnim.KeyFrame<quak>
struct _KeyFrame