99 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
Hans Goudey
99c87fbf18 Fix #137299: Exception with batch rename of nodes outside node editor
I'm not sure when this stopped working. The function in question is
quite confusing since it's called twice with two different purposes.
Fixing the exception is simple though. Just checking the data type
for "None" prevents changing the data type to one that's invalid given
the context. I didn't find a simple way to add an error message though.

Pull Request: https://projects.blender.org/blender/blender/pulls/138287
2025-05-02 15:17:23 +02:00
Campbell Barton
8ccdea1934 Cleanup: typos & references to variable names from recent refactor 2025-04-24 02:43:52 +00:00
Campbell Barton
9de0aa1066 Fix: #133486: 'use_region_toggle_pie' AssertionError in MovieClipEditor 2025-04-22 11:25:14 +00:00
Campbell Barton
5e2b421996 WM: support the "Hyper" modifier key on Linux
Add support for a 5th modifier key called "hyper",
this is a modifier supported on Wayland & X11 although
other platforms could support an additional modifier too.

Both GNOME and KDE can map CapsLock to Hyper.
Other compositors can use the XKB_DEFAULT_OPTIONS environment variable.

This allows users to have an additional modifier for their own use
that doesn't conflict with other keys.

Ref !136340
2025-03-26 10:39:55 +11:00
Philipp Oeser
138ede7194 Fix #134092: Keymap Editor can add an extra . to the end of an attribute
This happened for context attributes if already "complete" attributes
were typed/pasted in.

Reason is that this copies functionality from our intellisense
codecompletion where this is expected behavior, for context attributes
we cannot really use "tab" to expand, so it is less useful here.

When confirming (with the additional "."), the keymap entry would be
broken, so better solve in a way that we dont end up with those "." by
removing it.

NOTE: there might be ways to enhance the string-search behavior here (by
properly supporting "tab-expanding"), but this is a bit out-of-scope for
this bugfix.

Pull Request: https://projects.blender.org/blender/blender/pulls/135098
2025-02-26 09:12:28 +01:00
Pablo Vazquez
e2e992a425 UI: Add icons to Batch Rename data type menu
Add icons to better identify data types in the Batch Rename type menu.

Makes it easy for users to recognize icons they are already familiar
with, especially when following tutorials in English while using a
translated UI.

Also fixes 'Light' being singular, while others were plural.

Pull Request: https://projects.blender.org/blender/blender/pulls/130300
2025-01-21 11:31:24 +01:00
Falk David
b9f253564e VSE: Python API: Deprecate sequence properties and replace with new ones
This PR adds new RNA properties that deprecate and replace any `sequence` property.
The old prooperties are still there and fully functional, but the description is changed
to indicate that these will be removed in the future and that the new properties should
be used instead.

| Deprecated property | Replacement property |
| --------------------------------- | ----------------------------------- |
| `context.active_sequence_strip` | `context.active_strip` |
| `context.selected_editable_sequences` | `context.selected_editable_strips` |
| `context.selected_sequences` | `context.selected_strips` |
| `context.sequences` | `context.strips` |
| `SequenceEditor.sequences` | `SequenceEditor.strips` |
| `SequenceEditor.sequences_all` |  `SequenceEditor.strips_all` |
| `MetaStrip.sequences` | `MetaStrip.strips` |

Previously, rna paths for animation data on strips started with `sequence_editor.sequences`.
This PRadds versioning for the rna paths to make sure to use
the new naming scheme. This does mean that in previous versions of blender,
the animations don't show but the data is not lost (even if the file is saved in the older version).

Also do some cleanup of existing python scripts inside the source to use the
new properties.

Part of #132963.

Pull Request: https://projects.blender.org/blender/blender/pulls/133156
2025-01-21 11:30:20 +01: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
ec9c7ba465 I18n: Disambiguate "Spaces"
"Spaces" as a character in a text, not a Blender UI element.

Issue reported by Hoang Duy Tran.
2025-01-13 12:40:45 +01:00
Damien Picard
c3d071e469 I18n: Disambiguate "Power"
- In the context of color balance, refers to a power function. Uses
  ID_MOVIECLIP context, because the ID_NODE is already used for math
  functions.
- In the context of the scale constraint, also a power function.
- In the context of physics and particle settings, refers to a
  falloff.
- In the context of property subtypes and units, refers to a
  quantity.

Issue reported by Hoang Duy Tran.
2025-01-13 12:40:45 +01:00
Damien Picard
466af92f7a I18n: Disambiguate "Light"
"Light" already has multiple contexts, but some were missing:
- In general, "Light" refers to a Blender Light object. In many cases,
  this comes from an `id_type` enum, already using the ID context. Use
  it also for properties that were missing that context.
- In the context of render passes, "Light" is the actual illumination
  factor, not the light emitor. A new "Render Layer" translation
  context is introduced for this purpose as no existing ones are both
  specific and explicit enough.

