Commit Graph

655 Commits

Author SHA1 Message Date
Bastien Montagne
39cbeee0ce Merge branch 'blender-v5.0-release' 2025-10-15 16:36:55 +02:00
Damien Picard
d1fdc7a0ce I18n: Do not translate Python template menu entries 2025-10-15 16:26:46 +02:00
Aaron Carlisle
214f0b9cc0 Merge branch 'blender-v5.0-release' 2025-10-13 21:48:30 -04:00
Aaron Carlisle
624ebd69e5 Docs: Update RNA to user manual URL mapping 2025-10-13 21:46:57 -04:00
Campbell Barton
9cfa925916 Merge branch 'blender-v5.0-release' 2025-10-13 20:37:56 +11:00
Campbell Barton
1216651ca9 PyAPI: make internal modules explicitly "private"
Rename modules in `./scripts/modules/` to use an underscore prefix to
make it clear they aren't intended to be part of public API's. This
also means there is no implication that these modules should be stable,
allowing us to change them based on Blender's internal usage.

The following modules have been marked as private:

- `animsys_refactor`
- `bl_console_utils`
- `bl_i18n_utils`
- `bl_previews_utils`
- `bl_rna_utils`
- `bl_text_utils`
- `bl_ui_utils`
- `bpy_restrict_state`
- `console_python`
- `console_shell`
- `graphviz_export`
- `keyingsets_utils`
- `rna_info`
- `rna_manual_reference`
- `rna_xml`

Note that we could further re-arrange these modules
(under `_bpy_internal` in some cases), this change is mainly to mark
them as private, further changes can be handed on a case-by-case basis.

Ref !147773
2025-10-13 09:35:09 +00:00
Campbell Barton
7a249222be Cleanup: tweak multi-line parenthesis for Python scripts
Reduce right shift, moving closing parenthesis onto own line
for clarity & reducing diff noise in some cases.

Ref !147857
2025-10-12 03:31:31 +00:00
Nick Alberelli
877283a09a PyAPI: bpy.ops callable type in the C-API
Moving `__call__` logic into Python's C-API means error messages
caused by operators reference the code of the caller instead of the
call from `.scripts/modules/bpy/ops.py`.

When a full call stack is available this isn't so important,
however when logging callers it's not useful to log the call
from `ops.py`.

There minor performance advantages for moving from Python to C++
however this wasn't a significant consideration for the change.

Note that this is a fairly direct conversion from Python to C++,
there is room for refactoring to simplify the calling logic.

See #144746 for the motivation & #147448 for further improvements.

Ref !145344
2025-10-11 03:04:57 +00:00
Janne Nylander
88308e108e Fix #147739: Python animation baking script was checking bone selection from wrong type of bone
The script was checking if a bone was selected via Bone.select.
As of 5.0, this is not available. Instead, PoseBone.select should be used.

Pull Request: https://projects.blender.org/blender/blender/pulls/147743
2025-10-10 17:29:08 +02:00
Damien Picard
84fc90bb43 I18n: Extract many messages from ED_push_undo
This function is used to add undo steps. It includes a message, for
use in the Undo History menu. This label uses the "Operator" context
for translation.

This commit adds automatic extraction of two functions `ED_undo_push`
and `ED_undo_grouped_push`, as well as manual extraction for many
strings not declared in the function calls.

In order to extract those messages using the proper context, the
extraction logic had to be changed so that a custom context could be
specified. The regexes can now be either a pattern, or
a (ctxt_override, pattern) tuple.

Pull Request: https://projects.blender.org/blender/blender/pulls/147581
2025-10-10 16:01:35 +02:00
Bastien Montagne
d57d76f23d I18n: Refactor: Introduce class for message regexes, includes ctxt
This new class for C++ message extraction regexes includes an optional
translation context override.
2025-10-10 16:01:34 +02:00
Damien Picard
86ea2bd1ce I18n: Sort sockets in translation extraction, for stable .po files
Socket names and descriptions were not sorted, which could result in
changes between invocations of the translation extraction script.
2025-10-09 12:09:56 +02:00
Damien Picard
98814c1dcd I18n: Translate reports using "WM_global_report(f)"
In bd06baf6e6, "WM_report" was renamed to "WM_global_report", but this
name was not changed in the translation extraction regex. Same for the
format version of this function.

