-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add data binding blend states support
add support for data binding blend animations. There's a lot of boilerplate code, but I have commented the most relevant parts Diffs= f9355c5d84 add data binding blend states support (#7731) Co-authored-by: hernan <hernan@rive.app>
- Loading branch information
Showing
25 changed files
with
377 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1a8c1621517e961a2e7e04b51d1a0e2c0b0d049a | ||
f9355c5d844b041f7ea6475ef99be7288f74404c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,10 @@ | ||
{ | ||
"name": "BlendState1D", | ||
"key": { | ||
"int": 76, | ||
"int": 527, | ||
"string": "blendstate1d" | ||
}, | ||
"abstract": true, | ||
"extends": "animation/blend_state.json", | ||
"generic": "animation/blend_animation_1d.json", | ||
"properties": { | ||
"inputId": { | ||
"type": "Id", | ||
"typeRuntime": "uint", | ||
"initialValue": "Core.missingId", | ||
"initialValueRuntime": "-1", | ||
"key": { | ||
"int": 167, | ||
"string": "inputid" | ||
}, | ||
"description": "Id of the input that drives the mix value for this blend state." | ||
} | ||
} | ||
"generic": "animation/blend_animation_1d.json" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "BlendState1DInput", | ||
"key": { | ||
"int": 76, | ||
"string": "blendstate1dinput" | ||
}, | ||
"extends": "animation/blend_state_1d.json", | ||
"properties": { | ||
"inputId": { | ||
"type": "Id", | ||
"typeRuntime": "uint", | ||
"initialValue": "Core.missingId", | ||
"initialValueRuntime": "-1", | ||
"key": { | ||
"int": 167, | ||
"string": "inputid" | ||
}, | ||
"description": "Id of the input that drives the mix value for this blend state." | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "BlendState1DViewModel", | ||
"key": { | ||
"int": 528, | ||
"string": "blendstate1dviewmodel" | ||
}, | ||
"extends": "animation/blend_state_1d.json", | ||
"properties": { | ||
"bindablePropertyId": { | ||
"type": "Id", | ||
"initialValue": "Core.missingId", | ||
"key": { | ||
"int": 737, | ||
"string": "bindablepropertyid" | ||
}, | ||
"description": "Id of the bindable property that drives the mix value for this blend state.", | ||
"runtime": false | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#ifndef _RIVE_BLEND_STATE1_DINPUT_HPP_ | ||
#define _RIVE_BLEND_STATE1_DINPUT_HPP_ | ||
#include "rive/generated/animation/blend_state_1d_input_base.hpp" | ||
#include <stdio.h> | ||
namespace rive | ||
{ | ||
class BlendState1DInput : public BlendState1DInputBase | ||
{ | ||
public: | ||
bool hasValidInputId() const { return inputId() != Core::emptyId; } | ||
|
||
StatusCode import(ImportStack& importStack) override; | ||
}; | ||
} // namespace rive | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#ifndef _RIVE_BLEND_STATE1_DVIEW_MODEL_HPP_ | ||
#define _RIVE_BLEND_STATE1_DVIEW_MODEL_HPP_ | ||
#include "rive/generated/animation/blend_state_1d_viewmodel_base.hpp" | ||
#include "rive/data_bind/bindable_property.hpp" | ||
#include <stdio.h> | ||
namespace rive | ||
{ | ||
class BlendState1DViewModel : public BlendState1DViewModelBase | ||
{ | ||
public: | ||
StatusCode import(ImportStack& importStack) override; | ||
|
||
BindableProperty* bindableProperty() const { return m_bindableProperty; }; | ||
|
||
protected: | ||
BindableProperty* m_bindableProperty; | ||
}; | ||
} // namespace rive | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
include/rive/generated/animation/blend_state_1d_input_base.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#ifndef _RIVE_BLEND_STATE1_DINPUT_BASE_HPP_ | ||
#define _RIVE_BLEND_STATE1_DINPUT_BASE_HPP_ | ||
#include "rive/animation/blend_state_1d.hpp" | ||
#include "rive/core/field_types/core_uint_type.hpp" | ||
namespace rive | ||
{ | ||
class BlendState1DInputBase : public BlendState1D | ||
{ | ||
protected: | ||
typedef BlendState1D Super; | ||
|
||
public: | ||
static const uint16_t typeKey = 76; | ||
|
||
/// Helper to quickly determine if a core object extends another without | ||
/// RTTI at runtime. | ||
bool isTypeOf(uint16_t typeKey) const override | ||
{ | ||
switch (typeKey) | ||
{ | ||
case BlendState1DInputBase::typeKey: | ||
case BlendState1DBase::typeKey: | ||
case BlendStateBase::typeKey: | ||
case LayerStateBase::typeKey: | ||
case StateMachineLayerComponentBase::typeKey: | ||
return true; | ||
default: | ||
return false; | ||
} | ||
} | ||
|
||
uint16_t coreType() const override { return typeKey; } | ||
|
||
static const uint16_t inputIdPropertyKey = 167; | ||
|
||
protected: | ||
uint32_t m_InputId = -1; | ||
|
||
public: | ||
inline uint32_t inputId() const { return m_InputId; } | ||
void inputId(uint32_t value) | ||
{ | ||
if (m_InputId == value) | ||
{ | ||
return; | ||
} | ||
m_InputId = value; | ||
inputIdChanged(); | ||
} | ||
|
||
Core* clone() const override; | ||
void copy(const BlendState1DInputBase& object) | ||
{ | ||
m_InputId = object.m_InputId; | ||
BlendState1D::copy(object); | ||
} | ||
|
||
bool deserialize(uint16_t propertyKey, BinaryReader& reader) override | ||
{ | ||
switch (propertyKey) | ||
{ | ||
case inputIdPropertyKey: | ||
m_InputId = CoreUintType::deserialize(reader); | ||
return true; | ||
} | ||
return BlendState1D::deserialize(propertyKey, reader); | ||
} | ||
|
||
protected: | ||
virtual void inputIdChanged() {} | ||
}; | ||
} // namespace rive | ||
|
||
#endif |
39 changes: 39 additions & 0 deletions
39
include/rive/generated/animation/blend_state_1d_viewmodel_base.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#ifndef _RIVE_BLEND_STATE1_DVIEW_MODEL_BASE_HPP_ | ||
#define _RIVE_BLEND_STATE1_DVIEW_MODEL_BASE_HPP_ | ||
#include "rive/animation/blend_state_1d.hpp" | ||
namespace rive | ||
{ | ||
class BlendState1DViewModelBase : public BlendState1D | ||
{ | ||
protected: | ||
typedef BlendState1D Super; | ||
|
||
public: | ||
static const uint16_t typeKey = 528; | ||
|
||
/// Helper to quickly determine if a core object extends another without | ||
/// RTTI at runtime. | ||
bool isTypeOf(uint16_t typeKey) const override | ||
{ | ||
switch (typeKey) | ||
{ | ||
case BlendState1DViewModelBase::typeKey: | ||
case BlendState1DBase::typeKey: | ||
case BlendStateBase::typeKey: | ||
case LayerStateBase::typeKey: | ||
case StateMachineLayerComponentBase::typeKey: | ||
return true; | ||
default: | ||
return false; | ||
} | ||
} | ||
|
||
uint16_t coreType() const override { return typeKey; } | ||
|
||
Core* clone() const override; | ||
|
||
protected: | ||
}; | ||
} // namespace rive | ||
|
||
#endif |
Oops, something went wrong.