Issue reported by Hoang Duy Tran.
2025-01-13 12:40:45 +01:00
Campbell Barton
6ac52551d3 Cleanup: edit comments to avoid confusion type-checking commands
These comments caused vulture to fail.
2025-01-06 16:27:27 +11:00
Campbell Barton
38a76db083 UI: remove redundant undo pushes for menu operators
Operators that trigger menus should not enable UNDO.

Resolves #95906

Ref !131467
2024-12-07 00:41:36 +11:00
Campbell Barton
41ec8a6d44 Fix errors calling tool set operators without a space
This check was added [0] but only for WM_OT_tool_set_by_brush_type.

[0]: 7cbc94d835faa9aabdbfaf5a1fff8fb606359506
2024-11-04 11:55:39 +11:00
Campbell Barton
7cbc94d835 Fix some exceptions in Python operators when poll fails 2024-10-31 18:50:03 +11:00
Sybren A. Stüvel
a564e678f0 Fix #128797: Custom property Data-Block Type only has Object ID Type
In the WindowManager code, use `bpy.types.ID.id_type` enum property to
get all valid ID types, instead of using a property on the `Action`
type.

Pull Request: https://projects.blender.org/blender/blender/pulls/128834
2024-10-10 14:33:31 +02:00
Bastien Montagne
e2705a432a Fix #128767: Regression: Batch Rename failed to rename bones.
Regression from 8c3a3bb9a3, did not realize all items were not
necessarily actual IDs.
2024-10-09 15:57:19 +02:00
Campbell Barton
dadb9ba5dc Cleanup: script formatting 2024-10-02 15:42:46 +10:00
Harley Acheson
8d0fc95fb6 Cleanup: Make format
Just the result of running Make Format
2024-10-01 12:17:43 -07:00
Julian Eisel
33b670a65d Sculpt/Paint: Automatically switch tools when activating brushes
As discussed in #128066, we want that activating a brush makes sure the
most appropriate tool is activated. For example activating an eraser
brush should activate an eraser tool, if available. This makes the
tool and brush binding two ways, which is more clear. Plus it means that
users don't have to care about tools at all if they don't want to, they
can just keep switching brushes and Blender takes care of the tool.

Implementation wise, this works by letting a Python operator lookup a
tool for a given brush type name, when activating a brush.

Design Task: https://projects.blender.org/blender/blender/issues/128066
2024-10-01 18:21:15 +02: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
Bastien Montagne
8c3a3bb9a3 Fix #128006: Liboverride objects can be renamed using batch rename.
Do not allow renaming liboverride IDs from batch-rename either.

Users who really want to rename liboverrides should use python/RNA API
instead, this should not be exposed to standard UI tools (as renaming
liboverride IDs can lead to quite some confusing setups).
2024-09-23 15:45:02 +02:00
Red-Andringa
8345ebc704 Fix batch renaming object data from the outliner
Correct typo is_editabe > is_editable.

Ref: !127675
2024-09-16 19:20:18 +10:00
Campbell Barton
97179b10fb Refactor: make "sys_info" an internal module, rename for clarity
- Move sys_info into an internal module to avoid having so many
  top level modules for Blender's internal functionality.
- Rename system_info sub-modules that pre-fill URL's for clarity.
- Move top-level exception handling into the operator.
- Report an error if an unexpected exception occurs.
- Use `Exception` instead of `BaseException` as there is no reason to
  catch the additional exceptions.
- Remove use of sys_info from the command line example,
  replace with in-lined system info.
2024-09-06 11:11:26 +10:00
Alaska
3196ef1636 Add a script to collect system information when Blender isn't opening
This commit adds a python script that can collect some of the
information necessary to fill out a bug report.

The primary use case is to help users collect system information for
a bug report in the case that Blender can't open.

CMD and sh files are included to help users use the Python script.

Ref !122191
2024-09-03 13:26:54 +10:00
Campbell Barton
8a7ff41a85 Cleanup: wrap long lines in Python scripts 2024-08-19 10:48:07 +10:00
YimingWu
4f4add5406 Fix #125426: Update paths in animation when renaming IDProperty
Previously when renaming an IDProperty the existing paths in the
animation/driver system isn't updated, this leads to missing animation
after renaming the property. Now `BKE_animdata_fix_paths_rename_all`
will be called so the animation system records the updated name.

Pull Request: https://projects.blender.org/blender/blender/pulls/125474
2024-08-15 13:56:17 +02:00
Julian Eisel
0baeca8f9e Fix #123735: Tooltip missing from open URL preset operator
Necessary because the "type" property is no longer the default
`bl_property` since 7bc34283eacc.
2024-07-25 12:28:50 +02:00
Campbell Barton
4cf9f53946 Cleanup: remove unused BUG_ADDON URL preset 2024-07-24 13:35:41 +10:00
Damien Picard
6a52c76a65 I18n: Translate messages in extensions, operator descriptions, Node Wrangler
- Operator descriptions use tip_() since they will be displayed in
  tooltips.

