Skip to content

Commit b48d641

Browse files
committed
Squashed commit of the following:
commit 3c398bf Author: Luigi Rosso <[email protected]> Date: Tue Dec 17 04:58:20 2019 +0800 Fixing race condition with layer determination. #204 commit e1c9972 Author: Luigi Rosso <[email protected]> Date: Tue Dec 17 04:53:54 2019 +0800 Mark layers after drawables are computed. commit 0e815f5 Author: Luigi Rosso <[email protected]> Date: Mon Dec 16 09:21:52 2019 +0800 Fix for applying wrong animation to artboard. Issue #205. commit 788c662 Author: Luigi Rosso <[email protected]> Date: Mon Dec 9 19:35:25 2019 -0500 Fix for blur close to 0. commit f0b24f4 Author: Luigi Rosso <[email protected]> Date: Thu Dec 5 18:24:59 2019 -0500 Minor fixes for analyze. commit 333249f Author: Luigi Rosso <[email protected]> Date: Thu Dec 5 17:36:58 2019 -0500 Preparing for publish. commit 0aa32c5 Author: Luigi Rosso <[email protected]> Date: Wed Dec 4 15:19:37 2019 -0800 Adding Guss. commit 6ba1f70 Author: Luigi Rosso <[email protected]> Date: Wed Dec 4 09:12:26 2019 -0800 Fixing type error in jelly component. commit a522dff Author: Luigi Rosso <[email protected]> Date: Sun Dec 1 17:31:28 2019 -0800 Fixing effect on self. commit 2375f0c Author: Luigi Rosso <[email protected]> Date: Wed Nov 27 18:03:08 2019 -0800 Adding animation for effects. commit dee0d83 Author: Luigi Rosso <[email protected]> Date: Tue Nov 26 16:40:01 2019 -0800 Getting drop shadow, blur, and inner shadows working. commit 31aa641 Author: Luigi Rosso <[email protected]> Date: Mon Nov 25 19:57:39 2019 -0800 Major groundwork for effects & masking. commit 9ff2b94 Author: Luigi Rosso <[email protected]> Date: Wed Nov 20 16:38:28 2019 -0800 Fixing gradient transformations for shapes with transformAffectsStroke set to true. commit 1e88ddf Merge: c7758eb 17f73ec Author: Luigi Rosso <[email protected]> Date: Mon Nov 18 16:32:28 2019 -0800 Merge branch 'master' of https://github.com/2d-inc/Flare-Flutter commit c7758eb Author: Luigi Rosso <[email protected]> Date: Mon Nov 18 16:32:23 2019 -0800 Fixing FlareControls. commit 17f73ec Author: Umberto Sonnino <[email protected]> Date: Fri Nov 15 11:09:51 2019 +0000 Update README with latest version commit c9f4341 Author: Luigi Rosso <[email protected]> Date: Thu Nov 7 15:05:04 2019 -0800 Backing out changeImageFromNetwork. Issue #183 commit e9712a4 Author: Luigi Rosso <[email protected]> Date: Thu Nov 7 12:32:17 2019 -0800 Bumping versions. commit 366cdc0 Author: Luigi Rosso <[email protected]> Date: Thu Nov 7 12:27:53 2019 -0800 Adding support for runtime image swapping, requires marking image nodes as isDynamic in Flare. Issue #183. commit 53a7c65 Author: Luigi Rosso <[email protected]> Date: Wed Nov 6 17:30:42 2019 -0800 Updating flare_flutter version. commit b391dd4 Merge: 1e9b22e 9ec074b Author: Luigi Rosso <[email protected]> Date: Wed Nov 6 17:28:34 2019 -0800 Merge branch 'warmth_fix' commit 9ec074b Author: Luigi Rosso <[email protected]> Date: Wed Nov 6 15:43:31 2019 -0800 Call setState if mounted. commit c66ac64 Author: Luigi Rosso <[email protected]> Date: Wed Nov 6 15:38:06 2019 -0800 Addressing an issue found in #177 with FlareCacheBuilder setting state when widget is no longer mounted. commit 1e9b22e Author: Umberto Sonnino <[email protected]> Date: Wed Nov 6 19:02:25 2019 +0100 Init mat before inverting commit bc07b87 Author: Umberto Sonnino <[email protected]> Date: Wed Nov 6 19:00:13 2019 +0100 Remove local flare_dart from examples pubspec #184 commit e1cca7c Author: Luigi Rosso <[email protected]> Date: Tue Oct 29 12:50:30 2019 -0700 Bumping versions, merging optimal_load branch, and persisting settings in checkbox example. commit 55cae39 Author: Luigi Rosso <[email protected]> Date: Tue Oct 29 12:41:43 2019 -0700 Copy transform affects stroke properly when instancing shapes. commit 43716dd Author: Luigi Rosso <[email protected]> Date: Mon Oct 28 12:52:09 2019 -0700 Prevent coldLoad (async) from happening when widget isn’t ready to load. commit 506837e Author: Luigi Rosso <[email protected]> Date: Fri Oct 25 13:00:56 2019 -0700 Improving loading. commit 9ee95b9 Author: Luigi Rosso <[email protected]> Date: Fri Oct 25 10:42:42 2019 -0700 Make sure overrideColor is set even when drawableNodes is null. commit 7d59de1 Author: Umberto Sonnino <[email protected]> Date: Fri Oct 25 13:15:34 2019 +0100 Move null check commit 528af53 Author: Umberto Sonnino <[email protected]> Date: Fri Oct 25 13:10:17 2019 +0100 Insert null checks for artboards with no drawables #178 commit 33f23a7 Author: Umberto Sonnino <[email protected]> Date: Fri Oct 25 12:16:16 2019 +0100 Remove GradientColor override of ActorPaint opacity getter #179 commit 59ba2f0 Author: Umberto Sonnino <[email protected]> Date: Thu Oct 24 09:31:41 2019 +0100 Document the `actor_animatino.apply()` function commit d77438f Author: Umberto Sonnino <[email protected]> Date: Thu Oct 24 09:31:10 2019 +0100 Fix division by 0 on transform constraint commit f0cf988 Author: Luigi Rosso <[email protected]> Date: Fri Oct 11 12:59:13 2019 -0700 Fix reading of JSON clip values. Issue #172 commit a7796e0 Author: Luigi Rosso <[email protected]> Date: Fri Oct 11 12:39:48 2019 -0700 Mitigating issue #172. commit 373c14a Author: Luigi Rosso <[email protected]> Date: Wed Oct 9 14:21:47 2019 -0700 Fixing issue with image clipping. commit ae1c901 Author: Luigi Rosso <[email protected]> Date: Wed Oct 9 11:19:16 2019 -0700 Fix merge bugs. commit d8cb780 Author: Luigi Rosso <[email protected]> Date: Wed Oct 9 11:09:42 2019 -0700 Adding support for difference clipping. commit bf99a76 Author: Luigi Rosso <[email protected]> Date: Tue Oct 8 19:07:26 2019 -0700 Matching stable version commit 9becc74 Author: Luigi Rosso <[email protected]> Date: Tue Oct 8 13:58:11 2019 -0700 Bumping flare_dart to 2.0 due to breaking changes. commit 0a292cc Author: Luigi Rosso <[email protected]> Date: Tue Oct 8 13:39:57 2019 -0700 Bumping versions and changelogs. commit 431a98e Author: Luigi Rosso <[email protected]> Date: Tue Oct 8 13:35:26 2019 -0700 Fixing up analysis issues for #169 commit 72fb6fc Merge: 4d00202 dc68dea Author: Luigi Rosso <[email protected]> Date: Tue Oct 8 13:02:17 2019 -0700 Merge branch 'master' of https://github.com/2d-inc/Flare-Flutter commit 4d00202 Author: Luigi Rosso <[email protected]> Date: Tue Oct 8 13:02:11 2019 -0700 Cleaning up analysis issues. commit dc68dea Merge: 5ca8d49 f1d9749 Author: Luigi Rosso <[email protected]> Date: Tue Oct 8 11:06:53 2019 -0700 Merge pull request #168 from mehmetf/master Escalate the severity of unused imports in analyzer commit f1d9749 Author: Mehmet Fidanboylu <[email protected]> Date: Tue Oct 8 10:20:58 2019 -0700 Do the same changes to flare_dart commit 64f395e Author: Mehmet Fidanboylu <[email protected]> Date: Tue Oct 8 10:17:51 2019 -0700 Escalate the severity of unused imports in analyzer commit 5ca8d49 Author: Luigi Rosso <[email protected]> Date: Mon Oct 7 11:22:38 2019 -0700 Bumping versions and changelog. commit 874ce8e Author: Luigi Rosso <[email protected]> Date: Mon Oct 7 11:20:28 2019 -0700 Adding support for nodes inside of shapes. commit 4d06431 Author: Luigi Rosso <[email protected]> Date: Fri Oct 4 18:06:09 2019 -0700 Introducing FlareTesting.setup(); commit 2c5f420 Author: Luigi Rosso <[email protected]> Date: Fri Oct 4 13:44:25 2019 -0700 Clamping trim start/end. commit daba34d Author: Luigi Rosso <[email protected]> Date: Mon Sep 30 21:21:55 2019 +0200 Cherry picking critical lints from #1 63 and updating for pub.
1 parent 9116aa0 commit b48d641

