From 6c697cc17dc5053d1dbd3c2fdd6d20d7563ad233 Mon Sep 17 00:00:00 2001 From: luboslenco Date: Sun, 14 Jun 2026 08:35:24 +0200 Subject: [PATCH] paint: cleanup --- paint/sources/args.c | 2 +- paint/sources/functions.h | 4 ++-- paint/sources/io/export_mesh.c | 4 ++-- paint/sources/io/export_obj.c | 15 +-------------- paint/sources/ui/box_export.c | 8 ++------ 5 files changed, 8 insertions(+), 25 deletions(-) diff --git a/paint/sources/args.c b/paint/sources/args.c index aa9645aa..5a2bf076 100644 --- a/paint/sources/args.c +++ b/paint/sources/args.c @@ -171,7 +171,7 @@ void args_run_on_next_frame(void *_) { if (string_equals(f, "")) { f = string_copy(tr("untitled")); } - export_mesh_run(string("%s%s%s", args_export_mesh_path, PATH_SEP, f), NULL, false, true); + export_mesh_run(string("%s%s%s", args_export_mesh_path, PATH_SEP, f), NULL, true); } else if (args_export_material) { g_context->write_icon_on_export = true; diff --git a/paint/sources/functions.h b/paint/sources/functions.h index 4b78e6b1..2ea4f56e 100644 --- a/paint/sources/functions.h +++ b/paint/sources/functions.h @@ -607,7 +607,7 @@ void nodes_brush_list_init(); ui_node_t *nodes_brush_create_node(char *node_type); void import_obj_run(char *path, bool replace_existing); void import_folder_run(char *path); -void export_obj_run(char *path, mesh_object_t_array_t *paint_objects, bool apply_disp); +void export_obj_run(char *path, mesh_object_t_array_t *paint_objects); void export_obj_run_fast(char *path, mesh_object_t_array_t *paint_objects); void export_obj_run_sculpt(char *path, mesh_object_t_array_t *paint_objects); void make_blur_run(node_shader_t *kong); @@ -625,7 +625,7 @@ void console_toast(char *s); void console_info(char *s); void console_error(char *s); void console_log(char *s); -void export_mesh_run(char *path, mesh_object_t_array_t *paint_objects, bool apply_disp, bool merge_vertices); +void export_mesh_run(char *path, mesh_object_t_array_t *paint_objects, bool merge_vertices); void export_player_run(char *path); void camera_init(); void camera_update(void *_); diff --git a/paint/sources/io/export_mesh.c b/paint/sources/io/export_mesh.c index 78dfda1c..a9d42933 100644 --- a/paint/sources/io/export_mesh.c +++ b/paint/sources/io/export_mesh.c @@ -5,7 +5,7 @@ void export_glb_run(char *path, mesh_object_t_array_t *paint_objects); #endif -void export_mesh_run(char *path, mesh_object_t_array_t *paint_objects, bool apply_disp, bool merge_vertices) { +void export_mesh_run(char *path, mesh_object_t_array_t *paint_objects, bool merge_vertices) { if (paint_objects == NULL) { paint_objects = g_project->_->paint_objects; } @@ -14,7 +14,7 @@ void export_mesh_run(char *path, mesh_object_t_array_t *paint_objects, bool appl export_obj_run_sculpt(path, paint_objects); } else if (merge_vertices) { - export_obj_run(path, paint_objects, apply_disp); + export_obj_run(path, paint_objects); } else { export_obj_run_fast(path, paint_objects); diff --git a/paint/sources/io/export_obj.c b/paint/sources/io/export_obj.c index 08fa5ff6..69451c44 100644 --- a/paint/sources/io/export_obj.c +++ b/paint/sources/io/export_obj.c @@ -7,7 +7,7 @@ static void export_obj_write_string(u8_array_t *out, char *str) { } } -void export_obj_run(char *path, mesh_object_t_array_t *paint_objects, bool apply_disp) { +void export_obj_run(char *path, mesh_object_t_array_t *paint_objects) { u8_array_t *o = u8_array_create_from_raw((u8[]){}, 0); export_obj_write_string(o, "# armorpaint.org\n"); @@ -85,19 +85,6 @@ void export_obj_run(char *path, mesh_object_t_array_t *paint_objects, bool apply ti++; } } - if (apply_disp) { - // let height: buffer_t = gpu_get_texture_pixels(layers[0].texpaint_pack); - // let res: i32 = layers[0].texpaint_pack.width; - // let strength: f32 = 0.1; - // for (let i: i32 = 0; i < len; ++i) { - // let x: i32 = math_floor(texa2[i * 2 ] / 32767 * res); - // let y: i32 = math_floor((1.0 - texa2[i * 2 + 1] / 32767) * res); - // let h: f32 = (1.0 - height.get((y * res + x) * 4 + 3) / 255) * strength; - // posa2[i * 3 ] -= math_floor(nora2[i * 3 ] * inv * h / sc); - // posa2[i * 3 + 1] -= math_floor(nora2[i * 3 + 1] * inv * h / sc); - // posa2[i * 3 + 2] -= math_floor(nora2[i * 3 + 2] * inv * h / sc); - // } - } export_obj_write_string(o, string("o %s\n", p->base->name)); for (i32 i = 0; i < pi; ++i) { diff --git a/paint/sources/ui/box_export.c b/paint/sources/ui/box_export.c index 21516754..68324c83 100644 --- a/paint/sources/ui/box_export.c +++ b/paint/sources/ui/box_export.c @@ -3,7 +3,6 @@ bool _box_export_bake_material; export_preset_texture_t *_box_export_t; -bool _box_export_apply_displacement; bool _box_export_merge_vertices; void box_export_tab_export_textures_run(void *_) { @@ -438,7 +437,7 @@ void box_export_tab_export_mesh_path_picked(char *path) { }, 1); } - export_mesh_run(string("%s%s%s", path, PATH_SEP, f), paint_objects, _box_export_apply_displacement, _box_export_merge_vertices); + export_mesh_run(string("%s%s%s", path, PATH_SEP, f), paint_objects, _box_export_merge_vertices); } void box_export_tab_export_mesh(ui_handle_t *htab) { @@ -473,8 +472,6 @@ void box_export_tab_export_mesh(ui_handle_t *htab) { } ui_combo(box_export_mesh_handle, ar, tr("Meshes"), true, UI_ALIGN_LEFT, true); - bool apply_displacement = ui_check(ui_handle(__ID__), tr("Apply Displacement"), ""); - ui_handle_t *hmerge = ui_handle(__ID__); if (hmerge->init) { hmerge->b = true; @@ -507,8 +504,7 @@ void box_export_tab_export_mesh(ui_handle_t *htab) { } if (ui_icon_button(tr("Export"), ICON_CHECK, UI_ALIGN_CENTER)) { ui_box_hide(); - _box_export_apply_displacement = apply_displacement; - _box_export_merge_vertices = merge_vertices; + _box_export_merge_vertices = merge_vertices; ui_files_show(export_mesh_format_combo->buffer[g_context->export_mesh_format], true, false, &box_export_tab_export_mesh_path_picked); } }