Getting state machine and bones working with nnbd.

This commit is contained in:
Luigi Rosso
2021-03-23 15:34:51 -07:00
parent db75981800
commit 38cb01d192
5 changed files with 14 additions and 13 deletions

View File

@ -27,8 +27,7 @@ class StateMachineLayerImporter extends ImportStackObject {
int artboardAnimationIndex = state.animationId;
assert(artboardAnimationIndex >= 0 &&
artboardAnimationIndex < artboardImporter.animations.length);
state.animationId =
artboardImporter.animations[artboardAnimationIndex].id;
state.animation = artboardImporter.animations[artboardAnimationIndex];
}
for (final transition in state.transitions) {
// At import time the stateToId is an index relative to the entire layer

View File

@ -23,12 +23,4 @@ class AnimationState extends AnimationStateBase {
void animationIdChanged(int from, int to) {
animation = id == Core.missingId ? null : context.resolve(to);
}
@override
void onAddedDirty() {
super.onAddedDirty();
if (animationId != Core.missingId) {
animation = context.resolve(animationId);
}
}
}

View File

@ -56,6 +56,12 @@ class Skin extends SkinBase {
(parent as Skinnable).addSkin(this);
parent!.markRebuildDependencies();
}
_worldTransform[0] = xx;
_worldTransform[1] = xy;
_worldTransform[2] = yx;
_worldTransform[3] = yy;
_worldTransform[4] = tx;
_worldTransform[5] = ty;
}
@override

View File

@ -5,7 +5,7 @@ export 'package:rive/src/generated/bones/tendon_base.dart';
class Tendon extends TendonBase {
final Mat2D _bind = Mat2D();
Mat2D? _inverseBind = Mat2D();
Mat2D? _inverseBind;
SkeletalComponent _bone = SkeletalComponent.unknown;
SkeletalComponent get bone => _bone;
Mat2D get inverseBind {
@ -22,6 +22,12 @@ class Tendon extends TendonBase {
void onAddedDirty() {
super.onAddedDirty();
_bone = context.resolveWithDefault(boneId, SkeletalComponent.unknown);
_bind[0] = xx;
_bind[1] = xy;
_bind[2] = yx;
_bind[3] = yy;
_bind[4] = tx;
_bind[5] = ty;
}
@override

View File

@ -6,8 +6,6 @@ import 'package:rive/src/rive_core/shapes/path_vertex.dart';
import 'package:rive/src/generated/shapes/points_path_base.dart';
export 'package:rive/src/generated/shapes/points_path_base.dart';
enum PointsPathEditMode { off, creating, editing }
class PointsPath extends PointsPathBase with Skinnable {
final List<PathVertex> _vertices = [];
PointsPath() {