1 #ifndef _RIVE_STATE_TRANSITION_BASE_HPP_
2 #define _RIVE_STATE_TRANSITION_BASE_HPP_
3 #include "animation/state_machine_layer_component.hpp"
4 #include "core/field_types/core_uint_type.hpp"
7 class StateTransitionBase : public StateMachineLayerComponent
10 typedef StateMachineLayerComponent Super;
13 static const uint16_t typeKey = 65;
15 /// Helper to quickly determine if a core object extends another without
17 bool isTypeOf(uint16_t typeKey) const override
21 case StateTransitionBase::typeKey:
22 case StateMachineLayerComponentBase::typeKey:
29 uint16_t coreType() const override { return typeKey; }
31 static const uint16_t stateToIdPropertyKey = 151;
32 static const uint16_t flagsPropertyKey = 152;
33 static const uint16_t durationPropertyKey = 158;
34 static const uint16_t exitTimePropertyKey = 160;
42 inline int stateToId() const { return m_StateToId; }
43 void stateToId(int value)
45 if (m_StateToId == value)
53 inline int flags() const { return m_Flags; }
64 inline int duration() const { return m_Duration; }
65 void duration(int value)
67 if (m_Duration == value)
75 inline int exitTime() const { return m_ExitTime; }
76 void exitTime(int value)
78 if (m_ExitTime == value)
86 Core* clone() const override;
87 void copy(const StateTransitionBase& object)
89 m_StateToId = object.m_StateToId;
90 m_Flags = object.m_Flags;
91 m_Duration = object.m_Duration;
92 m_ExitTime = object.m_ExitTime;
93 StateMachineLayerComponent::copy(object);
96 bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
100 case stateToIdPropertyKey:
101 m_StateToId = CoreUintType::deserialize(reader);
103 case flagsPropertyKey:
104 m_Flags = CoreUintType::deserialize(reader);
106 case durationPropertyKey:
107 m_Duration = CoreUintType::deserialize(reader);
109 case exitTimePropertyKey:
110 m_ExitTime = CoreUintType::deserialize(reader);
113 return StateMachineLayerComponent::deserialize(propertyKey, reader);
117 virtual void stateToIdChanged() {}
118 virtual void flagsChanged() {}
119 virtual void durationChanged() {}
120 virtual void exitTimeChanged() {}