diff --git a/paint/assets/icons.png b/paint/assets/icons.png old mode 100644 new mode 100755 index ca7d96d2..6670b82d Binary files a/paint/assets/icons.png and b/paint/assets/icons.png differ diff --git a/paint/assets/icons2x.png b/paint/assets/icons2x.png old mode 100644 new mode 100755 index fa81301b..204a4d4a Binary files a/paint/assets/icons2x.png and b/paint/assets/icons2x.png differ diff --git a/paint/assets/locale/de.json b/paint/assets/locale/de.json index 5446c6ff..98f004c0 100644 --- a/paint/assets/locale/de.json +++ b/paint/assets/locale/de.json @@ -241,14 +241,14 @@ "Help": "Hilfe", "High Poly": "High Poly", "History": "Verlauf", - "Hold {action_paint} to erase\nHold {key} and press {action_paint} to erase a straight line (ruler mode)": "{action_paint} gedrückt halten um zu raddieren\n{key} gedrückt halten und {action_paint} drücken um eine gerade Linie wegzuraddieren (Lineal)", - "Hold {action_paint} to paint\nHold {key} and press {action_paint} to paint a straight line (ruler mode)": "{action_paint} gedrückt halten um zu malen\n{key} gedrückt halten und {action_paint} drücken um eine gerade Linie zu malen (Lineal)", + "Hold {action_paint} to erase\nHold {brush_ruler} and press {action_paint} to erase a straight line (ruler mode)": "{action_paint} gedrückt halten um zu raddieren\n{brush_ruler} gedrückt halten und {action_paint} drücken um eine gerade Linie wegzuraddieren (Lineal)", + "Hold {action_paint} to paint\nHold {brush_ruler} and press {action_paint} to paint a straight line (ruler mode)": "{action_paint} gedrückt halten um zu malen\n{brush_ruler} gedrückt halten und {action_paint} drücken um eine gerade Linie zu malen (Lineal)", "Hold {brush_angle} and move mouse to the left to decrease the angle\nHold {brush_angle} and move mouse to the right to increase the angle": "{brush_angle} und Maus nach links bewegen um Winkel zu verkleinern\n{brush_angle} und Maus nach rechts bewegen um Winkel zu vergrößern", "Hold {brush_opacity} and move mouse to the left to decrease the opacity\nHold {brush_opacity} and move mouse to the right to increase the opacity": "{brush_opacity} gedrückt halten und Maus nach links bewegen um die Deckkraft zu veringern\n{brush_opacity} gedrückt halten und Maus nach rechts bewegen um die Deckkraft zu erhöhen", "Hold {brush_radius} and move mouse to the left or press {brush_radius_decrease} to decrease the radius\nHold {brush_radius} and move mouse to the right or press {brush_radius_increase} to increase the radius": "{brush_radius} gedrückt halten und Maus nach links bewegen oder {brush_radius_decrease} um Radius zu verkleinern\n{brush_radius} gedrückt halten und Maus nach rechts bewegen oder {brush_radius_increase} um den Radius zu vergrößern", - "Hold {key} to paint on a decal mask": "{key} gedrückt halten um auf einer Aufklebermaske zu zeichnen", - "Hold {key} to set source": "{key} gedrückt halten um die Quelle zu setzen", - "Hold {key} to use the text as a mask": "{key} gedrückt halten um Text als Maske zu verwenden", + "Hold {decal_mask} to paint on a decal mask": "{decal_mask} gedrückt halten um auf einer Aufklebermaske zu zeichnen", + "Hold {set_clone_source} to set source": "{set_clone_source} gedrückt halten um die Quelle zu setzen", + "Hold {decal_mask} to use the text as a mask": "{decal_mask} gedrückt halten um Text als Maske zu verwenden", "Horizontal": "Horizontal", "Horizontal Inverted": "Umgekehrt horizontal", "How To": "How to", diff --git a/paint/sources/enums.ts b/paint/sources/enums.ts index a93bba19..e301774c 100644 --- a/paint/sources/enums.ts +++ b/paint/sources/enums.ts @@ -233,8 +233,8 @@ enum tool_type_t { COLORID = 9, PICKER = 10, BAKE = 11, - GIZMO = 12, - MATERIAL = 13, + MATERIAL = 12, + GIZMO = 13, } enum area_type_t { diff --git a/paint/sources/ui_toolbar.ts b/paint/sources/ui_toolbar.ts index d052d66d..14ae57b7 100644 --- a/paint/sources/ui_toolbar.ts +++ b/paint/sources/ui_toolbar.ts @@ -15,8 +15,24 @@ let ui_toolbar_tool_names: string[] = [ _tr("ColorID"), _tr("Picker"), _tr("Bake"), - _tr("Gizmo"), _tr("Material"), + _tr("Gizmo"), +]; +let ui_toolbar_tooltip_extras: string[] = [ + _tr("Hold {action_paint} to paint\nHold {brush_ruler} and press {action_paint} to paint a straight line (ruler mode)"), + _tr("Hold {action_paint} to erase\nHold {brush_ruler} and press {action_paint} to erase a straight line (ruler mode)"), + "", + _tr("Hold {decal_mask} to paint on a decal mask"), + _tr("Hold {decal_mask} to use the text as a mask"), + _tr("Hold {set_clone_source} to set source"), + "", + "", + "", + "", + "", + "", + "", + "", ]; let _ui_toolbar_i: i32; @@ -24,13 +40,13 @@ let _ui_toolbar_i: i32; function ui_toolbar_init() { } -function ui_toolbar_draw_tool(i: i32, img: gpu_texture_t, icon_accent: i32, keys: string[]) { +function ui_toolbar_draw_tool(tool: i32, img: gpu_texture_t, icon_accent: i32) { ui._x += 2; - if (context_raw.tool == i) { + if (context_raw.tool == tool) { ui_toolbar_draw_highlight(); } - let tile_y: i32 = math_floor(i / 12); - let tile_x: i32 = tile_y % 2 == 0 ? i % 12 : (11 - (i % 12)); + let tile_y: i32 = math_floor(tool / 12); + let tile_x: i32 = tile_y % 2 == 0 ? tool % 12 : (11 - (tool % 12)); let rect: rect_t = resource_tile50(img, tile_x, tile_y); let _y: i32 = ui._y; @@ -43,31 +59,34 @@ function ui_toolbar_draw_tool(i: i32, img: gpu_texture_t, icon_accent: i32, keys let image_state: ui_state_t = ui_sub_image(img, icon_accent, -1.0, rect.x, rect.y, rect.w, rect.h); if (image_state == ui_state_t.STARTED && visible) { - _ui_toolbar_i = i; + _ui_toolbar_i = tool; sys_notify_on_next_frame(function() { context_select_tool(_ui_toolbar_i); }); } else if (image_state == ui_state_t.RELEASED && config_raw.layout[layout_size_t.HEADER] == 0 && visible) { - if (ui_toolbar_last_tool == i) { + if (ui_toolbar_last_tool == tool) { ui_toolbar_tool_properties_menu(); } - ui_toolbar_last_tool = i; + ui_toolbar_last_tool = tool; } - if (i == tool_type_t.COLORID && context_raw.colorid_picked) { + if (tool == tool_type_t.COLORID && context_raw.colorid_picked) { let rt: render_target_t = map_get(render_path_render_targets, "texpaint_colorid"); draw_scaled_sub_image(rt._image, 0, 0, 1, 1, 0, _y + 1.5 * UI_SCALE(), 5 * UI_SCALE(), 34 * UI_SCALE()); } if (ui.is_hovered) { - let key: string = keys[i]; - if (key.length > 0) { - ui_tooltip(tr(ui_toolbar_tool_names[i]) + " " + key); + let tooltip: string = tr(ui_toolbar_tool_names[tool]); + let key: string = map_get(config_keymap, "tool_" + to_lower_case(ui_toolbar_tool_names[tool])); + if (key != "") { + tooltip += " (" + key + ")"; } - else { - ui_tooltip(tr(ui_toolbar_tool_names[i])); + let extra: string = ui_toolbar_tooltip_extras[tool]; + if (extra != "") { + tooltip += " - " + tr(extra, config_keymap); } + ui_tooltip(tooltip); } ui._x -= 2; ui._y += 2; @@ -77,18 +96,14 @@ function ui_toolbar_w(screen_size_request: bool = false): i32 { if (screen_size_request && context_is_floating_toolbar()) { return 0; } - if (!base_view3d_show) { return 0; } - let w: i32 = 0; + let w: i32 = ui_toolbar_default_w; if (config_raw.touch_ui) { w = ui_toolbar_default_w + 6; } - else { - w = ui_toolbar_default_w; - } w = math_floor(w * config_raw.window_scale); return w; } @@ -116,10 +131,8 @@ function ui_toolbar_render_ui() { if (ui_window(ui_toolbar_handle, x, y, ui_toolbar_w(), h)) { ui._y -= 4 * UI_SCALE(); - ui.image_scroll_align = false; let img: gpu_texture_t = resource_get("icons.k"); - let col: u32 = ui.ops.theme.WINDOW_BG_COL; let light: bool = col > 0xff666666; let icon_accent: i32 = light ? 0xff666666 : -1; @@ -160,75 +173,10 @@ function ui_toolbar_render_ui() { } ui._y -= 4 * UI_SCALE(); - let vars_brush: map_t = map_create(); - map_set(vars_brush, "key", map_get(config_keymap, "brush_ruler")); - map_set(vars_brush, "action_paint", map_get(config_keymap, "action_paint")); - - let vars_decal: map_t = map_create(); - map_set(vars_decal, "key", map_get(config_keymap, "decal_mask")); - - let vars_clone: map_t = map_create(); - map_set(vars_clone, "key", map_get(config_keymap, "set_clone_source")); - - let key_tool_brush: string = map_get(config_keymap, "tool_brush"); - let key_tool_eraser: string = map_get(config_keymap, "tool_eraser"); - let key_tool_fill: string = map_get(config_keymap, "tool_fill"); - let key_tool_decal: string = map_get(config_keymap, "tool_decal"); - let key_tool_text: string = map_get(config_keymap, "tool_text"); - let key_tool_clone: string = map_get(config_keymap, "tool_clone"); - let key_tool_blur: string = map_get(config_keymap, "tool_blur"); - let key_tool_smudge: string = map_get(config_keymap, "tool_smudge"); - let key_tool_particle: string = map_get(config_keymap, "tool_particle"); - let key_tool_colorid: string = map_get(config_keymap, "tool_colorid"); - let key_tool_picker: string = map_get(config_keymap, "tool_picker"); - let key_tool_bake: string = map_get(config_keymap, "tool_bake"); - let key_tool_gizmo: string = map_get(config_keymap, "tool_gizmo"); - let key_tool_material: string = map_get(config_keymap, "tool_material"); - - key_tool_brush = "(" + key_tool_brush + ") - " + tr("Hold {action_paint} to paint\nHold {key} and press {action_paint} to paint a straight line (ruler mode)", vars_brush); - key_tool_eraser = "(" + key_tool_eraser + ") - " + tr("Hold {action_paint} to erase\nHold {key} and press {action_paint} to erase a straight line (ruler mode)", vars_brush); - key_tool_fill = "(" + key_tool_fill + ")"; - key_tool_decal = "(" + key_tool_decal + ") - " + tr("Hold {key} to paint on a decal mask", vars_decal); - key_tool_text = "(" + key_tool_text + ") - " + tr("Hold {key} to use the text as a mask", vars_decal); - key_tool_clone = "(" + key_tool_clone + ") - " + tr("Hold {key} to set source", vars_clone); - key_tool_blur = "(" + key_tool_blur + ")"; - key_tool_smudge = "(" + key_tool_smudge + ")"; - key_tool_particle = "(" + key_tool_particle + ")"; - key_tool_colorid = "(" + key_tool_colorid + ")"; - key_tool_picker = "(" + key_tool_picker + ")"; - key_tool_bake = "(" + key_tool_bake + ")"; - key_tool_gizmo = "(" + key_tool_gizmo + ")"; - key_tool_material = "(" + key_tool_material + ")"; - - let keys: string[] = [ - key_tool_brush, - key_tool_eraser, - key_tool_fill, - key_tool_decal, - key_tool_text, - key_tool_clone, - key_tool_blur, - key_tool_smudge, - key_tool_particle, - key_tool_colorid, - key_tool_picker, - key_tool_bake, - key_tool_gizmo, - key_tool_material - ]; - - // Erase the () in case no shortcut is assigned - for(let i: i32 = 0; i < keys.length; ++i) { - let key: string = keys[i]; - if(key.length == 2) - keys[i] = ""; - else if(char_at(key,1) == ")") { - keys[i] = substring(key,5,key.length); - } + for (let i: i32 = 0; i < ui_toolbar_tool_names.length; ++i) { + ui_toolbar_draw_tool(i, img, icon_accent); } - ui_toolbar_ext_draw_tools(img, icon_accent, keys); - ui.image_scroll_align = true; } @@ -248,13 +196,10 @@ function ui_toolbar_render_ui() { function ui_toolbar_tool_properties_menu() { ui_menu_draw(function () { ui.changed = false; - ui_header_draw_tool_properties(); - if (ui.changed || ui.is_typing) { ui_menu_keep_open = true; } - if (ui_button(tr("Pin to Header"), ui_align_t.LEFT)) { config_raw.layout[layout_size_t.HEADER] = 1; } @@ -266,22 +211,3 @@ function ui_toolbar_draw_highlight() { draw_set_color(ui.ops.theme.HIGHLIGHT_COL); ui_draw_rect(true, ui._x + -1, ui._y + 2, size + 2, size + 2); } - - -function ui_toolbar_ext_draw_tools(img: gpu_texture_t, icon_accent: i32, keys: string[]) { - ui_toolbar_draw_tool(tool_type_t.BRUSH, img, icon_accent, keys); - ui_toolbar_draw_tool(tool_type_t.ERASER, img, icon_accent, keys); - ui_toolbar_draw_tool(tool_type_t.FILL, img, icon_accent, keys); - ui_toolbar_draw_tool(tool_type_t.DECAL, img, icon_accent, keys); - ui_toolbar_draw_tool(tool_type_t.TEXT, img, icon_accent, keys); - ui_toolbar_draw_tool(tool_type_t.CLONE, img, icon_accent, keys); - ui_toolbar_draw_tool(tool_type_t.BLUR, img, icon_accent, keys); - ui_toolbar_draw_tool(tool_type_t.SMUDGE, img, icon_accent, keys); - ui_toolbar_draw_tool(tool_type_t.PARTICLE, img, icon_accent, keys); - ui_toolbar_draw_tool(tool_type_t.COLORID, img, icon_accent, keys); - ui_toolbar_draw_tool(tool_type_t.PICKER, img, icon_accent, keys); - ui_toolbar_draw_tool(tool_type_t.BAKE, img, icon_accent, keys); - ui_toolbar_draw_tool(tool_type_t.MATERIAL, img, icon_accent, keys); - ui_toolbar_draw_tool(tool_type_t.GIZMO, img, icon_accent, keys); -} -