UNPKG

@polygonjs/polygonjs

Version:

node-based WebGL 3D engine https://polygonjs.com

47 lines (46 loc) 1.96 kB
"use strict"; import { TypedJsNode } from "./_Base"; import { NodeParamsConfig, ParamConfig } from "../utils/params/ParamsConfig"; import { JsConnectionPoint, JsConnectionPointType, JS_CONNECTION_POINT_IN_NODE_DEF } from "../utils/io/connections/Js"; import { Poly } from "../../Poly"; const CONNECTION_OPTIONS = JS_CONNECTION_POINT_IN_NODE_DEF; class AnimationActionJsParamsConfig extends NodeParamsConfig { constructor() { super(...arguments); this.clipName = ParamConfig.STRING(""); this.autoPlay = ParamConfig.BOOLEAN(1); } } const ParamsConfig = new AnimationActionJsParamsConfig(); export class AnimationActionJsNode extends TypedJsNode { constructor() { super(...arguments); this.paramsConfig = ParamsConfig; } static type() { return "animationAction"; } initializeNode() { this.io.inputs.setNamedInputConnectionPoints([ new JsConnectionPoint( JsConnectionPointType.ANIMATION_MIXER, JsConnectionPointType.ANIMATION_MIXER, CONNECTION_OPTIONS ) ]); this.io.outputs.setNamedOutputConnectionPoints([ new JsConnectionPoint(JsConnectionPointType.ANIMATION_ACTION, JsConnectionPointType.ANIMATION_ACTION) ]); } setLines(shadersCollectionController) { const mixer = this.variableForInput(shadersCollectionController, JsConnectionPointType.ANIMATION_MIXER); const clipName = this.variableForInputParam(shadersCollectionController, this.p.clipName); const autoPlay = this.variableForInputParam(shadersCollectionController, this.p.autoPlay); const varName = this.jsVarName(JsConnectionPointType.ANIMATION_ACTION); const func = Poly.namedFunctionsRegister.getFunction("getAnimationAction", this, shadersCollectionController); shadersCollectionController.addBodyOrComputed(this, [ { dataType: JsConnectionPointType.VECTOR3, varName, value: func.asString(mixer, clipName, autoPlay) } ]); } } AnimationActionJsNode.OUTPUT_NAME = "val";