2d-inc / Flare-Flutter

Load and get full control of your Rive files in a Flutter project using this library.
https://rive.app/
MIT License
2.55k stars 469 forks source link

Multiple Paths under a Shape don't invalidate #26

Closed umberto-sonnino closed 5 years ago

umberto-sonnino commented 5 years ago

If multiple Paths are nested under a single Shape have different keyframed values for each Path, the Shape won't invalidate any of the underlying Paths, and thus won't update.

A simple fix for this would be to add in ActorNode.update():

if ((dirt & TransformDirty) == TransformDirty) {
    updateTransform();
    if(this.parent != null && this.parent is FlutterActorShape)
    {
        this.parent.invalidateShape();
    }
}
umberto-sonnino commented 5 years ago

Here's a zip file containing two files: -translation.flr is the general case -translation1.flr is the bug

test_files.zip

luigi-rosso commented 5 years ago

The best way to handle this is by invalidating the shape when a sub-path has its transform marked dirty (as opposed to when the transform updates). This avoids generating two update cycles and avoids doing a conditional when every ActorNode updates.

I made this change for both the user drawn paths and the procedural ones.

umberto-sonnino commented 5 years ago

Alright, great, this looks fixed!