36 lines
960 B
C++
36 lines
960 B
C++
/*
|
|
* Copyright (c) Contributors to the Open 3D Engine Project
|
|
*
|
|
* 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
|