1 #ifndef _RIVE_WEIGHT_BASE_HPP_
2 #define _RIVE_WEIGHT_BASE_HPP_
3 #include "component.hpp"
4 #include "core/field_types/core_uint_type.hpp"
7 class WeightBase : public Component
10 typedef Component Super;
13 static const int typeKey = 45;
15 /// Helper to quickly determine if a core object extends another without
17 bool isTypeOf(int typeKey) const override
21 case WeightBase::typeKey:
22 case ComponentBase::typeKey:
29 int coreType() const override { return typeKey; }
31 static const int valuesPropertyKey = 102;
32 static const int indicesPropertyKey = 103;
38 inline int values() const { return m_Values; }
39 void values(int value)
41 if (m_Values == value)
49 inline int indices() const { return m_Indices; }
50 void indices(int value)
52 if (m_Indices == value)
60 bool deserialize(int propertyKey, BinaryReader& reader) override
64 case valuesPropertyKey:
65 m_Values = CoreUintType::deserialize(reader);
67 case indicesPropertyKey:
68 m_Indices = CoreUintType::deserialize(reader);
71 return Component::deserialize(propertyKey, reader);
75 virtual void valuesChanged() {}
76 virtual void indicesChanged() {}