Skip to content

Commit

Permalink
use shared data context between artboard and state machine
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
bodymovin and bodymovin committed Oct 8, 2024
1 parent d9df7cd commit 049e6e8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .rive_head
Original file line number Diff line number Diff line change
@@ -1 +1 @@
eccfca52894894d158761f902f46ed48b0794991
eed8230f84e2894d0436dd1d94566c59f4dfcb6f
4 changes: 2 additions & 2 deletions lib/src/rive_core/artboard.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/rive_core/nested_artboard.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions lib/src/runtime_mounted_artboard.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 049e6e8

Please sign in to comment.