Plugin fixes
This commit is contained in:
@@ -26,6 +26,19 @@ function nodes_brush_init() {
|
||||
map_set(nodes_brush_creates, "vector_node", vector_node_create);
|
||||
map_set(nodes_brush_creates, "color_node", color_node_create);
|
||||
|
||||
nodes_brush_list_init();
|
||||
|
||||
map_set(ui_nodes_custom_buttons, "inpaint_node_button", inpaint_node_button);
|
||||
map_set(ui_nodes_custom_buttons, "text_to_photo_node_button", text_to_photo_node_button);
|
||||
map_set(ui_nodes_custom_buttons, "tiling_node_button", tiling_node_button);
|
||||
map_set(ui_nodes_custom_buttons, "variance_node_button", variance_node_button);
|
||||
}
|
||||
|
||||
function nodes_brush_list_init() {
|
||||
if (nodes_brush_list != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
nodes_brush_input = [
|
||||
image_texture_node_def,
|
||||
rgb_node_def,
|
||||
@@ -44,11 +57,6 @@ function nodes_brush_init() {
|
||||
nodes_brush_input,
|
||||
nodes_brush_model
|
||||
];
|
||||
|
||||
map_set(ui_nodes_custom_buttons, "inpaint_node_button", inpaint_node_button);
|
||||
map_set(ui_nodes_custom_buttons, "text_to_photo_node_button", text_to_photo_node_button);
|
||||
map_set(ui_nodes_custom_buttons, "tiling_node_button", tiling_node_button);
|
||||
map_set(ui_nodes_custom_buttons, "variance_node_button", variance_node_button);
|
||||
}
|
||||
|
||||
function nodes_brush_create_node(node_type: string): ui_node_t {
|
||||
|
||||
@@ -22,6 +22,14 @@ function nodes_brush_init() {
|
||||
map_set(nodes_brush_creates, "vector_node", vector_node_create);
|
||||
map_set(nodes_brush_creates, "vector_math_node", vector_math_node_create);
|
||||
|
||||
nodes_brush_list_init();
|
||||
}
|
||||
|
||||
function nodes_brush_list_init() {
|
||||
if (nodes_brush_list != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
nodes_brush_category0 = [
|
||||
tex_image_node_def,
|
||||
input_node_def,
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
|
||||
function export_gpl(path, name, swatches) {
|
||||
let o: string = "";
|
||||
o += "GIMP Palette\n";
|
||||
o += "Name: " + name + "\n";
|
||||
o += "# armorpaint.org\n";
|
||||
o += "#\n";
|
||||
let o = "";
|
||||
o += "GIMP Palette\\n";
|
||||
o += "Name: " + name + "\\n";
|
||||
o += "# armorpaint.org\\n";
|
||||
o += "#\\n";
|
||||
|
||||
for (let i = 0; i < swatches.length; ++i) {
|
||||
let swatch = swatches[i];
|
||||
let rb = color_get_rb(swatch.base);
|
||||
let gb = color_get_gb(swatch.base);
|
||||
let bb = color_get_bb(swatch.base);
|
||||
o += rb + " " + gb + " " + bb + "\n";
|
||||
o += rb + " " + gb + " " + bb + "\\n";
|
||||
}
|
||||
|
||||
iron_file_save_bytes(path, sys_string_to_buffer(o), o.length);
|
||||
}
|
||||
|
||||
let plugin = plugin_create();
|
||||
path_swatch_exporters_set("gpl", export_gpl);
|
||||
// path_swatch_exporters_set("gpl", export_gpl);
|
||||
plugin_notify_on_delete(plugin, function() {
|
||||
path_swatch_exporters_delete("gpl");
|
||||
// path_swatch_exporters_delete("gpl");
|
||||
});
|
||||
|
||||
@@ -4,7 +4,7 @@ function import_gpl(path, replace_existing) {
|
||||
// let swatches: TSwatchColor[] = [];
|
||||
|
||||
// let str: string = sys_buffer_to_string(b);
|
||||
// let lines: string[] = string_split(str, "\n");
|
||||
// let lines: string[] = string_split(str, "\\n");
|
||||
|
||||
// // GIMP's color palette importer: https://gitlab.gnome.org/GNOME/gimp/-/blob/gimp-2-10/app/core/gimppalette-load.c#L39
|
||||
// if (!starts_with(lines[0], "GIMP Palette")) {
|
||||
@@ -41,7 +41,7 @@ function import_gpl(path, replace_existing) {
|
||||
}
|
||||
|
||||
let plugin = plugin_create();
|
||||
path_swatch_importers_set("gpl", import_gpl);
|
||||
// path_swatch_importers_set("gpl", import_gpl);
|
||||
plugin_notify_on_delete(plugin, function() {
|
||||
path_swatch_importers_delete("gpl");
|
||||
// path_swatch_importers_delete("gpl");
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
function import_txt(path) {
|
||||
let b = data_get_blob(path);
|
||||
let filename = path.split("\\").pop().split("/").pop();
|
||||
let filename = path.split("\\\\").pop().split("/").pop();
|
||||
ui_box_show_message(filename, buffer_to_string(b));
|
||||
data_delete_blob(path);
|
||||
}
|
||||
|
||||
@@ -654,12 +654,14 @@ FN(parser_material_parse_value_input) {
|
||||
|
||||
extern any_array_t *nodes_brush_categories;
|
||||
extern any_array_t *nodes_brush_list;
|
||||
void nodes_brush_list_init();
|
||||
FN(nodes_brush_category_add) {
|
||||
char *category_name = (char *)JS_ToCString(ctx, argv[0]);
|
||||
any_array_push(nodes_brush_categories, category_name);
|
||||
size_t len;
|
||||
void *ab = JS_GetArrayBuffer(ctx, &len, argv[1]);
|
||||
buffer_t b = { .buffer = ab, .length = len, .capacity = len };
|
||||
nodes_brush_list_init();
|
||||
any_array_push(nodes_brush_list, armpack_decode(&b));
|
||||
return JS_UNDEFINED;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user