Files
armorpaint/base/sources/ts/nodes/time_node.ts
T

77 lines
1.3 KiB
TypeScript
Raw Normal View History

2024-03-14 23:58:24 +01:00
type time_node_t = {
base?: logic_node_t;
};
2024-09-24 16:50:54 +02:00
function time_node_create(raw: ui_node_t, args: f32_array_t): time_node_t {
2024-03-14 23:58:24 +01:00
let n: time_node_t = {};
2024-10-21 19:28:43 +02:00
n.base = logic_node_create(n);
2024-03-14 23:58:24 +01:00
n.base.get = time_node_get;
return n;
}
2024-04-08 17:40:32 +02:00
function time_node_get(self: time_node_t, from: i32): logic_node_value_t {
2024-03-20 16:13:54 +01:00
if (from == 0) {
2025-03-11 10:02:47 +01:00
let v: logic_node_value_t = { _f32: sys_time() };
2024-04-08 17:40:32 +02:00
return v;
2024-03-20 16:13:54 +01:00
}
else if (from == 1) {
2025-03-11 19:49:42 +01:00
let v: logic_node_value_t = { _f32: sys_delta() };
2024-04-08 17:40:32 +02:00
return v;
2024-03-20 16:13:54 +01:00
}
else {
2024-04-08 17:40:32 +02:00
let v: logic_node_value_t = { _f32: context_raw.brush_time };
return v;
2024-03-20 16:13:54 +01:00
}
2024-03-14 23:58:24 +01:00
}
2024-09-03 15:52:05 +02:00
let time_node_def: ui_node_t = {
2024-03-14 23:58:24 +01:00
id: 0,
name: _tr("Time"),
type: "time_node",
x: 0,
y: 0,
color: 0xff4982a0,
inputs: [],
outputs: [
{
id: 0,
node_id: 0,
name: _tr("Time"),
type: "VALUE",
color: 0xffa1a1a1,
2024-04-24 12:14:47 +02:00
default_value: f32_array_create_x(0.0),
2024-04-10 19:39:17 +02:00
min: 0.0,
max: 1.0,
precision: 100,
display: 0
2024-03-14 23:58:24 +01:00
},
{
id: 0,
node_id: 0,
name: _tr("Delta"),
type: "VALUE",
color: 0xffa1a1a1,
2024-04-24 12:14:47 +02:00
default_value: f32_array_create_x(0.0),
2024-04-10 19:39:17 +02:00
min: 0.0,
max: 1.0,
precision: 100,
display: 0
2024-03-14 23:58:24 +01:00
},
{
id: 0,
node_id: 0,
name: _tr("Brush"),
type: "VALUE",
color: 0xffa1a1a1,
2024-04-24 12:14:47 +02:00
default_value: f32_array_create_x(0.0),
2024-04-10 19:39:17 +02:00
min: 0.0,
max: 1.0,
precision: 100,
display: 0
2024-03-14 23:58:24 +01:00
}
],
2024-04-10 19:39:17 +02:00
buttons: [],
width: 0
2024-03-14 23:58:24 +01:00
};