Commit Graph

841 Commits

Author SHA1 Message Date
Chris Dalton
71ad10836d rive-ios additions 2023-09-08 16:13:32 -06:00
csmartdalton
1dbf44304b Fix ios builds when PLS is not present
Diffs=
ea5593879 Fix ios builds when PLS is not present (#5959)

Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
2023-09-08 19:24:39 +00:00
csmartdalton
b1f11bf828 Integrate the Rive renderer into iOS
Diffs=
afc961233 Integrate the Rive renderer into iOS (#5952)

Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
Co-authored-by: Luigi Rosso <luigi.rosso@gmail.com>
2023-09-08 18:30:17 +00:00
luigi-rosso
cc236e3252 Timeline Events for runtime
Follow on to https://github.com/rive-app/rive/pull/5877! Does similar work for the C++ runtime and reconsiders some naming, will likely need to fix some higher level runtimes @zplata.

I renamed the fired to reportedEvent and added in the time delay too.

Diffs=
f96c86fcc Timeline Events for runtime (#5951)
2023-09-08 16:09:22 +00:00
luigi-rosso
5afb83146c Fix keepGoing when a work area is used.
Fixes an issue introduced here https://github.com/rive-app/rive/pull/5849 where we added some extra smarts to keepGoing which didn't take the work area into account.

Adds tests to both editor and runtime!

Diffs=
853ae7de1 Fix keepGoing when a work area is used. (#5939)
2023-09-01 21:52:31 +00:00
csmartdalton
6890a9fe0c Make Mat2D constructors constexpr
Diffs=
33aec1b20 Make Mat2D constructors constexpr (#5932)
2023-09-01 20:02:36 +00:00
dragostis
5069f318f8 Fixed runtime to compile with gcc.
Since the SIMD implementation currently only compiles on clang, this patch fixes the gcc compilation path by relying on the SIMD polyfill when compiling with gcc.

Also fixes some small issues when building Vello with gcc.

Diffs=
4335a2cd2 Fixed runtime to compile with gcc. (#5870)
2023-08-31 10:08:18 +00:00
luigi-rosso
cc4f475907 Allow setting text to completely empty.
Fix for issue caught by Pocketwatch where setting all the runs to empty strings results in no changes to the displayed text. We now handle this gracefully and update dimensions and paths to render accordingly.

Diffs=
c6b867df9 Allow setting text to completely empty. (#5924)
2023-08-31 04:53:23 +00:00
csmartdalton
fafc1c1ebd Make RenderBuffer mappable
Adds map() and unmap() functions to RenderBuffer, and changes Mesh::draw() to map and update the vertex buffer instead of making a new one.

Also refactors RenderBuffer to just be a blob of data as opposed to an array of elements of fixed size and type. Removes the type-specific factory methods for creating RenderBuffers in favor of a single one that just takes a buffer type and buffer size.

Diffs=
06a187288 Make RenderBuffer mappable (#5907)
2023-08-31 03:45:00 +00:00
csmartdalton
5a2b7026e6 Add a macro to create bitsets from enums
Adds a RIVE_MAKE_ENUM_BITFIELD() macro and accompanying EnumBitset<> class that allow us to treat strongly typed C++ enums as bitsets, including with an implicit bool conversion for expressions like "if (flags & Flags::myFlag)".

Diffs=
654d4488e Add a macro to create bitsets from enums (#5922)
2023-08-31 02:18:04 +00:00
luigi-rosso
aea5f87e37 Add some joystick flag tests.
The important checks are the ones done with the invertX&Y apply. The isJoystickFlagged checks are sanity checks, you could replace those with whatever you use for flag testing next @csmartdalton.

Note that the flag value is loaded via core (auto-generated) as a raw uint32_t:
eef7de3b1a/packages/runtime/include/rive/generated/joystick_base.hpp (L170)

Diffs=
7bbf083ce Add some joystick flag tests. (#5921)
2023-08-30 22:22:38 +00:00
luigi-rosso
24022f52e2 Run android tests on hosted runners.
Diffs=
12f35ace2 Run android tests on hosted runners. (#5818)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2023-08-30 15:53:52 +00:00
luigi-rosso
7213981f05 Delete the copy constructor from Mat2D
We can let it be defined implicitly.

Also update some Rust formatting to match what the Rustfmt workflow
wants.

Diffs=
d35df0427 Delete the copy constructor from Mat2D (#5916)
2023-08-29 22:22:11 +00:00
philter
35fac0b855 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)
2023-08-25 23:51:14 +00:00
luigi-rosso
aaf12fe6c4 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)
2023-08-25 00:10:17 +00:00
mjtalbot
a8259a74ff early out of advance if we are not going to keep goign
attached a file that is relevant to this issue.

this is a possible solution to the problem. basically early out of our advance, if we have already established that we are not going to keep going. this is to prevent accumulating more spilled time.

another approach might be to put the keep going check into the animationStateInstance, but then the animation state instance will have to track total time, maybe that makes more sense though than total time being tracked in the linear animation instance.

todo if this fix is acceptable:

- [x] add a golden test for this.
- [x] run generators for flutter runtime.
- [x] apply to cpp runtime.

[spilled_time.riv.zip](https://github.com/rive-app/rive/files/12381784/spilled_time.riv.zip)

https://github.com/rive-app/rive/assets/1216025/7afc5d4d-e9cf-4546-941c-947adf2d454b

Diffs=
2719b1463 early out of advance if we are not going to keep goign (#5849)
2023-08-24 08:32:10 +00:00
philter
b6aef76b11 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)
2023-08-24 05:31:35 +00:00
luigi-rosso
1e05186cee Fix follow path contention with MetricsPath
Building contour measures on the follow path constraint to remove contention on stored contour measures in the MetricsPath.

We were storing the contour data used for measuring on the MetricsPath. Calling computeLength with a different transform would mutate that stored contour data. So having the trim path and the FollowPathConstraint call computeLength with different transforms was causing problems as neither of them was guaranteed the contour data was for the correct transform they expected.

I fixed this by having the FollowPathConstraint store its own contours for the path.

Diffs=
033489f8b Fix follow path contention with MetricsPath (#5868)
2023-08-23 01:24:54 +00:00
luigi-rosso
1a9231b471 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)
2023-08-18 19:49:04 +00:00
dragostis
f0320e8ce7 Added a Vello back-end with a custom winit viewer.
My first PR! 🎉

You can get Rust with [Rustup](https://rustup.rs). Then run `cargo run --release` in the `vello/` directory.

Things left to do before merging:
- [x] remove `clap`
- [x] add rustfmt & clippy checks to CI
- [x] add text support
- [x] add README
- [ ] add CONTRIBUTING

Diffs=
abe5aab14 Added a Vello back-end with a custom winit viewer. (#5786)
2023-08-17 17:08:57 +00:00
csmartdalton
9f967d8188 Implement drawImage() in PLS
Rather than implementing a specific handler for this method, we add PaintType::image to PLS and implement drawImage() as drawPath() with a rectangle path and an image paint.

Diffs=
adeebb26a Implement drawImage() in PLS (#5780)
2023-08-14 20:57:43 +00:00
luigi-rosso
8f1e7a0afc 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)
2023-08-14 19:17:33 +00:00
HayesGordon
a1952271f4 chore: release v5.1.6 5.1.6 2023-08-14 12:06:16 +00:00
HayesGordon
d1edfc1926 Updating version files 2023-08-14 12:06:08 +00:00
luigi-rosso
b2099afd9c Fix issue with nested artboards not updating follow path constraints.
🤦🏼 https://2dimensions.slack.com/archives/CHMAP278R/p1691779191117059

Diffs=
e71ae68ba  Fix issue with nested artboards not updating follow path constraints. (#5810)
2023-08-11 23:42:07 +00:00
HayesGordon
7fbdb2b13f chore: release v5.1.5 5.1.5 2023-08-10 11:51:22 +00:00
HayesGordon
7906a93e91 Updating version files 2023-08-10 11:51:17 +00:00
csmartdalton
428da94a1b Add rive::math::msb()
Adds a method that can be used to find the location of the most significant bit of a uint32_t.

Diffs=
cbc6ba291 Add rive::math::msb() (#5777)
2023-08-10 07:45:16 +00:00
csmartdalton
ae94265c70 Add a Bitmap::detachBytes method
This allows us to share bitmap bytes with code that doesn't have a depency on rive_decoders.

Diffs=
58cc49580 Add a Bitmap::detachBytes method (#5763)
2023-08-10 06:30:49 +00:00
luigi-rosso
3260d6577c Letter spacing!
Still needs a new icon and one consideration around computed width but generally ready for action and can animate!
<img width="927" alt="CleanShot 2023-08-09 at 11 49 55@2x" src="https://github.com/rive-app/rive/assets/454182/d11a3fba-b5a8-4bac-9624-ed7282b293d6">

Diffs=
30351d475 Letter spacing! (#5774)
2023-08-10 03:37:54 +00:00
luigi-rosso
3692208065 Run editor tests on hosted runner.
Testing out the new mac minis.

Diffs=
3ab062dd2 Run editor tests on hosted runner. (#5760)
2023-08-08 18:52:51 +00:00
zplata
5f00b08174 chore: release v5.1.4 5.1.4 2023-08-07 19:03:15 +00:00
zplata
31027d559f Updating version files 2023-08-07 19:03:10 +00:00
mjtalbot
cec7e9e647 Require only app-extension-safe APIs
Contribution from downstream: https://github.com/rive-app/rive-ios/pull/267

Not really sure what to test here - but ran the example app on a sim and on a local iPhone and seems alright

(We'll merge this after testing if we can create a patch to `v4.0.6`)

Diffs=
354b04ea7 Require only app-extension-safe APIs (#5747)

Co-authored-by: Matt LaRose <larose@duolingo.com>
Co-authored-by: Zachary Plata <plata.zach@gmail.com>
2023-08-07 08:21:29 +00:00
zplata
0a9c02602a chore: release v5.1.3 5.1.3 2023-08-05 16:43:50 +00:00
zplata
af41f0a96c Updating version files 2023-08-05 16:43:44 +00:00
luigi-rosso
8e89aa9e94 fix leak in move operator= on SimpleArray
And add memory tests to github actions!

Diffs=
2f67af55f fix leak in move operator= on SimpleArray (#5752)
2023-08-05 04:36:32 +00:00
csmartdalton
b4c07ab841 Make rive_decoders compile on Windows
Diffs=
b3a367dad Make rive_decoders compile on Windows (#5733)
2023-08-05 03:40:30 +00:00
zplata
e24459a07b chore: release v5.1.2 5.1.2 2023-08-03 01:21:43 +00:00
zplata
90ec2888c0 Updating version files 2023-08-03 01:21:38 +00:00
luigi-rosso
735b519783 Clipping and baseline
The way we were computing the bounds for clipping was off which also exposed it was off in the runtime for transform constraints! This was also breaking the Lottie converter.

Now the origin, baseline, bounds, and clipping all look right in Flutter + C++. Goldens would help here too @mjtalbot

<img width="1152" alt="CleanShot 2023-08-02 at 11 50 36@2x" src="https://github.com/rive-app/rive/assets/454182/5b7d580e-9d82-4e7b-8b91-7155a2c89fa6">

Fixes #5732
Fixes issue discussed here: https://2dimensions.slack.com/archives/CLLCU09T6/p1690977600095549

Diffs=
d3e75b38d Clipping and baseline (#5734)
2023-08-02 20:29:44 +00:00
HayesGordon
33e4697b8d docs: add awesome-rive to README
Diffs=
50f10716b docs: add awesome-rive to README (#4866)

Co-authored-by: Gordon <pggordonhayes@gmail.com>
2023-08-02 18:30:28 +00:00
alxgibsn
c746dd7189 Enable animation for Text Run style prop
<img width="262" alt="CleanShot 2023-08-01 at 10 17 31@2x" src="https://github.com/rive-app/rive/assets/8057513/ee375ef9-7a23-418b-81a2-6f38bc102200">

Diffs=
da909105a Enable animation for Text Run style prop (#5726)
2023-08-01 21:41:09 +00:00
zplata
0aee73f234 maint: fix determine version build step in github workflow to bump based on major, minor, and patch instead of just patch
tl;dr small discrepancy in how we determine the release version and persisting the requested version everywhere correctly.

Noticed when we did a major bump of the `rive-ios` runtime from `v4.0.5` to `v5.0.0` for text that the reference back to where the artifact was located was incorrect. When trying to pull the artifact for SwiftUI / Cocoapods, it was trying to find a `v4.0.6` version.

i.e. See this automated commit that gets added, from our release workflow: 8c52c9ebe1 (diff-a010f59c5ba0ad9156da1e93bfd6fc2e6a968a3a3d633c96b593d4988faedea8L3)

Old logic was to find the next patch version of the `package.json` version committed in Git; new logic is to find the next version based on what we select when running the publish workflow. Other parts of the publish workflow rely on the output of this `determine_version` step so this should be the only place we need to worry about it.

Diffs=
77c21c16f maint: fix determine version build step in github workflow to bump based on major, minor, and patch instead of just patch (#5714)

Co-authored-by: Zachary Plata <plata.zach@gmail.com>
2023-08-01 14:10:12 +00:00
csmartdalton
5ba3f3c46b Lift tess decoders into a static lib
Add a packages/runtime/decoders project that can be reused by more projects than just the tess renderer.

Diffs=
b69ae1312 Lift tess decoders into a static lib (#5709)
2023-08-01 13:31:08 +00:00
zplata
5ea3213b58 chore: release v5.1.1 5.1.1 2023-07-31 22:42:25 +00:00
zplata
8568b32902 Updating version files 2023-07-31 22:42:20 +00:00
zplata
794fac904b chore: release v5.1.0 5.1.0 2023-07-31 18:30:50 +00:00
zplata
c674b856e6 Updating version files 2023-07-31 18:30:42 +00:00
philter
3c9f95a4c2 Fix crash when no Follow path target specified
Fixes a crash in the cloud renderer (it turns out, caused by the CPP runtime) when a Follow Path constraint has no target. Thanks for walking me through the backend tasks process and dependencies @mjtalbot!

Obviously it defeats the purpose of using follow path if you don't set a target, but still, we shouldn't crash.

Diffs=
baefd620c Fix crash when no Follow path target specified (#5706)
2023-07-31 16:34:59 +00:00