Commit graph

13 commits

Author SHA1 Message Date
Jonas Holzman
34d612ca0f UI: Remove header status text jumps for commonly used operations
This commit builds up on the work done in #140790 for it to completely
eliminate header status text jump for commonly used operations
(translate, inset, shrink flatten and more), improving readability with
the new centered header introduced in #139507.

To achieve this, multiple modifications were made:

- In the main `unit_as_string` function, limit the width of numbers of
  magnitude below 1 if fixed width is requested by passing a negative
  `prec` parameter, previously only used for trailing zero (e.g., with
  3 both 1.014 and 0.014 use the same decimal count, rather than 1.01
  missing an extra digit).
- Due to the above change reducing precision for numbers with |val| < 1,
  bump the overall precision for commonly used operations
  (translate, bevel, inset and shrink/flatten) by 1.
- When precision mode (holding shift) is enabled during transform
  operations, bump the displayed digit precision. This also has the
  bonus advantage of acting as an extra visual indicator to know when
  precision mode is enabled.
- Add a new `BLI_string_pad_number_sign` string util function, which
  prepends positive numeric string with a [figure space character]
  (https://en.wikipedia.org/wiki/Figure_space) to ensure they keep the
  same length as their negative counterpart with the proportional font
  used in the header.

The first modifications affects every part of Blender where conversion
of unit to string with trailing zeros preservation was previously used
(such as the depth eyedropper). The sign padding modification however
needs to be manually added to operators / transform operations on a
case by case basis as to not add empty minus sign padding in places
where it shouldn't be present.

Note that this commit removes jumping for *non-separated* unit
(None/Metric/Imperial *without* the Separate Units checkbox enabled in
the Scene unit settings), as separated unit (1m 50cm instead of 1.50m)
are bound to change width and cause jumps.

Pull Request: https://projects.blender.org/blender/blender/pulls/148574
2026-01-27 15:47:29 +01:00
Campbell Barton
84559f8bd4 Fix: trailing zeros added to the rounded value with split units
When units were split into larger and smaller values, the larger
value is rounded and should not show trailing zeros.
Trailing zeros should only be used for the smaller unit.

Ref !140790
2025-09-25 13:55:21 +10:00
Campbell Barton
4f1817cc18 Cleanup: declare __all__ for Python scripts
Declare all to make public public API's explicit and
help detect unused code.
2025-01-06 16:45:36 +11:00
Campbell Barton
2119d271e0 Cleanup: remove "-noaudio" argument in background mode
This is no longer needed as background mode implies -noaudio.
2024-02-14 00:13:38 +11:00
Campbell Barton
c527056f0c Fix #117783: Allow Multiple Negatives in Numerical Inputs with Units
Support multiple unary operators before a number where only a single
negative value worked in the past.

Ref !117827.
2024-02-06 09:28:30 +11:00
Campbell Barton
e955c94ed3 License Headers: Set copyright to "Blender Authors", add AUTHORS
Listing the "Blender Foundation" as copyright holder implied the Blender
Foundation holds copyright to files which may include work from many
developers.

While keeping copyright on headers makes sense for isolated libraries,
Blender's own code may be refactored or moved between files in a way
that makes the per file copyright holders less meaningful.

Copyright references to the "Blender Foundation" have been replaced with
"Blender Authors", with the exception of `./extern/` since these this
contains libraries which are more isolated, any changed to license
headers there can be handled on a case-by-case basis.

Some directories in `./intern/` have also been excluded:

- `./intern/cycles/` it's own `AUTHORS` file is planned.
- `./intern/opensubdiv/`.

An "AUTHORS" file has been added, using the chromium projects authors
file as a template.

Design task: #110784

Ref !110783.
2023-08-16 00:20:26 +10:00
Campbell Barton
65f99397ec License headers: use SPDX-FileCopyrightText in all sources 2023-06-15 13:35:34 +10:00
Campbell Barton
c434782e3a File headers: SPDX License migration
Use a shorter/simpler license convention, stops the header taking so
much space.

Follow the SPDX license specification: https://spdx.org/licenses

- C/C++/objc/objc++
- Python
- Shell Scripts
- CMake, GNUmakefile

While most of the source tree has been included

- `./extern/` was left out.
- `./intern/cycles` & `./intern/atomic` are also excluded because they
  use different header conventions.

doc/license/SPDX-license-identifiers.txt has been added to list SPDX all
used identifiers.

See P2788 for the script that automated these edits.

Reviewed By: brecht, mont29, sergey

Ref D14069
2022-02-11 09:14:36 +11:00
Campbell Barton
7ca5ba14b5 Cleanup: use keywords for unit tests
Prepare for function calls to be keyword only.
2021-06-08 00:07:19 +10:00
Brecht Van Lommel
22f17551e5 Fix scene units test failure after recent changes 2019-08-02 14:42:25 +02:00
Campbell Barton
8c15d612a5 Cleanup: pep8 2018-07-03 06:55:02 +02:00
Bastien Montagne
13d324f26b Tweak multi-units tests to match new precision handling in conversion from raw value to prety-printed one.
Note that new code allows to enable again the '1 million miles' tests.
2017-08-01 16:43:40 +02:00
Campbell Barton
fc6f4c11ae Add test scripts to ctest & rename 2015-09-24 20:52:58 +10:00
Renamed from tests/python/bl_pyapi_units.py (Browse further)