28 Commits

Author SHA1 Message Date
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
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
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
01a12255ea basic text test
adding a basic text test to get to the bottom of text not working

Diffs=
66e234066 basic text test (#5718)
b69ae1312 Lift tess decoders into a static lib (#5709)

Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
2023-08-01 14:48:05 +00:00
0e3fdf8de5 Caching example
(basing this pr onto our dart runtime change for now, to limit scope)

made some small tweaks to function names, mostly to get fonts and images to "feel" more similar.

broke out "decode' into parsing the asset first.

makes it possible to cache images/fonts with our dart runtime, example included

Diffs=
40302069e Caching example (#5517)

Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
2023-07-06 10:50:13 +00:00
5def5d7b1c Font dart runtime
There are a number of questions I'd like to resolve before considering to merge this. also a few thigns to clean up no doubt

# Questions before merging
To customize loading out of band assets, we expect our users to implement
```
abstract class FileAssetLoader {
  Future<bool> load(FileAsset asset);
  bool isCompatible(FileAsset asset) => true;
}
```

1. is this a good interface (i've changed `loadContents`, to `load`)? (if we like this we should change this in cpp too)
2. `FileAssetLoader` is a mouth-full, would `AssetLoader` be better?
3. We are passing `FileAssets` (our core objects) to users with some slight api extensions, is that good? should we just wrap this in an Asset class (I had this before, its not a lot of work to get it back)

things sorted
- [x] cdn "loading" vs url loading
    - just sticking with cdn, users can customize for url
- [x] asset class for consumers of our runtime.
    - i've avoided this one for now, just extending our FileAsset
- [x] Importer/Resolver/Loader. I flipped some names around, mostly because I want our end users to provide an `AssetLoader`, not a resolver.

things to sort out down the line, i'm declaring them out of scope for this pr, fft disagree:
- Fallback font, I see we have a fallback font file hardcoded in the runtime. should investigate if we can include an asset for people like this, or if we need to have users set this if they want to use fallback fonts.
- Image Placement, we should strip width/height from runtimes on ImageAssets
- What do we want to do about asset loading / decoding errors
- TextStyle has both assetId & fontAssetId it gets assetId from the file asset referencer, its nbd,

Diffs=
06e959ad2 Font dart runtime (#5411)

Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
2023-07-06 08:49:14 +00:00
00798ca173 Perf/flutter runtime opacity check
- Adds checks to see if a drawable has a 0% opacity before performing draw commands
- Add skinning example

Diffs=
a61f4c6b5 apply changes to rive_core
8152b8a02 docs: update CHANGELOG
b8f61022c perf: check if opacity is 0 before drawing
4c4826e67 chore: add typedef argument names
ff94982f9 docs: add skinning sample
f1ddd88d4 Fix artboard pieces slowly popping in. (#4818)
3039909c2 Update to using deployment workflow similar to ios
53a8f9517 Fix direction when looping. (#4786)
4c5a576ad Fix ping pong hang (#4776)
ae1e02afc Fix tess test linking (#4773)
4ecbf9321 Fix remap based on issue JC caught. (#4771)
89e38b700 allow negative speed (#4770)
4d115b4c6 Adding GLSL100 for tess renderer. (#4767)
31a3972aa ios shaders for tess (#4765)
686e5125b Add dependency to correct grand parent for linear gradients. (#4753)
e737ee427 Revert "Update to using deployment workflow similar to ios"
de0e57d55 Update to using deployment workflow similar to ios
051769242 Runtime Text! (#4741)
331ad0d55 Build cleanups
2538229d6 Use Rive's libpng premake dependency in golden testing
42a0377bc Fix condition with trim paths where all contours are 0 length. (#4722)
ea1c83d02 Use os.copyfile() instead of the '{COPY}' command
5c03e1640 Remove forcing arch to arm64 for libpng (#4715)
404a04d35 Cleaning up libpng premake to be isolated/stand-alone. (#4713)
2023-02-13 18:13:08 +00:00
0767844a56 style: updated example and readme
Diffs=
a259b57b2 style: clean up example app
483978f10 docs: update readme
2023-01-11 21:04:30 +00:00
cac78883af Value Graph Export + Runtime Support!!
- Renamed CubicInterpolator to CubicEaseInterpolator so that CubicInterpolator can now be the base class for both CubicEaseInterpolator and CubicValueInterpolator.
- Added CubicValueInterpolator to cpp and Flutter runtimes.
- Test in cpp runtime for the new cubic value interpolation.

Diffs=
1e80ad08f Value Graph Export + Runtime Support!! (#4524)
c532f8658 Shorten harfbuzz/SheenBidi directory paths
312a6c778 Drop the runtime to C++11
de4fe4d71 export MAKE_SKIA_FILE from all top-level scripts that build Skia
75a6b74b8 Beef up testing in tools/*
79f98695a Don't show interactive download progress when premaking on bots
b7fd1d825 Move golden testing into tools/
2022-12-14 22:15:43 +00:00
6d229dcdd9 add simple test & an example showing selection of different rive files 2022-08-26 18:16:13 +01:00
ef8e8d63f5 cleanup for publish 2022-06-14 09:08:05 -07:00
338d739bf7 Add a Listener to the RiveAnimation widget when a StateMachineController has events. 2022-05-18 11:15:37 -07:00
efdd943f39 Ran generator for constraints. 2021-07-13 17:41:43 -07:00
794bb90147 Adds artboard parameter to onInit callback 2021-06-18 11:02:53 -07:00
e22b403ee2 Adds custom controller for speed example 2021-06-14 16:18:39 -07:00
dddb78b62f Adds one-shot animation controller 2021-06-14 14:41:10 -07:00
7d82d06c79 WIP on simplifying controller use 2021-06-11 18:45:57 -07:00
1d54191031 Adds high level RiveAnimation widget 2021-05-27 17:37:54 -07:00
37adf790ee Blend states! 2021-05-07 19:41:50 -07:00
2851203e67 Improving state machine api and including more examples. 2021-04-12 16:57:40 -07:00
462faf20ff Adding ability to control state machine. 2021-03-11 20:21:35 -08:00
8e73700909 Fixes missing asset in example 2020-12-07 12:42:45 -08:00
39eddb4fd6 Preparing for pub 2020-11-17 16:04:42 -08:00
d0df759001 Updated example and readme 2020-11-10 14:46:53 -08:00
2e4a8ace85 Fixes #15 and preps for publish. 2020-10-02 15:56:43 -07:00
5bd55da4fc Bumping runtime version and murdering fractional. 2020-09-28 16:56:53 -07:00
4cb915605f Revving format to 2 with smaller string encoding. 2020-07-19 18:18:34 -07:00
d31388d6e4 Initial checkin of Rive 2 runtime. 2020-07-08 16:36:55 -07:00