Skip to content

Commit d9a07ab

Browse files
authored
Update for Defold version 1.9.8 (#149)
* Update headers * Update build scripts * Update work-in-progress * Build remaining packages * Updated plugins
1 parent 3aac021 commit d9a07ab

File tree

267 files changed

+3808
-536
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

267 files changed

+3808
-536
lines changed

defold-rive/include/defold/defold_graphics.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ namespace dmGraphics
198198
};
199199

200200
HTexture NewTexture(HContext context, const TextureCreationParams& params);
201-
void SetTexture(HTexture texture, const TextureParams& params);
201+
void SetTexture(HTexture texture, const TextureParams& params);
202202

203203
HRenderTarget NewRenderTarget(HContext context, uint32_t buffer_type_flags, const RenderTargetCreationParams params);
204204
void DeleteRenderTarget(HRenderTarget render_target);
@@ -207,7 +207,6 @@ namespace dmGraphics
207207
HUniformLocation GetUniformLocation(HProgram prog, const char* name);
208208
uint32_t GetUniformName(HProgram prog, uint32_t index, char* buffer, uint32_t buffer_size, Type* type, int32_t* size);
209209
uint32_t GetUniformCount(HProgram prog);
210-
HProgram NewProgram(HContext context, HVertexProgram vertex_program, HFragmentProgram fragment_program);
211210

212211
void SetStencilMask(HContext context, uint32_t mask);
213212
void SetStencilFunc(HContext context, CompareFunc func, uint32_t ref, uint32_t mask);

defold-rive/include/defold/defold_render.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222
namespace dmRender
2323
{
2424
const dmVMath::Matrix4& GetViewMatrix(HRenderContext render_context);
25-
const dmVMath::Matrix4& GetViewProjectionMatrix(HRenderContext render_context);
26-
HMaterial NewMaterial(HRenderContext render_context, dmGraphics::HVertexProgram vertex_program, dmGraphics::HFragmentProgram fragment_program);
25+
HMaterial NewMaterial(dmRender::HRenderContext render_context, dmGraphics::HProgram program);
2726
void SetMaterialTags(HMaterial material, uint32_t tag_count, const dmhash_t* tags);
2827
bool SetMaterialSampler(HMaterial material, dmhash_t name_hash, uint32_t unit, dmGraphics::TextureWrap u_wrap, dmGraphics::TextureWrap v_wrap, dmGraphics::TextureFilter min_filter, dmGraphics::TextureFilter mag_filter, float max_anisotropy);
2928
}

defold-rive/include/defold/shaders/rivemodel_blit.fpc.gen.h

-5
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Generated with bob.jar version: 1.9.8 sha1: 31dffed4341ecaf2e9bc6bf447f5bed6da05b8e7 built: 2025-03-05 13:17:23
2+
// Generated, do not edit!
3+
#include <stdint.h>
4+
extern "C" uint8_t RIVEMODEL_BLIT_SPC[];
5+
extern "C" uint32_t RIVEMODEL_BLIT_SPC_SIZE;

defold-rive/include/defold/shaders/rivemodel_blit.vpc.gen.h

-5
This file was deleted.

defold-rive/include/rive/animation/arithmetic_operation.hpp

+3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ enum class ArithmeticOperation : int
2121
asine = 13,
2222
atangent = 14,
2323
atangent2 = 15,
24+
round = 16,
25+
floor = 17,
26+
ceil = 18,
2427
};
2528
} // namespace rive
2629

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#ifndef _RIVE_DATA_CONVERTER_TO_STRING_FLAGS_HPP_
2+
#define _RIVE_DATA_CONVERTER_TO_STRING_FLAGS_HPP_
3+
4+
#include "rive/enum_bitset.hpp"
5+
6+
namespace rive
7+
{
8+
enum class DataConverterToStringFlags : unsigned short
9+
{
10+
11+
/// Whether to round to decimals
12+
Round = 1 << 0,
13+
14+
/// Whether to remove trailing zeros
15+
TrailingZeros = 1 << 1,
16+
17+
};
18+
19+
RIVE_MAKE_ENUM_BITSET(DataConverterToStringFlags)
20+
} // namespace rive
21+
#endif

defold-rive/include/rive/animation/elastic_ease.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ class ElasticEase
1111
float easeIn(float factor) const;
1212
float easeInOut(float factor) const;
1313

14+
#ifndef TESTING
1415
private:
16+
#endif
1517
float computeActualAmplitude(float time) const;
1618
float m_amplitude;
1719
float m_period;

