Files
armorpaint/paint/plugins/plugins.c
T

59 lines
1.4 KiB
C
Raw Normal View History

2024-08-22 23:07:22 +02:00
2025-02-27 16:12:24 +01:00
#include "../../../base/plugins/plugin_api.h"
2024-08-22 23:07:22 +02:00
void proc_xatlas_unwrap(void *mesh);
FN(proc_xatlas_unwrap) {
int64_t mesh;
2024-08-24 11:17:02 +02:00
JS_ToInt64(ctx, &mesh, argv[0]);
2024-08-22 23:07:22 +02:00
proc_xatlas_unwrap((void *)mesh);
return JS_UNDEFINED;
}
2025-07-20 00:14:24 +02:00
void plugin_uv_unwrap_button();
FN(plugin_uv_unwrap_button) {
plugin_uv_unwrap_button();
return JS_UNDEFINED;
}
2024-08-24 11:17:02 +02:00
void *io_svg_parse(char *buf);
FN(io_svg_parse) {
size_t len;
void *ab = JS_GetArrayBuffer(ctx, &len, argv[0]);
return JS_NewInt64(ctx, (int64_t)io_svg_parse(ab));
}
void *io_usd_parse(char *buf, size_t size);
FN(io_usd_parse) {
size_t len;
void *ab = JS_GetArrayBuffer(ctx, &len, argv[0]);
return JS_NewInt64(ctx, (int64_t)io_usd_parse(ab, len));
}
void *io_gltf_parse(char *buf, size_t size, const char *path);
2024-08-24 11:17:02 +02:00
FN(io_gltf_parse) {
size_t len;
void *ab = JS_GetArrayBuffer(ctx, &len, argv[0]);
const char *path = JS_ToCString(ctx, argv[1]);
return JS_NewInt64(ctx, (int64_t)io_gltf_parse(ab, len, path));
2024-08-24 11:17:02 +02:00
}
void *io_fbx_parse(char *buf, size_t size);
FN(io_fbx_parse) {
size_t len;
void *ab = JS_GetArrayBuffer(ctx, &len, argv[0]);
return JS_NewInt64(ctx, (int64_t)io_fbx_parse(ab, len));
}
2024-08-22 23:07:22 +02:00
void plugin_embed() {
JSValue global_obj = JS_GetGlobalObject(js_ctx);
BIND(proc_xatlas_unwrap, 1);
2025-07-20 00:14:24 +02:00
BIND(plugin_uv_unwrap_button, 0);
2024-08-24 11:17:02 +02:00
BIND(io_svg_parse, 1);
BIND(io_usd_parse, 1);
BIND(io_gltf_parse, 2);
2024-08-24 11:17:02 +02:00
BIND(io_fbx_parse, 1);
2024-08-22 23:07:22 +02:00
JS_FreeValue(js_ctx, global_obj);
}