Skip to content

Fix: Add locale-independent number parsing for all input methods (#2082)#2083

Open
ikonnow wants to merge 2 commits into
armory3d:mainfrom
ikonnow:fix/ui-scale-negative-values
Open

Fix: Add locale-independent number parsing for all input methods (#2082)#2083
ikonnow wants to merge 2 commits into
armory3d:mainfrom
ikonnow:fix/ui-scale-negative-values

Conversation

@ikonnow

@ikonnow ikonnow commented Jun 7, 2026

Copy link
Copy Markdown

This PR fixes issue #2082 and #2084.

#2082: Locale-independent float parsing

When users enter comma-separated decimal values (e.g., "1,5") in locales where comma is the decimal separator, the application incorrectly parses these values, leading to:

  • Negative UI scale values (-1) that crash the application
  • Incorrect brush radius values
  • General float parsing failures across the UI

Solution

Replace commas with dots before parsing floats in all input methods:

Modified files:

  1. base/sources/iron.h - parse_float() function
  2. base/sources/iron_ui.c - ui_slider() function (both WITH_EVAL and non-WITH_EVAL paths)
  3. base/sources/iron_ui_ext.c - ui_float_input() function
  4. base/sources/iron_json.c - JSON parsing (3 locations)
  5. base/sources/libs/minic.c - Lexer now recognizes leading-dot float literals (.3, .5f)
  6. base/sources/libs/minic_tests.c - Added test13 for leading-dot float literals

#2084: Clamp opacity to [0,1] range

Opacity values could drift outside the valid [0,1] range through the UI and rendering pipeline, causing visual artifacts.

Solution

Clamp opacity after slider input and in uniform reads:

Modified files:

  • paint/sources/nodes_brush/brush_output_node.c
  • paint/sources/ui/tab_layers.c
  • paint/sources/ui/tab_swatches.c
  • paint/sources/ui/ui_header.c
  • paint/sources/uniforms.c

Testing

  • All comma-to-dot and leading-dot float cases verified with standalone test
  • Full ArmorPaint Debug x64 build compiles cleanly
  • Manual testing confirmed comma-separated values and opacity sliders work correctly

@ikonnow ikonnow force-pushed the fix/ui-scale-negative-values branch from 0084ced to e927a27 Compare June 8, 2026 18:04
@ikonnow

ikonnow commented Jun 8, 2026

Copy link
Copy Markdown
Author

Updated the PR description to also include issue #2084 — the branch now contains two related fixes:

  1. UI scale accepts negative values causing app to not start - locale issue with comma vs decimal point #2082 — Locale-independent float parsing (comma→dot replacement in iron.h, iron_ui.c, iron_ui_ext.c, iron_json.c, plus minic lexer fix for .3 / .5f literals)
  2. Brush opacity can exceed 1.0 causing weird painting behavior #2084 — Clamp brush/layer opacity to [0,1] range

I’ve also reduced the commit history from 7 confusing commits to 2 clear ones to make it easier to review.
I hope this is a bit clearer now so that it can be merged… In my view, these changes make the application usable, at least with my German keyboard. The opacity adjustment can also be found in other tools, such as Krita, etc.

@ikonnow ikonnow force-pushed the fix/ui-scale-negative-values branch from e927a27 to d288155 Compare June 8, 2026 19:41
@ikonnow

ikonnow commented Jun 8, 2026

Copy link
Copy Markdown
Author

Rebased onto latest upstream main — branch is now conflict-free and ready for merge.

@ikonnow ikonnow force-pushed the fix/ui-scale-negative-values branch 2 times, most recently from 7622dc9 to 5abff82 Compare June 9, 2026 19:45
@ikonnow ikonnow force-pushed the fix/ui-scale-negative-values branch from 5abff82 to 8d42090 Compare June 23, 2026 22:08
@ikonnow ikonnow force-pushed the fix/ui-scale-negative-values branch from 8d42090 to eccf83d Compare June 25, 2026 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant