1//************************************ bs::framework - Copyright 2018 Marko Pintera **************************************//
2//*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********//
3#include "Animation/BsSkeletonMask.h"
4#include "Animation/BsSkeleton.h"
5
6namespace bs
7{
8 SkeletonMask::SkeletonMask(UINT32 numBones)
9 :mIsDisabled(numBones)
10 { }
11
12 bool SkeletonMask::isEnabled(UINT32 boneIdx) const
13 {
14 if (boneIdx >= (UINT32)mIsDisabled.size())
15 return true;
16
17 return !mIsDisabled[boneIdx];
18 }
19
20 SkeletonMaskBuilder::SkeletonMaskBuilder(const SPtr<Skeleton>& skeleton)
21 :mSkeleton(skeleton), mMask(skeleton->getNumBones())
22 { }
23
24 void SkeletonMaskBuilder::setBoneState(const String& name, bool enabled)
25 {
26 UINT32 numBones = mSkeleton->getNumBones();
27 for(UINT32 i = 0; i < numBones; i++)
28 {
29 if(mSkeleton->getBoneInfo(i).name == name)
30 {
31 mMask.mIsDisabled[i] = !enabled;
32 break;
33 }
34 }
35 }
36}