Reported by Ye Gui in #43295.
2025-10-09 12:09:56 +02:00
Damien Picard
2750cc1a70 I18n: Translate Geometry Nodes modifier warnings
Geometry Nodes can generate warnings inside node trees using a Warning
node. This is used to report warnings in the modifier interface.

This commit allows translation of these warnings in the interface
template, and extracts the messages from built-in asset node groups,
by looking at each warning node.

Pull Request: https://projects.blender.org/blender/blender/pulls/147584
2025-10-09 12:09:44 +02:00
Damien Picard
c35de6f92d I18n: Translate labels using node UI function from node_add_menu.py
In 2a1a658492, layout functions for nodes were refactored and new
methods were introduced, but this change was not applied to the
translation extraction script.

This commit adds these method names and argument order to Python
extraction: "node_operator", "node_operator_with_outputs",
"simulation_zone", "repeat_zone", "for_each_element_zone",
"closure_zone".

Tooltips specified in a special structure are manually extracted using
`n_()`.

Actual translation is done manually in the UI methods inside NodeMenu,
in order to override the context, which by default would have been
"Operator".

Reported by Ye Gui in #43295.

Pull Request: https://projects.blender.org/blender/blender/pulls/147582
2025-10-09 12:09:25 +02:00
Campbell Barton
cc1a3f19b4 Cleanup: resolve various pylint warnings from recent changes 2025-10-07 10:19:46 +11:00
Campbell Barton
01806a62e3 Cleanup: spelling (make check_spelling_*) 2025-10-07 10:19:46 +11:00
Nika Kutsniashvili
b4a8e8c5f8 Anim: Move "Copy Global Transform" extension to internal scripts
Move the Copy Global Transform core add-on into Blender's code.

- The entire extension was one Python file. This PR basically splits
  it into two, one for operators (in `bl_operators`) and the other for
  UI panels. Those panels are registered in the 3D viewport's sidebar,
  which were registered in `space_view3d`, but I made the decision
  here to create a new file `space_view3d_sidebar`, because the main
  file is getting too large and difficult to navigate. This PR puts
  the global transform panel in this file. After this is merged, I
  will do refactors to move the rest of the sidebar panels here as
  well.

- `AutoKeying` class was moved into `bpy_extras/anim_utils.py` so that
  it's reusable and also accessible from API, since it's generally
  very useful. There were discussions about putting this somewhere,
  but for now, I chose against it because creating a new file would
  also mean PR would have to affect documentation generation, and
  would complicate things. If we want to, we can probably create a new
  module in the future.

- Little tweaks to labels and descriptions. Now that they exist
  outside of the add-on context, and exist without the user explicitly
  enabling them, they need to be more descriptive and tell users what
  they actually do. They also need to conform to Blender's GUI
  guidelines. Also tried organizing files a little by grouping
  objects.

- Add-on properties (which included word `addon` in the name) have
  been registered in C++, on `scene.tool_settings` with `anim_`
  prefix.

Pull Request: https://projects.blender.org/blender/blender/pulls/145414
2025-10-03 17:42:04 +02:00
Sybren A. Stüvel
8d417cb280 Refactor: lazy import anim_utils from bpy_extras
Import `anim_utils` from `bpy_extras` in a lazy way, instead of at the top
of the module. This will improve load times of Blender.

No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/147215
2025-10-02 17:00:13 +02:00
Sybren A. Stüvel
7b18a2c324 Refactor: convert Rigify from legacy Action API to the current API
Minimal changes to make Rigify use the current Action API (introduced in
Blender 4.4) instead of the legacy API (removed in 5.0).

Most of the refactoring consists of:

- Find the right `Channelbag`
- Replace operations on `Action` with operations on that `Channelbag`.

I didn't manage to test all code, because some code paths are very hard
to follow, and others seem to only be available for legacy rigs.

This is part of #146586

Pull Request: https://projects.blender.org/blender/blender/pulls/147060
2025-10-02 14:42:43 +02:00
Sybren A. Stüvel
95c8521eb6 Refactor: convert "F-Curve path refactor" code to current Action API
Convert the code in `scripts/modules/animsys_refactor.py` from the
legacy Actions API to the current API.

