You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.0 KiB
C++
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:
|
|
m_value = static_cast<const AttributeInt32*>(other)->GetValue();
|
|
return true;
|
|
case MCore::AttributeBool::TYPE_ID:
|
|
m_value = static_cast<const AttributeBool*>(other)->GetValue();
|
|
return true;
|
|
case MCore::AttributeFloat::TYPE_ID:
|
|
m_value = static_cast<int32>(static_cast<const AttributeFloat*>(other)->GetValue());
|
|
return true;
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
} // namespace MCore
|