paint: fix enabling import plugin
This commit is contained in:
@@ -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;
|
||||
|
||||
+12
-6
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user