Restore unwrap mesh button
This commit is contained in:
@@ -5,18 +5,14 @@ function unwrap_mesh(mesh) {
|
|||||||
proc_xatlas_unwrap(mesh);
|
proc_xatlas_unwrap(mesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
// let h1 = ui_handle_create();
|
let h1 = ui_handle_create();
|
||||||
// plugin_notify_on_ui(plugin, function() {
|
plugin_notify_on_ui(plugin, function() {
|
||||||
// if (ui_panel(h1, "UV Unwrap")) {
|
if (ui_panel(h1, "UV Unwrap")) {
|
||||||
// if (ui_button("Unwrap Mesh")) {
|
if (ui_button("Unwrap Mesh")) {
|
||||||
// for (let po of project_paint_objects) {
|
plugin_uv_unwrap_button();
|
||||||
// unwrap_mesh(mesh);
|
}
|
||||||
// mesh_data_build();
|
}
|
||||||
// }
|
});
|
||||||
// util_mesh_merge_mesh();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
util_mesh_unwrappers_set("uv_unwrap.js", unwrap_mesh);
|
util_mesh_unwrappers_set("uv_unwrap.js", unwrap_mesh);
|
||||||
plugin_notify_on_delete(plugin, function() {
|
plugin_notify_on_delete(plugin, function() {
|
||||||
|
|||||||
@@ -9,6 +9,12 @@ FN(proc_xatlas_unwrap) {
|
|||||||
return JS_UNDEFINED;
|
return JS_UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void plugin_uv_unwrap_button();
|
||||||
|
FN(plugin_uv_unwrap_button) {
|
||||||
|
plugin_uv_unwrap_button();
|
||||||
|
return JS_UNDEFINED;
|
||||||
|
}
|
||||||
|
|
||||||
void *io_svg_parse(char *buf);
|
void *io_svg_parse(char *buf);
|
||||||
FN(io_svg_parse) {
|
FN(io_svg_parse) {
|
||||||
size_t len;
|
size_t len;
|
||||||
@@ -42,6 +48,7 @@ void plugin_embed() {
|
|||||||
JSValue global_obj = JS_GetGlobalObject(js_ctx);
|
JSValue global_obj = JS_GetGlobalObject(js_ctx);
|
||||||
|
|
||||||
BIND(proc_xatlas_unwrap, 1);
|
BIND(proc_xatlas_unwrap, 1);
|
||||||
|
BIND(plugin_uv_unwrap_button, 0);
|
||||||
BIND(io_svg_parse, 1);
|
BIND(io_svg_parse, 1);
|
||||||
BIND(io_usd_parse, 1);
|
BIND(io_usd_parse, 1);
|
||||||
BIND(io_gltf_parse, 2);
|
BIND(io_gltf_parse, 2);
|
||||||
|
|||||||
@@ -40,3 +40,25 @@ function tab_plugins_draw(htab: ui_handle_t) {
|
|||||||
///end
|
///end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function plugin_uv_unwrap_button() {
|
||||||
|
let cb: any = map_get(util_mesh_unwrappers, "uv_unwrap.js"); // JSValue * -> (a: raw_mesh_t)=>void
|
||||||
|
for (let i: i32 = 0; i < project_paint_objects.length; ++i) {
|
||||||
|
let md: mesh_data_t = project_paint_objects[i].data;
|
||||||
|
let mesh: raw_mesh_t = {
|
||||||
|
posa: md.vertex_arrays[0].values,
|
||||||
|
nora: md.vertex_arrays[1].values,
|
||||||
|
texa: null,
|
||||||
|
inda: md.index_arrays[0].values
|
||||||
|
};
|
||||||
|
js_call_ptr(cb, mesh);
|
||||||
|
md.vertex_arrays[0].values = mesh.posa;
|
||||||
|
md.vertex_arrays[1].values = mesh.nora;
|
||||||
|
md.vertex_arrays[2].values = mesh.texa;
|
||||||
|
md.index_arrays[0].values = mesh.inda;
|
||||||
|
md._.indices[0] = mesh.inda;
|
||||||
|
md._.ready = false;
|
||||||
|
mesh_data_build(md);
|
||||||
|
}
|
||||||
|
util_mesh_merge();
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user