The code was made for very old rigs (2.70 and older, last updated for
Caminandes in 2014). The updated code seems to work on a Caminandes test
file, and produces the same logging on the terminal as in Blender 4.3
(before slotted Actions).

No functional changes.

This is part of #146586

Pull Request: https://projects.blender.org/blender/blender/pulls/147060
2025-10-02 14:42:43 +02:00
Sybren A. Stüvel
5c2069e284 Refactor: convert "Bake Action" operator to current Action API
Remove the use of `action.fcurves` in the Bake Action operator, replacing
it with the current API (introduced for slotted Actions in Blender 4.4).

No functional changes.

This is part of #146586

Pull Request: https://projects.blender.org/blender/blender/pulls/147060
2025-10-02 14:42:43 +02:00
Campbell Barton
a941108804 Cleanup: defer loading anim_utils (previous wm.py commit wasn't enough) 2025-10-02 09:27:16 +10:00
Campbell Barton
df5366f596 Cleanup: spelling, duplicate terms 2025-10-01 23:22:42 +00:00
Sybren A. Stüvel
dbcb701eb2 Anim: make it easier to convert from legacy to current Action API
The changes:

1. Add `group_name` to the `channelbag.fcurves.new()` and
   `action.fcurve_ensure_for_datablock()` RNA functions.
2. Add `anim_utils.action_ensure_channelbag_for_slot(action, slot)`.
3. Add `channelbag.fcurves.ensure()` RNA function.

This makes it possible to replace this legacy code:

```py
fcurve = action.fcurves.new("location", index=2, action_group="Name")
```

with this code:

```py
channelbag = action_ensure_channelbag_for_slot(action, action_slot)
fcurve = channelbag.fcurves.new("location", index=2, group_name="Name")
```

or replace this legacy code:

```py
fcurve = action.fcurves.find("location", index=2, action_group="Name")
if not fcurve:
    fcurve = action.fcurves.new("location", index=2, action_group="Name")
```

with this code:

```py
channelbag = action_ensure_channelbag_for_slot(action, action_slot)
fcurve = channelbag.fcurves.ensure("location", index=2, group_name="Name")
```

Note that the parameter name is different (`action_group` became
`group_name`). This clarifies that this is the name of the group, and
not a reference to the group itself.

This is part of #146586

Pull Request: https://projects.blender.org/blender/blender/pulls/146977
2025-09-30 14:43:56 +02:00
Campbell Barton
ab4a66bd48 Cleanup: resolve pylint warnings 2025-09-30 10:45:29 +10:00
Casey Bianco-Davis
e8bb5a6558 Python: Rename IDType_ID_GP.name_plural to grease_pencils
This renames `IDType_ID_GP.name_plural` for Grease Pencil from
`grease_pencil_v3` to `grease_pencil`.

Part of #125058.

Pull Request: https://projects.blender.org/blender/blender/pulls/146903
2025-09-29 12:33:42 +02:00
Casey Bianco-Davis
d2269441bb Python: Rename bpy.data.grease_pencils_v3 to bpy.data.grease_pencils
This renames `bpy.data.grease_pencils_v3` to `bpy.data.grease_pencils`.

Part of #125058.

Pull Request: https://projects.blender.org/blender/blender/pulls/146904
2025-09-29 12:32:08 +02:00
Damien Picard
4e034b5ecb I18n: Improve message extraction for node socket declaration
Node sockets could already be declared using:

```cpp
add_input<decl::<SOCKET TYPE>>("NAME")
```

They can now additionally be declared with:

```cpp
add_input(socket_type, "NAME")
```

This commit adds the later form to the message extraction regex. Since
they are mutually exclusive, they are now in a non-capturing group
with an | operator.

Reported by Ye Gui in #43295.
2025-09-29 11:07:03 +02:00
Damien Picard
285c1ee8bb I18n: Get displays, views, looks, colorspaces info from OCIO config
This extracts the names and descriptions for displays, views, and
colorspaces. They are all used in the different parts of the UI.
The views' descriptions are used for the displays'.

The extraction uses the built-in PyOpenColorIO module. This ensures
only data that is actually used is extracted (not ignored in the
config).
2025-09-29 11:07:03 +02:00
Jeroen Bakker
8111fe2369 Fix #146655: GPU: Call of deprecated function
There are deprecation usages in the gpu presets and custom
shapes python module. This PR uses the correct calls to remove the
deprecation warnings.

Pull Request: https://projects.blender.org/blender/blender/pulls/146746
2025-09-25 17:22:35 +02:00
Alaska
2f02866519 Fix #146322: Spelling mistake and missing return type for axis_conversion
Fix typo in PyApi doc of `axis_conversion` and add return type

Pull Request: https://projects.blender.org/blender/blender/pulls/146353
2025-09-22 15:48:11 +02:00
Habib Gahbiche
1b4daf9d2e Nodes: remove "Use Nodes" in Shader Editor for Object Materials
"Use Nodes" was removed in the compositor to simplify the compositing
workflow. This introduced a slight inconsistency with the Shader Node
Editor.

This PR removes "Use Nodes" for object materials.

For Line Style, no changes are planned (not sure how to preserve
compatibility yet).
This simplifies the state of objects; either they have a material or
they don't.

Backward compatibility:
- If Use Nodes is turned Off, new nodes are added to the node tree to
simulate the same material:
- DNA: Only `use_nodes` is marked deprecated
- Python API:
  - `material.use_nodes` is marked deprecated and will be removed in
6.0. Reading it always returns `True` and setting it has no effect.
  - `material.diffuse_color`, `material.specular` etc.. Are not used by
EEVEE anymore but are kept because they are used by Workbench.

Forward compatibility:
Always enable 'Use Nodes' when writing blend files.

Known Issues:
Some UI tests are failing on macOS

Pull Request: https://projects.blender.org/blender/blender/pulls/141278
2025-09-14 17:53:54 +02:00
Damien Picard
ddbc6ed858 I18n: Allow translation of some messages using string formatting
- Add `iface_` translation functions and `translate=False` to a few UI
  elements.
- Add `rpt_` translation functions to a few reports.
2025-09-12 18:30:56 +02:00
luz paz
072f956ce0 Cleanup: Fix typos in scripts subdirectory
Fix spellings from comment and string
Found via codespell

Pull Request: https://projects.blender.org/blender/blender/pulls/145834
2025-09-11 11:29:06 +02:00
Jacques Lucke
c3f49cd24e Shader Nodes: add Python API for inlined shader nodes
This makes the shader node inlining from #141936 available to external renderers
which use the Python API. Existing external renderer add-ons need to be updated
to get the inlined node tree from a material like below instead of using the
original node tree of the material directly.

The main contribution are these three methods: `Material.inline_shader_nodes()`,
`Light.inline_shader_nodes()` and `World.inline_shader_nodes()`.

In theory, there could be an inlining API for node trees more generally, but
some aspects of the inlining are specific to shader nodes currently. For example
the detection of output nodes and implicit input handling. Furthermore, having
the method on e.g. `Material` instead of on the node tree might be more future
proof for the case when we want to store input properties of the material on the
`Material` which are then passed into the shader node tree.

Example from API docs:
```python
import bpy

# The materials should be retrieved from the evaluated object to make sure that
# e.g. edits of Geometry Nodes are applied.
depsgraph = bpy.context.view_layer.depsgraph
ob = bpy.context.active_object
ob_eval = depsgraph.id_eval_get(ob)
material_eval = ob_eval.material_slots[0].material

# Compute the inlined shader nodes.
# Important: Do not loose the reference to this object while accessing the inlined
#   node tree. Otherwise there will be a crash due to a dangling pointer.
inline_shader_nodes = material_eval.inline_shader_nodes()

# Get the actual inlined `bpy.types.NodeTree`.
tree = inline_shader_nodes.node_tree

for node in tree.nodes:
    print(node.name)
```

Pull Request: https://projects.blender.org/blender/blender/pulls/145811
2025-09-11 06:08:30 +02:00
Sergey Sharybin
3ef2df3893 Cycles: Remove Use Tiling option
Always enforce tiling of some size, up to the 8k tile size.

Rendering very big images without tiles have a lot of challenges.
While solving those challenges is not impossible, it does not seem to
be a practical time investment.

The internals of the way how Cycles work, including Cycles Standalone
is not affected by this change.

A possible downside is that path guiding might not work exactly how one
would expect it to due to lack of information sharing across multiple
tiles. This is something that never worked nicely, and camera animation
and border render has the same issues, so it is not considered a stopper
for this change.

Fixes #145900

Co-authored-by: Brecht Van Lommel <brecht@blender.org>

Pull Request: https://projects.blender.org/blender/blender/pulls/146031
2025-09-10 17:15:07 +02:00
Aaron Carlisle
4d6405c130 Docs: Update RNA to user manual URL mapping 2025-09-06 16:54:25 -04:00
Aaron Carlisle
fdcbb0c99b Docs: Update RNA to user manual URL mapping 2025-08-24 20:09:53 -04:00
Campbell Barton
e964f078b5 PyDoc: correct use of back ticks for literal text 2025-08-22 15:10:29 +10:00
Aaron Carlisle
782adf8878 Docs: Update RNA to user manual URL mapping 2025-08-20 00:42:05 -04:00
Aaron Carlisle
ecba348b73 Docs: Update RNA to user manual URL mapping 2025-08-18 00:21:07 -04:00
Casey Bianco-Davis
a767671c56 Grease Pencil: Edit Mode Pen Tool
This adds the `Pen` tool to Grease Pencil Edit Mode.

With the pen tool you can:
- Extrude points by `Left Click`.
- Move the handles by dragging the mouse.
- Snap handles to 45 degree increments with `Shift`.
- Cycle through the handle types by `Double Clicking`.
- Add new point on segments by `Ctrl Clicking`.
- Remove existing point by `Ctrl Clicking`.
- Close a curve by clicking on one end while having the other selected.
- Move existing segment by clicking and dragging on the edge.
- Move points by clicking and dragging the mouse.

Some changes have been made compared to the legacy
curve object's pen tool:
- `Angle locking` with `Alt` was replaced with `Angle Snapping`
   using `Shift`. This was done to match the behavior of Grease Pencil
   primitive tools.
- `Move Entire Point` was changed from the `Space` key to `Alt`. This
   was done because some laptops can't move the mouse while
  `Space` is held.
- `Link Handles` and `Free Align Toggle` were not implemented.
- `Toggle Vector` and `Close Spline Method` were removed.
- `Close Spline` was removed and set to always be true.
- `Extrude Handle` type was removed as a option and was replaced
   by the `shift` modifier key when clicking.
- Newly created points are placed on the drawing plane, instead of
  the view plane.

When a new curve is created, the material will be the active material
and the radius will be set from the `radius` property.

Note: This tool is added to edit mode because it uses handle selection
and bézier overlays which currently don't exist in draw mode.
A future PR will implement a draw mode version.

Pull Request: https://projects.blender.org/blender/blender/pulls/142646
2025-08-15 18:17:09 +02:00
Aras Pranckevicius
3d9155eb0a PointCache: improve performance and compression, always compress
Point Caches (used by particle system, cloth, boids etc.) are now
always compressed, uzing zstd coupled with lossless data filtering.

- This is both smaller cache files _and_ faster than the old
  "Heavy" compression mode,
- And smaller data files and same or slightly faster speed than
  using no compression at all,
- There was not much difference between compression levels once
  data filtering got added, so option to pick them was removed.
- So there's no downside to just always using the compression,
  which makes for a simpler UI.
- RNA change: removes PointCache.compression property.

More details and cache size / performance numbers in the PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/144356
2025-08-13 16:38:46 +02:00
Campbell Barton
eb57af250c Cleanup: consistent doc-string comment block style
Mixing different newline style with doc-strings is error prone.
2025-08-12 12:17:45 +10:00
Aaron Carlisle
0d8a19c790 PyDocs: Fix syntax formatting errors 2025-08-11 21:15:58 -04:00
Campbell Barton
729b76f454 Cleanup: use str.format to format strings in Python
Also replace redundant `{!s}` with `{:s}`.
2025-08-12 10:21:38 +10:00
Campbell Barton
eb2cc80cd0 PyAPI: move bpy_types.py to a private module
Use an underscore prefix as this module should not be accessed directly.
2025-08-10 13:45:40 +10:00
Campbell Barton
b3e36d6983 Cleanup: replace unused RNA doc-string with comment
The doc-string used in the manual is stored in RNA.
2025-08-10 11:23:45 +10:00
Aaron Carlisle
8c932cb507 Docs: Update RNA to user manual URL mapping 2025-08-09 19:28:54 -04:00