Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export some types #53

Merged
merged 1 commit into from
Sep 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cocos/core/animation/newgen-anim/graph-eval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export class PoseGraphEval {
}
}

interface TransitionStatus {
export interface TransitionStatus {
duration: number;
time: number;
}
Expand Down Expand Up @@ -1089,7 +1089,7 @@ export class PoseNodeEval extends NodeBaseEval {
progress: 0.0,
};

private _setSpeed(value: number) {
private _setSpeed (value: number) {
this._speed = value;
}
}
Expand Down
1 change: 1 addition & 0 deletions cocos/core/animation/newgen-anim/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export { PoseBlendDirect } from './pose-blend-direct';
export { PoseBlend1D } from './pose-blend-1d';
export { PoseBlend2D } from './pose-blend-2d';
export { NewGenAnim } from './newgenanim-component';
export type { PoseNodeStats, TransitionStatus, PoseStatus } from './newgenanim-component';
export type { BindableNumber, BindableBoolean } from './parametric';
export { SkeletonMask } from '../skeleton-mask';
export { StateMachineComponent } from './state-machine-component';
Expand Down
53 changes: 48 additions & 5 deletions cocos/core/animation/newgen-anim/newgenanim-component.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
import { Component } from '../../components';
import { PoseGraph } from './pose-graph';
import { property, ccclass, menu } from '../../data/class-decorator';
import { PoseGraphEval } from './graph-eval';
import { PoseGraphEval, PoseNodeStats, TransitionStatus, PoseStatus } from './graph-eval';
import { Value } from './variable';
import { assertIsNonNullable } from '../../data/utils/asserts';

@ccclass('cc.animation.NewGenAnim')
@menu('Components/animation/NewGenAnim')
export class NewGenAnim extends Component {
export type {
PoseNodeStats,
PoseStatus,
TransitionStatus,
};

@ccclass('cc.animation.AutomataAnimation')
@menu('Components/Animation/Automata Animation')
export class AutomataAnimation extends Component {
@property(PoseGraph)
public graph: PoseGraph | null = null;

Expand All @@ -23,6 +30,42 @@ export class NewGenAnim extends Component {
}

public setValue (name: string, value: Value) {
this._graphEval?.setValue(name, value);
const { _graphEval: graphEval } = this;
assertIsNonNullable(graphEval);
graphEval.setValue(name, value);
}

public getCurrentPoseNodeStats (layer: number) {
const { _graphEval: graphEval } = this;
assertIsNonNullable(graphEval);
return graphEval.getCurrentPoseNodeStats(layer);
}

public getCurrentPoses (layer: number) {
const { _graphEval: graphEval } = this;
assertIsNonNullable(graphEval);
return graphEval.getCurrentPoses(layer);
}

public getCurrentTransition (layer: number) {
const { _graphEval: graphEval } = this;
assertIsNonNullable(graphEval);
return graphEval.getCurrentTransition(layer);
}

public getNextPoseNodeStats (layer: number) {
const { _graphEval: graphEval } = this;
assertIsNonNullable(graphEval);
return graphEval.getNextPoseNodeStats(layer);
}

public getNextPoses (layer: number) {
const { _graphEval: graphEval } = this;
assertIsNonNullable(graphEval);
return graphEval.getNextPoses(layer);
}
}

export {
AutomataAnimation as NewGenAnim,
};