22 Commits

Author SHA1 Message Date
Sean Kim
ee67c098d9 Fix #110879: Multires relative subdivide navigation subdivides mesh
Prior to this commit, the `object.subdivision_set` would prevent
actually applying a subdivision to a multires modifier when the relative
option was set. This is commonly accessed via Alt-1 / Alt-2 or D / Shift
D in Sculpt mode.

However, when the multires modifier did not already exist, pressing
these keybinds would still create the modifier and further subdivide the
mesh.

To fix this, this commit adds a hidden property to the operator:
`ensure_modifier` to indicate if the keybind should create the modifier
or not.

Pull Request: https://projects.blender.org/blender/blender/pulls/130254
2025-06-11 01:34:08 +02:00
Campbell Barton
be0c9174aa Cleanup: argument wrapping for Python scripts
- Wrap the closing parenthesis onto it's own line
  which makes assignments to the return value
  read better.
- Reduce right-shift with multi-line function calls.
2025-01-14 12:53:32 +11:00
Damien Picard
88dbe8dcd1 I18n: Disambiguate "Pattern"
- "Pattern" can mean type of texture.
- It can also refer to refers to a type of matching wildcard.

Issue reported by Hoang Duy Tran.
2025-01-13 12:40:45 +01:00
Campbell Barton
a7ab81d927 PyAPI: remove use of BaseException
BaseException was used as a catch-all in situations where it
didn't make sense and where "Exception" is more appropriate
based on Python's documentation & error checking tools,
`pylint` warns `broad-exception-caught` for e.g.

BaseException includes SystemExit, KeyboardInterrupt & GeneratorExit,
so unless the intention is to catch calls to `sys.exit(..)`,
breaking a out of a loop using Ctrl-C or generator-exit,
then it shouldn't be used.

Even then, it's preferable to catch those exceptions explicitly.
2024-10-01 13:18:46 +10:00
Campbell Barton
e34d9eeac7 Cleanup: use C-style comments, double quote Python text 2024-09-03 21:22:34 +10:00
Brecht Van Lommel
a926f5b67d Refactor: Replace ID_IS_LINKED by !ID_IS_EDITABLE
Add new ID_IS_EDITABLE macro that checks if the ID can be edited in the
user interface. Replace usage of ID_IS_LINKED where it is used with this
meaning.

Also add a corresponding ID.is_editable property for Python.

This prepares for the ability to edit some linked datablocks for brush
assets.

Pull Request: https://projects.blender.org/blender/blender/pulls/121838
2024-05-16 14:53:09 +02:00
Campbell Barton
56388dc8fe Cleanup: reduce right-shift in startup scripts
Also un-wrap lines that fit in the column width.
2024-04-30 12:46:05 +10:00
Campbell Barton
0c4d3754f1 Cleanup: replace {!s} with {:s} when used with strings
When passing strings to str.format(..) use `{:s}` format specifier
which only takes strings and wont run `.__str__()` on non-strings.

While `{!s}` is an equivalent to `%s`, for the most part `%s` was
used for strings, so using `{:s}` is clearer and more specific.
2024-04-27 16:02:37 +10:00
Campbell Barton
0e3b594edb Refactor: scripts under scripts/startup/ to use str.format
Part of modernizing scripts in Blender, where the previous convention
was to use percentage formatting which has become the "old" way to
format strings in Python.

See proposal for details #120453.

Ref !120552
2024-04-27 16:02:36 +10:00
Campbell Barton
0660fa6971 UI: remove double-quoting in report
repr() already quotes, so including quotes isn't necessary
2024-04-12 10:02:41 +10:00
Campbell Barton
d07d6f1c10 Cleanup: un-wrap lines that fit within 120 width for Python scripts 2024-03-15 10:04:03 +11:00
Sebastian Parborg
013cd3d1ba Fix: Remove duplicate image_add operators in the 3D view port
As part of #118623, we discovered that the operator used for adding images in the 3D viewport was not the same when drag and dropping as when adding it from the add menu. This lead to different and potentially confusing behaviour for the user when they use both.

This patch removes the python operator and unifies the functionality into one operator. It also renames the operator to be in line with the other "Add X" object operators.

Pull Request: https://projects.blender.org/blender/blender/pulls/118973
2024-03-11 16:18:25 +01:00
Damien Picard
3bd41cf9bc I18n: Go over TIP_ and IFACE_ usages, change to RPT_ when relevant
The previous commit introduced a new `RPT_()` macro to translate
strings which are not tooltips or regular interface elements, but
longer reports or statuses.

This commit uses the new macro to translate many strings all over the
UI.

Most of it is a simple replace from `TIP_()` or `IFACE_()` to
`RPT_()`, but there are some additional changes:
- A few translations inside `BKE_report()` are removed altogether
  because they are already handled by the translation system.
- Messages inside `UI_but_disable()` are no longer translated
  manually, but they are handled by a new regex in the translation
  system.

Pull Request: https://projects.blender.org/blender/blender/pulls/116804

Pull Request: https://projects.blender.org/blender/blender/pulls/116804
2024-01-12 13:37:32 +01:00
Philipp Oeser
fe59704b52 UI: enable immediate typing for 'Select Pattern" operator
Saves a click so the "pattern" field has immediate focus.

Pull Request: https://projects.blender.org/blender/blender/pulls/115658
2023-12-01 16:09:56 +01:00
Campbell Barton
790fea431f Cleanup: use since quotes for enum values, wrap multi-line brackets 2023-09-29 14:41:48 +10:00
Philipp Oeser
4086ef986c Fix #112374: loading reference/background images filters out movies
Movies are perfectly fine for reference/background images, now allow for
loading them by adjusting the default filter for the filebrowser.

Pull Request: https://projects.blender.org/blender/blender/pulls/112378
2023-09-14 19:42:26 +02: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
9f5be2a861 Cleanup: quiet pylint warnings using BaseException 2023-07-30 16:14:11 +10:00
Campbell Barton
65f99397ec License headers: use SPDX-FileCopyrightText in all sources 2023-06-15 13:35:34 +10:00
Campbell Barton
fa5cc84a0a WM: avoid Python exceptions in poll functions 2023-04-30 15:08:26 +10:00
Hans Goudey
c31434a570 Cleanup: Remove setting polygon loop total from Python
This property is not editable after 7966cd16d6dc4e66d01f,
though doing so didn't seem to give an error. It doesn't have
to be set anymore, since the data is redundant with the
"loop_start" anyway.
2023-04-12 08:38:32 -04:00
Sergey Sharybin
03806d0b67 Re-design of submodules used in blender.git
This commit implements described in the #104573.

The goal is to fix the confusion of the submodule hashes change, which are not
ideal for any of the supported git-module configuration (they are either always
visible causing confusion, or silently staged and committed, also causing
confusion).

This commit replaces submodules with a checkout of addons and addons_contrib,
covered by the .gitignore, and locale and developer tools are moved to the
main repository.

This also changes the paths:
- /release/scripts are moved to the /scripts
- /source/tools are moved to the /tools
- /release/datafiles/locale is moved to /locale

This is done to avoid conflicts when using bisect, and also allow buildbot to
automatically "recover" wgen building older or newer branches/patches.

Running `make update` will initialize the local checkout to the changed
repository configuration.

Another aspect of the change is that the make update will support Github style
of remote organization (origin remote pointing to thy fork, upstream remote
pointing to the upstream blender/blender.git).

Pull Request #104755
2023-02-21 16:39:58 +01:00