Files
o3de/Gems/EMotionFX/Code/MCore/Source/Attribute.h
T
Steve Pham b4a2edec6a Final update copyright headers to reference license files at the repo root (#1693)
* Final update copyright headers to reference license files at the repo root

Signed-off-by: spham <spham@amazon.com>

* Fix copyright validator unit tests to support the stale O3DE header scenario

Signed-off-by: spham <spham@amazon.com>
2021-06-30 19:51:55 -07:00

97 lines
3.9 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
*
*/
#pragma once
// include the required headers
#include "StandardHeaders.h"
#include "MemoryManager.h"
#include "Endian.h"
#include "Stream.h"
#include <AzCore/std/string/string.h>
namespace EMotionFX
{
namespace Network
{
class AnimGraphSnapshotChunkSerializer;
}
}
namespace MCore
{
// forward declarations
class AttributeSettings;
// the attribute interface types
enum : uint32
{
ATTRIBUTE_INTERFACETYPE_FLOATSPINNER = 0, // MCore::AttributeFloat
ATTRIBUTE_INTERFACETYPE_FLOATSLIDER = 1, // MCore::AttributeFloat
ATTRIBUTE_INTERFACETYPE_INTSPINNER = 2, // MCore::AttributeFloat
ATTRIBUTE_INTERFACETYPE_INTSLIDER = 3, // MCore::AttributeFloat
ATTRIBUTE_INTERFACETYPE_COMBOBOX = 4, // MCore::AttributeFloat
ATTRIBUTE_INTERFACETYPE_CHECKBOX = 5, // MCore::AttributeFloat
ATTRIBUTE_INTERFACETYPE_VECTOR2 = 6, // MCore::AttributeVector2
ATTRIBUTE_INTERFACETYPE_VECTOR3GIZMO = 7, // MCore::AttributeVector3
ATTRIBUTE_INTERFACETYPE_VECTOR4 = 8, // MCore::AttributeVector4
ATTRIBUTE_INTERFACETYPE_COLOR = 10, // MCore::AttributeVector4
ATTRIBUTE_INTERFACETYPE_STRING = 11, // MCore::AttributeString
ATTRIBUTE_INTERFACETYPE_TAG = 26, // MCore::AttributeBool
ATTRIBUTE_INTERFACETYPE_VECTOR3 = 113212, // MCore::AttributeVector3
ATTRIBUTE_INTERFACETYPE_PROPERTYSET = 113213, // MCore::AttributeSet
ATTRIBUTE_INTERFACETYPE_DEFAULT = 0xFFFFFFFF// use the default attribute type that the specific attribute class defines as default
};
/**
*
*
*
*/
class MCORE_API Attribute
{
friend class AttributeFactory;
public:
virtual ~Attribute();
virtual Attribute* Clone() const = 0;
virtual const char* GetTypeString() const = 0;
MCORE_INLINE uint32 GetType() const { return mTypeID; }
virtual bool InitFromString(const AZStd::string& valueString) = 0;
virtual bool ConvertToString(AZStd::string& outString) const = 0;
virtual bool InitFrom(const Attribute* other) = 0;
virtual uint32 GetClassSize() const = 0;
virtual uint32 GetDefaultInterfaceType() const = 0;
// These two members and ReadData can go away once we put the old-format parser
bool Read(Stream* stream, MCore::Endian::EEndianType sourceEndianType);
virtual uint32 GetDataSize() const = 0; // data only
Attribute& operator=(const Attribute& other);
virtual void NetworkSerialize(EMotionFX::Network::AnimGraphSnapshotChunkSerializer&) {};
protected:
uint32 mTypeID; /**< The unique type ID of the attribute class. */
Attribute(uint32 typeID);
/**
* Read the attribute info and data from a given stream.
* Please note that the endian information of the actual data is not being converted. You have to handle that yourself.
* The data endian conversion could be done with for example the static Attribute::ConvertDataEndian method.
* @param stream The stream to read the info and data from.
* @param endianType The endian type in which the data is stored in the stream.
* @param version The version of the attribute.
* @result Returns true when successful, or false when reading failed.
*/
virtual bool ReadData(MCore::Stream* stream, MCore::Endian::EEndianType streamEndianType, uint8 version) = 0;
};
} // namespace MCore