mirror of
https://github.com/rive-app/rive-cpp.git
synced 2026-01-18 21:21:17 +01:00
Bunch of changes, i think its at the point where it will be helpful to get a review, there is a *lot* of outstanding work to do here, but i'm hoping that much of it can be done while this is in master but not enabled for uat yet. so @susan101566 and I can work through that set together, with smaller more targeted fixes and changes.
There are a couple of things i want to figure out to make sure we can merge this:
- is the Resolver approach going to work (library components resolve to real components)
- writing library assets into the parent needs a bit more love, it should not cause problems unless you're using libraries
- I want to do a small refactor on the exporter before merge to keep asset writing and asset index updates together as suggested by @susan101566. there's a larger refactor here but i think that can be done in due course.
- re-check editor-only deliniation
After refactoring those i also need to re-check that all these things still work, because chances are i've broken something in the meantime.
for
using a library in as a nested artboard &
using a library as part of using a nested artboard that contains a library
check
using a library animation
using a library stateMachine
using a library stateMachineInputs
we can key state machine input changes
we can trigger nested state machine input changes from teh state machine editor
using a library with assets
exporting all the above and view in cpp viewer
exporting all the above and view in dart viewer
There is a large list of items that need to be worked on beyond this. but hopefully we can do that more incrementally. this includes but is not limited to:
- object validations make sense
- the asset panel is interacting as we want
- right click menus make sense
- out of band loading works
- library api failures are handled
- refactor how we add library assets
- refactor asset exporting
- tracking
- smi paths'
Diffs=
9d8a7e81fa Libraries (#9255)
Co-authored-by: Arthur Vivian <arthur@rive.app>
Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
Co-authored-by: Susan Wang <susan@rive.app>
52 lines
1.9 KiB
C++
52 lines
1.9 KiB
C++
#include <rive/file.hpp>
|
|
#include <rive/node.hpp>
|
|
#include <rive/nested_artboard.hpp>
|
|
#include <rive/shapes/clipping_shape.hpp>
|
|
#include <rive/shapes/rectangle.hpp>
|
|
#include <rive/animation/nested_simple_animation.hpp>
|
|
#include <rive/animation/nested_state_machine.hpp>
|
|
#include <rive/animation/nested_bool.hpp>
|
|
#include <rive/animation/nested_trigger.hpp>
|
|
#include <rive/animation/nested_number.hpp>
|
|
#include <rive/relative_local_asset_loader.hpp>
|
|
#include <utils/no_op_factory.hpp>
|
|
#include <utils/no_op_renderer.hpp>
|
|
#include "rive_file_reader.hpp"
|
|
#include <catch.hpp>
|
|
#include <cstdio>
|
|
|
|
TEST_CASE("File with state machine inputs loads", "[state_machine]")
|
|
{
|
|
// created by test in rive_core.
|
|
auto file = ReadRiveFile("assets/smi_test.riv");
|
|
|
|
auto nestedArtboard = file->artboard()->find<rive::NestedArtboard>(
|
|
"artboard to nest component");
|
|
REQUIRE(nestedArtboard != nullptr);
|
|
REQUIRE(nestedArtboard->x() == 100);
|
|
REQUIRE(nestedArtboard->y() == 100);
|
|
REQUIRE(nestedArtboard->name() == "artboard to nest component");
|
|
REQUIRE(nestedArtboard->artboardId() == 1);
|
|
|
|
auto nestedSimpleAnimation =
|
|
file->artboard()->find<rive::NestedStateMachine>("");
|
|
REQUIRE(nestedSimpleAnimation != nullptr);
|
|
REQUIRE(nestedSimpleAnimation->name() == "");
|
|
REQUIRE(nestedSimpleAnimation->animationId() == 0);
|
|
|
|
auto nestedTrigger = file->artboard()->find<rive::NestedTrigger>("");
|
|
REQUIRE(nestedTrigger != nullptr);
|
|
REQUIRE(nestedTrigger->name() == "");
|
|
REQUIRE(nestedTrigger->inputId() == 0);
|
|
|
|
auto nestedBool = file->artboard()->find<rive::NestedBool>("");
|
|
REQUIRE(nestedBool != nullptr);
|
|
REQUIRE(nestedBool->name() == "");
|
|
REQUIRE(nestedBool->inputId() == 1);
|
|
|
|
auto nestedNumber = file->artboard()->find<rive::NestedNumber>("");
|
|
REQUIRE(nestedNumber != nullptr);
|
|
REQUIRE(nestedNumber->name() == "");
|
|
REQUIRE(nestedNumber->inputId() == 2);
|
|
}
|