-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAvatarMask.cpp
More file actions
80 lines (73 loc) · 1.83 KB
/
Copy pathAvatarMask.cpp
File metadata and controls
80 lines (73 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#include "AvatarMask.h"
#include "Skeleton.h"
AvatarMask::~AvatarMask()
{
for (auto& mask : m_BoneMasks)
{
delete mask;
}
}
bool AvatarMask::IsBoneEnabled(BoneRegion region)
{
if (useAll)
return true;
switch (region)
{
case BoneRegion::Root:
return useLower;
case BoneRegion::Spine:
return useLower;
case BoneRegion::LeftArm:
return useUpper;
case BoneRegion::RightArm:
return useUpper;
case BoneRegion::Neck:
return useUpper;
case BoneRegion::LeftLeg:
return useLower;
case BoneRegion::RightLeg:
return useLower;
}
return false;
}
void AvatarMask::ReCreateMask(AvatarMask* _otherMask)
{
/* for (auto* boneMask : _otherMask->m_BoneMasks)
{
BoneMask* copy = new BoneMask(*boneMask);
m_BoneMasks.push_back(copy);
}*/
//m_BoneMasks = _otherMask->m_BoneMasks;
for(int i = 0; i < _otherMask->m_BoneMasks.size(); ++i)
{
m_BoneMasks[i]->isEnabled = _otherMask->m_BoneMasks[i]->isEnabled;
}
isHumanoid = _otherMask->isHumanoid;
useAll = _otherMask->useAll;
useUpper = _otherMask->useUpper;
useLower = _otherMask->useLower;
}
bool AvatarMask::IsBoneEnabled(const std::string& name)
{
for (const auto& mask : m_BoneMasks)
{
if (mask == nullptr) return false;
if (mask->boneName == name)
return mask->isEnabled;
}
return false;
}
BoneMask* AvatarMask::MakeBoneMask(Bone* Bone)
{
if (!Bone) return nullptr;
BoneMask* newMask = new BoneMask();
newMask->boneName = Bone->m_name;
newMask->isEnabled = true;
m_BoneMasks.push_back(newMask);
for (auto& child : Bone->m_children)
{
BoneMask* childMask = MakeBoneMask(child);
newMask->m_children.push_back(childMask);
}
return newMask;
}