Commit Graph

543 Commits

Author SHA1 Message Date
Campbell Barton
3c15f1bbe0 Cleanup: quiet Python linter warnings 2025-04-22 21:23:03 +10:00
Bastien Montagne
288ab8ed1c I18N: Add British English language to supported translations. 2025-04-21 10:08:30 +02:00
Falk David
ee6d683809 Grease Pencil: Python API: Expose bézier handle selection
This adds two new python properties to  `GreasePencilStrokePoint`
* `select_handle_left`: The selection of the left handle of this point
* `select_handle_right`: The selection of the right handle of this point

These could already be written to using `drawing.attributes[".selection_handle_left"]`
and `drawing.attributes[".selection_handle_right"]`, but this makes it
easier to work on individual points from the higher-level
python API.

Resolves #137639.

Pull Request: https://projects.blender.org/blender/blender/pulls/137730
2025-04-18 18:20:33 +02:00
Campbell Barton
9567ac1272 Cleanup: quiet python linter warnings 2025-04-16 11:08:40 +10:00
RedMser
ba04393fde Cleanup: Remove deprecated Python and Rigid Body Joint constraints
Remove long-deprecated constraints that will likely never be
implemented in this form.

- Rigid Body Joint Constraint was removed in 2.80, but some references
  remained in the code. Versioning code was written that tried to
  remove them on load, but since constraint initialization code sets
  the type to CONSTRAINT_TYPE_NULL before versioning gets a chance,
  the versioning code ended up never running. This has all been
  removed.
- Python/Script Constraint never worked since 2.50 and showed an error
  message in the UI panel.

These constraints now load as 'null' constraint, as seems to be
(looking at the code) the way that Blender currently deals with
removed constraint types. These still show up in the outliner and
python API, but have no UI panel. Removing such constraints completely
will be left for another time, as it is beyond the scope of removing
these two specific constraint types.

Pull Request: https://projects.blender.org/blender/blender/pulls/136672
2025-04-11 11:38:29 +02:00
Campbell Barton
ab20edf469 RNA: support flagging properties as support blend file relative prefix
Some paths in Blender support the `//` prefix for blend-file relative
paths however this is not communicated anywhere.

Support declaring this with a new flag which can be applied to filepath
& dirpath typed properties.

This is used to:

- Show red-alert when "//" are used in paths which don't support a relative prefix.
- Show a warning in the tooltip that the relative suffix is used when unsupported.
- Python warns if this prefix is ever used in an assignment or
  function argument.

Resolves #133456.

Ref !137060
2025-04-10 23:27:21 +00:00
Sybren A. Stüvel
9605cbde6f Fix #137041: Bugs with Slotted Actions and the Available Keying Set
Make the 'Available' keying set look at the F-Curves for the assigned
slot, instead of the backward-compatible API (which only sees the F-Curves
for the first slot).

Pull Request: https://projects.blender.org/blender/blender/pulls/137131
2025-04-08 11:10:46 +02:00
Germano Cavalcante
855ad33936 Fix #136938: bpy.path.module_names does not return list[str]
The documentation at
https://docs.blender.org/api/4.4/bpy.path.html#bpy.path.module_names
points out that `bpy.path.module_names` returns `list[str]`, while it
actually returns `list[tuple[str, str]]`.

Besides fixing the documentation, this commit also removes a leftover
debug print.

Pull Request: https://projects.blender.org/blender/blender/pulls/136951
2025-04-03 23:54:56 +02:00
Christoph Lendenfeld
28d0bef706 Fix: Retain slot name when baking action
Previously when an action was baked, the slot name was not retained.
This causes problems when switching between actions because the slot
will not automatically be assigned.

This is now fixed by ensuring that the name of the last assigned slot
is used to create the new slot.

Pull Request: https://projects.blender.org/blender/blender/pulls/136814
2025-04-03 10:18:15 +02:00
Jacques Lucke
29fddf4710 Python: Geometry: create GeometrySet wrapper for Python
In Geometry Nodes a geometry is represented by a `GeometrySet`. This is a
container that can contain one geometry of each of the supported types (mesh,
curves, volume, grease pencil, pointcloud, instances). It's possible for a
`GeometrySet` to contain e.g. a mesh and a point cloud.

