|
|
|
@ -37,11 +37,11 @@ namespace Resource
|
|
|
|
|
|
|
|
|
|
bool RetrieveAnimationsVisitor::belongsToLeftUpperExtremity(const std::string& name)
|
|
|
|
|
{
|
|
|
|
|
static const std::array boneNames = { "bip01_l_clavicle", "left_clavicle", "bip01_l_upperarm", "left_upper_arm",
|
|
|
|
|
"bip01_l_forearm", "bip01_l_hand", "left_hand", "left_wrist", "shield_bone", "bip01_l_pinky1",
|
|
|
|
|
"bip01_l_pinky2", "bip01_l_pinky3", "bip01_l_ring1", "bip01_l_ring2", "bip01_l_ring3", "bip01_l_middle1",
|
|
|
|
|
"bip01_l_middle2", "bip01_l_middle3", "bip01_l_pointer1", "bip01_l_pointer2", "bip01_l_pointer3",
|
|
|
|
|
"bip01_l_thumb1", "bip01_l_thumb2", "bip01_l_thumb3", "left_forearm" };
|
|
|
|
|
static const std::array boneNames = { "bip01 l clavicle", "left clavicle", "bip01 l upperarm", "left upper arm",
|
|
|
|
|
"bip01 l forearm", "bip01 l hand", "left hand", "left wrist", "shield bone", "bip01 l pinky1",
|
|
|
|
|
"bip01 l pinky2", "bip01 l pinky3", "bip01 l ring1", "bip01 l ring2", "bip01 l ring3", "bip01 l middle1",
|
|
|
|
|
"bip01 l middle2", "bip01 l middle3", "bip01 l pointer1", "bip01 l pointer2", "bip01 l pointer3",
|
|
|
|
|
"bip01 l thumb1", "bip01 l thumb2", "bip01 l thumb3", "left forearm" };
|
|
|
|
|
|
|
|
|
|
if (std::find(boneNames.begin(), boneNames.end(), name) != boneNames.end())
|
|
|
|
|
return true;
|
|
|
|
@ -51,11 +51,11 @@ namespace Resource
|
|
|
|
|
|
|
|
|
|
bool RetrieveAnimationsVisitor::belongsToRightUpperExtremity(const std::string& name)
|
|
|
|
|
{
|
|
|
|
|
static const std::array boneNames = { "bip01_r_clavicle", "right_clavicle", "bip01_r_upperarm",
|
|
|
|
|
"right_upper_arm", "bip01_r_forearm", "bip01_r_hand", "right_hand", "right_wrist", "bip01_r_thumb1",
|
|
|
|
|
"bip01_r_thumb2", "bip01_r_thumb3", "weapon_bone", "bip01_r_pinky1", "bip01_r_pinky2", "bip01_r_pinky3",
|
|
|
|
|
"bip01_r_ring1", "bip01_r_ring2", "bip01_r_ring3", "bip01_r_middle1", "bip01_r_middle2", "bip01_r_middle3",
|
|
|
|
|
"bip01_r_pointer1", "bip01_r_pointer2", "bip01_r_pointer3", "right_forearm" };
|
|
|
|
|
static const std::array boneNames = { "bip01 r clavicle", "right clavicle", "bip01 r upperarm",
|
|
|
|
|
"right upper arm", "bip01 r forearm", "bip01 r hand", "right hand", "right wrist", "bip01 r thumb1",
|
|
|
|
|
"bip01 r thumb2", "bip01 r thumb3", "weapon bone", "bip01 r pinky1", "bip01 r pinky2", "bip01 r pinky3",
|
|
|
|
|
"bip01 r ring1", "bip01 r ring2", "bip01 r ring3", "bip01 r middle1", "bip01 r middle2", "bip01 r middle3",
|
|
|
|
|
"bip01 r pointer1", "bip01 r pointer2", "bip01 r pointer3", "right forearm" };
|
|
|
|
|
|
|
|
|
|
if (std::find(boneNames.begin(), boneNames.end(), name) != boneNames.end())
|
|
|
|
|
return true;
|
|
|
|
@ -66,7 +66,7 @@ namespace Resource
|
|
|
|
|
bool RetrieveAnimationsVisitor::belongsToTorso(const std::string& name)
|
|
|
|
|
{
|
|
|
|
|
static const std::array boneNames
|
|
|
|
|
= { "bip01_spine1", "bip01_spine2", "bip01_neck", "bip01_head", "head", "neck", "chest", "groin" };
|
|
|
|
|
= { "bip01 spine1", "bip01 spine2", "bip01 neck", "bip01 head", "head", "neck", "chest", "groin" };
|
|
|
|
|
|
|
|
|
|
if (std::find(boneNames.begin(), boneNames.end(), name) != boneNames.end())
|
|
|
|
|
return true;
|
|
|
|
@ -88,9 +88,7 @@ namespace Resource
|
|
|
|
|
{
|
|
|
|
|
//"Default" is osg dae plugin's default naming scheme for unnamed animations
|
|
|
|
|
if (animation->getName() == "Default")
|
|
|
|
|
{
|
|
|
|
|
animation->setName(std::string("idle"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
osg::ref_ptr<Resource::Animation> mergedAnimationTrack = new Resource::Animation;
|
|
|
|
|
const std::string animationName = animation->getName();
|
|
|
|
@ -99,6 +97,9 @@ namespace Resource
|
|
|
|
|
const osgAnimation::ChannelList& channels = animation->getChannels();
|
|
|
|
|
for (const auto& channel : channels)
|
|
|
|
|
{
|
|
|
|
|
// Repalce channel target name to match the renamed bones/transforms
|
|
|
|
|
channel->setTargetName(Misc::StringUtils::underscoresToSpaces(channel->getTargetName()));
|
|
|
|
|
|
|
|
|
|
if (name == "Bip01 R Clavicle")
|
|
|
|
|
{
|
|
|
|
|
if (!belongsToRightUpperExtremity(channel->getTargetName()))
|
|
|
|
|