Files
rive-cpp/include/rive/animation/nested_input.hpp
mjtalbot 9122e58a54 Libraries
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>
2025-04-03 17:27:06 +00:00

54 lines
1.4 KiB
C++

#ifndef _RIVE_NESTED_INPUT_HPP_
#define _RIVE_NESTED_INPUT_HPP_
#include "rive/animation/nested_state_machine.hpp"
#include "rive/animation/state_machine_input_instance.hpp"
#include "rive/generated/animation/nested_input_base.hpp"
#include <stdio.h>
namespace rive
{
class NestedInput : public NestedInputBase
{
public:
StatusCode onAddedDirty(CoreContext* context) override
{
StatusCode result = Super::onAddedDirty(context);
auto parent = this->parent();
if (parent != nullptr && parent->is<NestedStateMachine>())
{
parent->as<NestedStateMachine>()->addNestedInput(this);
}
return result;
}
virtual void applyValue() {}
SMIInput* input() const
{
auto parent = this->parent();
if (parent != nullptr && parent->is<NestedStateMachine>())
{
StateMachineInstance* smInstance =
parent->as<NestedStateMachine>()->stateMachineInstance();
if (smInstance == nullptr)
{
return nullptr;
}
auto inputInstance = smInstance->input(this->inputId());
return inputInstance;
}
return nullptr;
}
const std::string name() const
{
auto smi = input();
if (smi != nullptr)
{
return smi->name();
}
return std::string();
}
};
} // namespace rive
#endif