rive-app / rive-ios

iOS runtime for Rive
MIT License
462 stars 53 forks source link

exposed inputs from nested artboards are not working. #303

Closed mjtalbot closed 1 month ago

mjtalbot commented 2 months ago

Now I noticed some other bug: exposed inputs from nested artboards are not working.

I've updated the repository with a new Rive file that has a state machine with both nested input and normal input.

image

Do I need to open a new issue?

Originally posted by @jonyw4 in https://github.com/rive-app/rive-ios/issues/302#issuecomment-2091424033

mjtalbot commented 2 months ago

link to repository with a repro to the issue: https://github.com/Ursula-AI/rive-ios-nested-artboard-bug

(contains .riv, .rev & ios project that will repro the issue)

jonyw4 commented 2 months ago

Okay. Hey folks, do you have any timelines on when are you are taking a look into this bug?

mjtalbot commented 1 month ago

Hi @jonyw4, we've been talking about this issue internally, and while its a known issue I do not have a timeline for a fix for this at this point. We are also working on data binding, which will negate the need for an api like this.

The high level api simply does not allow setting states on nested artboards in a nice way at this point. But there are work arounds, which are a little tedious. I've attached a .rev file using a work around to set nested artboard inputs

nested_inputs.rev.zip

jonyw4 commented 1 month ago

Thank you!

But there are work arounds, which are a little tedious. I've attached a .rev file using a work around to set nested artboard inputs

How would that work?

jonyw4 commented 1 month ago

Is there a way for me to do a workaround?

philter commented 1 month ago

Hi @jonyw4, to elaborate on the method @mjtalbot mentioned, essentially, you can use an input on the main artboard to change the value of the nested input on a nested artboard. So in that .rev file, he has set up 4 inputs on the main artboard (tl, tr, bl, br), and you can set those directly from your iOS runtime code. When set, those inputs will cause the main state machine to transition to a state that causes the corresponding nested input to also change value. In the .rev file you can see 4 layers on the main artboard's state machine that handle this.

So from the runtime, you only need to be concerned with setting the values of the inputs tl, tr, bl, br.

jonyw4 commented 1 month ago

I see. That would not work for us, we have 100+ inputs. 😆 Do you guys have any timeline on when this is going to be fixed? 🤔

HayesGordon commented 1 month ago

This is now possible on the latest version of the runtime! See our docs: https://rive.app/community/doc/state-machines/docxeznG7iiK#nested-inputs