Skip to content

Commit

Permalink
Adjust code order to eliminate warning (cocos#15418)
Browse files Browse the repository at this point in the history
  • Loading branch information
shrinktofit authored Jun 14, 2023
1 parent 75e6d42 commit 2332643
Showing 1 changed file with 51 additions and 51 deletions.
102 changes: 51 additions & 51 deletions cocos/animation/marionette/pose-graph/pose-nodes/modify-pose-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,57 +10,6 @@ import { PoseGraphType } from '../foundation/type-system';
import { assertIsTrue, CachedArray, Pool } from '../../../../core';
import { Transform } from '../../../core/transform';

@ccclass(`${CLASS_NAME_PREFIX_ANIM}PoseNodeModifyPoseBase`)
@poseGraphNodeHide()
export abstract class PoseNodeModifyPoseBase extends PoseNode {
@serializable
@input({ type: PoseGraphType.POSE })
public pose: PoseNode | null = null;

public settle (context: AnimationGraphSettleContext) {
this.pose?.settle(context);
this._spaceFlagTable = new PoseTransformSpaceFlagTable(context.transformCount);
}

public reenter () {
this.pose?.reenter();
}

public bind (context: AnimationGraphBindingContext): void {
this.pose?.bind(context);
}

protected doUpdate (context: AnimationGraphUpdateContext) {
this.pose?.update(context);
}

protected doEvaluate (context: AnimationGraphEvaluationContext): Pose {
const poseTransformSpaceRequirement = this.getPoseTransformSpaceRequirement();
const inputPose = this.pose?.evaluate(context, poseTransformSpaceRequirement)
?? PoseNode.evaluateDefaultPose(context, poseTransformSpaceRequirement);

const { _modificationQueue: modificationQueue } = this;
assertIsTrue(modificationQueue.length === 0);
this.modifyPose(context, inputPose, modificationQueue);

applyTransformModificationQueue(context, inputPose, modificationQueue, this._spaceFlagTable);
modificationQueue.clear();

return inputPose;
}

protected abstract getPoseTransformSpaceRequirement(): PoseTransformSpaceRequirement;

protected abstract modifyPose(
context: AnimationGraphEvaluationContext,
pose: Pose,
transformModificationQueue: TransformModificationQueue,
): void;

private _modificationQueue = new TransformModificationQueue();
private _spaceFlagTable = new PoseTransformSpaceFlagTable(0);
}

class TransformModification {
public transformIndex = -1;
public transform = new Transform();
Expand Down Expand Up @@ -249,3 +198,54 @@ function applyTransformModificationQueue (
}
}
}

@ccclass(`${CLASS_NAME_PREFIX_ANIM}PoseNodeModifyPoseBase`)
@poseGraphNodeHide()
export abstract class PoseNodeModifyPoseBase extends PoseNode {
@serializable
@input({ type: PoseGraphType.POSE })
public pose: PoseNode | null = null;

public settle (context: AnimationGraphSettleContext) {
this.pose?.settle(context);
this._spaceFlagTable = new PoseTransformSpaceFlagTable(context.transformCount);
}

public reenter () {
this.pose?.reenter();
}

public bind (context: AnimationGraphBindingContext): void {
this.pose?.bind(context);
}

protected doUpdate (context: AnimationGraphUpdateContext) {
this.pose?.update(context);
}

protected doEvaluate (context: AnimationGraphEvaluationContext): Pose {
const poseTransformSpaceRequirement = this.getPoseTransformSpaceRequirement();
const inputPose = this.pose?.evaluate(context, poseTransformSpaceRequirement)
?? PoseNode.evaluateDefaultPose(context, poseTransformSpaceRequirement);

const { _modificationQueue: modificationQueue } = this;
assertIsTrue(modificationQueue.length === 0);
this.modifyPose(context, inputPose, modificationQueue);

applyTransformModificationQueue(context, inputPose, modificationQueue, this._spaceFlagTable);
modificationQueue.clear();

return inputPose;
}

protected abstract getPoseTransformSpaceRequirement(): PoseTransformSpaceRequirement;

protected abstract modifyPose(
context: AnimationGraphEvaluationContext,
pose: Pose,
transformModificationQueue: TransformModificationQueue,
): void;

private _modificationQueue = new TransformModificationQueue();
private _spaceFlagTable = new PoseTransformSpaceFlagTable(0);
}

0 comments on commit 2332643

Please sign in to comment.