Skip to content

Commit

Permalink
fix: fixed the bug of animator revert when blendWeight length exceeds…
Browse files Browse the repository at this point in the history
… 4 (#817)

* fix: fixed the bug of animator revert when blendWeight length exceeds 4
  • Loading branch information
luzhuang authored Jun 1, 2022
1 parent 3ffc687 commit 99a5e6e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/core/src/animation/internal/AnimationCurveOwner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class AnimationCurveOwner {
readonly component: Component;
readonly defaultValue: InterpolableValue;
readonly fixedPoseValue: InterpolableValue;

/** @internal */
_hasSavedDefaultValue: boolean = false;

Expand All @@ -43,9 +43,10 @@ export class AnimationCurveOwner {
this.component = target.transform;
break;
case AnimationProperty.BlendShapeWeights:
this.defaultValue = new Float32Array(4);
this.fixedPoseValue = new Float32Array(4);
this.component = target.getComponent(SkinnedMeshRenderer);
const weightLength = (<SkinnedMeshRenderer>this.component).blendShapeWeights.length;
this.defaultValue = new Float32Array(weightLength);
this.fixedPoseValue = new Float32Array(weightLength);
break;
}
}
Expand All @@ -64,7 +65,7 @@ export class AnimationCurveOwner {
case AnimationProperty.BlendShapeWeights:
const { blendShapeWeights } = <SkinnedMeshRenderer>this.component;
for (let i = 0, length = blendShapeWeights.length; i < length; ++i) {
this.defaultValue[i] = (<SkinnedMeshRenderer>this.component).blendShapeWeights[i];
this.defaultValue[i] = blendShapeWeights[i];
}
break;
}
Expand Down

0 comments on commit 99a5e6e

Please sign in to comment.