541 Commits

Author SHA1 Message Date
5ee2d85279 Fix incorrect default layout flags value
Added tests for default values on the layoutFlags. When I removed the clip bit, I generated the wrong hex value as the default which this fixes. This should not impact customers since there is no way currently to modify layoutFlags in the editor (since we moved clip out).

Also fixes a copy/paste error.

Diffs=
5e834adc2 Fix incorrect default layout flags value (#6596)
2277c08fc Apply same changes as downstream (#6634)
faf6ea317 Option to build harfbuzz with renames to avoid static lib collision. (#6630)
c51bda03e Fix downstream windows tests. (#6632)
34fff8ea4 Audio out of band in Unity! (#6616)
61f553d6d Audio for Unity (#6606)
562fc5c51 fix cast (#6599)
e145f9348 Add audio preview generator. (#6580)

Co-authored-by: Philip Chung <philterdesign@gmail.com>
2024-02-16 04:59:43 +00:00
cb2fe94eba Move clip property outside of layoutFlags
Moved clip property out of layoutFlags0 into it's own bool value, and right shifted layoutFlags0 by 1 bit.

Diffs=
cd4a8f840 Move clip property outside of layoutFlags (#6579)
27ac9fcbb text modifier length calculation fix (#6494)

Co-authored-by: Luigi Rosso <luigi.rosso@gmail.com>
Co-authored-by: Philip Chung <philterdesign@gmail.com>
2024-02-07 21:00:50 +00:00
3c3362e70a Update key to align with old artboard clip value
Diffs=
c053d6acc Update key to align with old artboard clip value (#6574)

Co-authored-by: Philip Chung <philterdesign@gmail.com>
2024-02-06 23:34:05 +00:00
cc80e0b888 support draw order sorting
add support for sorting draw orders

Diffs=
fd1dcaab8 support draw order sorting (#6554)
f5e458f80 Rework text/event count/at. (#6548)
852b17bca fix ./build_viewer.sh run (#6545)
029d67465 Update goldens (#6542)

Co-authored-by: hernan <hernan@rive.app>
2024-02-03 01:38:24 +00:00
9f55101ec5 apply current state update before changing states
Once a transition completes, we update the state without applying the advance to the currentState of the transition.
This PR checks whether a transition is complete to invoke apply to the complete state before moving to the next state.
Note: It could happen that the next state is actually the same one completed in the transition, so apply would be called twice on the same state.
Conceptually it makes sense to treat it as two different things, since one is in the context of the transition and the other "apply" is in the context of the new state. But in terms of performance, this might not be the best solution.

Diffs=
da14cc814 apply current state update before changing states (#6538)
ac0d97c12 Clean up emscripten build (#6531)

Co-authored-by: hernan <hernan@rive.app>
2024-02-01 05:16:13 +00:00
c978da30da make sure we force embedded assets when exporting for cloud renderer …
…preview

fixes an issue when hosted/referenced is set for assets for the cloud renderer.

by either producing a zip file or a file without the assets (both of which do not work well when previewing the render)

removed a few things that were flagged up as warnings as well.

i ignored an extra dependency for editor though:
```
  just_audio: ^0.9.36
```

gonna have a quick look if i can add a test...

Diffs=
acdaee21f make sure we force embedded assets when exporting for cloud renderer … (#6536)
353cf349b Fix GL rendering with URP. (#6535)
6150f1267 Unity with new Premake scripts! (#6532)
231b35a41 Unity Android & C# style updates (#6517)
da8d2d5f7 fix listener resolving to different event (#6528)
026caa5a9 Tests use new premake system (#6526)
a8c86e949 fix viewer build (#6527)

Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
2024-01-31 18:21:43 +00:00
e43e18973e Lua formatter
Format all our lua scripts with Stylua

https://www.notion.so/rive-app/Formatters-be8845abbca34e39b5d4c212b2437b3f?pvs=4

Diffs=
858215cc4 Lua formatter (#6525)
b8875ef31 Reorganize premake (#6522)
fddb050ca Build Android deps with audio (#6515)
5cfc226f2 PLS external framebuffer optimizations (#6516)
2018358a6 Properly generate an android_ndk toolset (#6506)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2024-01-26 23:52:44 +00:00
ff3dcae269 Audio engine
Adds an audio engine abstraction (implemented with miniaudio) in Rive. We can selectively replace it with other abstractions later if we find miniaudio isn't well suited everywhere but I'm confident it will be based on flexibility with getting it working in the recorder.

Adds audio support in:

- packages/rive_common
  - WASM: rive_audio_wasm.dart
  - FFI: rive_audio_ffi.dart
- packages/runtime
- packages/recorder

Subsequent PR will add support in:

- packages/rive_unity
  - This is getting meaty enough...
- packages/rive_flutter
  - This requires publishing rive_common so I want to make sure this is reviewed and accepted before publishing
  - I'd also prefer to merge layout constraints into rive_common before this lands.

Editor features:
- Updated preview window:
<img width="248" alt="CleanShot 2024-01-15 at 14 44 31@2x" src="https://github.com/rive-app/rive/assets/454182/a9588be6-8370-4e22-ab32-af1e9ed71183">

- Preview waveforms in the timeline:
<img width="651" alt="CleanShot 2024-01-15 at 14 44 53@2x" src="https://github.com/rive-app/rive/assets/454182/2710667f-838f-483d-9647-e2bcb9e0237a">

- Subsequent PR will also use threads in web editor build (currently uses a time/frame based decoder to offload ui). I can't do that until I can verify the Shared Memory access is granted once rive_common lands in pub.dev and then we can push to UAT.

Diffs=
73bf11db3 Audio engine (#6454)
b098ad23a IntersectionBoard optimizations (#6486)
fafdef56c IntersectionBoard cleanups (#6474)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2024-01-23 04:14:10 +00:00
7bfa7e5646 Layout constraints
A lot here and some of it isn't fully complete but want to try to get this merged so Alex can have an easier time iterating on the UX.

What's done:
- Build integration of Taffy Rust library with Flutter via Rustup & Cargokit (more info here: https://matejknopp.com/post/flutter_plugin_in_rust_with_no_prebuilt_binaries/)
- Flex & Grid functionality implemented in Flutter (editor & Flutter runtime) with placeholder editor UX
- Flex implemented in Wasm
- Editor layout UX flagged

To do:
- Grid implementation in Wasm needs more work, but can come after this PR since it won't be part of Alex's initial editor UX.
- Flex & Grid in CPP is done for the most part, but isn't part of this PR. It can't be merged until we get Taffy to build. @dragostis did some work on the build stuff here https://github.com/rive-app/rive/pull/6385 but will likely need additional work.

This PR revs rive_common on pub.dev to 0.2.9 and flutter_wasm on npm to 16.0.0

Diffs=
5ca57bcf5 Layout constraints (#6421)
584a1c28e fix elastic interpolator crash with period 0 (#6450)
af2f2d632 Unify storage buffers for atomic mode and normal (#6449)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
Co-authored-by: Luigi Rosso <luigi.rosso@gmail.com>
Co-authored-by: Philip Chung <philterdesign@gmail.com>
2024-01-17 20:29:59 +00:00
40cf82f877 fix: validate attached state before handling pointer events
Fixes https://github.com/rive-app/rive-flutter/issues/355

Diffs=
cfe49a60b fix: validate attached state before handling pointer events (#6439)
dcbe806b0 default to skia branch for commit hash in cache helper (#6432)

Co-authored-by: Gordon <pggordonhayes@gmail.com>
2024-01-11 16:52:40 +00:00
031dcb6813 Remove threshold adjustment for exit time.
This is to address the issue discussed here re: missing final events: https://2dimensions.slack.com/archives/CLLCU09T6/p1704819997769059

We added a small amount of padding to the exit time check to fix this issue: https://github.com/rive-app/rive/issues/4997

This is causing us to miss reporting events that are right on the last frame.

It seems like we also addressed the issue above by being more precise with the "should exit" logic from a linear animation instance. I can no longer repro the issue Pedro posted in the original bug (where it would never exit the Jump animation) above without the exit time padding.
https://github.com/rive-app/rive/pull/5939

Diffs=
21b318244 Remove threshold adjustment for exit time. (#6427)
d67aeac4d Implement re-ordering for PLS atomic draws (#6417)
a3788ed8a add support for self clipping shape (#6416)
b58df4ba7 clone metrics path when a path is added (#6394)
124a8f4e2 Defer PLS writes to GPU resources until flush (#6405)
d52d14a1f Refactor PLSRenderer into draw objects (#6397)
8666bde87 Convert RenderPath/CommandPath and RenderPaint to refcounted objects (#6395)
9c3da38e3 Delete the Vec2D default constructor (#6388)
ee0a1ee5d use skia directly from skia repository for recorder (#6359)
f8004f31e add support for svg export (#6166)
d563202b4 fix off color interpolation (#6375)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2024-01-10 03:29:43 +00:00
1ce734c75f chore: publish flutter v0.12.4
Diffs=
8fb397939 chore: publish flutter v0.12.4 (#6369)

Co-authored-by: Gordon <pggordonhayes@gmail.com>
2023-12-19 09:59:47 +00:00
07c6d25de0 feat: flutter hit test self on rive render object
This PR adds hit testing to Flutter by overriding `hitTestSelf` on the Rive RenderObject.

Currently, the hit area is the entire bounding box of the canvas. This means that when a Rive animation is rendered above any other Flutter content (for example, a Stack) all hits are absorbed by Rive and do not pass through.

With this change, Rive will only absorb hits if the pointer comes in contact with a hittable Rive element.

With this change, `handleEvent` will only be called if `hitTestSelf` returns true. There is some duplicate work here as `_processEvent` already performs similar hit test logic, which we can look at optimizing. But `hitTest` needed to be separate method call, as `hitTestSelf` is called before `handleEvent` and `handleEvent` sends additional information (whether it's a pointer down/up etc.).

Diffs=
95beaa4f5 feat: add flutter hit test self on rive render object (#6341)
bd71143bc chore: fix broken docs link (#6360)

Co-authored-by: Gordon <pggordonhayes@gmail.com>
2023-12-18 09:00:21 +00:00
3b03b0565e update flutter runtime
Diffs=
423366fb7 update flutter runtime (#6350)
0f08dd379 prevent pointer event propagation to collapsed nested artboards (#6322)
d863a6258 mark text dirty when the style id of a text run changes (#6334)
c357e7aa7 Add a "lite_rtti" utility and use it with Render objects (#6311)
53972cc17 Make tess compile again (#6308)
fabb7f97f Ios out of band (#6232)
ed4474d1a skip constraints in editor when target is collapsed (#6294)

Co-authored-by: hernan <hernan@rive.app>
2023-12-13 15:26:11 +00:00
412ee93224 ignore paths that are inactive in solos when calculating hit test
we were not skipping collapsed shapes and paths for hit testing, so pointer events were triggering on elements that were inactive.
This PR skips those paths to fix it.
Note: there might be some performance improvements that can be done in the future skipping shapes that are fully hidden, but this PR most likely covers the majority of the usual cases.

Diffs=
2c2d332e0 ignore paths that are inactive in solos when calculating hit test (#6276)
c37a28468 generate drawing rules in the correct order (#6275)

Co-authored-by: hernan <hernan@rive.app>
2023-11-23 12:40:13 +00:00
a04ede704e Xxxx hidden paths runtime render fixes solos
This PR adds support for soloing individual paths and nested shapes. It also aligns editor and runtime behavior.

Diffs=
ee674a819 Xxxx hidden paths runtime render fixes solos (#6252)
a0f076e31 tendon crash fix (#6258)
fdad66136 Disable d3d blend state during PLS flush (#6254)
e717ed98a add clipResult enum and render clips to copy the editor behavior (#6218)
faba3ff51 Unity (#6173)
18ae32102 Delete assets after artboards to fix race condition with FileAssetReferencers. (#6223)
252100f48 Fix validation for listeners to validate with nested inputs (#6220)
f21ebc98c compute parameters when cubic values change (#6207)

Co-authored-by: hernan <hernan@rive.app>
2023-11-22 20:18:16 +00:00
511205fa21 chore: release flutter 0.12.3
Diffs=
da903372b chore: release flutter 0.12.3 (#6208)

Co-authored-by: Gordon <pggordonhayes@gmail.com>
2023-11-06 11:14:34 +00:00
bee29187dd Fix event listening for RuntimeArtboard
Flutter runtime needed an additional callback hooked up to listen for nested artboard events because its main artboard is a RuntimeArtboard.

Diffs=
c5f85ed7f Fix event listening for RuntimeArtboard (#6202)
5e33d8c96 fix: Made default and copy constructors explicit. (#6203)

Co-authored-by: Gordon Hayes <pggordonhayes@gmail.com>
Co-authored-by: Philip Chung <philterdesign@gmail.com>
2023-11-06 10:27:38 +00:00
73731ffa6e Fix follow path 6070
fixes #6070

thank you @philter for sorting out the path mess, i got myself extra confused with `addToRawPath` (i thought we were simply passing the variables along and one of them got corrupted, i didnt notice that it was just down to a bad static cast when we were a path!)

vid of this behaving in dart & cpp

Added a rive-flutter test to this.

one interesting thing, essentially follow path currently follows the "first" path in a shape.

https://github.com/rive-app/rive/assets/1216025/d59026f6-c901-439c-aff2-2214a021ee75

Diffs=
ef8a4e7f7 Fix follow path 6070 (#6182)
3927ea695 add support for rendering static scene (#6192)

Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
Co-authored-by: Phil Chung <philterdesign@gmail.com>
2023-11-03 17:15:23 +00:00
276dc2058c Publish rive_flutter and rive_common.
Diffs=
351838fb5 Publish rive_flutter and rive_common. (#6186)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2023-11-02 16:16:17 +00:00
357b9ed102 Core.copy doesn't copy core object id.
Usually when we copy/clone an object we do it with the intention of adding to core shortly after. This has a problem if the object has an id already, it won't be assigned a new one which means we'll end up with multiple objects in core with the same id. This breaks the fundamental concept in Core that each Id will always point to an object of a specific type (which is important for undo/redo but also for concurrent client changes). Changing a type should incur a new core object.

Note that reference ids to other objects still get copied.

Diffs=
f9a356004 Core.copy doesn't copy core object id. (#6187)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2023-11-01 20:52:01 +00:00
243896a94b remove duplicate interpolator import
elastic interpolators were imported twice, once in their class and once in the KeyframeINterpolator class.
This was offsetting the ids to which keyframes were pointing.
This PR removes the import from the ElasticInterpolator class (copying how the cpp version does)

Diffs=
a853c5ac7 remove duplicate interpolator import (#6180)

Co-authored-by: hernan <hernan@rive.app>
2023-11-01 01:02:40 +00:00
297f8a04b3 Support Artboards as event listener targets
As discussed, in order to listen for events triggered from the same artboard, add support for Artboards as StateMachineListener targets (only display artboard events in the Event list if the Artboard is the target). This is for Artboards only, NestedArtboards already behave correctly.

One caveat to this is that we still show pointer events in the Event list when an Artboard is selected. Maybe we should remove those? However, we also show pointer events currently when no target is selected, so maybe at some point we should take another pass at that?

Diffs=
4a11ac691 Support Artboards as listener targets - Events only (#6147)
1506b069c Outofbandcache (#6049)

Co-authored-by: Philip Chung <philterdesign@gmail.com>
2023-10-26 22:08:34 +00:00
7cb9e8c18e Fix for FollowPathConstraint position at distance multiples of 100%
Reported by Chad and simpleclub that the position of the constrained component moves to its 0 distance position when distance is set to any multiple of 100%. Fix is for editor and runtimes.

Diffs=
40f9d91ac Fix for FollowPathConstraint position at distance multiples of 100% (#6149)

Co-authored-by: Philip Chung <philterdesign@gmail.com>
2023-10-25 23:54:57 +00:00
57e1fb00a9 set state machine active adding a reported event
set state machine controller as active when an event is added to report event. This fixes events not being applied in some scenarios

Diffs=
eeaf88f05 set state machine active adding a reported event (#6153)

Co-authored-by: hernan <hernan@rive.app>
2023-10-25 23:19:53 +00:00
3a2c824c2b Add elastic interpolation to Flutter runtime
Fixes crash @LauraRive caught when editing a file with nested artboards.

Diffs=
389618e94 Add elastic interpolation to Flutter runtime (#6158)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2023-10-25 22:14:08 +00:00
fa80780c28 Apply NestedInput initial values
This update applies the initial values for nested inputs (as set in the Inputs panel of the Editor), so that NestedInputs behave in the same way as regular StateMachineInputs. There are a couple of reasons to do this:

1. Currently if you have a nested artboard and set the initial nested input value, it will only apply in the editor when viewing that artboard. If you nest that artboard in another artboard, the initial values do not apply. Similarly, initial nested values do not apply in the runtimes. Currently StateMachineInputs do apply initial values, so this brings NestedInputs in line with that.

2. There was a bug Hernan noticed where there in certain cases, NestedInput values that were keyed on a timeline did not apply properly in cases where the keyed value was the same as the default value. In these cases, the keyed value is ignored because it and the default values were the same. In addition, since the initial value wasn't being applied, the state wasn't being update properly based on the nested input's value.

Diffs=
6d9aa0179 Apply NestedInput initial values (#6140)
92c8f1164 Elastic easing (#6143)

Co-authored-by: Philip Chung <philterdesign@gmail.com>
2023-10-25 05:37:20 +00:00
312a8b0577 bring flutter asset loading inline with cpp
basically does what it says, i'm also removing an example i used to check on things being garbage collected

Diffs=
c0411df0a bring flutter asset loading inline with cpp (#6135)

Co-authored-by: Gordon Hayes <pggordonhayes@gmail.com>
Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
2023-10-24 14:37:30 +00:00
50f9624195 add ArtboardProvider class
This PR solves some issues with nested artboards where they don't get refreshed when some properties from its children change. In consequence, parent artboards display old data when their State machines are played.
It's solved by adding a unified way of flagging artboards when a property changes, so any class that inherits from artboard_provider will automatically flag the artboard as changed.

Diffs=
db984dfd3 add ArtboardProvider class (#6112)
d65b239c5 Add options to build with rtti and exceptions (#6121)
82d664d4b Fix clang format error (#6137)
8f6b07395 add isCollapsed validation on nested artboard advance method (#6081)
c5cde614b Fixed clang check. (#6125)

Co-authored-by: Luigi Rosso <luigi.rosso@gmail.com>
Co-authored-by: hernan <hernan@rive.app>
2023-10-23 22:10:30 +00:00
ab75e1707a Show NestedInputs in the Inputs panel of the parent artboard
One feature missing from the nested inputs implementation was the ability to see the nested input values in the parent artboard's input panel. This update adds this feature, grouping the nested input by its nested artboard.

https://github.com/rive-app/rive/assets/186340/6892826f-14e0-46e7-a9bf-e629e005e85c

Diffs=
3b32d2431 Show NestedInputs in the Inputs panel of the parent artboard (#6107)
7227975fb Move vello (#6104)
6488a1822 Added by-name instantiation. (#6102)

Co-authored-by: Philip Chung <philterdesign@gmail.com>
2023-10-19 17:20:20 +00:00
0bb24516d9 add ability to attach callbacks when resolving file asset listeners
Bascially add tracking of fileAssetReferencers from file assets, so that when file assets update, they can tell things that reference them to update also.

its worth looking at the rive-flutter & runtime implementations

in cpp it looks like we can hook into the delete hooks nicely to clean up after ourselves (so that when artboards get collected we are not holding references to them from file assets)

in dart this is more of a problem, however using weakReferences we do end up seeing artboards go out of scope
but weakReferences requires us to bump to a min dart of 2.17 (we are 2.14 in flutter & 2.12 in our editor atm)

the update here also uses the referencers to mark fonts dirty when fonts are set, which causes them to be updated on the next draw cycle

(video showing font updates working properly now in dart)

https://github.com/rive-app/rive/assets/1216025/d65ea2cf-95d6-4412-b8f5-368cda609d0b

(video showing how referencers get collected and trashed in dart, it looks like we hold onto about 10 of them at a time.. but they do drop off over time. also we start with 2 references, the main artboard and the artboard instance)

https://github.com/rive-app/rive/assets/1216025/b11b7b46-aa9d-4dcc-bc11-f745d8449575

Diffs=
7bc216b03 add ability to attach callbacks when resolving file asset listeners (#6068)

Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
2023-10-17 16:05:47 +00:00
159a6850cc chore: increase http package range
This is my fault, I should have done this when I initially bumped the http package to support a wider range to ensure our package plays well with other packages that rely on the HTTP package.

The 1.0 HTTP release also bumped the minimum Dart version to 3+

Normally if this is a problem for someone they can manually provide a dependency override if they want to use an older version of the HTTP package, but this is a problem for Flutter Flow users that want to create a custom widget and add Rive as a dependency, as certain FF dependencies are using the older version of HTTP.

Diffs=
9e40f95e5 chore: increase http package range (#6099)

Co-authored-by: Gordon <pggordonhayes@gmail.com>
2023-10-17 12:54:34 +00:00
284afd6414 Xxxx nested inputs fixes
Diffs=
c583c4e5b Xxxx nested inputs fixes (#6098)
8b7dd980b patch up division by zero issue on normalizing Length (#6095)
8c99c8dcf Android Out of Band Assets (#6019)

Co-authored-by: hernan <hernan@rive.app>
2023-10-17 01:43:46 +00:00
c6f1ae4cff Removed single-threaded counter.
This counter type is single-threaded and makes all objects using it thread-unsafe.

Diffs=
6a74a01f2 Removed single-threaded counter. (#6090)
b4ef09a6d Removed Cargo workspace dependencies. (#6089)
c63346b93 Fission the CG and Skia renderers (#6071)

Co-authored-by: Dragoș Tiselice <dragos@rive.app>
2023-10-13 15:11:10 +00:00
e617da4f74 Nested Inputs
This PR adds support for setting NestedInput values from a parent artboard. We should support NestedBool, NestedNumber and NestedTrigger. After discussion with @alxgibsn there are at least 4 editor UI updates required to work together with this feature.

- [x] Add a `public` boolean to StateMachineInput that allows you to specify whether the input should be available outside of its own artboard. This is presented in the motion inspector when a StateMachineInput is selected.
- [x] Surfacing Nested Inputs in the Inputs panel alongside the Inputs for the current artboard. We also need a way to differentiate Nested Inputs from regular Inputs (possibly a folder-like hierarchy).
- [x] Surfacing Nested Inputs in the Inputs list for a Listener.
- [x] Surfacing Nested Inputs in the NestedArtboard StateMachine flyout. Looks like this work has already been done!
- [x]  Get NestedTrigger working

Diffs=
45359b3e8 Nested Inputs  (#6007)

Co-authored-by: Philip Chung <philterdesign@gmail.com>
2023-10-11 22:23:08 +00:00
672dbf976e Add support to Listeners for events from nested artboards
- Propagate events up to parent Artboard state machines
- Add Event to Listener types and display in combobox
- Add support for StateMachineListeners to listen for events

Still needs implementation on CPP runtime.

In this example, the rectangles are in a nested artboard. Clicking them fires an event from the nested artboard up to the parent artboard which has a listener which updates an input triggering the animation.

https://github.com/rive-app/rive/assets/186340/22bfb00e-8d1e-46f0-8faa-d2d5e5a1bbfb

Diffs=
1a9dd7e97 Add support to Listeners for events from nested artboards (#5923)
52a1a6f88 Added a Rust runtime. (#6027)
22077beda feat: add count and query APIs for events and text runs at the Artboard level, and expose in WASM (#6043)
f95f54140 Add out of band loading to rive-wasm (#6017)
54d736fec 6041 follow path with 0 opacity (#6060)
bb7d5ac4c Add a math::round_up_to_multiple_of<N>() utility (#6061)
6ee7cea9e Clamping color stops. (#6052)
bb00ec119 Add a WebGPU mode that uses EXT_shader_pixel_local_storage (#6048)
af873d55a update runtime with file asset cdn information (#6040)

Co-authored-by: Philip Chung <philterdesign@gmail.com>
2023-10-11 21:22:17 +00:00
bd54862d72 chore: prep flutter runtime for release v0.11.17
- Checks to see everything is working
- Fixes a few analyser warnings and updates CHANGELOG

Diffs=
399ef7716 chore: prep flutter runtime for release v0.11.17 (#6011)

Co-authored-by: Gordon <pggordonhayes@gmail.com>
2023-09-19 18:50:22 +00:00
64a335e20c Fix issue with timeline events on first frame
Events that fire on the first frame (with a work area too) were not reporting. This was because the way we look for occurred events wouldn't catch an event that started at the same time as the playhead as presumably that would've been caught on the previous frame. This falls apart when the animation starts on the same frame as the one where an event (or multiple) are triggered.

Adds a fix by detecting this condition and a bunch of tests in both C++ and Dart for it.

Also revs the lightning bolt animation in the editor for triggering the event as this showed an issue with state contention in its state machine.

Diffs=
382a48cf8 Fix issue with timeline events on first frame (#6006)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2023-09-19 02:46:23 +00:00
98040494a8 feat: expose wrapper event class to runtime
The goal of this PR is to improve the usability of events for the Flutter runtime and to hide unnecessary editor implementation detail. This also ensures that an event is not modifiable after it has been reported (from the runtime's perspective)

This is achieved by exposing runtime specific classes `RiveEvent`, `RiveOpenURLEvent` and `RiveGeneralEvent` (similar to the other runtimes), and mapping the current `Event` to these classes as an immutable object. It also maps the list of events to a Map called `properties`.

This PR also:
- Adds more event examples and fixes the audio example (`.stop` resulted in issues, and calling dispose, etc.)
- Adds tests for events

TODO:
- Will need to potentially change things (and expose the `delay`) when this lands: https://github.com/rive-app/rive/pull/5951

Diffs=
eae01824d feat: expose wrapper event class to runtime (#5956)

Co-authored-by: Gordon <pggordonhayes@gmail.com>
2023-09-18 17:54:53 +00:00
acdcb4ef2f Event fixes
Addresses issues brought up here:
https://2dimensions.slack.com/archives/CLLCU09T6/p1694766559770229

- Custom properties not updating when expected.
- Events not firing on first frame.

One important aspect of all of this:
- Custom properties on events update with LinearAnimation.apply.
- Events on timelines and state machines accrue/report during StateMachine/LinearAnimation.advance

These could happen when the state machine would transition to a layer with an animation. The first frame would apply with mix 0 meaning all non-mixable properties wouldn't be applied per https://github.com/rive-app/rive/pull/5960/files.

I took a slightly different approach. Now apply will always try to apply values. If mix is 0, non mixing properties will apply. I think semantically this makes more sense too. If you don't want to apply, don't apply. Apply with mix 0 is effectively a no-op as we had it before, so it was just a perf suck.

So I re-worked the various call sites for apply to not call it when attempting to mix in an effectively mixed-out animation. This has one caveat for blend states. Because the blend state advances all the animations in sync, .advance must still be called when mix is 0, so events will still report but custom property keyframes in mixed out animations will not update. I think that's reasonable, but may not be immediately apparent. We can opt to not report events when the mix is 0 by introducing a "reportEvents" boolean to advance, or add an option to the blend state for whether or not they should report.

Diffs=
236d788ea Event fixes (#5997)
05e1afaf3 Bump the iOS minimum version to 13 on native builds (#5989)
0dcbdade4 add artboards shapes to updates when RenderOpacity has dirt (#5971)
85b2b6ed1 Read passed any empty runs when iterating glyphs. (#5974)

Co-authored-by: Alex Gibson <agibson.uk@gmail.com>
Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2023-09-15 22:11:30 +00:00
e95a35f710 Don't apply id keyframes when mix value is 0
Addresses an issue where mixing animations of a nested artboard from it's parent artboard can produce unexpected results when dealing with id based keyframes (such as active solo or draw rules). The proposed solution ignores applying an id keyframe's value to an object if the mix value for that animation/keyframe is 0. This provides a way to turn "off" an id based keyframe during a mix.

Behavior AFTER this update. This example has an artboard with 2 animations that each have different values for active solo and a draw rule that is on or off. This artboard is nested in another artboard which sets the animation mix as seen in the recording.

https://github.com/rive-app/rive/assets/186340/b67e98c8-ab7c-4a92-ab3b-65d27b0eadbd

Behavior BEFORE:

https://github.com/rive-app/rive/assets/186340/c0a6c558-efc4-43ec-8974-57bf8f6ab3e8

Diffs=
b9382846d Don't apply id keyframes when mix value is 0 (#5960)
f96c86fcc Timeline Events for runtime (#5951)

Co-authored-by: Philip Chung <philterdesign@gmail.com>
2023-09-12 16:14:29 +00:00
c6791d7b6d Timeline events & Core Callback type
Introduces a new Core field type which does not produce stored fields. Instead it provides a callback which can be keyed and unique per type so time based events can trigger against their property keys.

This is to allow things like nested trigger inputs and triggering events from the timeline.

Draft as there's a bunch more work to do for actually invoking them from the StateMachine & LinearAnimations. In the meantime the tests can do some sanity testing.

- [x] Generate core types that do not produce stored fields.
- [x] Massage Keyframe hierarchy to allow for non stored value Keyframes (markers for trigger).
- [x] Key those core types with specialized keyframes.
- [x] Pass context (like StateMachine) to those triggers and see it all tie together.

Diffs=
6058b52ce Timeline events & Core Callback type (#5877)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2023-09-05 20:14:25 +00:00
94c7847bb0 Publish new version of rive_common.
Fixes https://github.com/rive-app/rive-flutter/issues/340

Diffs=
4892035f5 Publish new version of rive_common. (#5946)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2023-09-05 19:36:01 +00:00
2022de3092 Published Flutter 0.11.16
Diffs=
4be3c364b Published Flutter 0.11.16 (#5941)
853ae7de1 Fix keepGoing when a work area is used. (#5939)
33aec1b20 Make Mat2D constructors constexpr (#5932)
4335a2cd2 Fixed runtime to compile with gcc. (#5870)
c6b867df9 Allow setting text to completely empty. (#5924)
06a187288 Make RenderBuffer mappable (#5907)
654d4488e Add a macro to create bitsets from enums (#5922)
7bbf083ce Add some joystick flag tests. (#5921)
d35df0427 Delete the copy constructor from Mat2D (#5916)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2023-09-01 23:27:50 +00:00
f9cc0f968a Treat all Constraints and ClippingShapes differently than children when propagating collapse
Decided to go with the `is` check because it seems like all types of Constraints or ClippingShapes should follow this behavior now and in the future.

Diffs=
16cf8082f Treat Constraints, ClippingShapes and DrawRules as special Solo child types (#5897)

Co-authored-by: Philip Chung <philterdesign@gmail.com>
2023-08-25 23:50:35 +00:00
7222e458c8 Improve collapse propagation for solo.
Fixes https://2dimensions.slack.com/archives/CLLCU09T6/p1692895941301969

Should also address #5888

Basically we were propagating the collapse to the ClippingShape for the solo which meant that the update on the clip was never called. This meant the path would never be generated and so our contents would always get clipped out (no intersection with an empty path).

ClippingShapes and Constraints should be treated more like siblings (or properties) of the Solo instead of children that can be collapsed by the active solo child choice.

Diffs=
e1b9d360b Improve collapse propagation for solo. (#5890)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2023-08-25 00:09:51 +00:00
c517e49ebf make custom workflow to see whats happening wiht flutter
Diffs=
ab5745943 Update files to use git lfs (#5883)
2719b1463 early out of advance if we are not going to keep goign (#5849)

Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
Co-authored-by: Philip Chung <philterdesign@gmail.com>
2023-08-24 15:32:54 +00:00
174048e3ee Don't collapse child constraints of Solos
Fixes the problem where FollowPathConstraints were not working with Solos in CPP runtime (works only in editor). The proposed solution is to not collapse constraints of the Solo because in the case of FollowPathConstraint, a call to it's update() is required in order to get the path info.

Before the fix:

https://github.com/rive-app/rive/assets/186340/48df0eb5-a422-464c-84c0-4c49412fa90e

After the fix:

https://github.com/rive-app/rive/assets/186340/dbfc8172-217d-4685-92c8-c34c551235ca

Diffs=
a91b1b764 Don't collapse child constraints of Solos - fixes Follow Paths on Solos (#5866)
033489f8b Fix follow path contention with MetricsPath (#5868)

Co-authored-by: Philip Chung <philterdesign@gmail.com>
2023-08-24 05:31:50 +00:00
278695858d Choose events to fire on State and Transition start/end.
Allows selection of event and when to fire it per state and transition.

On a state:
![CleanShot 2023-08-16 at 22 28 32@2x](https://github.com/rive-app/rive/assets/454182/34c49212-6638-4187-91ed-d99042cc5a2a)

On a transition:
![CleanShot 2023-08-16 at 22 28 53@2x](https://github.com/rive-app/rive/assets/454182/d7bcbcbf-6719-4c5f-9a2a-cfee491ac718)

I also kept getting the annoying combo-box stuck at the bottom of the screen with these combos so low to the bottom right, so I fixed that too. Which helps the text combos too. Popups with predictable heights will try to open in the direction where they'll have most vertical space:
<img width="570" alt="CleanShot 2023-08-16 at 22 30 02@2x" src="https://github.com/rive-app/rive/assets/454182/88802e09-04df-4256-b4c1-2cc2bf490fcd">

Diffs=
ad4236501 Choose events to fire on State and Transition start/end. (#5830)
abe5aab14 Added a Vello back-end with a custom winit viewer. (#5786)
adeebb26a Implement drawImage() in PLS (#5780)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2023-08-18 19:49:16 +00:00
4780d19c3a Event triggering
Explores an API for triggering events and querying them at runtime.

For Flutter we expose an onEvent callback that you can add a callback to on the StateMachineController:
```dart
final controller = StateMachineController.fromArtboard(artboard, 'bumpy', onEvent: {);
controller.onEvent = (event) {
  // Do something with event. Like:
  if(event is OpenURLEvent) {
    launchUrl(event.url);
  }
};
artboard.addController(controller!);
```

Note that I haven't piped onEvent to the Flutter runtime yet but you'll see it in the StateMachineController in core.

In C++:
```c++
auto count = stateMachineInstance->firedEventCount();
for(auto i = 0; i < count; i++) {
  auto event = stateMachineInstance->firedEventAt(i);
  if(event->is<OpenURLEvent>()) {
    // Do something with the url.
    auto url = event->as<OpenURLEvent>()->url();
  }
}
```

You can see some of this in action in the state_machine_event_test.cpp.

You can also see the events in the console in the editor:
<img width="717" alt="CleanShot 2023-08-10 at 18 03 22@2x" src="https://github.com/rive-app/rive/assets/454182/af21902a-424d-435b-b5b0-2a43701fe186">

In a follow up PR:
- Ability to trigger events from State (in/out) and Transition (start/end).
- Add custom properties to Events C++ API (currently they are loaded but not tracked against their respective events).

Diffs=
8caa7d377 Event triggering (#5793)
e71ae68ba  Fix issue with nested artboards not updating follow path constraints. (#5810)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2023-08-14 19:17:57 +00:00