mirror of
https://github.com/OpenMW/openmw.git
synced 2025-07-12 15:11:42 +00:00
automatic clang format
This commit is contained in:
parent
d8de56e33c
commit
7ef6b3cb62
1 changed files with 23 additions and 68 deletions
|
@ -31,104 +31,59 @@ namespace Resource
|
||||||
, mVFS(vfs)
|
, mVFS(vfs)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RetrieveAnimationsVisitor::belongsToLeftUpperExtremity(const std::string& name)
|
bool RetrieveAnimationsVisitor::belongsToLeftUpperExtremity(const std::string& name)
|
||||||
{
|
{
|
||||||
const int bodypartCount = 25;
|
const int bodypartCount = 25;
|
||||||
static const std::array<std::string_view, bodypartCount> boneNames = {
|
static const std::array<std::string_view, bodypartCount> boneNames
|
||||||
"bip01_l_clavicle",
|
= { "bip01_l_clavicle", "left_clavicle", "bip01_l_upperarm", "left_upper_arm", "bip01_l_forearm",
|
||||||
"left_clavicle",
|
"bip01_l_hand", "left_hand", "left_wrist", "shield_bone", "bip01_l_pinky1", "bip01_l_pinky2",
|
||||||
"bip01_l_upperarm",
|
"bip01_l_pinky3", "bip01_l_ring1", "bip01_l_ring2", "bip01_l_ring3", "bip01_l_middle1",
|
||||||
"left_upper_arm",
|
"bip01_l_middle2", "bip01_l_middle3", "bip01_l_pointer1", "bip01_l_pointer2", "bip01_l_pointer3",
|
||||||
"bip01_l_forearm",
|
"bip01_l_thumb1", "bip01_l_thumb2", "bip01_l_thumb3", "left_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"
|
|
||||||
};
|
|
||||||
|
|
||||||
for (unsigned short int i = 0; i < bodypartCount; i++)
|
for (unsigned short int i = 0; i < bodypartCount; i++)
|
||||||
{
|
{
|
||||||
if (name == boneNames[i])
|
if (name == boneNames[i])
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RetrieveAnimationsVisitor::belongsToRightUpperExtremity(const std::string& name)
|
bool RetrieveAnimationsVisitor::belongsToRightUpperExtremity(const std::string& name)
|
||||||
{
|
{
|
||||||
const int bodypartCount = 25;
|
const int bodypartCount = 25;
|
||||||
static const std::array<std::string_view, bodypartCount> boneNames = {
|
static const std::array<std::string_view, bodypartCount> boneNames = { "bip01_r_clavicle", "right_clavicle",
|
||||||
"bip01_r_clavicle",
|
"bip01_r_upperarm", "right_upper_arm", "bip01_r_forearm", "bip01_r_hand", "right_hand", "right_wrist",
|
||||||
"right_clavicle",
|
"bip01_r_thumb1", "bip01_r_thumb2", "bip01_r_thumb3", "weapon_bone", "bip01_r_pinky1", "bip01_r_pinky2",
|
||||||
"bip01_r_upperarm",
|
"bip01_r_pinky3", "bip01_r_ring1", "bip01_r_ring2", "bip01_r_ring3", "bip01_r_middle1", "bip01_r_middle2",
|
||||||
"right_upper_arm",
|
"bip01_r_middle3", "bip01_r_pointer1", "bip01_r_pointer2", "bip01_r_pointer3", "right_forearm" };
|
||||||
"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"
|
|
||||||
};
|
|
||||||
|
|
||||||
for (unsigned short int i = 0; i < bodypartCount; i++)
|
for (unsigned short int i = 0; i < bodypartCount; i++)
|
||||||
{
|
{
|
||||||
if (name == boneNames[i])
|
if (name == boneNames[i])
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RetrieveAnimationsVisitor::belongsToTorso(const std::string& name)
|
bool RetrieveAnimationsVisitor::belongsToTorso(const std::string& name)
|
||||||
{
|
{
|
||||||
const int bodypartCount = 8;
|
const int bodypartCount = 8;
|
||||||
static const std::array<std::string_view, bodypartCount> boneNames = {
|
static const std::array<std::string_view, bodypartCount> 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" };
|
||||||
};
|
|
||||||
|
|
||||||
for (unsigned short int i = 0; i < bodypartCount; i++)
|
for (unsigned short int i = 0; i < bodypartCount; i++)
|
||||||
{
|
{
|
||||||
if (name == boneNames[i])
|
if (name == boneNames[i])
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void RetrieveAnimationsVisitor::addKeyframeController(const std::string& name, const osg::Node& node)
|
void RetrieveAnimationsVisitor::addKeyframeController(const std::string& name, const osg::Node& node)
|
||||||
{
|
{
|
||||||
osg::ref_ptr<SceneUtil::OsgAnimationController> callback = new SceneUtil::OsgAnimationController();
|
osg::ref_ptr<SceneUtil::OsgAnimationController> callback = new SceneUtil::OsgAnimationController();
|
||||||
|
@ -155,7 +110,7 @@ namespace Resource
|
||||||
|
|
||||||
const osgAnimation::ChannelList& channels = animation->getChannels();
|
const osgAnimation::ChannelList& channels = animation->getChannels();
|
||||||
for (const auto& channel : channels)
|
for (const auto& channel : channels)
|
||||||
{
|
{
|
||||||
if (name == "Bip01 R Clavicle")
|
if (name == "Bip01 R Clavicle")
|
||||||
{
|
{
|
||||||
if (!belongsToRightUpperExtremity(channel->getTargetName()))
|
if (!belongsToRightUpperExtremity(channel->getTargetName()))
|
||||||
|
@ -174,7 +129,7 @@ namespace Resource
|
||||||
else if (belongsToRightUpperExtremity(channel->getTargetName())
|
else if (belongsToRightUpperExtremity(channel->getTargetName())
|
||||||
|| belongsToLeftUpperExtremity(channel->getTargetName())
|
|| belongsToLeftUpperExtremity(channel->getTargetName())
|
||||||
|| belongsToTorso(channel->getTargetName()))
|
|| belongsToTorso(channel->getTargetName()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mergedAnimationTrack->addChannel(channel.get()->clone()); // is ->clone needed?
|
mergedAnimationTrack->addChannel(channel.get()->clone()); // is ->clone needed?
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue