Commit Graph

91 Commits

Author SHA1 Message Date
Hans Goudey
91803e130f Cleanup: Grammar: Fix uses of "for e.g."
e.g. stands for "exempli gratia" in Latin which means "for example".
The best way to make sure it makes sense when writing is to just expand
it to "for example". In these cases where the text was "for e.g.", that
leaves us with "for for example" which makes no sense. This commit fixes
all 110 cases, mostly just just replacing the words with "for example",
but also restructuring the text a bit more in a few cases, mostly by
moving "e.g." to the beginning of a list in parentheses.

Pull Request: https://projects.blender.org/blender/blender/pulls/139596
2025-05-29 21:21:18 +02:00
Campbell Barton
0265b13399 Tools: add a utility to validate array sizes
The script check_source/static_check_size_comments.py run directly
or called via the convenience target "make check_size_comments".

Add a utility module: `line_number_utils` which implements
a version of `re.finditer` that includes line numbers & ranges.
2025-05-23 14:04:26 +10:00
Campbell Barton
16c87b62e4 UI: include rip in the UV menu
The shortcut for this operator wasn't discoverable.
Show this in the menu as done with with edit-mesh rip.
2025-05-07 15:49:21 +10:00
Sergey Sharybin
0b59d9f00d Fix: make format to expand tabs
There is similar issue as what was fixed in autopep8 with the initial
LFS migration: `git ls-tree` running to gather all files contains files
with non-ascii names, such as some non-latin utf-8 files in the tests.

Decode the ls-tree using utf-8 for C code format as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/138488
2025-05-06 12:39:20 +02:00
Campbell Barton
fd6ac498b0 Cleanup: spelling in comments, strings (make check_spelling_*)
Also replace some triple-quoted non-doc-string strings with commented
blocks in examples.
2025-05-06 00:18:39 +00:00
Sergey Sharybin
bbfc97ad6f Move tests/data and assets to the main repository
This change moves the tests data files and publish folder of assets
repository to the main blender.git repository as LFS files.

The goal of this change is to eliminate toil of modifying tests,
cherry-picking changes to LFS branches, adding tests as part of a
PR which brings new features or fixes.

More detailed explanation and conversation can be found in the
design task.

Ref #137215

Pull Request: https://projects.blender.org/blender/blender/pulls/137219
2025-05-05 15:10:22 +02:00
Campbell Barton
9567ac1272 Cleanup: quiet python linter warnings 2025-04-16 11:08:40 +10:00
Campbell Barton
ac402bf7af Tools: include STRNLEN macros in code_clean utility 2025-04-12 13:39:11 +10:00
Campbell Barton
8e5c0aedec Cleanup: use type hints for trailing_space_clean.py utility 2025-04-05 20:06:34 +11:00
Campbell Barton
9057e528c7 Tools: prevent "struct" being removed from timezone
macOS requires this.
2025-02-18 10:24:23 +11:00
Campbell Barton
dde68fbf95 Tools: fix code_clean operating on the same file from multiple processes
Job splitting logic didn't account for the same file being built
multiple times, causing there to be multiple built arguments per file.

