Initial commit

This commit is contained in:
alexpete
2021-03-05 11:26:34 -08:00
commit a10351f38d
27091 changed files with 5521199 additions and 0 deletions
@@ -0,0 +1,121 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
#include "Maestro_precompiled.h"
#include <AzCore/Serialization/SerializeContext.h>
#include "BoolTrack.h"
#include "Maestro/Types/AnimValueType.h"
//////////////////////////////////////////////////////////////////////////
CBoolTrack::CBoolTrack()
: m_bDefaultValue(true)
{
}
//////////////////////////////////////////////////////////////////////////
void CBoolTrack::GetKeyInfo([[maybe_unused]] int index, const char*& description, float& duration)
{
description = 0;
duration = 0;
}
//////////////////////////////////////////////////////////////////////////
AnimValueType CBoolTrack::GetValueType()
{
return AnimValueType::Bool;
}
//////////////////////////////////////////////////////////////////////////
void CBoolTrack::GetValue(float time, bool& value)
{
value = m_bDefaultValue;
CheckValid();
int nkeys = m_keys.size();
if (nkeys < 1)
{
return;
}
int key = 0;
while ((key < nkeys) && (time >= m_keys[key].time))
{
key++;
}
if (m_bDefaultValue)
{
value = !(key & 1); // True if even key.
}
else
{
value = (key & 1); // False if even key.
}
}
//////////////////////////////////////////////////////////////////////////
void CBoolTrack::SetValue([[maybe_unused]] float time, const bool& value, bool bDefault)
{
if (bDefault)
{
SetDefaultValue(value);
}
Invalidate();
}
//////////////////////////////////////////////////////////////////////////
void CBoolTrack::SetDefaultValue(const bool bDefaultValue)
{
m_bDefaultValue = bDefaultValue;
}
/// @deprecated Serialization for Sequence data in Component Entity Sequences now occurs through AZ::SerializeContext and the Sequence Component
bool CBoolTrack::Serialize(XmlNodeRef& xmlNode, bool bLoading, bool bLoadEmptyTracks)
{
bool retVal = TAnimTrack<IBoolKey>::Serialize(xmlNode, bLoading, bLoadEmptyTracks);
if (bLoading)
{
xmlNode->getAttr("DefaultValue", m_bDefaultValue);
}
else
{
//saving
xmlNode->setAttr("DefaultValue", m_bDefaultValue);
}
return retVal;
}
//////////////////////////////////////////////////////////////////////////
template<>
inline void TAnimTrack<IBoolKey>::Reflect(AZ::SerializeContext* serializeContext)
{
serializeContext->Class<TAnimTrack<IBoolKey> >()
->Version(2)
->Field("Flags", &TAnimTrack<IBoolKey>::m_flags)
->Field("Range", &TAnimTrack<IBoolKey>::m_timeRange)
->Field("ParamType", &TAnimTrack<IBoolKey>::m_nParamType)
->Field("Keys", &TAnimTrack<IBoolKey>::m_keys)
->Field("Id", &TAnimTrack<IBoolKey>::m_id);
}
//////////////////////////////////////////////////////////////////////////
void CBoolTrack::Reflect(AZ::SerializeContext* serializeContext)
{
TAnimTrack<IBoolKey>::Reflect(serializeContext);
serializeContext->Class<CBoolTrack, TAnimTrack<IBoolKey> >()
->Version(1)
->Field("DefaultValue", &CBoolTrack::m_bDefaultValue);
}