defold-rive/include/rive/animation/listener_viewmodel_change.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ namespace rive
88
class ListenerViewModelChange : public ListenerViewModelChangeBase
99
{
1010
public:
11+
~ListenerViewModelChange();
1112
void perform(StateMachineInstance* stateMachineInstance,
1213
Vec2D position,
1314
Vec2D previousPosition) const override;

defold-rive/include/rive/animation/nested_state_machine.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class NestedStateMachine : public NestedStateMachineBase
3535
size_t inputCount() { return m_nestedInputs.size(); }
3636
NestedInput* input(size_t index);
3737
NestedInput* input(std::string name);
38-
void setDataContextFromInstance(ViewModelInstance* viewModelInstance);
38+
void bindViewModelInstance(rcp<ViewModelInstance> viewModelInstance);
3939
void dataContext(DataContext* dataContext);
4040
};
4141
} // namespace rive

defold-rive/include/rive/animation/state_machine_input_instance.hpp

+10-3
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,22 @@ class Triggerable
7979
{
8080

8181
public:
82-
bool useInLayer(StateMachineLayerInstance* layer) const
82+
bool isUsedInLayer(StateMachineLayerInstance* layer) const
83+
{
84+
auto it = std::find(m_usedLayers.begin(), m_usedLayers.end(), layer);
85+
if (it == m_usedLayers.end())
86+
{
87+
return false;
88+
}
89+
return true;
90+
}
91+
void useInLayer(StateMachineLayerInstance* layer) const
8392
{
8493
auto it = std::find(m_usedLayers.begin(), m_usedLayers.end(), layer);
8594
if (it == m_usedLayers.end())
8695
{
8796
m_usedLayers.push_back(layer);
88-
return true;
8997
}
90-
return false;
9198
}
9299

93100
protected:

defold-rive/include/rive/animation/state_machine_instance.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ class StateMachineInstance : public Scene,
100100
SMIBool* getBool(const std::string& name) const override;
101101
SMINumber* getNumber(const std::string& name) const override;
102102
SMITrigger* getTrigger(const std::string& name) const override;
103-
void setDataContextFromInstance(
104-
ViewModelInstance* viewModelInstance) override;
103+
void bindViewModelInstance(
104+
rcp<ViewModelInstance> viewModelInstance) override;
105105
void dataContext(DataContext* dataContext);
106106

107107
size_t currentAnimationCount() const;

defold-rive/include/rive/animation/state_transition.hpp

+4
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,10 @@ class StateTransition : public StateTransitionBase
134134
/// correct time to the animation instance in the stateFrom, when
135135
/// applicable (when it's an AnimationState).
136136
bool applyExitCondition(StateInstance* stateFrom) const;
137+
138+
/// Marks any trigger based condition as used for this layer
139+
void useLayerInConditions(StateMachineInstance* stateMachineInstance,
140+
StateMachineLayerInstance* layerInstance) const;
137141
};
138142
} // namespace rive
139143

defold-rive/include/rive/animation/transition_comparator.hpp

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ class TransitionComparator : public TransitionComparatorBase
1818
const StateMachineInstance* stateMachineInstance,
1919
StateMachineLayerInstance* layerInstance);
2020

21+
virtual void useInLayer(const StateMachineInstance* stateMachineInstance,
22+
StateMachineLayerInstance* layerInstance) const
23+
{}
24+
2125
protected:
2226
bool compareNumbers(float left, float right, TransitionConditionOp op);
2327
bool compareBooleans(bool left, bool right, TransitionConditionOp op);

defold-rive/include/rive/animation/transition_condition.hpp

+4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ class TransitionCondition : public TransitionConditionBase
2222
return true;
2323
}
2424

