plugins: move to minic
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
#include "global.h"
|
||||
|
||||
void *plugin;
|
||||
char *category_name = "My Nodes";
|
||||
char *node_name = "Hello World";
|
||||
char *node_type = "HELLO_WORLD";
|
||||
|
||||
float custom_node(logic_node_t *node, int from) {
|
||||
return sin(sys_time() * node->inputs->buffer[0]->get(0));
|
||||
}
|
||||
|
||||
void on_delete() {
|
||||
plugin_brush_custom_nodes_remove(node_type);
|
||||
plugin_brush_category_remove(category_name);
|
||||
}
|
||||
|
||||
void main() {
|
||||
plugin = plugin_create();
|
||||
gc_root(plugin);
|
||||
|
||||
// Create new node category
|
||||
any_array_t *node_list = any_array_create(0);
|
||||
// ui_node_t *n = gc_alloc(sizeof(ui_node_t));
|
||||
ui_node_t *n = gc_alloc(72);
|
||||
any_array_push(node_list, n);
|
||||
|
||||
n->id = 0;
|
||||
n->name = node_name;
|
||||
n->type = node_type;
|
||||
n->x = 0;
|
||||
n->y = 0;
|
||||
n->color = 0xffb34f5a;
|
||||
|
||||
n->inputs = any_array_create(0);
|
||||
// ui_node_socket_t *s = gc_alloc(sizeof(ui_node_socket_t));
|
||||
ui_node_socket_t *s = gc_alloc(56);
|
||||
any_array_push(n->inputs, s);
|
||||
s->id = 0;
|
||||
s->node_id = 0;
|
||||
s->name = "Scale";
|
||||
s->type = "VALUE";
|
||||
s->color = 0xffa1a1a1;
|
||||
s->default_value = f32_array_create_x(1.0);
|
||||
s->min = 0.0;
|
||||
s->max = 5.0;
|
||||
s->precision = 100.0;
|
||||
s->display = 0;
|
||||
|
||||
n->outputs = any_array_create(0);
|
||||
// s = gc_alloc(sizeof(ui_node_socket_t));
|
||||
s = gc_alloc(56);
|
||||
any_array_push(n->outputs, s);
|
||||
s->id = 0;
|
||||
s->node_id = 0;
|
||||
s->name = "Value";
|
||||
s->type = "VALUE";
|
||||
s->color = 0xffc7c729;
|
||||
s->default_value = f32_array_create_x(1.0);
|
||||
s->min = 0.0;
|
||||
s->max = 5.0;
|
||||
s->precision = 100.0;
|
||||
s->display = 0;
|
||||
|
||||
n->buttons = any_array_create(0);
|
||||
n->width = 0;
|
||||
n->flags = 0;
|
||||
|
||||
plugin_brush_category_add(category_name, node_list);
|
||||
|
||||
// Brush node
|
||||
plugin_brush_custom_nodes_set(node_type, custom_node);
|
||||
|
||||
// Cleanup
|
||||
plugin_notify_on_delete(plugin, on_delete);
|
||||
}
|
||||
Reference in New Issue
Block a user