Commit Graph

180 Commits

Author SHA1 Message Date
bodymovin
6eaf71f485 feature: scripted listener actions (#11468) f3a89390cb
Co-authored-by: hernan <hernan@rive.app>
2026-01-15 19:53:42 +00:00
bodymovin
15a922714f Nnnnn relative data bind all paths (#11346) 41d316c675
* StateMachineListener relative view model property path
* StateMachineFireTrigger relative view model property path
* ScriptInputViewModelProperty relative view model property path

Co-authored-by: hernan <hernan@rive.app>
2026-01-02 21:11:44 +00:00
bodymovin
7a489bb15f feature: allow listeners to listen to any type of view model change (#11313) 4b7a5a8032
Co-authored-by: hernan <hernan@rive.app>
2025-12-19 18:31:47 +00:00
luigi-rosso
2981f6ad37 feat: Text input from editor + start of Focusable (#9905) e5c8a7ae8f
* feat: working on focusable

* feat: text events to rive native

* feat: runtime text from editor

* feat: text input in the editor

* chore: cleanup

* chore: fix non text builds

* chore: fix warning

* fix: key import in rive_native_web

* feat: text input for web rive_native

* chore: fixes

* chore: cleanup

* fix: remove unused imports

* chore: more tests for missed lines

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2025-12-12 01:10:25 +00:00
philter
f73857b3b4 chore: Scripted PointerEvents at runtime (#11046) 7507e62b37
This PR refactors some of the StateMachine related code (listener groups) and adds support for pointer events to ScriptedDrawables.

Co-authored-by: Philip Chung <philterdesign@gmail.com>
2025-11-15 19:46:00 +00:00
bodymovin
33544ab137 fix: advance current state by 0 when there is no previous state (#10994) f1fb606c21
* fix: advance current state by 0 when there is no previous state
* fix memory leak

Co-authored-by: Phil Chung <philterdesign@gmail.com>
Co-authored-by: hernan <hernan@rive.app>
2025-11-14 01:05:08 +00:00
philter
3d195c35fd fix(runtime): Revert state machine checks for needsAdvance (#10985) 3b82e09da9
Reverted an update where nested artboards were checking their nested state machine instances for needsAdvance and advancing if true. This appeared to fix (#10842) an issue that required a double advance when running goldens, however, there is actually another issue that this masked rather than fixing it. That will come in a seperate PR.

Co-authored-by: Philip Chung <philterdesign@gmail.com>
2025-11-06 02:19:48 +00:00
bodymovin
094ae0c127 fix: set dataContext to nullptr when unbinding (#10898) 684c603b1a
Co-authored-by: hernan <hernan@rive.app>
2025-10-23 22:56:49 +00:00
bodymovin
42d61b6c86 add drag event type support (#10807) 2f4ec0a570
* add drag event type support

Co-authored-by: hernan <hernan@rive.app>
2025-10-21 22:21:50 +00:00
philter
52632f65a2 fix(runtime): Address issues requiring double advance (#10842) 5dd872763b
This PR removes the double advanceAndApply(0) when running goldens. There were 3 seperate issues that are resolved here.

NestedInput values which were keyed on a timeline did not take effect until the next frame when they were used to drive a Blend state. Fix: NestedArtboards and ArtboardComponentLists should check if needsAdvance() in addition to tryChangeState()
Layouts where positionType (absolute/relative) were keyed on a timeline were behaving inconsistently depending on whether positionLeft/positionTop were also keyed on the same frame. Fix: Make sure changing positionType only overrides the positionTop/positionLeft values if those were not keyed on the same frame as positionType
Text follow path modifier was rendering incorrectly in a specific case where a Text's width was bound to a VM property which gets its value from a Path's length. Fix: Call updateDataBinds before returning in Artboard::updatePass

Co-authored-by: Philip Chung <philterdesign@gmail.com>
2025-10-21 18:01:27 +00:00
bodymovin
007969f903 feature: add support for pausing nested artboards (#10833) 0a3cb5ac3e
* feature: add support for pausing nested artboards

Co-authored-by: hernan <hernan@rive.app>
2025-10-20 16:10:14 +00:00
JoshJRive
c468e6757b Get the Linux unit tests building and running in the GitHub workflow (#10761) a0b890f273
Co-authored-by: Josh Jersild <joshua@rive.app>
2025-10-15 22:11:25 +00:00
bodymovin
70708343e6 chore: automatically bind view model trees to dependents when any of … (#10782) ae01b2a8c3
* chore: automatically bind view model trees to dependents when any of its children view models is replaced

Co-authored-by: hernan <hernan@rive.app>
2025-10-15 13:56:47 +00:00
bodymovin
129076c675 fix: cache and reset pointer events (#10707) fd286173b1
* fix: cache and reset pointer events

Co-authored-by: hernan <hernan@rive.app>
2025-10-04 00:10:51 +00:00
bodymovin
89fcbd1e25 Feature: add support for multitouch (#9581) 12764e9a3b
add support for multitouch

Co-authored-by: hernan <hernan@rive.app>
2025-09-30 21:29:34 +00:00
bodymovin
d0faf6e011 feature: add toggle to make scroll constraint not interactive (#10680) 0b069a9936
* feature: add toggle to make scroll constraint not interactive

Co-authored-by: hernan <hernan@rive.app>
2025-09-30 20:23:54 +00:00
bodymovin
001594b951 chore: improve iteration of data bound list (#10625) 8385ec62ed
improve iteration of data bound list

Co-authored-by: hernan <hernan@rive.app>
2025-09-30 15:53:12 +00:00
bodymovin
6362192a61 data bind artboards rcp file (#10214) c542b9b7ac
* make file ref counted

* migrate File to refcnt

* add bindable artboard class to keep file reference

* feat(unity): support rcp file and BindableArtboard class (#10228)

* refactor(apple): use updated file bindable artboard apis (#10229)

* update command queue to support bindable artboards

* use bindable artboards on command queue

* self manage view model instances in js runtime

* change remaining viewModelInstanceRuntimes to rcp

* refactor(apple): update view model instances to use rcp (#10298)

* refactor(unity): support rcp ViewModelInstanceRuntime (#10309)

* rebase fix

* deprecate getArtboard in favor of getBindableArtboard

* fix merge

* remove unused lambda capture

* fix rive binding

* feat(Android): RCP File, VMI, and add bindable artboards (#10456)

* refactor: C++ refactors

- Import from long (incorrect) -> jlong
- Header clang-tidy fix
- Use reinterpret_cast instead of C-style cast
- Break out some variables instead of long one liners
- Use auto
- Remove unused env and thisObj

# Conflicts:
#	packages/runtime_android/kotlin/src/main/cpp/src/helpers/general.cpp

* docs: Improve documentation on the File class

* feat: Support bindable artboard type and RCP VMIs

# Conflicts:
#	packages/runtime_android/kotlin/src/androidTest/java/app/rive/runtime/kotlin/core/RiveDataBindingTest.kt

* feat: Support RCP files

* refactor: Change from +1/-1 ref to just release

* fix: Moved to the more appropriate null pointer for GetStringUTFChars

* replace unref with release

Co-authored-by: Adam <67035612+damzobridge@users.noreply.github.com>
Co-authored-by: David Skuza <david@rive.app>
Co-authored-by: Erik <erik@rive.app>
Co-authored-by: hernan <hernan@rive.app>
2025-09-30 00:01:40 +00:00
bodymovin
6b729b79e6 chore: add pointer exit support (#10595) d999d6a22c
* add pointer exit support

Co-authored-by: hernan <hernan@rive.app>
2025-09-26 15:42:26 +00:00
philter
4978b05b7d (fix): Artboard list item hit order (#10618) f95ef8fdc5
Since Artboard list items are rendered with z index increasing as the item index increases (ie, later children will sit above earlier children), when doing hit testing, we need to traverse the items in reverse order in order to capture the property z ordering. This is only important when items have overlap.

Co-authored-by: Philip Chung <philterdesign@gmail.com>
2025-09-18 23:05:29 +00:00
bodymovin
0a6a20a9d5 feature: add support for different random modes (#10538) dab3b5994d
* feature: add support for different random modes

Co-authored-by: hernan <hernan@rive.app>
2025-09-09 23:49:53 +00:00
HayesGordon
825c51c8ba fix(runtime): force keep going on 0 advanceAndApply (#10504) 0152183944
* fix(runtime): force keep going on 0 advanceAndApply

* Update packages/runtime/src/animation/state_machine_instance.cpp

Co-authored-by: Gordon <pggordonhayes@gmail.com>
Co-authored-by: hernan <hernan@rive.app>
2025-09-09 06:46:58 +00:00
bodymovin
bcba3d089a fix: create a copy of the events list to avoid clearing immediately a… (#10461) 70108fd1a6
fix: create a copy of the events list to avoid clearing immediately added events

Co-authored-by: hernan <hernan@rive.app>
2025-08-28 20:22:41 +00:00
philter
9548baa5fd Don't perform shape AABB hit tests when walking up parent tree (#10444) d8beb0c4ea
This PR skips parent shape AABB tests when hittesting components. There was an issue following recent updates to walk up parent tree when performing hit tests which would prevent objects nested inside shapes from being hit due to trying to AABB test the parent shapes in cases where the shape had no path or the path did not overlap with the listening component.

Co-authored-by: Philip Chung <philterdesign@gmail.com>
2025-08-23 00:36:15 +00:00
aliasbinman
cf0c68cb0c Runtime profiler base (#10391) 4171e09f80
* Add profiling macros and optick profiler

* Update premake5_optick.lua

* Added more profiling markers

* Remove microprofiler option for now as not implemented

* Added more markers ro rendering code

* Update Optick build premake only for windows builds

* More build file changes for optick with windows

* Change how optick is built on windows

* Update premake5_v2.lua

* Update build files to use with_optick option

* Added ScopeName macro to appease ASAN

* Push to rekick jobs

* Delete ProfilerMacros.h

* Create profiler_macros.h

* Update path_fiddle.cpp

* Update fiddle_context.hpp

* Update for rename of header

* More header changes

* Update fiddle_context.hpp

* Update profiler_macros.h

* Update for clang format

* Update fiddle_context.hpp

* Update profiler_macros.h

* Update profiler_macros.h

* Changed premake values on Chris' comments

* Removed multiple define fro RIVE_OPTICK and now in rive_build_config.lua

* Added Optick URL and Version to rive_build_config

Co-authored-by: John White <aliasbinman@gmail.com>
2025-08-20 18:07:00 +00:00
bodymovin
954eaa6e23 fix: trigger adds dirt to listeners only when it is not reset (#10377) 760472b069
Co-authored-by: hernan <hernan@rive.app>
2025-08-14 18:09:23 +00:00
bodymovin
f99b9b363c feature: add support for firing triggers on state transitions (#10329) cc34f96631
* feature: add support for fiiring triggers on state transitions

Co-authored-by: hernan <hernan@rive.app>
2025-08-08 07:20:20 +00:00
bodymovin
633f7bcb85 fix nested events conflicting with parent events (#10326) 51f1f66e31
Co-authored-by: hernan <hernan@rive.app>
2025-08-06 19:27:37 +00:00
bodymovin
27a0028f17 add support for view model trigger based listeners (#10323) e7ef71b568
Co-authored-by: hernan <hernan@rive.app>
2025-08-06 18:29:54 +00:00
bodymovin
ab86fa1075 add advanced phase to render loop (#10318) af18705be2
* add reset phase to render loop

Co-authored-by: hernan <hernan@rive.app>
2025-08-05 23:15:39 +00:00
philter
ac160033db Prevent pointer events when interacting with scroll view (#10251) 40592c7963
Currently, when items are inside a scroll view, when the scroll view is dragged and released, the item's click event will still trigger its listener if the same item is hovered. This adds a way to disable pointer events. In this implementation, when a scroll drag begins, we set the GestureClickPhase to disabled which prevents clicks from being captured.

Co-authored-by: Philip Chung <philterdesign@gmail.com>
2025-08-05 17:50:48 +00:00
bodymovin
78cf8e06a6 feature: add support for using event objects as targets for listeners (#10204) ac9841b38d
* add support for using event objects as targets for listeners

Co-authored-by: hernan <hernan@rive.app>
2025-07-18 22:11:21 +00:00
bodymovin
93198420e2 chore: add extra info when state machine exceeds max iterations (#10201) 34883935ac
Co-authored-by: hernan <hernan@rive.app>
2025-07-18 01:47:37 +00:00
bodymovin
912438bf52 List virtualization hit testing 3 (#10157) 8b7aa84704
* feat: propagate hit tests up in the component tree to detect if they are hitting a clipped area

Co-authored-by: hernan <hernan@rive.app>
2025-07-14 19:00:28 +00:00
bodymovin
c3e853f16f Nnnn data biinding artboard fixes (#10139) e54d2ba962
* update overrides when artboard changes
* add nested artboard as hit component even if it does not have state machines to support data binding
* when adding a new item to a list, use the previous view model from the list as source if it exists

Co-authored-by: hernan <hernan@rive.app>
2025-07-10 20:49:14 +00:00
philter
fa403da393 List Virtualization & Scroll Carousel (#9965) d973e8c253
Add support for List virtualization as well as a parameter to the ScrollConstraint to support infinite scrolling (Carousel).

There are important caveats with Virtualization enabled:

The List instances enough artboards to fit into their parent's bounds and when not rendered, they are pooled and reused as necessary. Lists can be non-uniform meaning they can consist of more than 1 Artboard (ViewModel) type
Does not currently work when its parent is set to wrap because more complex computations may result when wrapping
In order to use Carousel, virtualization must also be enabled
Infinite scroll only works in a single direction, not both at the same time

Co-authored-by: Philip Chung <philterdesign@gmail.com>
2025-07-08 21:48:40 +00:00
susan101566
4933f8b06d runtime: get rid of the HitTextRun destructor (#10092) fc5abebaec
context: https://2dimensions.slack.com/archives/CLLCU09T6/p1751307412381219

Sometimes it causes crashes on Unity.

This destructor existed because I was worried the glyph contours could take up a lot of space and computation when the state machine is not playing. But perhaps that's better than crashing runtimes.

Co-authored-by: Susan Wang <susan@rive.app>
2025-07-01 19:14:09 +00:00
bodymovin
7c48c4c159 Nnnn data bind artboards 4 (#10038) 32f0d6d0a0
* add js runtime support

Co-authored-by: hernan <hernan@rive.app>
2025-06-29 23:22:37 +00:00
philter
53cf65931f Use Flutter's PointerEvent timeStamp to compute elapsed time for scrolling (#10013) 94ee0804b8
In Flutter, due to how the pointer events are captured, using DateTime.now or Stopwatch at the time the StateMachine receives the pointer event does not provide accurate timestamps, thus the calculation of the pointer delta and elapsed time were inaccurate in the editor. For example, while dragging, the relative x/y delta between mouse move events may be steady, but the difference between DateTime.now and the previous now could vary widely, leading to inconsistent scroll behavior.

This PR updates to use the PointerEvent's timeStamp instead which is more representative of when the pointer event was dispatched. We capture the timeStamp and pass it through to both the Dart and C++ ScrollConstraints in order to correctly do the computation.

Co-authored-by: Philip Chung <philterdesign@gmail.com>
2025-06-17 19:28:03 +00:00
bodymovin
4dcda0f0ec Nnnn separate clear and unbind (#9888) f22462bd78
Nnnn separate clear and unbind

Co-authored-by: hernan <hernan@rive.app>
2025-06-17 14:33:05 +00:00
bodymovin
396287ab21 chore: refactor databind update cycle (#9863) 891f65794c
* advance data binds per artboard

Co-authored-by: hernan <hernan@rive.app>
2025-06-10 19:56:47 +00:00
bodymovin
6009196eae chore: add data binding set of tests (#9821) 6a3aa2cbfd
* add data binding set of tests

library: export used artboards from library files only (#9816) 127097dac4
# Description
Before this PR, we export all artboards from library files in runtime_exporter. This PR makes sure we only include what's directly or indirectly used by the host file.

# Details
While working on the runtime exporter, I'm realizing that we have a lot of arguments on the exportOneFile function that can be simplified, so I changed the api a little there too. I tried to separate out this in the first two commits.

For DataEnums, before this PR, there are 2 sources of 'filter' on what to export. One comes from 'usage', and the other comes from `requiredDataEnums` in the mappingContext. With this PR, I'm consolidating this into just using `requiredDataEnums`, so the usage of the current file is folded into this too.

For ViewModels, it's very similar. Before this PR, there's the argument `viewModels`, and the context view models coming from `requiredViewModels` in the mapping context. I've found this to be a little redundant, so I again folded the former into the latter.

For Artboards, there's already `exportArtboards` in the mapping context, but this represents what's exported by each file. The nested artboards rendering logic uses this directly. We don't have a way to communicate, for every file, what's required by other files. As such, I created a `requiredArtboards` concept, that's similar to the `requiredDataEnums` and the `requiredViewModels` above. This tracks the Artboards that every library file needs to export.

Fixes: https://github.com/rive-app/rive/issues/9434

Co-authored-by: Susan Wang <susan@rive.app>
Co-authored-by: hernan <hernan@rive.app>
2025-05-29 01:15:44 +00:00
bodymovin
ad0f98cc21 Nnnn data bind assets bkp 2 (#9705) e6782a6bfb
data bind images

Co-authored-by: hernan <hernan@rive.app>
2025-05-16 16:03:13 +00:00
luigi-rosso
a1441bba0a chore: fix clang-17 compiler (#9666) 8a1f3286b9
* chore: fix clang-17 compiler

* chore: adding missing file

* fix: rive_native builds

* chore: remove no runtime linking on linux

* chore: more fixes

* chore: removing rive_common

* chore: use build_rive.sh for ios

* chore: use rive_build.sh for recorder

* chore: fix fill missing version

* chore: add rive_build.sh to path

* chore: add rive_build.sh to pr_ios_tests.yaml

* chore: add rive_build to the recorder tests

* chore: drop rive_flutter tests

* chore: fixing ios tests

* fix misspelled

* chore: cleanup

* chore: use latest zlib

* chore: premake5.lua redirects to premake5_v2

* fix: tvos and ios builds

* fix: unreal build path for miniaudio

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2025-05-15 18:21:04 +00:00
bodymovin
691531d656 Component list js runtime ca744236fb
Component list js runtime

Co-authored-by: hernan <hernan@rive.app>
2025-05-02 15:58:17 +00:00
bodymovin
163e199710 fix: pass correct data context to state machine (#9545) 68262f2f3f
* fix: pass correct data context to state machine

* remove unused var

Co-authored-by: hernan <hernan@rive.app>
2025-04-26 01:47:33 +00:00
bodymovin
85d197e7e9 fix: update data binds when events from children are notified
# Description
when a nested artboard notifies events, we need to update data bound objects because those events might trigger changes on values that need to be synced

Diffs=
a21d95735d fix: update data binds when events from children are notified (#9499)

Co-authored-by: hernan <hernan@rive.app>
2025-04-20 22:42:29 +00:00
philter
cb122ae5d6 Component List in CPP
# Description
This PR implements Component Lists in the CPP runtime.

# Details
Mirrors the Component List Dart functionality in C++. Allows generation of Artboard Instances at runtime through ViewModelInstanceLists. This PR does not implement virtualization.

Diffs=
db11b46e96 Component List in CPP (#9408)

Co-authored-by: Philip Chung <philterdesign@gmail.com>
Co-authored-by: hernan <hernan@rive.app>
2025-04-18 21:45:29 +00:00
luigi-rosso
6c453ad79d Make RectanglesToContour more memory efficient (particularly for re-runs).
# Description
In the text input branch I realized I needed to re-use RectanglesToContour and that it would be called often when moving selection ranged cursors. The existing implementation closely matches our Dart one which is not very memory efficient, mostly due to it just being Dart.

# Details
- Try to store re-used containers on the RectanglesToContour class so allocation can happen less frequently when re-using the RectanglesToContour.
- Try to avoid any forced heap allocation (although some is still bound to happen).
- We had a lot of Vectors of Vectors. In almost all cases these got simplified to linear vectors or vectors of structs/classes. Because each vector does its own heap allocation, vector<vector<vector<...>>> can cause a lot of memory re-alloc when adding/removing elements.
- The boolean inclusion vector got converted to a bitset which is also stored on the class so it can be re-used.
- Nuke Rect as we have the same functionality in AABB.
- Massaged the API a bit to have names match the updated API a little more closely.

I'll add more comments inline below...

Diffs=
5c4e83502f Make RectanglesToContour more memory efficient (particularly for re-runs). (#9438)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2025-04-14 19:53:54 +00:00
mjtalbot
9122e58a54 Libraries
Bunch of changes, i think its at the point where it will be helpful to get a review, there is a *lot* of outstanding work to do here, but i'm hoping that much of it can be done while this is in master but not enabled for uat yet. so @susan101566 and I can work through that set together, with smaller more targeted fixes and changes.

There are a couple of things i want to figure out to make sure we can merge this:
- is the Resolver approach going to work (library components resolve to real components)
- writing library assets into the parent needs a bit more love, it should not cause problems unless you're using libraries
- I want to do a small refactor on the exporter before merge to keep asset writing and asset index updates together as suggested by @susan101566. there's a larger refactor here but i think that can be done in due course.
- re-check editor-only deliniation

After refactoring those i also need to re-check that all these things still work, because chances are i've broken something in the meantime.

for
    using a library in as a nested artboard &
    using a library as part of using a nested artboard that contains a library
check
    using a library animation
    using a library stateMachine
    using a library stateMachineInputs
        we can key state machine input changes
        we can trigger nested state machine input changes from teh state machine editor
    using a library with assets

exporting all the above and view in cpp viewer
exporting all the above and view in dart viewer

There is a large list of items that need to be worked on beyond this. but hopefully we can do that more incrementally. this includes but is not limited to:
- object validations make sense
- the asset panel is interacting as we want
- right click menus make sense
- out of band loading works
- library api failures are handled
- refactor how we add library assets
- refactor asset exporting
- tracking
- smi paths'

Diffs=
9d8a7e81fa Libraries (#9255)

Co-authored-by: Arthur Vivian <arthur@rive.app>
Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
Co-authored-by: Susan Wang <susan@rive.app>
2025-04-03 17:27:06 +00:00