Plugin fixes

This commit is contained in:
luboslenco
2025-01-17 09:51:53 +01:00
parent 348ea6037b
commit 303f941abe
6 changed files with 35 additions and 17 deletions
+8 -8
View File
@@ -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");
});
+3 -3
View File
@@ -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 -1
View File
@@ -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);
}