File tree

8 files changed

+61
-43
lines changed

8 files changed

+61
-43
lines changed

flare_dart/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [2.3.2] - 2019-12-17 04:54:38
2+
3+
- Mark layers for drawable items by first computing which drawables are in the layer. Removes race conditions with layers not being set correctly.
4+
15
## [2.3.1] - 2019-12-16 09:17:37
26

37
- Type checking when applying trim path animation. Improves robustness and helps prevent crashes when applying animations from non-matching artboards.

flare_dart/lib/actor_artboard.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,10 +286,10 @@ class ActorArtboard {
286286
// layers won't be known before this.
287287
for (int i = 1; i < componentCount; i++) {
288288
ActorComponent c = components[i];
289-
if (c is ActorDrawable && c.layerEffectRenderer == null) {
289+
if (c is ActorDrawable && c.layerEffectRenderParent == null) {
290290
_drawableNodes.add(c);
291291
}
292-
if (c is ActorLayerEffectRenderer && c.layerEffectRenderer == null) {
292+
if (c is ActorLayerEffectRenderer && c.layerEffectRenderParent == null) {
293293
_effectRenderers.add(c);
294294
}
295295
}

flare_dart/lib/actor_drawable.dart

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,7 @@ abstract class ActorDrawable extends ActorNode {
8585
}
8686
}
8787
}
88-
89-
ActorLayerEffectRenderer _layerEffectRenderer;
90-
ActorLayerEffectRenderer get layerEffectRenderer => _layerEffectRenderer;
91-
set layerEffectRenderer(ActorLayerEffectRenderer value) {
92-
if (_layerEffectRenderer == value) {
93-
return;
94-
}
95-
_layerEffectRenderer?.removeDrawable(this);
96-
_layerEffectRenderer = value;
97-
_layerEffectRenderer?.addDrawable(this);
98-
}
88+
/// If this is set the drawable belongs to a layer. We store a reference to
89+
/// the parent node that contains the layer.
90+
ActorNode layerEffectRenderParent;
9991
}

