paint: ui fixes

This commit is contained in:
luboslenco
2026-06-10 09:58:38 +02:00
parent ceffbe5f79
commit a34e14daba
5 changed files with 60 additions and 51 deletions
-23
View File
@@ -474,29 +474,6 @@ void box_preferences_usage_tab() {
if (h_alpha_discard->changed) {
make_material_parse_paint_material(true);
}
ui_text(tr("2D View"), UI_ALIGN_LEFT, 0x00000000);
ui_handle_t *h_view2d_grid_show = ui_handle(__ID__);
h_view2d_grid_show->b = g_config->view2d_grid_show;
g_config->view2d_grid_show = ui_check(h_view2d_grid_show, tr("Show Grid"), "");
if (h_view2d_grid_show->changed) {
ui_view2d_hwnd->redraws = 2;
}
ui_handle_t *h_view2d_grid_cell = ui_handle(__ID__);
h_view2d_grid_cell->f = g_config->view2d_grid_cell;
g_config->view2d_grid_cell = ui_slider(h_view2d_grid_cell, tr("Grid Cell"), 1.0, 256.0, true, 1, true, UI_ALIGN_RIGHT, true);
if (g_ui->is_hovered) {
ui_tooltip(tr("Cell size in pixels"));
}
if (h_view2d_grid_cell->changed) {
ui_view2d_hwnd->redraws = 2;
}
ui_handle_t *h_view2d_grid_snap = ui_handle(__ID__);
h_view2d_grid_snap->b = g_config->view2d_grid_snap;
g_config->view2d_grid_snap = ui_check(h_view2d_grid_snap, tr("Grid Snap"), "");
}
// ██████╗ █████╗ ███╗ ███╗███████╗██████╗ █████╗
+26 -20
View File
@@ -302,10 +302,18 @@ void tab_meshes_draw_context_menu() {
}
void tab_meshes_draw_edit() {
if (ui_menu_button(tr("Flip Normals"), "", ICON_NONE)) {
util_mesh_flip_normals();
g_context->ddirty = 2;
#ifdef WITH_PLUGINS
if (ui_menu_button(tr("UV Unwrap"), "", ICON_NONE)) {
plugin_uv_unwrap_button();
}
#endif
if (ui_menu_button(tr("Edit UV Map"), "", ICON_NONE)) {
ui_base_show_2d_view(VIEW_2D_TYPE_UVMAP);
}
ui_menu_separator();
if (ui_menu_sub_button(ui_handle(__ID__), tr("Calculate Normals"))) {
ui_menu_sub_begin(2);
@@ -320,6 +328,11 @@ void tab_meshes_draw_edit() {
ui_menu_sub_end();
}
if (ui_menu_button(tr("Flip Normals"), "", ICON_NONE)) {
util_mesh_flip_normals();
g_context->ddirty = 2;
}
if (ui_menu_button(tr("Geometry to Origin"), "", ICON_NONE)) {
util_mesh_to_origin();
g_context->ddirty = 2;
@@ -336,41 +349,36 @@ void tab_meshes_draw_edit() {
if (ui_menu_button(tr("X"), "", ICON_NONE)) {
util_mesh_swap_axis(1, 2);
g_context->ddirty = 2;
ui_menu_keep_open = true;
}
if (ui_menu_button(tr("Y"), "", ICON_NONE)) {
util_mesh_swap_axis(2, 0);
g_context->ddirty = 2;
ui_menu_keep_open = true;
}
if (ui_menu_button(tr("Z"), "", ICON_NONE)) {
util_mesh_swap_axis(0, 1);
g_context->ddirty = 2;
ui_menu_keep_open = true;
}
ui_menu_sub_end();
}
if (ui_menu_button(tr("Edit UV Map"), "", ICON_NONE)) {
ui_base_show_2d_view(VIEW_2D_TYPE_UVMAP);
}
ui_menu_separator();
#ifdef WITH_PLUGINS
if (ui_menu_button(tr("UV Unwrap"), "", ICON_NONE)) {
plugin_uv_unwrap_button();
}
#endif
if (g_config->experimental && ui_menu_button(tr("Decimate"), "", ICON_NONE)) {
if (ui_menu_button(tr("Decimate"), "", ICON_NONE)) {
util_mesh_decimate(0.5);
}
if (g_config->experimental && ui_menu_button(tr("Smooth"), "", ICON_NONE)) {
if (ui_menu_button(tr("Smooth"), "", ICON_NONE)) {
util_mesh_smooth();
}
if (g_config->experimental && ui_menu_button(tr("Subdivide"), "", ICON_NONE)) {
if (ui_menu_button(tr("Subdivide"), "", ICON_NONE)) {
util_mesh_subdivide();
}
if (g_config->experimental && ui_menu_button(tr("Bevel"), "", ICON_NONE)) {
if (ui_menu_button(tr("Bevel"), "", ICON_NONE)) {
util_mesh_bevel(0.1);
}
}
@@ -420,11 +428,9 @@ void tab_meshes_draw_import() {
project_append_mesh();
}
if (g_config->experimental) {
if (ui_menu_button(tr("Append Shape"), "", ICON_NONE)) {
project_fetch_default_meshes();
if (ui_menu_button(tr("Append Shape"), "", ICON_NONE)) {
ui_menu_draw(&tab_meshes_draw_append_shape, -1, -1);
}
ui_menu_draw(&tab_meshes_draw_append_shape, -1, -1);
}
}
+5 -7
View File
@@ -494,13 +494,11 @@ void ui_menubar_draw_category_items() {
g_context->ddirty = 2;
}
if (g_config->experimental) {
ui_handle_t *show_envmap_spheres_handle = ui_handle(__ID__);
show_envmap_spheres_handle->b = g_context->show_envmap_spheres;
g_context->show_envmap_spheres = ui_check(show_envmap_spheres_handle, string(" %s", tr("Envmap Spheres")), "");
if (show_envmap_spheres_handle->changed) {
g_context->ddirty = 2;
}
ui_handle_t *show_envmap_spheres_handle = ui_handle(__ID__);
show_envmap_spheres_handle->b = g_context->show_envmap_spheres;
g_context->show_envmap_spheres = ui_check(show_envmap_spheres_handle, string(" %s", tr("Envmap Spheres")), "");
if (show_envmap_spheres_handle->changed) {
g_context->ddirty = 2;
}
if (ui_menu_button(tr("Reset Envmap"), "", ICON_NONE)) {
+28
View File
@@ -62,6 +62,34 @@ void ui_view2d_draw_edit() {
ui_menu_separator();
ui_handle_t *h_view2d_grid_show = ui_handle(__ID__);
h_view2d_grid_show->b = g_config->view2d_grid_show;
g_config->view2d_grid_show = ui_check(h_view2d_grid_show, tr("Show Grid"), "");
if (h_view2d_grid_show->changed) {
ui_view2d_hwnd->redraws = 2;
ui_menu_keep_open = true;
}
ui_handle_t *h_view2d_grid_cell = ui_handle(__ID__);
h_view2d_grid_cell->f = g_config->view2d_grid_cell;
g_config->view2d_grid_cell = ui_slider(h_view2d_grid_cell, tr("Grid Cell"), 1.0, 256.0, true, 1, true, UI_ALIGN_RIGHT, true);
if (g_ui->is_hovered) {
ui_tooltip(tr("Cell size in pixels"));
}
if (h_view2d_grid_cell->changed) {
ui_view2d_hwnd->redraws = 2;
ui_menu_keep_open = true;
}
ui_handle_t *h_view2d_grid_snap = ui_handle(__ID__);
h_view2d_grid_snap->b = g_config->view2d_grid_snap;
g_config->view2d_grid_snap = ui_check(h_view2d_grid_snap, tr("Grid Snap"), any_map_get(g_keymap, "grid_snap"));
if (h_view2d_grid_snap->changed) {
ui_menu_keep_open = true;
}
ui_menu_separator();
if (ui_menu_button(tr("Zoom to Fit"), "", ICON_NONE)) {
ui_view2d_pan_x = 0.0;
ui_view2d_pan_y = 0.0;
+1 -1
View File
@@ -90,7 +90,7 @@ void util_shortcut_global() {
if (keyboard_started(any_map_get(g_keymap, "view_distract_free")) || (keyboard_started("escape") && !ui_base_show && !ui_box_show)) {
ui_base_toggle_distract_free();
}
if (g_config->experimental && keyboard_started("f5") && g_config->workspace != WORKSPACE_PLAYER) {
if (keyboard_started("f5") && g_config->workspace != WORKSPACE_PLAYER) {
// g_config->workspace = WORKSPACE_PLAYER;
// base_update_workspace();
base_run_in_player();