- Extension messages:
  - Split "(Add-on|Theme) \"{:s}\" already installed!" into two
    messages.
  - Use rpt_() to translate error messages.

- Restore core add-on name and description translation.

- Use DATA_ to translate paint material slot name, so that translation
  happens only if the user enabled it for user-created data.

- Node Wrangler contains functions used to build operators' poll
  methods. This change allows them to be properly translated by using
  str.format() instead of f-strings, and explicit extraction with
  tip_().

Pull Request: https://projects.blender.org/blender/blender/pulls/123795
2024-07-04 10:49:52 +02:00
Dalai Felinto
dd7cc11796 Extensions: Link to visit the extensions platform 2024-06-25 15:13:50 +02:00
Dalai Felinto
33a7cf8c49 Translations: blender.org should not be translatable 2024-06-25 15:13:50 +02:00
Damien Picard
f87d4e4e40 I18n: Extract and disambiguate a few messages
Extract
- Cycles denoiser enum.
- Extensions user preferences UI.
- Node operator poll message from new node function.

Improve
- Split "(Enabled|Disabled) on startup, overriding the preference."
into two messages.

Disambiguate
- "Add" when describing the action of adding something should use the
  Operator context.
- "Dimensions", in noise textures.
- "Transform" as a noun, the matrix transform type of Geometry Nodes,
  as opposed to the verb to move things in space.
- "Parent" as a noun or verb (the parent of an object, to parent an
  object to another).

Some issues reported by Satoshi Yamasaki, deathblood, and Gabriel Gazzán.

Pull Request: https://projects.blender.org/blender/blender/pulls/122969
2024-06-13 12:15:55 +02:00
Damien Picard
602b26f461 I18n: Disambiguate messages from custom properties
These messages are part of enum items not directly used by their
EnumProperty, because they are returned by a function. They cannot be
accessed in RNA at all times, and need to be extracted manually.
2024-06-11 15:09:09 +02:00
Campbell Barton
949dfbfaa8 Cleanup: Python script formatting
- Double quotes for strings.
- Trailing commas when wrapped lines.
2024-06-06 11:26:28 +10:00
Dalai Felinto
40b882437e Extensions: Use the INTERNET_OFFLINE icon for the offline mode message 2024-05-31 13:07:41 +02:00
Campbell Barton
43a47f39f9 UI: always show text on the splash when running in offline mode
see #119521
2024-05-31 18:47:15 +10:00
Campbell Barton
aacf14ae95 UI: remove option to enable online access on startup
Setting up online access is being updated and this isn't required.
2024-05-24 14:06:58 +10:00
Campbell Barton
57c023d580 Preference: add option allow internet access
Add a preference to "Work Offline" system preference as well as command
line options `--offline-mode` & `--online-mode`
(which overrides the preference).
This option is displayed in the initial setup screen too.

This is currently respected by:

- Check for updates on startup
- Disables running an update when enabling extensions.

When Blender is launched with `--offline-mode` the option cannot be
enabled in the preferences. This is intended for environments
where internet access is intentionally disallowed.

Background: with Blender supporting access to online-repositories
as well as 3rd party extensions themselves potentially accessing the
internet. This setting provides a way for users to disable online
functionality.

This prevents error messages when online access fails in environments
without internet access as well as the ability for users who prefer
Blender doesn't access the internet to have one place to turn this off.

While it does not enforce limitations on add-ons, 3rd party scripts
are expected to respect this setting using `bpy.app.internet_offline`.

The details for this will be handled along with other policies scripts
are expected to follow.

Ref !121994
2024-05-23 13:50:06 +10:00
Campbell Barton
e0b043d076 Cleanup: minor changes to the splash "Quick Setup"
No functional changes.

- Remove unnecessary variable declarations.
- Declare wm & prefs at the function beginning
  to prevent noisy patches in case they're used elsewhere in the future.
- Correct invalid comment.
2024-05-20 12:51:20 +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
e64d067c78 Docs: document why the eventstate is cleared while refreshing a popup
Also correct a comments grammar.
2024-05-08 20:44:36 +10:00
Jacques Lucke
423df70129 Fix: string formatting issue on splash screen 2024-04-27 11:26:46 +02: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
Harley Acheson
d2d810f11a UI: Splash Screen Import Changes
Removal of "What's New" button, addition of a section divider, and many
very small changes to the text, some reordering of items.

Pull Request: https://projects.blender.org/blender/blender/pulls/118224
2024-04-09 22:57:06 +02:00
Campbell Barton
a2dae7e4b4 Cleanup: consistent quotes for Python scripts 2024-03-29 10:07:28 +11:00
Campbell Barton
f347706ecd Cleanup: add "unreachable" message to "assert False" statements
Clarify that these blocks are unreachable so the intention is clear
if they're ever encountered.
2024-03-15 13:20:11 +11:00
Campbell Barton
d07d6f1c10 Cleanup: un-wrap lines that fit within 120 width for Python scripts 2024-03-15 10:04:03 +11:00