* 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>
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>
* 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>
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>
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>
* 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>
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>
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>
* 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>
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>
* 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>
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>
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>
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>
* 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>
# 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>
# 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>
# 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>
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>