This patch creates a Python  wrapper for the built-in `GeometrySet`. For now,
it's main purpose is to consume the complete evaluated geometry of an object
without having to go through complex hoops via `depsgraph.object_instances`. It
also also allows retrieving instances that have been created with legacy
instancing systems such as dupli-verts or particles.

In the future, the `GeometrySet` API could also be used for more kinds of
geometry processing from Python, similar to how we use `GeometrySet` internally
as generic geometry storage.

Since we can't really have constness guarantees in Python currently, it's
enforced that the `GeometrySet` wrapper always has its own copy of each geometry
type (so e.g. it does not share a `Mesh` data-block pointer with any other place
in Blender). Without the copy, changes to the mesh in the geometry set would
also affect the evaluated geometry that Blender sees. The copy has a small cost,
but typically the overhead should be low, because attributes and other run-time
data can still be shared. This should be entirely thread-safe, assuming that no
code modifies implicitly shared data, which is forbidden. For historic reasons
there are still cases like #132423 where this assumption does not hold in all
cases. Those cases should be fixed. To my knowledge, this patch does not
introduce any new such issues or makes existing issues worse.

Pull Request: https://projects.blender.org/blender/blender/pulls/135318
2025-03-28 22:40:01 +01:00
Campbell Barton
38d9d971e5 WM: add a "Hyper" capability flag
Avoids the need to check against ghost backends.
2025-03-28 13:46:39 +11:00
Campbell Barton
894dca7f76 UI: correct the keymap editor to match the OSKEY label to the platform 2025-03-28 13:26:09 +11:00
Campbell Barton
e436b9638e Cleanup: replace references to "C" to C++ or the C-API
Also capitalize Blender, Python & API in docs & code-comments.
2025-03-26 17:23:33 +11: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
John Kiril Swenson
b729928897 Cleanup: VSE: Rename Keymaps
Rename to be more consistent with other Blender keymaps, as well as the
naming convention used in "View Type."

- "SequencerCommon" -> "Video Sequence Editor"
- "SequencerPreview" -> "Preview"
- "Sequencer Timeline Tool" -> "Sequencer Tool"
- "Sequencer Preview Tool" -> "Preview Tool"

There is versioning in place to make sure custom keyconfigs keep working.

Once #131102 goes through, if we would like to rename the "Sequencer"
view type to "Timeline" or "Sequencer Timeline," then we can make the
necessary changes here too.

Pull Request: https://projects.blender.org/blender/blender/pulls/136217
2025-03-25 23:46:15 +01:00
YimingWu
68a0e68bcd Fix #135999: Extensions: Remove emails in bl_info['author']
Previously when an addon is expanded on the UI, the "Maintainer" string
would be cut short until a `<` character, to prevent showing e-mail on the
UI, however there could be more than one person/email entries in there
so to prevent cutting short the string, now we use regex to take out the
email part only, so full maintainer string is displayed.

Pull Request: https://projects.blender.org/blender/blender/pulls/136031
2025-03-24 07:35:44 +01:00
Campbell Barton
5b04f13219 Cleanup: wrap long lines 2025-03-21 22:08:31 +11:00
Campbell Barton
6ef7dae8ef Cleanup: spelling in comments (make check_spelling_*) 2025-03-13 13:41:17 +11:00
Sybren A. Stüvel
6def7c3276 Merge remote-tracking branch 'origin/blender-v4.4-release' 2025-03-12 11:47:31 +01:00
Sybren A. Stüvel
9c1845dbf2 Fix #135775: Bake to an empty Action using bake_action_objects throws error
Fix a few small mistakes in the action baking code:

- Assigning an action slot should only happen after the action itself has
  been assigned.
- `_ensure_channelbag_exists()` didn't actually ensure the channelbag
  always exists; now it also creates the layer & strip if necessary.

Pull Request: https://projects.blender.org/blender/blender/pulls/135853
2025-03-12 11:46:34 +01:00
Campbell Barton
1974fbc443 Merge branch 'blender-v4.4-release' 2025-03-10 20:39:55 +11:00
Campbell Barton
3d49186a4a Fix #132843: Wheel's with "Root-is-Purelib: false" fail to install
Some wheels don't use "Purelib", meaning the directory layout of the
wheel needs to be manipulated on installation.

