Removed ReadDataSize/ReadData() helpers for attributes

Used only by legacy binary file format

Signed-off-by: Benjamin Jillich <jillich@amazon.com>
This commit is contained in:
Benjamin Jillich
2021-07-26 09:57:01 +02:00
parent a3e90b878c
commit a287b67b43
14 changed files with 3 additions and 294 deletions
@@ -79,9 +79,6 @@ namespace EMotionFX
AttributePose(AnimGraphPose* pose)
: MCore::Attribute(TYPE_ID) { mValue = pose; }
~AttributePose() {}
uint32 GetDataSize() const override { return 0; }
bool ReadData(MCore::Stream* stream, MCore::Endian::EEndianType streamEndianType, uint8 version) override { MCORE_UNUSED(stream); MCORE_UNUSED(streamEndianType); MCORE_UNUSED(version); return false; } // unsupported
};
@@ -130,9 +127,6 @@ namespace EMotionFX
AttributeMotionInstance(MotionInstance* motionInstance)
: MCore::Attribute(TYPE_ID) { mValue = motionInstance; }
~AttributeMotionInstance() {}
uint32 GetDataSize() const override { return 0; }
bool ReadData(MCore::Stream* stream, MCore::Endian::EEndianType streamEndianType, uint8 version) override { MCORE_UNUSED(stream); MCORE_UNUSED(streamEndianType); MCORE_UNUSED(version); return false; } // unsupported
};
class AnimGraphPropertyUtils
@@ -7,6 +7,7 @@
*/
#pragma once
#include <MCore/Source/Config.h>
namespace EMotionFX
@@ -20,8 +21,6 @@ namespace EMotionFX
SHARED_CHUNK_TIMESTAMP = 51
};
// a chunk
struct FileChunk
{
uint32 mChunkID; // the chunk ID
@@ -29,7 +28,6 @@ namespace EMotionFX
uint32 mVersion; // the version of the chunk
};
// color [0..1] range
struct FileColor
{
@@ -39,16 +37,12 @@ namespace EMotionFX
float mA; // alpha
};
// a 2D vector
struct FileVector2
{
float mX;
float mY;
};
// a 3D vector
struct FileVector3
{
float mX; // x+ = to the right
@@ -56,7 +50,6 @@ namespace EMotionFX
float mZ; // z+ = up
};
// a compressed 3D vector
struct File16BitVector3
{
@@ -65,7 +58,6 @@ namespace EMotionFX
uint16 mZ; // z+ = up
};
// a compressed 3D vector
struct File8BitVector3
{
@@ -74,8 +66,6 @@ namespace EMotionFX
uint8 mZ; // z+ = up
};
// a quaternion
struct FileQuaternion
{
float mX;
@@ -84,7 +74,6 @@ namespace EMotionFX
float mW;
};
// the 16 bit component quaternion
struct File16BitQuaternion
{
@@ -94,7 +83,6 @@ namespace EMotionFX
int16 mW;
};
// a time stamp chunk
struct FileTime
{
@@ -105,17 +93,5 @@ namespace EMotionFX
int8 mMinutes;
int8 mSeconds;
};
// attribute
struct FileAttribute
{
uint32 mDataType;
uint32 mNumBytes;
uint32 mFlags;
// followed by:
// uint8 mData[mNumBytes];
};
} // namespace FileFormat
} // namespace EMotionFX
} // namespace EMotionFX
+1 -28
View File
@@ -6,7 +6,6 @@
*
*/
// include required headers
#include "Attribute.h"
#include "AttributeFactory.h"
#include "AttributeString.h"
@@ -14,20 +13,15 @@
namespace MCore
{
// constructor
Attribute::Attribute(uint32 typeID)
{
mTypeID = typeID;
}
// destructor
Attribute::~Attribute()
{
}
// equal operator
Attribute& Attribute::operator=(const Attribute& other)
{
if (&other != this)
@@ -36,25 +30,4 @@ namespace MCore
}
return *this;
}
// read the attribute
bool Attribute::Read(Stream* stream, Endian::EEndianType sourceEndianType)
{
// read the version
uint8 version;
if (stream->Read(&version, sizeof(uint8)) == 0)
{
return false;
}
// read the data
const bool result = ReadData(stream, sourceEndianType, version);
if (result == false)
{
return false;
}
return true;
}
} // namespace MCore
} // namespace MCore
@@ -8,7 +8,6 @@
#pragma once
// include the required headers
#include "StandardHeaders.h"
#include "MemoryManager.h"
#include "Endian.h"
@@ -28,7 +27,6 @@ namespace MCore
// forward declarations
class AttributeSettings;
// the attribute interface types
enum : uint32
{
@@ -49,12 +47,6 @@ namespace MCore
ATTRIBUTE_INTERFACETYPE_DEFAULT = 0xFFFFFFFF// use the default attribute type that the specific attribute class defines as default
};
/**
*
*
*
*/
class MCORE_API Attribute
{
friend class AttributeFactory;
@@ -70,10 +62,6 @@ namespace MCore
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&) {};
@@ -82,16 +70,5 @@ namespace MCore
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
@@ -63,23 +63,5 @@ namespace MCore
: Attribute(TYPE_ID)
, mValue(value) {}
~AttributeBool() {}
uint32 GetDataSize() const override { return sizeof(int8); }
// read from a stream
bool ReadData(MCore::Stream* stream, MCore::Endian::EEndianType streamEndianType, uint8 version) override
{
MCORE_UNUSED(version);
MCORE_UNUSED(streamEndianType);
int8 streamValue;
if (stream->Read(&streamValue, sizeof(int8)) == 0)
{
return false;
}
mValue = (streamValue == 0) ? false : true;
return true;
}
};
} // namespace MCore
@@ -79,27 +79,5 @@ namespace MCore
: Attribute(TYPE_ID)
, mValue(value) { }
~AttributeColor() {}
uint32 GetDataSize() const override { return sizeof(RGBAColor); }
// read from a stream
bool ReadData(MCore::Stream* stream, MCore::Endian::EEndianType streamEndianType, uint8 version) override
{
MCORE_UNUSED(version);
// read the value
RGBAColor streamValue;
if (stream->Read(&streamValue, sizeof(RGBAColor)) == 0)
{
return false;
}
// convert endian
Endian::ConvertRGBAColor(&streamValue, streamEndianType);
mValue = streamValue;
return true;
}
};
} // namespace MCore
@@ -57,8 +57,6 @@ namespace MCore
private:
float mValue; /**< The float value. */
uint32 GetDataSize() const override { return sizeof(float); }
AttributeFloat()
: Attribute(TYPE_ID)
, mValue(0.0f) {}
@@ -66,21 +64,5 @@ namespace MCore
: Attribute(TYPE_ID)
, mValue(value) {}
~AttributeFloat() {}
// read from a stream
bool ReadData(MCore::Stream* stream, MCore::Endian::EEndianType streamEndianType, uint8 version) override
{
MCORE_UNUSED(version);
float streamValue;
if (stream->Read(&streamValue, sizeof(float)) == 0)
{
return false;
}
Endian::ConvertFloat(&streamValue, streamEndianType);
mValue = streamValue;
return true;
}
};
} // namespace MCore
@@ -64,23 +64,5 @@ namespace MCore
: Attribute(TYPE_ID)
, mValue(value) {}
~AttributeInt32() {}
uint32 GetDataSize() const override { return sizeof(int32); }
// read from a stream
bool ReadData(MCore::Stream* stream, MCore::Endian::EEndianType streamEndianType, uint8 version) override
{
MCORE_UNUSED(version);
int32 streamValue;
if (stream->Read(&streamValue, sizeof(int32)) == 0)
{
return false;
}
Endian::ConvertSignedInt32(&streamValue, streamEndianType);
mValue = streamValue;
return true;
}
};
} // namespace MCore
@@ -66,18 +66,5 @@ namespace MCore
: Attribute(TYPE_ID)
, mValue(pointer) { }
~AttributePointer() {}
uint32 GetDataSize() const override { return sizeof(void*); }
// read from a stream
bool ReadData(MCore::Stream* stream, MCore::Endian::EEndianType streamEndianType, uint8 version) override
{
MCORE_UNUSED(stream);
MCORE_UNUSED(streamEndianType);
MCORE_UNUSED(version);
MCore::LogWarning("MCore::AttributePointer::ReadData() - Pointer attributes cannot be read from disk.");
return false;
}
};
} // namespace MCore
@@ -82,26 +82,5 @@ namespace MCore
: Attribute(TYPE_ID)
, mValue(value) {}
~AttributeQuaternion() { }
uint32 GetDataSize() const override { return sizeof(AZ::Quaternion); }
// read from a stream
bool ReadData(MCore::Stream* stream, MCore::Endian::EEndianType streamEndianType, uint8 version) override
{
MCORE_UNUSED(version);
// read the value
AZ::Quaternion streamValue;
if (stream->Read(&streamValue, sizeof(AZ::Quaternion)) == 0)
{
return false;
}
// convert endian
Endian::ConvertQuaternion(&streamValue, streamEndianType);
mValue = streamValue;
return true;
}
};
} // namespace MCore
@@ -72,40 +72,5 @@ namespace MCore
: Attribute(TYPE_ID)
, mValue(value) { }
~AttributeString() { mValue.clear(); }
uint32 GetDataSize() const override
{
return sizeof(uint32) + static_cast<uint32>(mValue.size());
}
// read from a stream
bool ReadData(MCore::Stream* stream, MCore::Endian::EEndianType streamEndianType, uint8 version) override
{
MCORE_UNUSED(version);
// read the number of characters
uint32 numCharacters;
if (stream->Read(&numCharacters, sizeof(uint32)) == 0)
{
return false;
}
// convert endian
Endian::ConvertUnsignedInt32(&numCharacters, streamEndianType);
if (numCharacters == 0)
{
mValue.clear();
return true;
}
mValue.resize(numCharacters);
if (stream->Read(mValue.data(), numCharacters) == 0)
{
return false;
}
return true;
}
};
} // namespace MCore
@@ -78,27 +78,5 @@ namespace MCore
: Attribute(TYPE_ID)
, mValue(value) { }
~AttributeVector2() { }
uint32 GetDataSize() const override { return sizeofVector2; }
// read from a stream
bool ReadData(MCore::Stream* stream, MCore::Endian::EEndianType streamEndianType, uint8 version) override
{
MCORE_UNUSED(version);
// read the value
AZ::Vector2 streamValue;
if (stream->Read(&streamValue, sizeofVector2) == 0)
{
return false;
}
// convert endian
Endian::ConvertVector2(&streamValue, streamEndianType);
mValue = streamValue;
return true;
}
};
} // namespace MCore
@@ -79,27 +79,5 @@ namespace MCore
: Attribute(TYPE_ID)
, mValue(value) { }
~AttributeVector3() { }
uint32 GetDataSize() const override { return sizeof(AZ::Vector3); }
// read from a stream
bool ReadData(MCore::Stream* stream, MCore::Endian::EEndianType streamEndianType, uint8 version) override
{
MCORE_UNUSED(version);
// read the value
AZ::PackedVector3f streamValue(0.0f);
if (stream->Read(&streamValue, sizeof(AZ::PackedVector3f)) == 0)
{
return false;
}
// convert endian
mValue = AZ::Vector3(streamValue.GetX(), streamValue.GetY(), streamValue.GetZ());
Endian::ConvertVector3(&mValue, streamEndianType);
return true;
}
};
} // namespace MCore
@@ -75,27 +75,5 @@ namespace MCore
: Attribute(TYPE_ID)
, mValue(value) { }
~AttributeVector4() { }
uint32 GetDataSize() const override { return sizeof(AZ::Vector4); }
// read from a stream
bool ReadData(MCore::Stream* stream, MCore::Endian::EEndianType streamEndianType, uint8 version) override
{
MCORE_UNUSED(version);
// read the value
AZ::Vector4 streamValue;
if (stream->Read(&streamValue, sizeof(AZ::Vector4)) == 0)
{
return false;
}
// convert endian
Endian::ConvertVector4(&streamValue, streamEndianType);
mValue = streamValue;
return true;
}
};
} // namespace MCore