25+
virtual void useInLayer(const StateMachineInstance* stateMachineInstance,
26+
StateMachineLayerInstance* layerInstance) const
27+
{}
28+
2529
protected:
2630
virtual bool validateInputType(const StateMachineInput* input) const
2731
{

defold-rive/include/rive/animation/transition_property_viewmodel_comparator.hpp

+9-3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class TransitionPropertyViewModelComparator
1010
: public TransitionPropertyViewModelComparatorBase
1111
{
1212
public:
13+
~TransitionPropertyViewModelComparator();
1314
StatusCode import(ImportStack& importStack) override;
1415
bool compare(TransitionComparator* comparand,
1516
TransitionConditionOp operation,
@@ -18,15 +19,20 @@ class TransitionPropertyViewModelComparator
1819
template <typename T = BindableProperty, typename U>
1920
U value(const StateMachineInstance* stateMachineInstance)
2021
{
21-
if (m_bindableProperty->is<T>())
22+
if (m_bindableProperty != nullptr && m_bindableProperty->is<T>())
2223
{
2324
auto bindableInstance =
2425
stateMachineInstance->bindablePropertyInstance(
2526
m_bindableProperty);
26-
return bindableInstance->as<T>()->propertyValue();
27+
if (bindableInstance != nullptr)
28+
{
29+
return bindableInstance->as<T>()->propertyValue();
30+
}
2731
}
28-
return (new T())->propertyValue();
32+
return T::defaultValue;
2933
};
34+
void useInLayer(const StateMachineInstance* stateMachineInstance,
35+
StateMachineLayerInstance* layerInstance) const override;
3036

3137
protected:
3238
BindableProperty* m_bindableProperty;

defold-rive/include/rive/animation/transition_trigger_condition.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ class TransitionTriggerCondition : public TransitionTriggerConditionBase
99
public:
1010
bool evaluate(const StateMachineInstance* stateMachineInstance,
1111
StateMachineLayerInstance* layerInstance) const override;
12+
void useInLayer(const StateMachineInstance* stateMachineInstance,
13+
StateMachineLayerInstance* layerInstance) const override;
1214

1315
protected:
1416
bool validateInputType(const StateMachineInput* input) const override;

defold-rive/include/rive/animation/transition_viewmodel_condition.hpp

+3
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@ class TransitionViewModelCondition : public TransitionViewModelConditionBase
1414
TransitionComparator* m_rightComparator;
1515

1616
public:
17+
~TransitionViewModelCondition();
1718
bool evaluate(const StateMachineInstance* stateMachineInstance,
1819
StateMachineLayerInstance* layerInstance) const override;
20+
void useInLayer(const StateMachineInstance* stateMachineInstance,
21+
StateMachineLayerInstance* layerInstance) const override;
1922
TransitionComparator* leftComparator() const { return m_leftComparator; };
2023
TransitionComparator* rightComparator() const { return m_rightComparator; };
2124
void comparator(TransitionComparator* value)

defold-rive/include/rive/artboard.hpp

+16-9
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ class Artboard : public ArtboardBase, public CoreContext
6666
std::vector<DataBind*> m_DataBinds;
6767
std::vector<DataBind*> m_AllDataBinds;
6868
DataContext* m_DataContext = nullptr;
69+
bool m_ownsDataContext = false;
6970
bool m_JoysticksApplyBeforeUpdate = true;
7071

7172
unsigned int m_DirtDepth = 0;
72-
RawPath m_backgroundRawPath;
7373
Factory* m_Factory = nullptr;
7474
Drawable* m_FirstDrawable = nullptr;
7575
bool m_IsInstance = false;
@@ -101,6 +101,12 @@ class Artboard : public ArtboardBase, public CoreContext
101101
void host(NestedArtboard* nestedArtboard);
102102
NestedArtboard* host() const;
103103

104+
// Implemented for ShapePaintContainer.
105+
const Mat2D& shapeWorldTransform() const override
106+
{
107+
return worldTransform();
108+
}
109+
104110
private:
105111
#ifdef TESTING
106112
public:
@@ -172,8 +178,8 @@ class Artboard : public ArtboardBase, public CoreContext
172178
void addToRenderPath(RenderPath* path, const Mat2D& transform);
173179

174180
#ifdef TESTING
175-
RenderPath* clipPath() const { return m_clipPath.get(); }
176-
RenderPath* backgroundPath() const { return m_backgroundPath.get(); }
181+
ShapePaintPath* clipPath() { return &m_worldPath; }
182+
ShapePaintPath* backgroundPath() { return &m_localPath; }
177183
#endif
178184

179185
const std::vector<Core*>& objects() const { return m_Objects; }
@@ -203,12 +209,12 @@ class Artboard : public ArtboardBase, public CoreContext
203209
void dataContext(DataContext* dataContext);
204210
void internalDataContext(DataContext* dataContext, bool isRoot);
205211
void clearDataContext();
206-
void setDataContextFromInstance(ViewModelInstance* viewModelInstance,
207-
DataContext* parent);
208-
void setDataContextFromInstance(ViewModelInstance* viewModelInstance,
209-
DataContext* parent,
210-
bool isRoot);
211-
void setDataContextFromInstance(ViewModelInstance* viewModelInstance);
212+
void bindViewModelInstance(rcp<ViewModelInstance> viewModelInstance,
213+
DataContext* parent);
214+
void bindViewModelInstance(rcp<ViewModelInstance> viewModelInstance,
215+
DataContext* parent,
216+
bool isRoot);
217+
void bindViewModelInstance(rcp<ViewModelInstance> viewModelInstance);
212218
void addDataBind(DataBind* dataBind);
213219
void populateDataBinds(std::vector<DataBind*>* dataBinds);
214220
void sortDataBinds();
@@ -415,6 +421,7 @@ class Artboard : public ArtboardBase, public CoreContext
415421
void onLayoutDirty(ArtboardCallback callback)
416422
{
417423
m_layoutDirtyCallback = callback;
424+
addDirt(ComponentDirt::Components);
418425
}
419426
#endif
420427
};

defold-rive/include/rive/command_path.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class CommandPath : public RefCnt<CommandPath>
2929
virtual void close() = 0;
3030

3131
virtual RenderPath* renderPath() = 0;
32+
virtual const RenderPath* renderPath() const = 0;
3233

3334
// non-virtual helpers
3435

defold-rive/include/rive/constraints/layout_constraint.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
#include <stdio.h>
44
namespace rive
55
{
6-
class LayoutComponent;
6+
class LayoutNodeProvider;
77

88
class LayoutConstraint
99
{
1010
public:
11-
virtual void constrainChild(LayoutComponent* component) {}
11+
virtual void constrainChild(LayoutNodeProvider* child) {}
1212
};
1313
} // namespace rive
1414

defold-rive/include/rive/constraints/scrolling/scroll_constraint.hpp

+18-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <stdio.h>
1212
namespace rive
1313
{
14+
class LayoutNodeProvider;
1415

1516
class ScrollConstraint : public ScrollConstraintBase,
1617
public AdvancingComponent,
@@ -23,23 +24,29 @@ class ScrollConstraint : public ScrollConstraintBase,
2324
float m_offsetY = 0;
2425
ScrollPhysics* m_physics;
2526
Mat2D m_scrollTransform;
27+
bool m_isDragging = false;
28+
29+
Vec2D positionAtIndex(float index);
30+
float indexAtPosition(Vec2D pos);
2631

2732
public:
2833
void constrain(TransformComponent* component) override;
2934
std::vector<DraggableProxy*> draggables() override;
3035
void buildDependencies() override;
3136
StatusCode import(ImportStack& importStack) override;
37+
StatusCode onAddedDirty(CoreContext* context) override;
3238
Core* clone() const override;
3339
void dragView(Vec2D delta);
3440
void runPhysics();
35-
void constrainChild(LayoutComponent* component) override;
41+
void constrainChild(LayoutNodeProvider* child) override;
3642
bool advanceComponent(float elapsedSeconds,
3743
AdvanceFlags flags = AdvanceFlags::Animate |
3844
AdvanceFlags::NewFrame) override;
3945

4046
ScrollPhysics* physics() const { return m_physics; }
4147
void physics(ScrollPhysics* physics) { m_physics = physics; }
4248
void initPhysics();
49+
void stopPhysics();
4350

4451
ScrollPhysicsType physicsType() const
4552
{
@@ -147,6 +154,16 @@ class ScrollConstraint : public ScrollConstraintBase,
147154
m_offsetY = value;
148155
content()->markWorldTransformDirty();
149156
}
157+
158+
void scrollOffsetXChanged() override { offsetX(scrollOffsetX()); }
159+
void scrollOffsetYChanged() override { offsetY(scrollOffsetY()); }
160+
161+
float scrollPercentX() override;
162+
float scrollPercentY() override;
163+
float scrollIndex() override;
164+
void setScrollPercentX(float value) override;
165+
void setScrollPercentY(float value) override;
166+
void setScrollIndex(float value) override;
150167
};
151168
} // namespace rive
152169

defold-rive/include/rive/constraints/scrolling/scroll_physics.hpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ class ScrollPhysics : public ScrollPhysicsBase
5353
m_isRunning = true;
5454
}
5555
virtual void stop() { m_isRunning = false; }
56-
virtual void reset() {}
56+
virtual void reset()
57+
{
58+
m_acceleration = Vec2D();
59+
stop();
60+
}
5761
StatusCode import(ImportStack& importStack) override;
5862
};
5963
} // namespace rive

defold-rive/include/rive/container_component.hpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ class ContainerComponent : public ContainerComponentBase
1313
virtual void addChild(Component* component);
1414
bool collapse(bool value) override;
1515

16-
// Returns true if it searched through all of its children. predicate can
17-
// return false to stop searching.
16+
// Returns whether predicate returns true for the current Component.
1817
bool forAll(std::function<bool(Component*)> predicate);
19-
bool forEachChild(std::function<bool(Component*)> predicate);
18+
19+
// Recursively descend onto all the children in the hierarchy tree.
20+
// If predicate returns false, it won't recurse down a particular branch.
21+
void forEachChild(std::function<bool(Component*)> predicate);
2022

2123
private:
2224
std::vector<Component*> m_children;

0 commit comments

Comments
 (0)