Files
armorpaint/paint/sources/tab_plugins.c
T

61 lines
1.7 KiB
C
Raw Normal View History

2026-03-09 13:17:15 +01:00
#include "global.h"
2026-03-06 12:56:38 +01:00
void tab_plugins_draw(ui_handle_t *htab) {
2026-03-15 11:37:45 +01:00
if (ui_tab(htab, tr("Plugins"), false, -1, false)) {
2026-03-06 12:56:38 +01:00
ui_begin_sticky();
f32_array_t *row = f32_array_create_from_raw(
(f32[]){
-100,
},
1);
ui_row(row);
2026-03-15 11:37:45 +01:00
if (ui_icon_button(tr("Preferences"), ICON_COG, UI_ALIGN_CENTER)) {
2026-03-31 12:48:56 +02:00
box_preferences_htab->i = PREFERENCES_TAB_PLUGINS;
2026-03-06 12:56:38 +01:00
box_preferences_show();
}
ui_end_sticky();
// Draw plugins
2026-03-31 18:47:10 +02:00
string_array_t *keys = map_keys(plugin_map);
2026-03-06 12:56:38 +01:00
for (i32 i = 0; i < keys->length; ++i) {
plugin_t *p = any_map_get(plugin_map, keys->buffer[i]);
2026-03-07 21:12:59 +01:00
if (p->on_ui != NULL) {
2026-03-23 23:20:02 +01:00
minic_ctx_call_fn(p->ctx, p->on_ui, NULL, 0);
2026-03-06 12:56:38 +01:00
}
}
2026-03-17 20:26:09 +01:00
#ifdef is_debug
2026-03-31 18:47:10 +02:00
string_array_t *rt_keys = map_keys(render_path_render_targets);
2026-03-07 21:12:59 +01:00
array_sort(rt_keys, NULL);
2026-03-06 12:56:38 +01:00
for (i32 i = 0; i < rt_keys->length; ++i) {
render_target_t *rt = any_map_get(render_path_render_targets, rt_keys->buffer[i]);
ui_text(rt_keys->buffer[i], UI_ALIGN_LEFT, 0x00000000);
ui_image(rt->_image, 0xffffffff, -1.0);
}
2026-03-17 20:26:09 +01:00
#endif
2026-03-06 12:56:38 +01:00
}
}
2026-03-23 23:20:02 +01:00
#ifdef WITH_PLUGINS
void proc_uv_unwrap(void *mesh);
2026-03-06 12:56:38 +01:00
void plugin_uv_unwrap_button() {
for (i32 i = 0; i < project_paint_objects->length; ++i) {
mesh_data_t *md = project_paint_objects->buffer[i]->data;
raw_mesh_t *mesh =
GC_ALLOC_INIT(raw_mesh_t,
2026-03-07 21:12:59 +01:00
{.posa = md->vertex_arrays->buffer[0]->values, .nora = md->vertex_arrays->buffer[1]->values, .texa = NULL, .inda = md->index_array});
2026-03-23 23:20:02 +01:00
proc_uv_unwrap(mesh);
2026-03-06 12:56:38 +01:00
md->vertex_arrays->buffer[0]->values = mesh->posa;
md->vertex_arrays->buffer[1]->values = mesh->nora;
md->vertex_arrays->buffer[2]->values = mesh->texa;
md->index_array = mesh->inda;
mesh_data_build(md);
}
2026-03-07 21:12:59 +01:00
util_mesh_merge(NULL);
2026-03-06 12:56:38 +01:00
}
2026-03-23 23:20:02 +01:00
#endif