2024-03-14 15:31:22 +01:00
|
|
|
|
2024-08-26 22:14:53 +02:00
|
|
|
let nodes_brush_categories: string[] = [
|
|
|
|
|
_tr("Nodes")
|
2024-04-25 22:04:43 +02:00
|
|
|
];
|
|
|
|
|
|
2024-09-03 15:52:05 +02:00
|
|
|
let nodes_brush_category0: ui_node_t[];
|
2024-08-26 22:14:53 +02:00
|
|
|
let nodes_brush_list: node_list_t[];
|
2024-03-14 15:31:22 +01:00
|
|
|
|
2024-05-03 21:29:39 +02:00
|
|
|
let nodes_brush_creates: map_t<string, (args: f32_array_t)=>logic_node_ext_t>;
|
2024-03-21 21:06:41 +01:00
|
|
|
|
|
|
|
|
function nodes_brush_init() {
|
|
|
|
|
nodes_brush_creates = map_create();
|
|
|
|
|
map_set(nodes_brush_creates, "brush_output_node", brush_output_node_create);
|
2024-09-24 16:06:49 +02:00
|
|
|
// map_set(nodes_brush_creates, "tex_image_node", tex_image_node_create);
|
|
|
|
|
map_set(nodes_brush_creates, "TEX_IMAGE", tex_image_node_create);
|
2024-03-21 21:06:41 +01:00
|
|
|
map_set(nodes_brush_creates, "input_node", input_node_create);
|
|
|
|
|
map_set(nodes_brush_creates, "math_node", math_node_create);
|
|
|
|
|
map_set(nodes_brush_creates, "random_node", random_node_create);
|
|
|
|
|
map_set(nodes_brush_creates, "separate_vector_node", separate_vector_node_create);
|
|
|
|
|
map_set(nodes_brush_creates, "time_node", time_node_create);
|
|
|
|
|
map_set(nodes_brush_creates, "float_node", float_node_create);
|
|
|
|
|
map_set(nodes_brush_creates, "vector_node", vector_node_create);
|
|
|
|
|
map_set(nodes_brush_creates, "vector_math_node", vector_math_node_create);
|
2024-08-26 22:14:53 +02:00
|
|
|
|
2025-01-17 09:51:53 +01:00
|
|
|
nodes_brush_list_init();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function nodes_brush_list_init() {
|
|
|
|
|
if (nodes_brush_list != null) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-26 22:14:53 +02:00
|
|
|
nodes_brush_category0 = [
|
|
|
|
|
tex_image_node_def,
|
|
|
|
|
input_node_def,
|
|
|
|
|
math_node_def,
|
|
|
|
|
random_node_def,
|
|
|
|
|
separate_vector_node_def,
|
|
|
|
|
time_node_def,
|
|
|
|
|
float_node_def,
|
|
|
|
|
vector_node_def,
|
|
|
|
|
vector_math_node_def
|
|
|
|
|
];
|
|
|
|
|
nodes_brush_list = [
|
|
|
|
|
nodes_brush_category0
|
|
|
|
|
];
|
2024-03-21 21:06:41 +01:00
|
|
|
}
|
|
|
|
|
|
2024-09-03 15:52:05 +02:00
|
|
|
function nodes_brush_create_node(node_type: string): ui_node_t {
|
2024-03-21 21:06:41 +01:00
|
|
|
for (let i: i32 = 0; i < nodes_brush_list.length; ++i) {
|
2024-09-03 15:52:05 +02:00
|
|
|
let c: ui_node_t[] = nodes_brush_list[i];
|
2024-03-21 21:06:41 +01:00
|
|
|
for (let i: i32 = 0; i < c.length; ++i) {
|
2024-09-03 15:52:05 +02:00
|
|
|
let n: ui_node_t = c[i];
|
2024-03-14 23:58:24 +01:00
|
|
|
if (n.type == node_type) {
|
2024-09-03 15:52:05 +02:00
|
|
|
let canvas: ui_node_canvas_t = context_raw.brush.canvas;
|
|
|
|
|
let nodes: ui_nodes_t = context_raw.brush.nodes;
|
|
|
|
|
let node: ui_node_t = ui_nodes_make_node(n, nodes, canvas);
|
2024-03-20 16:13:54 +01:00
|
|
|
array_push(canvas.nodes, node);
|
2024-03-14 15:31:22 +01:00
|
|
|
return node;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|