From 7e1e49a3b5885bb0f94c33d5d43a4bd34eb9bf1d Mon Sep 17 00:00:00 2001 From: luboslenco Date: Sat, 14 Mar 2026 19:29:15 +0100 Subject: [PATCH] paint: fix enabling import plugin --- base/sources/iron_path.c | 4 ++-- paint/plugins/plugins.c | 18 ++++++++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/base/sources/iron_path.c b/base/sources/iron_path.c index 911b5011..26128c12 100644 --- a/base/sources/iron_path.c +++ b/base/sources/iron_path.c @@ -12,8 +12,8 @@ bool path_is_protected_linux = false; #endif -static char_ptr_array_t *_path_mesh_formats = NULL; -static char_ptr_array_t *_path_texture_formats = NULL; +char_ptr_array_t *_path_mesh_formats = NULL; +char_ptr_array_t *_path_texture_formats = NULL; static char_ptr_array_t *_path_base_color_ext = NULL; static char_ptr_array_t *_path_opacity_ext = NULL; static char_ptr_array_t *_path_normal_map_ext = NULL; diff --git a/paint/plugins/plugins.c b/paint/plugins/plugins.c index 8398e139..cb32a6ee 100644 --- a/paint/plugins/plugins.c +++ b/paint/plugins/plugins.c @@ -215,40 +215,46 @@ FN(util_mesh_unwrappers_delete) { } extern any_map_t *import_mesh_importers; -extern char_ptr_array_t *path_mesh_formats; +extern char_ptr_array_t *_path_mesh_formats; +char_ptr_array_t *path_mesh_formats(void); FN(path_mesh_importers_set) { char *format_name = (char *)JS_ToCString(ctx, argv[0]); JSValue *p = malloc(sizeof(JSValue)); JSValue dup = JS_DupValue(ctx, argv[1]); memcpy(p, &dup, sizeof(JSValue)); any_map_set(import_mesh_importers, format_name, p); - any_array_push(path_mesh_formats, format_name); + path_mesh_formats(); // Init array + any_array_push(_path_mesh_formats, format_name); return JS_UNDEFINED; } FN(path_mesh_importers_delete) { char *format_name = (char *)JS_ToCString(ctx, argv[0]); map_delete(import_mesh_importers, format_name); - array_splice(path_mesh_formats, char_ptr_array_index_of(path_mesh_formats, format_name), 1); + path_mesh_formats(); // Init array + array_splice(_path_mesh_formats, char_ptr_array_index_of(_path_mesh_formats, format_name), 1); return JS_UNDEFINED; } extern any_map_t *import_texture_importers; -extern char_ptr_array_t *path_texture_formats; +extern char_ptr_array_t *_path_texture_formats; +char_ptr_array_t *path_texture_formats(void); FN(path_texture_importers_set) { char *format_name = (char *)JS_ToCString(ctx, argv[0]); JSValue *p = malloc(sizeof(JSValue)); JSValue dup = JS_DupValue(ctx, argv[1]); memcpy(p, &dup, sizeof(JSValue)); any_map_set(import_texture_importers, format_name, p); - any_array_push(path_texture_formats, format_name); + path_texture_formats(); // Init array + any_array_push(_path_texture_formats, format_name); return JS_UNDEFINED; } FN(path_texture_importers_delete) { char *format_name = (char *)JS_ToCString(ctx, argv[0]); map_delete(import_texture_importers, format_name); - array_splice(path_texture_formats, char_ptr_array_index_of(path_texture_formats, format_name), 1); + path_texture_formats(); // Init array + array_splice(_path_texture_formats, char_ptr_array_index_of(_path_texture_formats, format_name), 1); return JS_UNDEFINED; }