560 Commits

Author SHA1 Message Date
e34fc4cc41 feat: adds play and pause to artboard
An oversight from our side. We've previously recommended setting `isActive` to false on the StateMachine or Animation. But this will not propagate down to nested artboards.

Diffs=
e64daefff feat: adds play and pause to artboard (#7078)
2828b7b01 propagate volume to nested artboards (#7067)
4a9947630 Stop audio in iOS when backgrounded. (#7055)

Co-authored-by: Gordon <pggordonhayes@gmail.com>
2024-04-19 09:34:59 +00:00
a22fc5f047 Ensure rive_common wasm module gets pulled into rive_flutter properly
In rive_flutter, we were doing a check to see if the file had any text before we loaded the rive_common wasm module. However, since all rive_common deps (text, audio, layout) are bundled together, we need to make sure to check for existence of those as well, and since Artboard extends LayoutComponent, we pretty much always need to load the module.

Diffs=
024f95b10 Ensure rive_common wasm module gets pulled into rive_flutter properly (#7040)
cb2ea5b2d Exposing artboard volume (#7022)
8ecc99130 Fixing audio runtimes. (#7007)

Co-authored-by: Philip Chung <philterdesign@gmail.com>
2024-04-11 18:23:47 +00:00
4ede8c868e Fix WASM audio MP3
Increases the stack size to accommodate for the greedy MP3 decoder.

Discussion here: https://2dimensions.slack.com/archives/CLLCU09T6/p1712597103737719

Diffs=
cf43d9fdf Fix WASM audio MP3 (#6995)
0bc446fad negative speed fix (#6982)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2024-04-09 03:35:03 +00:00
2acceb195b Audio asset volume + VU
This also fixes a bug where multiple sounds would play at the same time making clipping even worse...

Some more details here:

https://2dimensions.slack.com/archives/CHMAP278R/p1712443028936919

Diffs=
f832e2617 Audio asset volume + VU (#6985)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2024-04-07 15:14:48 +00:00
b440934299 Fix audio overlap
Also fixes some warnings from the flutter runtime.

Diffs=
5d10f615b Fix audio overlap (#6979)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2024-04-05 21:34:08 +00:00
3da1cbe3a1 Getting audio working in Flutter runtime.
@philter this also adds a bunch of layout stuff to the Flutter runtime as I had to run the core generator, does it all look ok?

Diffs=
6837ee0f7 Getting audio working in Flutter runtime. (#6975)
522a31bc2 treat cubic curve as quad when control point equals endpoint (#6919)
473dbcb5c Export proxy and testing at runtime. (#6950)
a69bfba11 Export audio clip (#6949)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2024-04-03 22:26:25 +00:00
584d00fa00 propagate parent input change to nested input
We have decided to add a new attribute to our code generator that will allow to overwrite the behavior of property setters for the c++ runtime.
For the editor, the solution is more complex because we still need to reflect the nested artboard value in the inspector so users can follow changes both at the parent and the child level.

Diffs=
fee67f16d propagate parent input change to nested input (#6878)
ff2c0cbf6 apply final update if it has not been applied before (#6930)
f3739347c Get wasm sizes back down. (#6927)
a0a40213f No simd canvas (#6926)
e2328daeb More LTO tweaks (#6904)
cae08a3c5 Add a @rive-app/webgl2 package that uses PLS (#6845)

Co-authored-by: hernan <hernan@rive.app>
2024-03-28 00:09:58 +00:00
380ae10d79 Fix rive common size annotation
Based on issue reported here https://github.com/rive-app/rive-flutter/issues/347#issuecomment-1979496123

Diffs=
f4ef0e301 Fix rive common size annotation (#6886)
e0e55a59e Remove the Queue from Metal PLS (#6852)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2024-03-16 04:46:29 +00:00
b53ddd7cd6 support for interrupting transitions on state change
We are adding a flag to support interrupting transitions on state changes.

Diffs=
337f9df1c support for interrupting transitions on state change (#6850)

Co-authored-by: hernan <hernan@rive.app>
2024-03-15 19:26:13 +00:00
b68f6e89a9 chore: update README
Mostly sentence case for headers and adding new info as needed + removing older things

Diffs=
e68c7b6de chore: update README (#6824)
bcf6451f4 Unity webgl! (#6816)
09feaccb0 Always decode 3 or 4 channel PNG images. (#6818)

Co-authored-by: Gordon <pggordonhayes@gmail.com>
2024-03-11 19:04:16 +00:00
1557ea2ddc Publish flutter v0.13.0
Diffs=
ef100e0d9 Publish flutter v0.13.0 (#6808)

Co-authored-by: Philip Chung <philterdesign@gmail.com>
2024-03-08 20:52:07 +00:00
8487b7f3d7 Add an object generator.
I guess I never PRed this...

Adds ability to override built-in objects to custom ones so you can do things like add shadows:
```
RiveAnimation.asset(
  'assets/shadowtext.riv',
  objectGenerator: (coreTypeKey) {
    switch (coreTypeKey) {
      case ShapeBase.typeKey:
        return ShadowRiveShape();
    }
    return null;
  },
```

![image](https://github.com/rive-app/rive/assets/454182/cae261b1-8005-4c49-9714-3bb1dca50cde)

```
class ShadowRiveShape extends Shape {
  Paint? _shadowPaint;
  @override
  void onAdded() {
    if (name == 'ShadowShape') {
      // This was named "ShadowShape" we use that as a simple way to determine
      // that we want to add a drop shadow at runtime.
      _shadowPaint = Paint()
        ..imageFilter = ImageFilter.blur(
          // Make it a 10x10 black blur
          sigmaX: 10,
          sigmaY: 10,
          tileMode: TileMode.clamp,
        );
    }
    super.onAdded();
  }

  @override
  K? clone<K extends Core<CoreContext>>() {
    var shape = ShadowRiveShape();
    shape.copy(this);
    return shape as K;
  }

  @override
  void draw(Canvas canvas) {
    var shadow = _shadowPaint;
    if (shadow != null) {
      // We draw a blurred version of this shape before regular drawing. Make
      // sure to respect clipping rules for the shadow too.
      bool clipped = clip(canvas);
      var path = pathComposer.fillPath;
      canvas.save();
      if (!fillInWorld) {
        canvas.transform(worldTransform.mat4);
      }
      // Offset the shadow to the bottom right (change to whatever you want).
      canvas.translate(10, 10);
      canvas.drawPath(path, shadow);

      canvas.restore();

      if (clipped) {
        canvas.restore();
      }
    }

    // Draw the regular shape.
    super.draw(canvas);
  }
}
```

Diffs=
99a2215da Add an object generator. (#6805)
7cb7eb812 Upgrade rive_wasm to the new premake system (#6789)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2024-03-08 20:02:05 +00:00
bee93ab545 Update rive_flutter downstream tests to build rive_common shared lib
Thanks for this fix @luigi-rosso!

Diffs=
74e649ee2 Update rive_flutter downstream tests to build rive_common shared lib (#6783)

Co-authored-by: Philip Chung <philterdesign@gmail.com>
2024-03-08 06:16:12 +00:00
2d6fa529b4 Update flutter golden images
Run --update-goldens to regenerate golden images since at least some of these appear to be failing in rive_flutter. Its possible Flutter upgrades is causing slight discrepancies. Did a visual side by side and the images appear identical. Want to get this in before publishing rive_flutter.

Diffs=
072f8ffb5 Update flutter golden images (#6768)

Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
Co-authored-by: Philip Chung <philterdesign@gmail.com>
2024-03-07 16:35:49 +00:00
f3ec042a47 Run core generators
Need to get these in before we publish rive_flutter.

Diffs=
8785b0ff7 Run core generators (#6761)
e62a93370 fix text not updating when style changes (#6743)

Co-authored-by: Philip Chung <philterdesign@gmail.com>
Co-authored-by: hernan <hernan@rive.app>
2024-03-07 16:27:26 +00:00
a273bc837e Rev rive_common version
Diffs=
a1532043c Rev rive_common version (#6709)

Co-authored-by: Philip Chung <philterdesign@gmail.com>
2024-03-02 05:33:34 +00:00
12aac262f5 slim down harfbuzz
Diffs=
c36e16cb6 slim down harfbuzz (#6710)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2024-03-02 04:57:22 +00:00
8e7c5dae92 Remove taffy
Removing Taffy. Will be replacing with Yoga shortly.

Diffs=
12cf6b8c3 Remove taffy (#6670)
f2ecb3a22 Implement an MSAA fallback for PLS (#6680)
ffde4f5f6 trigger change when text modifier updates (#6675)
20b585bea add support for text feature in runtime (#6674)

Co-authored-by: Philip Chung <philterdesign@gmail.com>
2024-03-01 22:45:42 +00:00
870234fddc sort hit shapes when draw order changes and stop propagation on hit s…
sort hit shapes when draw order changes and stop propagation on hit success

Diffs=
8bca56dca sort hit shapes when draw order changes and stop propagation on hit s… (#6624)
9d605a1fe Updating harfbuzz to 8.3.0 (#6652)
5cb42a9b0 Unity compute bounds (#6649)
b765280df Fix path for downstream runtime. (#6645)
1cf6a65f1 Fix downstream cpp tests (#6643)
a35883508 Single test script for windows and mac. (#6642)
37ce9aaea Fix tests to use harfbuzz renames. (#6641)
9338d6ec6 make a change to force a mono flush (#6638)
6059f744d update mono to keep details in commit and not pr (#6637)
a394393a0 update mono scripts to be able to create "fixing" pr (#6636)

Co-authored-by: hernan <hernan@rive.app>
2024-02-21 14:40:02 +00:00
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