flare_dart/lib/actor_layer_effect_renderer.dart

Lines changed: 45 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import 'package:flare_dart/math/aabb.dart';
44

55
import 'actor_artboard.dart';
66
import 'actor_blur.dart';
7+
import 'actor_component.dart';
78
import 'actor_drawable.dart';
89
import 'actor_inner_shadow.dart';
910
import 'actor_mask.dart';
@@ -27,16 +28,6 @@ class ActorLayerEffectRenderer extends ActorDrawable {
2728
List<ActorDropShadow> get dropShadows => _dropShadows;
2829
List<ActorInnerShadow> get innerShadows => _innerShadows;
2930

30-
bool addDrawable(ActorDrawable drawable) {
31-
if (_drawables.contains(drawable)) {
32-
return false;
33-
}
34-
_drawables.add(drawable);
35-
return true;
36-
}
37-
38-
bool removeDrawable(ActorDrawable drawable) => _drawables.remove(drawable);
39-
4031
void sortDrawables() {
4132
_drawables
4233
.sort((ActorDrawable a, ActorDrawable b) => a.drawOrder - b.drawOrder);
@@ -80,52 +71,66 @@ class ActorLayerEffectRenderer extends ActorDrawable {
8071
parent.children.whereType<ActorInnerShadow>().toList(growable: false);
8172
}
8273

74+
@override
75+
void resolveComponentIndices(List<ActorComponent> components) {
76+
super.resolveComponentIndices(components);
77+
parent.findLayerEffect();
78+
}
79+
8380
@override
8481
void completeResolve() {
8582
super.completeResolve();
8683

87-
// When we complete resolve we find all the children and mark their layers.
88-
// Alternative way to do this is to have each drawable check for parent
89-
// layers when the parent changes. That would be more effective if nodes
90-
// were to get moved around at runtime.
84+
_drawables.clear();
85+
9186
parent?.all((node) {
92-
if (node is ActorDrawable && node != this) {
93-
node.layerEffectRenderer = this;
87+
if (node == this) {
88+
// don't recurse into this renderer
89+
return false;
90+
} else if (node is ActorNode &&
91+
node.layerEffect != null &&
92+
node.layerEffect != this) {
93+
_drawables.add(node.layerEffect);
94+
// don't recurse further into nodes that are drawing to layers
95+
return false;
96+
}
97+
if (node is ActorDrawable) {
98+
_drawables.add(node);
9499
}
95100
return true;
96101
});
102+
103+
_drawables.forEach(_computeLayerNode);
104+
97105
sortDrawables();
98106
computeMasks();
99107
findEffects();
100108
}
101109

102110
void computeMasks() {
103111
_renderMasks.clear();
104-
var maskSearch = parent;
105-
var masks = <ActorMask>[];
106-
107-
while (maskSearch != null) {
108-
masks +=
109-
maskSearch.children.whereType<ActorMask>().toList(growable: false);
110-
maskSearch = maskSearch.parent;
111-
}
112+
var masks = parent.children.whereType<ActorMask>().toList(growable: false);
112113

113114
for (final mask in masks) {
114115
var renderMask = ActorLayerEffectRendererMask(mask);
115116
mask.source?.all((child) {
117+
if (child == parent) {
118+
// recursive mask was selected
119+
return false;
120+
}
116121
if (child is ActorDrawable) {
117-
if (child.layerEffectRenderer != null &&
118-
child.layerEffectRenderer != this) {
122+
if (child == this) {
123+
return false;
124+
} else if (child.layerEffect != null) {
119125
// Layer effect is direct discendant of this layer, so we want to
120126
// draw it with the other drawables in this layer.
121-
renderMask.drawables.add(child.layerEffectRenderer);
127+
renderMask.drawables.add(child.layerEffect);
122128
// Don't iterate if child has further layer effect
123129
return false;
124130
} else {
125131
renderMask.drawables.add(child);
126132
}
127133
}
128-
129134
return true;
130135
});
131136

@@ -135,3 +140,15 @@ class ActorLayerEffectRenderer extends ActorDrawable {
135140
}
136141
}
137142
}
143+
144+
void _computeLayerNode(ActorDrawable drawable) {
145+
ActorNode parent = drawable;
146+
while (parent != null) {
147+
if (parent.layerEffect != null) {
148+
drawable.layerEffectRenderParent = parent;
149+
return;
150+
}
151+
parent = parent.parent;
152+
}
153+
drawable.layerEffectRenderParent = null;
154+
}

flare_dart/lib/actor_node.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class ActorNode extends ActorComponent {
3333
double _opacity = 1.0;
3434
double _renderOpacity = 1.0;
3535
ActorLayerEffectRenderer _layerEffect;
36+
ActorLayerEffectRenderer get layerEffect => _layerEffect;
3637

3738
bool _overrideWorldTransform = false;
3839
bool _isCollapsedVisibility = false;

flare_dart/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: flare_dart
22
description: Vector design and runtime animation.
3-
version: 2.3.1
3+
version: 2.3.2
44
author: "Rive Team <[email protected]>"
55
homepage: https://github.com/2d-inc/Flare-Flutter
66
environment:

flare_flutter/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [1.8.3] - 2019-12-17 04:56:04
2+
3+
- Mark layers for drawable items by first computing which drawables are in the layer. Removes race conditions with layers not being set correctly.
4+
15
## [1.8.2] - 2019-12-16 09:19:22
26

37
- Clear out layers when instancing artboards to prevent animations from other artboards being applied.

flare_flutter/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: flare_flutter
22
description: Vector design and runtime animation for Flutter.
3-
version: 1.8.2
3+
version: 1.8.3
44
author: "Rive Team <[email protected]>"
55
homepage: https://github.com/2d-inc/Flare-Flutter
66
environment:

0 commit comments

Comments
 (0)