Add partial support for Python's "Binary distribution format" when
Purelib is false, since paths such as `includes` & `scripts` are not
remapped into user accessible locations - they will remain in the
wheels "*.data" directory, these could be supported if it's needed
although it seems like a fairly niche use case.

Ref !135709
2025-03-10 20:38:02 +11:00
Christoph Lendenfeld
ba1e51cff9 Merge branch 'blender-v4.4-release' 2025-03-06 15:54:03 +01:00
Christoph Lendenfeld
a485bf6556 Fix #134034: Baking a custom property with a name existing in Blender failed
When baking custom properties that were named exactly the same
as a property already in Blender (in this case `scale`), it would fail.
The issue was introduced with eee32726c7 where the goal was
to not key addon defined properties.
The problem with that approach was that `obj.bpy_rna.properties`
not only contains addon defined properties but also all that are native to Blender.
So the rna path would be created to be identical as for e.g. transform properties.

The fix is to test the property for `is_runtime` which is true for addon
defined properties but false for blender internal properties

I tested with the test file of #121349 to confirm that doing so
doesn't bring that original bug back.

Pull Request: https://projects.blender.org/blender/blender/pulls/135297
2025-03-06 15:51:44 +01:00
Sebastian Parborg
1fc2daf3e2 Merge branch 'blender-v4.4-release' 2025-02-27 15:16:37 +01:00
Christoph Lendenfeld
566f51c24a Fix: selecting bones of pose assets not respecting multiple slots
The code for selecting bones from a pose was still using the legacy api,
thus it didn't work properly for selecting bones of all slots.

Pull Request: https://projects.blender.org/blender/blender/pulls/134912
2025-02-27 14:46:36 +01:00
Aaron Carlisle
5083b91c28 Merge branch 'blender-v4.4-release' 2025-02-26 16:45:57 -05:00
Aaron Carlisle
1049f055dc Docs: Update RNA to user manual URL mapping 2025-02-26 16:45:30 -05:00
Aaron Carlisle
3eca8ca60f Merge branch 'blender-v4.4-release' 2025-02-25 14:08:58 -05:00
Aaron Carlisle
778b1efd84 PyAPI Docs: Properly document byte string types
Fixes blender/blender-manual#105044
2025-02-25 14:02:58 -05:00
Dalai Felinto
645242dcc4 Fix: Point cloud keymap not working
Pull Request: https://projects.blender.org/blender/blender/pulls/134638
2025-02-17 08:44:05 +01:00
Aaron Carlisle
01763ea34b Merge branch 'blender-v4.4-release' 2025-02-11 21:32:11 -05:00
Aaron Carlisle
f8cb37a322 Docs: Update RNA to user manual URL mapping 2025-02-11 21:29:05 -05:00
Campbell Barton
968909d57c Cleanup: rename RNA parameter to clarify its meaning
This flag is only used when classes are registered,
avoid confusion by renaming to `PARM_PYFUNC_REGISTER_OPTIONAL`.
2025-02-11 16:31:42 +11:00
Campbell Barton
198d07e240 Extensions: resolve unhandled exceptions when wheel extraction fails
Setting up wheels wasn't handling errors if extraction failed.

