From 019d8a7368db6adbabf46a48bbaa71855be49971 Mon Sep 17 00:00:00 2001 From: luigi-rosso Date: Fri, 8 Sep 2023 16:09:20 +0000 Subject: [PATCH] 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) Co-authored-by: Luigi Rosso --- .rive_head | 2 +- wasm/src/bindings.cpp | 12 +++++++----- wasm/submodules/rive-cpp | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.rive_head b/.rive_head index 2e50f1fb..e1220dc1 100644 --- a/.rive_head +++ b/.rive_head @@ -1 +1 @@ -df9c651a1cf45ef795de0b7242156e290a4cf499 +f96c86fcc800a1fa2bec3e97be00cab395ea838d diff --git a/wasm/src/bindings.cpp b/wasm/src/bindings.cpp index e9d2b2e7..b6d58ff8 100644 --- a/wasm/src/bindings.cpp +++ b/wasm/src/bindings.cpp @@ -425,7 +425,7 @@ EMSCRIPTEN_BINDINGS(RiveWASM) select_overload(&rive::LinearAnimationInstance::time), select_overload(&rive::LinearAnimationInstance::time)) .property("didLoop", &rive::LinearAnimationInstance::didLoop) - .function("advance", &rive::LinearAnimationInstance::advance) + .function("advance", select_overload(&rive::LinearAnimationInstance::advance)) .function("apply", &rive::LinearAnimationInstance::apply, allow_raw_pointers()); class_>("StateMachine"); @@ -447,18 +447,20 @@ EMSCRIPTEN_BINDINGS(RiveWASM) optional_override([](rive::StateMachineInstance& self, double x, double y) { self.pointerUp(rive::Vec2D((float)x, (float)y)); })) - .function("firedEventCount", &rive::StateMachineInstance::firedEventCount) + .function("reportedEventCount", &rive::StateMachineInstance::reportedEventCount) .function( - "firedEventAt", + "reportedEventAt", optional_override([](rive::StateMachineInstance& self, size_t index) -> emscripten::val { - const rive::Event* event = self.firedEventAt(index); - if (event == nullptr) + const rive::EventReport report = self.reportedEventAt(index); + if (report.event() == nullptr) { return emscripten::val::undefined(); } + rive::Event* event = report.event(); emscripten::val eventObject = emscripten::val::object(); eventObject.set("name", event->name()); + eventObject.set("delay", report.secondsDelay()); if (event->is()) { auto urlEvent = event->as(); diff --git a/wasm/submodules/rive-cpp b/wasm/submodules/rive-cpp index 5e8642f6..bc7a03a8 160000 --- a/wasm/submodules/rive-cpp +++ b/wasm/submodules/rive-cpp @@ -1 +1 @@ -Subproject commit 5e8642f6c0bdf60727e1be4711452e362c9559f8 +Subproject commit bc7a03a8826b67b64fc47c876837075f9ff3be40