use shared data context between artboard and state machine

this PR changes multiple files addressing three things:
the first two are pretty basic changes: rename the method `dataContextFromInstance` to `setDataContextFromInstance` and remove the side effect of setting the parent of the data context in `internalDataContext`.
The other change is commented in the code: instead of creating a new data context for nested state machines, it is shared between the nested artboard and its state machines. This was already so in the cpp runtime, but the flutter bridge wasn't doing the same.

Diffs=
eed8230f8 use shared data context between artboard and state machine (#8299)
56d95d200 Fix Apple runtime crashes on Macs with non-Apple-Silicon GPUs (#8301)
ab13be54d Drag and drop into layouts without Cmd modifier (#8293)
bc4d42b7b Layout misc fixes (#8292)
31bf5a44f Download python-ply inside of premake (#8285)
5d5d418b7 enable all viewmodels as source for a condition (#8284)
7bef90845 Calculate LOD ahead of time for image paints (#8260)
b0a3b89cf Premultiply clear colors (#8280)
018eb4b62 add enum bind core property (#8279)
bcd3c9218 Rename InterlockMode::depthStencil to InterlockMode::msaa (#8265)
348017707 add missing dirty flags (#8276)
0ee01f784 Fix layout animation not cascading (#8267)
a6aef22e9 fix uninitialized font features (#8266)
f84c14188 add text bindable properties (#8248)
4111579ac added #ifdef where it was missing (#8262)

Co-authored-by: hernan <hernan@rive.app>
This commit is contained in:
bodymovin
2024-10-08 23:17:13 +00:00
parent d9df7cdbce
commit 049e6e8b9d
4 changed files with 6 additions and 6 deletions

View File

@ -1 +1 @@
eccfca52894894d158761f902f46ed48b0794991
eed8230f84e2894d0436dd1d94566c59f4dfcb6f

View File

@ -824,7 +824,7 @@ class Artboard extends ArtboardBase with ShapePaintContainer {
ViewModelInstance? nestedViewModelInstance =
dataContext!.getViewModelInstance(nestedArtboard.dataBindPath);
if (nestedViewModelInstance != null) {
mountedArtboard.dataContextFromInstance(
mountedArtboard.setDataContextFromInstance(
nestedViewModelInstance, dataContext, false);
} else {
mountedArtboard.internalDataContext(
@ -835,7 +835,7 @@ class Artboard extends ArtboardBase with ShapePaintContainer {
computeBindings(isRoot);
}
void dataContextFromInstance(
void setDataContextFromInstance(
ViewModelInstance viewModelInstance, DataContext? parent, bool isRoot) {
final dataContext = DataContext(viewModelInstance);
internalDataContext(dataContext, parent, isRoot);

View File

@ -63,7 +63,7 @@ abstract class MountedArtboard {
void artboardWidthIntrinsicallySizeOverride(bool intrinsic);
void artboardHeightIntrinsicallySizeOverride(bool intrinsic);
void dispose();
void dataContextFromInstance(ViewModelInstance viewModelInstance,
void setDataContextFromInstance(ViewModelInstance viewModelInstance,
DataContext? dataContextValue, bool isRoot);
void internalDataContext(DataContext dataContextValue,
DataContext? parentDataContext, bool isRoot);

View File

@ -150,9 +150,9 @@ class RuntimeMountedArtboard extends MountedArtboard {
}
@override
void dataContextFromInstance(ViewModelInstance viewModelInstance,
void setDataContextFromInstance(ViewModelInstance viewModelInstance,
DataContext? dataContextValue, bool isRoot) {
artboardInstance.dataContextFromInstance(
artboardInstance.setDataContextFromInstance(
viewModelInstance, dataContextValue, isRoot);
}