Exemple #1
0
void CSMotion::SortBonesBySkeleton(BoneVec& bones)
{
    BoneMotionVec new_bone_mots;
    for (BoneIt b_it = bones.begin(); b_it != bones.end(); ++b_it)
    {
        st_BoneMotion* BM = FindBoneMotion((*b_it)->Name());
        if (!BM)
        {
            CBone* B = *(b_it);
            bone_mots.push_back(st_BoneMotion());
            st_BoneMotion& bm0 = bone_mots[0];
            st_BoneMotion& bm = bone_mots.back();
            bm.SetName(B->Name().c_str());
            bm.m_Flags.assign(bm0.m_Flags);

            for (int ch = 0; ch < ctMaxChannel; ++ch)
            {
                bm.envs[ch] = xr_new<CEnvelope>();
                //. bm.envs[ch]->Load_2(F);
            }
            bm.envs[ctPositionX]->InsertKey(0.0f, B->_Offset().x);
            bm.envs[ctPositionY]->InsertKey(0.0f, B->_Offset().y);
            bm.envs[ctPositionZ]->InsertKey(0.0f, B->_Offset().z);
            bm.envs[ctRotationH]->InsertKey(0.0f, B->_Rotate().x);
            bm.envs[ctRotationP]->InsertKey(0.0f, B->_Rotate().y);
            bm.envs[ctRotationB]->InsertKey(0.0f, B->_Rotate().z);
            BM = &bm;
        };
        new_bone_mots.push_back(*BM);
    }
    bone_mots.clear();
    bone_mots = new_bone_mots;
}