@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
48 lines (39 loc) • 1.91 kB
text/typescript
/**
* create an animation mixer from an object that contains animation tracks
*
*
*/
import {TypedJsNode} from './_Base';
import {NodeParamsConfig} from '../utils/params/ParamsConfig';
import {JsConnectionPoint, JsConnectionPointType, JS_CONNECTION_POINT_IN_NODE_DEF} from '../utils/io/connections/Js';
import {JsLinesCollectionController} from './code/utils/JsLinesCollectionController';
import {inputObject3D} from './_BaseObject3D';
import {Poly} from '../../Poly';
import {JsType} from '../../poly/registers/nodes/types/Js';
const CONNECTION_OPTIONS = JS_CONNECTION_POINT_IN_NODE_DEF;
class AnimationMixerJsParamsConfig extends NodeParamsConfig {}
const ParamsConfig = new AnimationMixerJsParamsConfig();
export class AnimationMixerJsNode extends TypedJsNode<AnimationMixerJsParamsConfig> {
override readonly paramsConfig = ParamsConfig;
static override type() {
return JsType.ANIMATION_MIXER;
}
static readonly OUTPUT_NAME = 'val';
override initializeNode() {
this.io.inputs.setNamedInputConnectionPoints([
// new ActorConnectionPoint(TRIGGER_CONNECTION_NAME, ActorConnectionPointType.TRIGGER, CONNECTION_OPTIONS),
new JsConnectionPoint(JsConnectionPointType.OBJECT_3D, JsConnectionPointType.OBJECT_3D, CONNECTION_OPTIONS),
]);
this.io.outputs.setNamedOutputConnectionPoints([
new JsConnectionPoint(JsConnectionPointType.ANIMATION_MIXER, JsConnectionPointType.ANIMATION_MIXER),
]);
}
override setLines(shadersCollectionController: JsLinesCollectionController) {
const object3D = inputObject3D(this, shadersCollectionController);
const varName = this.jsVarName(JsConnectionPointType.ANIMATION_MIXER);
const func = Poly.namedFunctionsRegister.getFunction('getAnimationMixer', this, shadersCollectionController);
shadersCollectionController.addBodyOrComputed(this, [
{dataType: JsConnectionPointType.VECTOR3, varName, value: func.asString(object3D)},
]);
}
}