2020-04-27 20:02:08 +02:00
|
|
|
|
2024-04-02 15:45:49 +02:00
|
|
|
let plugin = plugin_create();
|
2020-04-27 20:02:08 +02:00
|
|
|
|
2024-04-02 15:45:49 +02:00
|
|
|
let category_name = "My Nodes";
|
|
|
|
|
let node_name = "Hello World";
|
|
|
|
|
let node_type = "HELLO_WORLD";
|
2020-04-27 20:02:08 +02:00
|
|
|
|
|
|
|
|
// Create new node category
|
2024-08-22 23:07:22 +02:00
|
|
|
let node_list = [
|
2020-04-27 20:02:08 +02:00
|
|
|
{
|
|
|
|
|
id: 0,
|
2024-04-02 15:45:49 +02:00
|
|
|
name: node_name,
|
|
|
|
|
type: node_type,
|
2020-04-27 20:02:08 +02:00
|
|
|
x: 0,
|
|
|
|
|
y: 0,
|
|
|
|
|
color: 0xffb34f5a,
|
|
|
|
|
inputs: [
|
|
|
|
|
{
|
|
|
|
|
id: 0,
|
|
|
|
|
node_id: 0,
|
|
|
|
|
name: "Scale",
|
|
|
|
|
type: "VALUE",
|
|
|
|
|
color: 0xffa1a1a1,
|
2024-08-22 23:07:22 +02:00
|
|
|
default_value__f32: [1.0],
|
|
|
|
|
min__f32: 0.0,
|
|
|
|
|
max__f32: 5.0,
|
|
|
|
|
precision__f32: 100.0,
|
|
|
|
|
display: 0
|
2020-04-27 20:02:08 +02:00
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
outputs: [
|
|
|
|
|
{
|
|
|
|
|
id: 0,
|
|
|
|
|
node_id: 0,
|
|
|
|
|
name: "Value",
|
|
|
|
|
type: "VALUE",
|
|
|
|
|
color: 0xffc7c729,
|
2024-08-22 23:07:22 +02:00
|
|
|
default_value__f32: [1.0],
|
|
|
|
|
min__f32: 0.0,
|
|
|
|
|
max__f32: 5.0,
|
|
|
|
|
precision__f32: 100.0,
|
|
|
|
|
display: 0
|
2020-04-27 20:02:08 +02:00
|
|
|
}
|
|
|
|
|
],
|
2024-08-22 23:07:22 +02:00
|
|
|
buttons: [],
|
|
|
|
|
width: 0
|
2020-04-27 20:02:08 +02:00
|
|
|
}
|
|
|
|
|
];
|
2024-08-22 23:07:22 +02:00
|
|
|
|
|
|
|
|
nodes_brush_category_add(category_name, armpack_encode(node_list));
|
2020-04-27 20:02:08 +02:00
|
|
|
|
|
|
|
|
// Brush node
|
2024-08-22 23:07:22 +02:00
|
|
|
parser_logic_custom_nodes_set(node_type, function(node, from) {
|
2025-03-11 10:02:47 +01:00
|
|
|
return Math.sin(sys_time() * node.inputs[0].get(0));
|
2020-04-27 20:02:08 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Cleanup
|
2024-08-22 23:07:22 +02:00
|
|
|
plugin_notify_on_delete(plugin, function() {
|
|
|
|
|
parser_logic_custom_nodes_delete(node_type);
|
|
|
|
|
nodes_brush_category_remove(category_name);
|
|
|
|
|
});
|