Commit Graph

504 Commits

Author SHA1 Message Date
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
Campbell Barton
6216e8574c Cleanup: declare __all__ for doc-generation & icon updating utils 2025-01-04 20:33:53 +11:00
Brecht Van Lommel
6a15f301ef Revert "Fix: Missing super().__del__() in Cycles and Hydra render engine"
This is leading to "'super' object has no attribute '__del__'" errors
in some situations. As explained in #132476 this is only for future
proofing, so don't do it yet.

This reverts commit f301952b6a.
2024-12-31 19:30:39 +01:00
Brecht Van Lommel
f301952b6a Fix: Missing super().__del__() in Cycles and Hydra render engine
According to the Python API release notes, this is required now along
with super().__init__() which was already done.

Also fixes mistake in example in API docs.

Pull Request: https://projects.blender.org/blender/blender/pulls/132476
2024-12-31 15:18:25 +01:00
Pratik Borhade
2e10c5d174 Fix #102439: Missing node tools in keymap hierarchy
Select_* tool keymap was only accessed from searching, they were not
exposed in hierarchy. Now fixed, added inside "node editor" keymap
category.

Pull Request: https://projects.blender.org/blender/blender/pulls/132154
2024-12-20 12:10:58 +01:00
Campbell Barton
a7bc3e3418 Cleanup: quiet Python linter warnings 2024-12-11 11:26:24 +11:00
Campbell Barton
560b6e2831 Cleanup: spelling (make check_spelling_*) 2024-12-11 11:23:51 +11:00
Bastien Montagne
9f9500f0f2 Fix part of #116579: I18N tools: Do not extract UI messages of unregistered operators.
Operators keep being a pain... This time, the fact that unregistered
operators are not removed from `bpyt.type.Operator` subclasses list
breaks workflow to generate translations info for a specific add-on
(since it relies on differences between UI messages extracted when this
add-on is enabled, and when it is disabled).
2024-12-09 16:05:52 +01:00
Campbell Barton
48a3c53188 Cleanup: redundant imports, redundant "global" declaration 2024-12-09 11:50:37 +11:00
Campbell Barton
6ca1417103 Cleanup: suppress unused Python warnings
Suppress unused warnings using the "vulture" utility.

- Include public definitions in the modules `__all__`.
- Mark arguments & variables as unused with a "_" prefix.
2024-12-03 12:54:13 +11:00
Nathan Vegdahl
aa83738d44 Anim: change parameters of slots.new() RNA function
`Action.slots.new()` in the Python API previously took either an ID or nothing
as a parameter. In the former case it would create a slot with the appropriate
`id_root` and name for that ID. In the latter case it would create a default
slot with an unspecified `id_root` and default name.

This had several issues:

1. You couldn't create a slot with a specific `id_root` without already having
   an ID of that type. In theory this isn't a problem, but in practice in larger
   scripts/addons you don't necessarily have such an ID on hand at the call
   site.
2. You couldn't directly create a slot with a desired name without an existing
   ID with that name. This isn't so important, since you can always just set the
   name afterwards. But it's a bit annoying.
3. Most other `new()` APIs in Blender *require* you to specify the name of the
   item being created. So calling this with no parameters was violating that
   norm.
4. Ideally, we want to eliminate unspecified `id_root`s, since they cause other
   weirdness in the API such as slot identifiers changing upon slot assignment.

To resolve these issues, and just generally to make the API more
straightforward, this PR changes `slots.new()` to take two required parameters:
an ID type and a name. For example:

`slots.new(id_type='CAMERA', name="My Camera Data Slot")`.

This fully specifies everything needed for the slot identifier upon creation,
and doesn't require any outside data items to create a slot with the desired
type and name.

In the future if we decide we still want a `for_id`-style slot creation API, we
can reintroduce it as a separate function.

Ref: #130892
Pull Request: https://projects.blender.org/blender/blender/pulls/130970
2024-12-02 17:04:37 +01:00
Campbell Barton
056f748e04 Cleanup: replace redundant functions with os.path.lexists 2024-12-02 12:52:21 +11:00
Alaska
e84103d958 Fix #130822: Update built-in Python scripts to use new EEVEE material settings
In Blender 4.3 all the EEVEE Legacy compatibility Python API calls for
materials in were removed. All Python code that makes use of that API
need to be updated to make use of the new API.

This commit updates two built in Python scripts to use the new API
to avoid errors like the one reported in #130822

Candidate for 4.3.1 corrective release

Pull Request: https://projects.blender.org/blender/blender/pulls/130873
2024-11-25 10:51:45 +01:00
Campbell Barton
0de8ae8046 Cleanup: spelling in comments 2024-11-25 13:24:46 +11:00
Pablo Vazquez
1cd0ffd1d6 UI: Keymap Editor: Add margin from scrollbar
The "X" button to delete a keymap entry is too close to the scrollbar,
potentially leading to misclicks that would delete data.

