Files
armorpaint/base/Sources/nodes/SeparateVectorNode.ts
T

62 lines
1001 B
TypeScript
Raw Normal View History

2023-02-08 14:51:54 +01:00
class SeparateVectorNode extends LogicNode {
2024-01-17 18:53:31 +01:00
constructor() {
2023-12-12 14:57:44 +01:00
super();
2023-02-08 14:51:54 +01:00
}
2024-01-17 18:53:31 +01:00
override get = (from: i32, done: (a: any)=>void) => {
2024-02-05 20:57:20 +01:00
this.inputs[0].get((vector: vec4_t) => {
2023-02-08 14:51:54 +01:00
if (from == 0) done(vector.x);
else if (from == 1) done(vector.y);
else done(vector.z);
});
}
2023-02-22 19:52:02 +01:00
2024-02-06 19:32:21 +01:00
static def: zui_node_t = {
2023-02-22 19:52:02 +01:00
id: 0,
name: _tr("Separate Vector"),
type: "SeparateVectorNode",
x: 0,
y: 0,
color: 0xff4982a0,
inputs: [
{
id: 0,
node_id: 0,
name: _tr("Vector"),
type: "VECTOR",
color: 0xff6363c7,
2024-01-20 10:58:12 +01:00
default_value: new Float32Array([0.0, 0.0, 0.0])
2023-02-22 19:52:02 +01:00
}
],
outputs: [
{
id: 0,
node_id: 0,
name: _tr("X"),
type: "VALUE",
color: 0xffa1a1a1,
default_value: 0.0
},
{
id: 0,
node_id: 0,
name: _tr("Y"),
type: "VALUE",
color: 0xffa1a1a1,
default_value: 0.0
},
{
id: 0,
node_id: 0,
name: _tr("Z"),
type: "VALUE",
color: 0xffa1a1a1,
default_value: 0.0
}
],
buttons: []
};
2023-02-08 14:51:54 +01:00
}