Now multiple build configurations are stored per file.
2025-02-18 10:24:20 +11:00
Campbell Barton
7d53e33889 Cleanup: use typed named tuple for code_clean.py 2025-02-18 10:21:27 +11:00
Campbell Barton
59732c95d8 Cleanup: strip trailing space for TOML,HTML & XML 2025-02-02 13:58:34 +11:00
Campbell Barton
4425acf946 Cleanup: suppress pylint/ruff warnings in Python scripts 2025-01-06 12:57:09 +11:00
Campbell Barton
5f640457d8 Cleanup: suppress various pylint warnings 2025-01-04 21:17:29 +11:00
Campbell Barton
5fe261c89d Cleanup: declare __all__ for many scripts in tools/ 2025-01-04 20:27:58 +11:00
Campbell Barton
a7bc3e3418 Cleanup: quiet Python linter warnings 2024-12-11 11:26:24 +11:00
Dalai Felinto
7ed7e584cb make license: mention Blender Foundation copyright for the bundle 2024-12-03 17:55:21 +01:00
Dalai Felinto
f8ca9ee46b make license: Tweak on generated comments
After coming back to this file after a few months I myself did not remember where to edit it.
Adding the "Introduction and formatting" bullet item and update others for brevity.
2024-12-03 17:55:21 +01:00
Campbell Barton
273f48cd53 Cleanup: use main functions to allow importing scripts
Support importing scripts without running their logic to
allow basic validation (see #130746).

Parts of !131037 were used.

Co-authored-by: Bastien Montagne <bastien@blender.org>
2024-11-29 15:54:58 +11:00
Campbell Barton
ec46eafeb9 Merge branch 'blender-v4.3-release' 2024-11-06 10:51:41 +11:00
Campbell Barton
326b65f27c Tools: bump autopep8 min version 2024-11-06 10:49:44 +11:00
Campbell Barton
d920ef5425 Merge branch 'blender-v4.3-release' 2024-11-03 22:04:44 +11:00
Campbell Barton
b00550916c PyDoc: correct use of single back-ticks 2024-11-03 21:50:33 +11:00
Campbell Barton
a0453ab87a Cleanup: update use of typing in for Python scripts 2024-10-23 12:48:09 +11:00
Campbell Barton
68b1fe3986 Merge branch 'blender-v4.3-release' 2024-10-23 12:30:01 +11:00
Campbell Barton
d1c82cc537 Cleanup: spelling in comments 2024-10-23 12:25:58 +11:00
Campbell Barton
9df897a1d8 make license: back port changes from main
Back port fix & changes from main to keep licenses compatible for all
releases:

- 675aa86ca6
- 9f0043b8d6
- 81025eabd2
2024-10-21 20:57:58 +11:00
Dalai Felinto
8cff5ecb4d Cleanup: make_license: use Path more deliberately
Changes suggested by Sybren Stüvel.

The original suggestion was even to use resolve() instead of abspath,
but we don't even need that here.
2024-10-21 11:55:27 +02:00
Dalai Felinto
d1857d1d58 Revert "Cleanup: make_license: use Path more deliberately"
This reverts commit 94959cb84f.

make_license.py was actually refactored in main, and this is introducing
a minor conflict. I will leave make_license as it is in 4.3, and focus
on the cleanups in main itself.
2024-10-21 11:45:04 +02:00
Dalai Felinto
94959cb84f Cleanup: make_license: use Path more deliberately
Changes suggested by Sybren Stüvel.
2024-10-21 11:40:45 +02:00
Campbell Barton
81025eabd2 Refactor: various changes to "make license"
- Avoid manipulating a dictionary arguments, use return values &
  iterators to return results.
- Move logic out of the file reading context once the file was read
  (reducing right-shift).
- Move intermediate license data from a dictionary to a named-tuple
  for better clarity & type safety.
- Remove use of `dataclass` as a container for constants,
  as it quite clear to define the constants directly in the
  global namespace.
- Group imports at the beginning of the file (no need to quiet pylint).
- Add headings for code sections.
- Use double quotes.
- Use the term "dir" instead of both dir/folder.
- Note the limitations parsing CMake files directly,
  with a possible alternative.
2024-10-19 17:53:17 +11:00
Campbell Barton
9f0043b8d6 Fix "make license" hiding duplicate versions of the same library
There are two "SPIRV TOOLS" IGC_SPIRV_TOOLS & SHADERC_SPIRV_TOOLS, in:
build_files/build_environment/cmake/versions.cmake

Show both in the license.md file.

Also remove use of defaultdict to make it clear where dictionary
values are created.
2024-10-19 17:53:16 +11:00
Campbell Barton
675aa86ca6 make license: clear trailing white space & ensure newline at eof
Clear trailing space as this has as space at the line end
has a special meaning in markdown.

Write a new line at the end of the file
since some development tools add this or note when it's missing,
it's simplest just to add it.
2024-10-19 17:52:01 +11:00
Falk David
f1a92ea4dd Formatting 2024-10-18 18:10:31 +02:00
Dalai Felinto
0a4dbc57b8 make license: command to update the license file
This generates a `license.md` file with all the relevant information about
the different libraries and their respecive licenses.

This should replace: THIRD-PARTY-LICENSES.txt

Important files:
* `make_license.py` (main script called by `make license`.
* `licenses.json` (file to add the definition of new licenses).
* `licenses/*/*.txt` (individual license files.

The `license.md` groups the libraries per license, list their
corresponding copyright information and include the complete license.

Code includes contributions from:
* Campbell Barton (multi-line parser for versions.cmake).
* Thomas Dinges (Windows support for `make license`).

Part of: !129018
2024-10-18 17:09:43 +02:00
Campbell Barton
931469484e pyproject.toml: correct autopep8 configuration for 2.3.1
The updated autopep8 was ignoring the "exclude" values because
they started with a "./" instead of a "/".

The documentation I found doesn't go into details, even if this is a
regression in autopep8, update the configuration as it causes
"make format" to format files that aren't meant to be modified.
2024-10-16 20:55:03 +11:00
Campbell Barton
c3b067dc80 Cleanup: single/double quote use in scripts 2024-10-16 14:45:08 +11:00
Falk David
5f5b1b83d0 GPv3: Rename mode enum names and python identifiers
This renames the mode identifiers to be consistent with e.g. the context mode identifiers and other names used for the new Grease Pencil.

For `object.mode`:
* `PAINT_GPENCIL` -> `PAINT_GREASE_PENCIL`
* `SCULPT_GPENCIL` -> `SCULPT_GREASE_PENCIL`
* `VERTEX_GPENCIL` -> `VERTEX_GREASE_PENCIL`
* `WEIGHT_GPENCIL` -> `WEIGHT_GREASE_PENCIL`

For the internal `ob->mode` flag:
* `OB_MODE_PAINT_GPENCIL_LEGACY` -> `OB_MODE_PAINT_GREASE_PENCIL`
* `OB_MODE_SCULPT_GPENCIL_LEGACY` -> `OB_MODE_SCULPT_GREASE_PENCIL`
* `OB_MODE_VERTEX_GPENCIL_LEGACY` -> `OB_MODE_VERTEX_GREASE_PENCIL`
* `OB_MODE_WEIGHT_GPENCIL_LEGACY` -> `OB_MODE_WEIGHT_GREASE_PENCIL`

Resolves #127374.

Pull Request: https://projects.blender.org/blender/blender/pulls/128604
2024-10-04 19:20:00 +02:00
Campbell Barton
840c65f442 Cleanup: spelling in comments 2024-09-25 19:24:20 +10:00
Campbell Barton
ccfdf79bc3 Tools: support excluding directories for "make format"
As of [0] `intern/itasc/` is excluded from formatting,
however the formatting script was still running clang-format
on files in this directory.

Support ignoring directories to avoid the overhead of running
clang-format which does nothing.

Also add comments & skip creating paths to convert to spaces when
converting tabs to spaces isn't enabled.

[0]: 77617fce77
2024-09-21 19:56:21 +10:00
Campbell Barton
f43da6fc4c Cleanup: format all of ./intern, use .clang-format to exclude paths
Directories in intern/ were selectively formatted based on
paths in `tools/utils_maintenance/clang_format_paths.py`.

This had the following problems:

- Editing files inside intern/ would auto-format on save with editors
  setup to auto-format as there was nothing to disable formatting.
- Some directories were missing (by accident it seems).

Resolve by formatting all of `./intern/` exclude except for
`./intern/itasc/` which includes ITASC & KDL versions we might
want to sync with upstream.
2024-09-20 16:26:42 +10:00
Iliya Katueshenock
76eed5c65a Fix clang-format & autopep8 do extra work when nothing to operate on
When passing `.py` paths to the format command, clang-format paths
would be empty and operate on all paths.

Resolve by detecting cases when there is nothing to format.

Ref: !126055
2024-08-23 09:55:30 +10:00
Campbell Barton
7971e6a9c2 Cleanup: return error code instead of sys.exit() for formatting utils 2024-08-23 09:55:30 +10:00
Campbell Barton
d777267982 Cleanup: use str.format instead of f-strings 2024-08-16 09:33:20 +10:00
Brecht Van Lommel
b802f146e6 Tools: Move warning about wrong clang-format version to the bottom
So it doesn't scroll off screen and is easy to miss.
2024-06-27 11:49:00 +02:00
Campbell Barton
7dfedf4e84 Tools: various fixes/corrections to the autopep8 formatter
When autopep8 is accessed as a Python module (using `--no-subprocess`),
which is now default on MS-Windows.

- Perform version checks on the module version instead of the command.
- Remove checks for the command existing in the PATH.
- Adjust errors to make sense for a Python module.
2024-06-26 10:08:03 +10:00
Ray Molenkamp
9f1f869e16 make.bat: Enable .py formatting with make format
autopep8_format_paths.py was never wired up in the windows tooling,
this PR wires it up, to get around a 8191 limitation for command
lines on windows an alternative "--no-subprocess" option has been
introduced to call the pep8 module directly from python.

TODO: A subprocess is still used for getting the version information

Contributors:

- @campbellbarton fixes to autopep8_format_paths.py to support
  the -no-subprocess option.

Pull Request: https://projects.blender.org/blender/blender/pulls/120794
2024-06-06 09:10:19 -06:00
Campbell Barton
e5fb4ad03b Cleanup: replace %-formatting with str.format in tools/ & release/ 2024-04-27 16:06:53 +10:00
Campbell Barton
d5f837a8ee Cleanup: remove redundant string formatting 2024-04-12 10:04:07 +10:00