Add margin to the right of the buttons to prevent this.
The X button is now aligned when the box is open/closed.

Pull Request: https://projects.blender.org/blender/blender/pulls/130349
2024-11-18 15:57:42 +01:00
Aaron Carlisle
378b62e349 Merge branch 'blender-v4.3-release' 2024-11-13 01:27:50 -05:00
Aaron Carlisle
d8b90ee422 Docs: Update RNA to user manual URL mapping 2024-11-13 01:26:36 -05:00
Campbell Barton
db62ddd57c Merge branch 'blender-v4.3-release' 2024-11-09 13:20:40 +11:00
Campbell Barton
325c8c0190 PyDoc: add doc-string for addon_utils.extensions_refresh 2024-11-09 13:19:27 +11:00
Campbell Barton
9ee8e00fbc Merge branch 'blender-v4.3-release' 2024-11-09 11:46:44 +11:00
Campbell Barton
cd07e729a2 Fix #130024: addon_utils.enable(..) doesn't setup extensions wheels
addon_utils.enable/disable now handle wheels so that the functions can
be used with extension add-ons.

A new argument `refresh_handled` supports scripts handing refresh
themselves which is needed to avoid refreshing many times in cases
when there are multiple calls to enable/disable.

This is mostly useful for internal operations.
2024-11-09 11:44:34 +11:00
Jonas Holzman
263212c4fa Merge branch 'blender-v4.3-release' 2024-11-09 01:35:36 +01:00
Campbell Barton
eb390425f3 Fix missing extensions refresh after the repository config changed
Enabling/disabling a repository was not refreshing its wheels or
compatibility data.
2024-11-09 11:10:26 +11:00
Alaska
f11503e385 Merge branch 'blender-v4.3-release' 2024-11-09 02:26:18 +13:00
Alaska
79cb23b049 Add GPU backend to "Report a Bug" script
Adds the current GPU backend to the `Help -> Report a bug` script
when using the OpenGL or Vulkan backend. This makes it easier for
triagers to figure out if a user is using OpenGL or Vulkan
in cases the user doesn't explictly state which they're using.

Pull Request: https://projects.blender.org/blender/blender/pulls/130006
2024-11-08 14:25:35 +01:00
Campbell Barton
96ac7b7ff3 Merge branch 'blender-v4.3-release' 2024-11-06 10:51:53 +11:00
Campbell Barton
6fe8b5724a Merge branch 'blender-v4.3-release' 2024-11-06 10:51:01 +11:00
Campbell Barton
6ccbafc5dc Cleanup: spelling in comments 2024-11-06 10:49:51 +11:00
Campbell Barton
4210a4f1cf Fix error keymap conflict operator
Detecting conflicts was failing because of an undefined function call &
an unknown "Timeline" keymap in the keymap hierarchy.
2024-11-06 10:49:41 +11:00
Campbell Barton
ba3c53f200 Merge branch 'blender-v4.3-release' 2024-11-03 22:04:48 +11:00
Campbell Barton
d920ef5425 Merge branch 'blender-v4.3-release' 2024-11-03 22:04:44 +11:00
Campbell Barton
e97e2e4b6d Merge branch 'blender-v4.3-release' 2024-11-03 22:04:42 +11:00
Campbell Barton
091ee2833b PyDoc: replace references to the deprecated "bgl" with "gpu"
Also correct bullet-points in gpu.state.blend_set.
2024-11-03 21:50:33 +11:00
Campbell Barton
b00550916c PyDoc: correct use of single back-ticks 2024-11-03 21:50:33 +11:00
Campbell Barton
901359abf7 Cleanup: replace doc-strings with comments for internal logic
There is no need to store text in memory for comments on functions
that aren't exposed publicly and are only of used when reading
the code.
2024-11-03 21:50:33 +11:00
Campbell Barton
ca8d00d0bb Cleanup: add doc-strings for bpy_extras.id_map_utils 2024-11-03 21:50:29 +11:00
Campbell Barton
f17379a5d0 Merge branch 'blender-v4.3-release' 2024-11-03 16:07:40 +11:00
Campbell Barton
3bcfb151c1 PyDoc: use Python's type annotation syntax for doc-strings
Replace plain-text type information with the type syntax used
for Python's type annotations as it's more concise, especially for
callbacks which often didn't include useful type information.

Note that this change only applies to inline doc-strings,
generated doc-strings from RNA need to be updated separately.

Details:

- Many minor corrections were made when "list" was incorrectly used
  instead of "sequence".
- Some type information wasn't defined in the doc-strings and has been
  added.
- Verbose type info would benefit from support for type aliases.
2024-11-03 15:44:35 +11:00
Campbell Barton
71a38df6fa Merge branch 'blender-v4.3-release' 2024-11-02 18:02:15 +11:00
Campbell Barton
a05345e139 PyDoc: various corrections to function doc-strings
Add missing arguments, corrections & remove unchecked type info.
2024-11-02 17:48:21 +11:00