Addresses the error in #132924.
2025-02-07 20:30:08 +11:00
Campbell Barton
fb3fe458bf Extensions: forward any errors setting up wheels to reports
When actions on extensions failed setup extensions, errors weren't
forwarded to the user and were only visible in the terminal.
2025-02-07 20:30:02 +11:00
Andrej730
380e8455e8 PyDoc: Fix typing issues with bpy.utils.register_tool
- Add `type[]` for the `tool_cls` as it's expecting tool type class,
  not the instance (similar to #132420)
- Add `set[str]` to `after` type as it's seems to be the way it's used
  the most widely, e.g. in "UI Tool Simple" example that comes with Blender:

`bpy.utils.register_tool(MyTool, after={"builtin.scale_cage"}, separator=True, group=True)`

Pull Request: https://projects.blender.org/blender/blender/pulls/133975
2025-02-05 07:06:53 +01:00
Campbell Barton
6fcd84721c Cleanup: quiet some warnings from check_pep8 target 2025-02-04 14:51:17 +11:00
Sybren A. Stüvel
226486aa91 Refactor: Anim, rename and adjust ActionKeyframeStrip.channels()
Rename `ActionKeyframeStrip.channels()` to `.channelbag()`, and change
its first parameter from `slot_handle` to `slot`.

This is to be consistent with `ActionKeyframeStrip.channelbags`, which is
the array of channelbags in the keyframe strip. Having a function that's
singluar makes sense for finding a single element in the array.

The change from using the slot handle to using the slot is to be consistent
with `.channelbags.new(slot)`. Furthermore, the Python API should be using
slot handles as little as possible (they're basically meaningless numbers).
Using the slots directly is preferred. If that's not possible, it is
recommended to use the slot identifier (`slot.identifier`) instead, as that
can be used to look up the slot (`action.slots[slot_identifier]`).

This breaks the glTF add-on, which will be fixed in !133915.

Pull Request: https://projects.blender.org/blender/blender/pulls/133868
2025-02-03 20:19:00 +01:00
Campbell Barton
ec40ad0b3f Cleanup: use str.format to format strings in Python 2025-01-31 13:22:10 +11:00
Pratik Borhade
71213799b0 Fix #77799: Missing categories for gizmos in keymap hierarchy
Expose generic gizmo keymap in hierarchy.

Pull Request: https://projects.blender.org/blender/blender/pulls/132788
2025-01-29 20:18:10 +01:00
Jonas Holzman
001c3b0d4b Fix #132150: macOS: Allow searching keymap using native modifiers key names
Allow searching through keybindings on macOS using native modifiers key
names "control", "option", and "command".

Pull Request: https://projects.blender.org/blender/blender/pulls/132579
2025-01-28 02:12:06 +01:00
Campbell Barton
abd933d6b0 Cleanup: prefer parenthesis over line continuations in Python scripts 2025-01-21 23:30:55 +11:00
Pratik Borhade
9439ff09e9 Fix #133259: Regression: Error when saving a theme
Missed in 655a17a6ab.

Pull Request: https://projects.blender.org/blender/blender/pulls/133285
2025-01-20 10:35:27 +01:00
Brecht Van Lommel
a6b293daac Python Module: Bundle VFX library python bindings
When calling bpy.utils.expose_bundled_modules(), these modules are
added to sys.path.

This provides a solution/workaround to two problems:
* Using bpy together with packages like usd-core is problematic. Besides
  crashing due to C++ symbol conflicts, it's just impossible to import
  different versions of the same module, or to have distinct environment
  variables for both. (#127132)
* Blender add-ons using these VFX modules do not currently work with
  the bpy module.

This adds about 15MB to the bpy package.

Pull Request: https://projects.blender.org/blender/blender/pulls/133082
2025-01-17 10:13:31 +01:00
Campbell Barton
481a8b67d4 PyAPI: add bpy.app.portable, derived from WITH_INSTALL_PORTABLE
Support differentiating between portable & system installations,
useful to properly locate relative paths which would not work
on system installations.

Ref !133143
2025-01-16 21:07:29 +11:00
jlalleve
2feadc623b Core: Environment variables for deployment
* BLENDER_SYSTEM_SCRIPTS support for multiple script paths, separated by
  ; on Windows and : on other platforms.
* New BLENDER_CUSTOM_SPLASH to replace the splash screen image.
* New BLENDER_CUSTOM_SPLASH_BANNER to overlay an image on the splash.

Contributed by Sony Interactive Entertainment: https://github.com/PlayStation-OpenSource
2025-01-14 20:57:31 +01:00
Jonas Holzman
0ee4ae89e4 UI: Capitalize default filenames from "untitled" to "Untitled"
Capitalize the default filename used for .blend files and other savable
and exportable file formats (like images, 3D formats, etc.) from
"untitled" to "Untitled".

Pull Request: https://projects.blender.org/blender/blender/pulls/132424
2025-01-13 20:06:27 +01: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
444f1064c9 Cleanup: remove unused functions, imports 2025-01-04 21:09:41 +11:00