blob: 5ba9b08de61798fbfc6e81ae59c1cdfd924602a0 [file]
#ifndef _RIVE_ANIMATION_STATE_BASE_HPP_
#define _RIVE_ANIMATION_STATE_BASE_HPP_
#include "rive/animation/advanceable_state.hpp"
#include "rive/core/field_types/core_id_type.hpp"
#include "rive/core/id.hpp"
namespace rive
{
class AnimationStateBase : public AdvanceableState
{
protected:
typedef AdvanceableState Super;
public:
static const uint16_t typeKey = 61;
uint16_t coreType() const override { return typeKey; }
static const uint16_t animationIdPropertyKey = 149;
protected:
Id m_AnimationId = kEmptyId;
public:
inline Id animationId() const { return m_AnimationId; }
void animationId(Id value)
{
if (m_AnimationId == value)
{
return;
}
RIVE_EDITOR_CHANGING(animationIdPropertyKey, &m_AnimationId, &value);
m_AnimationId = value;
notifyPropertyChanged(animationIdPropertyKey);
}
Core* clone() const override;
void copy(const AnimationStateBase& object)
{
m_AnimationId = object.m_AnimationId;
AdvanceableState::copy(object);
}
bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
{
switch (propertyKey)
{
case animationIdPropertyKey:
m_AnimationId = CoreIdType::runtimeDeserialize(reader);
return true;
}
return AdvanceableState::deserialize(propertyKey, reader);
}
protected:
#ifdef WITH_RIVE_EDITOR
#include "editor_native/generated/animation/animation_state_ext.inl"
#endif
};
} // namespace rive
#endif