From e8ab4bd42b2a43e2a150ee6dea21a82871c3e5a2 Mon Sep 17 00:00:00 2001 From: luboslenco Date: Thu, 16 Apr 2026 11:26:57 +0200 Subject: [PATCH] paint: add padding export option --- paint/sources/box_export.c | 19 ++++++++++++++++++- paint/sources/types.h | 1 + 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/paint/sources/box_export.c b/paint/sources/box_export.c index 8246253c..9ca07ee3 100644 --- a/paint/sources/box_export.c +++ b/paint/sources/box_export.c @@ -7,6 +7,19 @@ bool _box_export_apply_displacement; bool _box_export_merge_vertices; void box_export_tab_export_textures_run(void *_) { + + if (g_context->export_padding) { + i32 _dilate_radius = g_config->dilate_radius; + g_config->dilate_radius = 256; + slot_layer_t *_layer = g_context->layer; + for (i32 i = 0; i < project_layers->length; ++i) { + g_context->layer = project_layers->buffer[i]; + render_path_paint_dilate(true, true); + } + g_context->layer = _layer; + g_config->dilate_radius = _dilate_radius; + } + export_texture_run(g_context->texture_export_path, _box_export_bake_material); } @@ -138,6 +151,8 @@ void box_export_tab_export_textures(char *title, bool bake_material) { box_export_preset = NULL; } + ui_row2(); + ui_handle_t *layers_destination_handle = ui_handle(__ID__); layers_destination_handle->i = g_context->layers_destination; @@ -149,7 +164,9 @@ void box_export_tab_export_textures(char *title, bool bake_material) { 2); g_context->layers_destination = ui_combo(layers_destination_handle, layers_destination_combo, tr("Destination"), true, UI_ALIGN_LEFT, true); - ui_end_element(); + ui_handle_t *h_padding = ui_handle(__ID__); + h_padding->b = g_context->export_padding; + g_context->export_padding = ui_check(h_padding, tr("Padding"), ""); ui_row2(); if (ui_icon_button(tr("Cancel"), ICON_CLOSE, UI_ALIGN_CENTER)) { diff --git a/paint/sources/types.h b/paint/sources/types.h index ff9d5fc5..a68cfe8b 100644 --- a/paint/sources/types.h +++ b/paint/sources/types.h @@ -197,6 +197,7 @@ typedef struct context { texture_ldr_format_t format_type; f32 format_quality; export_destination_t layers_destination; + bool export_padding; split_type_t split_by; f32 select_time; viewport_mode_t viewport_mode;