Files
o3de/Gems/EMotionFX/Code/MCore/Source/AttributeInt32.cpp
T
Steve Pham 38261d0800 Shorten copyright headers by splitting into 2 lines (#2213)
* Updated all copyright headers to split the longer original copyright line into 2 shorter lines

Signed-off-by: Steve Pham <spham@amazon.com>
2021-07-16 15:25:48 -07:00

37 lines
1.0 KiB
C++

/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "AttributeFloat.h"
#include "AttributeInt32.h"
#include "AttributeBool.h"
#include <MCore/Source/AttributeAllocator.h>
namespace MCore
{
AZ_CLASS_ALLOCATOR_IMPL(AttributeInt32, AttributeAllocator, 0)
bool AttributeInt32::InitFrom(const Attribute* other)
{
switch (other->GetType())
{
case TYPE_ID:
mValue = static_cast<const AttributeInt32*>(other)->GetValue();
return true;
case MCore::AttributeBool::TYPE_ID:
mValue = static_cast<const AttributeBool*>(other)->GetValue();
return true;
case MCore::AttributeFloat::TYPE_ID:
mValue = static_cast<int32>(static_cast<const AttributeFloat*>(other)->GetValue());
return true;
default:
return false;
}
}
} // namespace MCore