Commit Graph

353 Commits

Author SHA1 Message Date
Campbell Barton
e3d0997065 Merge branch 'blender-v4.2-release' 2024-07-02 16:19:45 +10:00
Andrej730
1f0592b3b1 Docs: corrections to bpy.utils.register_tool
- Replaced `tool` argument with `tool_cls`.
- Removed `space_type` argument that's not present in the method.

Ref: !118900
2024-07-02 16:18:08 +10:00
Campbell Barton
83ce50f2b8 Merge branch 'blender-v4.2-release' 2024-07-02 16:09:45 +10:00
Thomas Barlow
d1cff7974a Fix #108254: Infinite loop in rna_info.BuildRNAInfo(..)
When a registered class has a non-registered superclass,
rna_info.BuildRNAInfo entered an eternal loop.

The while loop in `rna_info.get_py_class_from_rna` was not mutating the
variables within the loop nor the variable in its condition, meaning it
would loop infinitely if the loop didn't exit in its first iteration.

When yielding registered classes in `subclasses_recurse`, the function
was erroneously checking if the class' superclass was registered rather
than checking the class itself, causing registered classes to be skipped
if their superclass was not also registered. If the class to be found
was skipped, the while loop would not exit in its first iteration and
would thus loop infinitely.

The while loop has been modified to iterate through each base rna type
until there is no further base type.

The `subclasses_recurse` function now correctly checks whether the
subclass is registered, not its superclass, when determining if the
subclass should be yielded.

Besides the fix, no functional changes are expected, the generated
Python API docs remain unchanged.

Ref: !108256
2024-07-02 16:03:26 +10:00
Campbell Barton
11b32ed48b Merge branch 'blender-v4.2-release' 2024-07-02 15:07:17 +10:00
Campbell Barton
c29d8326e0 UI: sort add-ons by name
Previously add-ons were sorted by category & name, remove the category
only sorting by name since the category is no longer displayed and
isn't part of extension meta-data. Now the add-ons are sorted by name
(case insensitive).

Details:

- Store add-ons modules sorted to avoid having to sort on every redraw.
- addon_utils.modules() now returns an iterator.
2024-07-02 15:06:14 +10:00
Campbell Barton
14a2e933f4 Merge branch 'blender-v4.2-release' 2024-07-01 15:16:48 +10:00
Campbell Barton
7447f6415e Merge branch 'blender-v4.2-release' 2024-07-01 15:16:39 +10:00
Campbell Barton
67ddb0e1a5 Extensions: detect external changes on startup & loading preferences
Changes to an extensions manifest weren't accounted for.
This was particularly a problem for "System" extensions which aren't
intended to be managed inside Blender however the problem existed for
any changes made outside of Blender.

Now enabled extensions are checked on startup to ensure:

- They are compatible with Blender.
- The Python wheels are synchronized.

Resolves #123645.

Details:

- Any extension incompatibilities prevent the add-on being enabled
  with a message printing the reason for it being disabled.

- Incompatible add-ons are kept enabled in the preferences to avoid
  loosing their own preferences and allow for an upgrade to restore
  compatibility.

- To avoid slowing down Blender's startup:

  - Checks are skipped when no extensions are enabled
    (as is the case for `--factory-startup` & running tests).
  - Compatibility data is cached so in common case,
    the cache is loaded and all enabled extensions `stat` their
    manifests to detect changes without having to parse them.
  - The cache is re-generated if any extensions change or the
    Blender/Python version changes.

- Compatibility data is updated:

  - On startup (when needed).
  - On an explicit "Refresh Local"
    (mainly for developers who may edit the manifest).
  - When refreshing extensions after install/uninstall etc.
    since an incompatible extensions may become compatible
    after an update.
  - When reloading preferences.

- Additional info is shown when the `--debug-python` is enabled,
  if there are ever issues with the extension compatibility cache
  generation not working as expected.

- The behavior for Python wheels has changed so they are only setup
  when the extension is enabled. This was done to simplify startup
  checks and has the benefit that an installed but disabled extension
  never runs code - as the ability to install wheels means it could
  have been imported from other scripts. It also means users can disable
  an extension to avoid wheel version conflicts.

  This does add the complication however that enabling add-on which is
  an extension must first ensure it's wheels are setup.
  See `addon_utils.extensions_refresh(..)`.

See code-comments for further details.
2024-07-01 15:08:14 +10:00
Campbell Barton
350b8047c6 Extensions: move the wheel_manager out of the extensions add-on
Move wheel management to a generic private module, prepare addon_utils
to handle changes to repositories on load (needed to resolve #123645).
2024-07-01 10:07:16 +10:00
Campbell Barton
72e5254669 Merge branch 'blender-v4.2-release' 2024-06-29 22:15:34 +10:00
Andrej730
87844ae24d Fix bl_text_utils/external_editor.py broken __all__
Ref: !123910
2024-06-29 22:14:37 +10:00
Dalai Felinto
b528aca711 Merge remote-tracking branch 'origin/blender-v4.2-release' 2024-06-28 11:46:45 +02:00
Damien Picard
92c026c39b I18n: Fix multi-context message extraction regex
The BLT_I18N_MSGID_MULTI_CTXT() macro allows extracting a single
message into up to 16 different contexts. The regex to do that was
slightly wrong because it did not account for the macro potentially
ending with a ",".

The contexts for "New" were also sorted.

Pull Request: https://projects.blender.org/blender/blender/pulls/123793
2024-06-28 10:42:47 +02:00
Campbell Barton
ac8da6c72e Extensions: move junction_module to a private location
bpy_extras is part of the public API where as the junction_module
is part of the internal implementation of extensions.
Move to "_bpy_internal".
2024-06-28 14:30:11 +10:00
Campbell Barton
f1bfaaf2f7 Merge branch 'blender-v4.2-release' 2024-06-27 21:26:23 +10:00
Campbell Barton
fb94028d10 Merge branch 'blender-v4.2-release' 2024-06-27 21:26:21 +10:00
Campbell Barton
42e1239ba8 Core: support restricting the types an XML preset may load
Prevent potential problems from untrusted XML (typically themes)
traversing into data outside the intended targets.

From what I can tell it's not currently possible but changes to RNA
could allow for this which would likely go by unnoticed.

Further details in code-comments.
2024-06-27 21:21:07 +10:00
Campbell Barton
65d0f365a9 Cleanup: correct misleading name of internal function 2024-06-27 21:01:15 +10:00
Campbell Barton
66e422f33d Merge branch 'blender-v4.2-release' 2024-06-26 14:27:40 +10:00
Campbell Barton
96906536db Extensions: add a Python API for user editable extension directories
Provide a convenient way to access a writable directory for extensions.
This will typically be accessed via:

  bpy.utils.extension_path_user(__package__, create=True)

This API is provided as some extensions on extensions.blender.org
are writing into the extensions own directory which is error prone:

- The extensions own directory is removed when upgrading.
- Users may not have write access to the extensions directory,
  especially with "System" repositories which may be on shared network
  drives for example.

These directories are only removed when:

- Uninstalling the extension.
- Removing the repository and its files.
2024-06-26 14:23:17 +10:00
Brecht Van Lommel
eab14b0a0c Merge branch 'blender-v4.2-release' 2024-06-14 16:56:00 +02:00
Damien Picard
4719ce5d56 I18n: Allow translation of extension tags and permissions
The new extension system introduces tags, similar to categories from
legacy add-ons, and permissions. A hardcoded list is supported for
each, available in the docs:
- https://docs.blender.org/manual/en/dev/advanced/extensions/tags.html
- https://developer.blender.org/docs/features/extensions/schema/

This change allows extraction of these new metadata to the translation
files.

In order to disambiguate the new messages, tags use the new "Script"
translation context. Permissions are lower case, so there is a low
risk of collision, and they use the default context.

While the tags are defined per-platform, with extensions.blender.org
being the only one available currently, they are extracted as a single
list.

Pull Request: https://projects.blender.org/blender/blender/pulls/123150
2024-06-14 16:35:54 +02:00
2162af9e7b Merge remote-tracking branch 'origin/blender-v4.2-release' 2024-06-13 15:11:00 +02:00
Christoph Lendenfeld
9dcc63b76c Fix #122372: Keyingsets not keying custom properties of type EnumProperty
The issue was that when applying the keyingsets
`Whole Character` and `LocRotScale & Custom Properties` the
enum property of a rigify rig was not keyed.
The reason it was not keyed was just because
it was not specified in the compatible types in the keying set.
The fix is to just add `bpy.types.EnumProperty` to the list.

Pull Request: https://projects.blender.org/blender/blender/pulls/122377
2024-06-13 13:17:32 +02:00
Bastien Montagne
de713122f3 Merge branch 'blender-v4.2-release' 2024-06-13 12:17:10 +02:00
Dalai Felinto
77a69d04f2 Extensions: Changes to the translatable tags table
* Drop the repository - let's combine tags in a single list (per type)
  to avoid duplications in the future.

* Give a more sensitive name for tthe property, to avoid tags.tags.
2024-06-13 10:17:10 +02:00
Omar Emara
cbabe2d3ef Compositor: Remove Auto Render option
This patch removes the Auto Render option from the compositor. This is
done for the following reason:

- The option didn't really work except in the case of transforming an
  object. So it wasn't really reliable.
- It made little sense to use since the introduction of the Viewport
  Compositor.
- It had a number of UX issues, including the fact that it can't be used
  with animation playback, and the fact that rendering can get in the
  way of the UI depending on the preferences for temporary editors.

Pull Request: https://projects.blender.org/blender/blender/pulls/123132
2024-06-13 07:29:37 +02:00
Campbell Barton
8112ee47d9 Merge branch 'blender-v4.2-release' 2024-06-12 12:49:59 +10:00
Campbell Barton
eaa3f4c034 Cleanup: double-quote plain text strings 2024-06-12 10:56:12 +10:00
Aras Pranckevicius
165a929196 Merge branch 'blender-v4.2-release' 2024-06-11 19:15:07 +03:00
Dalai Felinto
188b6fd3d0 Extensions: List of tags to be used for translation
Internal module used for translation.

Pull Request: https://projects.blender.org/blender/blender/pulls/123069
2024-06-11 17:42:56 +02:00
Bastien Montagne
96228e516a Merge branch 'blender-v4.2-release' 2024-06-11 15:14:41 +02:00
Damien Picard
f9c2758c85 Actually extract n_() message
Forgot to commit the actual functional part...

Pull Request: https://projects.blender.org/blender/blender/pulls/122971
2024-06-11 15:09:14 +02:00
Aaron Carlisle
80faafb0ac Merge branch 'blender-v4.2-release' 2024-06-10 23:56:46 -04:00
Aaron Carlisle
38df2148f5 Docs: Update rna manual references 2024-06-10 23:55:55 -04:00
Sergey Sharybin
6334fdc988 Merge branch 'blender-v4.2-release' 2024-06-10 11:46:48 +02:00
Damien Picard
a5df83167e I18n: Fix add-on extraction
- The "location" and "warning" fields in bl_info are no longer exposed
  in the interface, so there is no need to extract them any more.

- Some add-ons do not define a description (Copy Global Transform for
  example), so they should be skipped.

- Some third-party legacy add-ons do not use the 'support' field, and
  that can cause an error in extraction. Since this won't happen
  for built-in add-ons, checking that an add-on is built-in is enough.

Pull Request: https://projects.blender.org/blender/blender/pulls/122970
2024-06-10 11:13:10 +02:00
Campbell Barton
2007fc2029 Merge branch 'blender-v4.2-release' 2024-06-10 00:25:32 +10:00
Campbell Barton
b4ea8583ed WM: correct logic for resetting add-ons & caching meta-data
All add-ons were being scanned at startup, while this didn't cause
errors it was noticeable with extensions where any errors in the
manifest were being reported at startup, even when running with
factory-startup (including blender's own tests).

Address two issues:

- The logic to "reset" add-ons, so as to match the preferences when
  reverting or resetting preferences always ran on startup.
  This occurred because a check for Python being initialized was
  incorrectly used to detect that this wasn't the first time preferences
  were being loaded (regression in [0]).

- Resetting add-ons scanned all add-ons (including disabled add-ons) to
  ensure their module cache is up to date. Since this the cache is
  lazily initialized, it's simpler to set it as uninitialized as
  resetting the add-ons doesn't require the cached meta-data.

[0]: 497bc4d19977abc7b9e2c0f5024a23057e680954
2024-06-10 00:22:56 +10:00
Campbell Barton
d6dcd974c4 Merge branch 'blender-v4.2-release' 2024-06-07 13:44:25 +10:00
Campbell Barton
6450141a18 Fix #122769: bpy.utils.register_submodule_factory fails with extensions
The unregister function from register_submodule_factory didn't support
a sub-module name argument.
2024-06-07 13:42:59 +10:00
Ray Molenkamp
d761634fb3 Merge remote-tracking branch 'origin/blender-v4.2-release' 2024-06-06 09:11:11 -06:00
Ray Molenkamp
9f1f869e16 make.bat: Enable .py formatting with make format
autopep8_format_paths.py was never wired up in the windows tooling,
this PR wires it up, to get around a 8191 limitation for command
lines on windows an alternative "--no-subprocess" option has been
introduced to call the pep8 module directly from python.

TODO: A subprocess is still used for getting the version information

Contributors:

- @campbellbarton fixes to autopep8_format_paths.py to support
  the -no-subprocess option.

Pull Request: https://projects.blender.org/blender/blender/pulls/120794
2024-06-06 09:10:19 -06:00
Brecht Van Lommel
5e1812dbb8 Merge branch 'blender-v4.2-release' 2024-06-06 15:29:35 +02:00
Brecht Van Lommel
f7797a90f6 Core: Make BLENDER_SYSTEM_SCRIPTS always add paths
Originally this would replace scripts that come bundled with Blender,
but it's unclear how this is useful.

Searching for this online mainly leads to people asking how they can
use it to add scripts. For example in a studio environment you might
want to deploy add-ons and startup scripts for all users.

Even if you wanted to use it for replacement though, it wasn't really
doing that and inconsistent for different types of scripts:

* startup: ignored
* modules: replaces bundled scripts
* presets: adds to bundled scripts
* addons (in 4.1): ignored
* addons_core (in 4.2): ignored
* startup/bl_app_templates_system: replaces bundled scripts

This change makes it add scripts from this path for all. This is a
breaking change, though arguably this feature was just broken to
begin with and not used much in practice because of that.

The alternative would be add a new set of environment variables to
avoid breaking existing behavior. But that also means keeping around the
broken behavior or fixing it in another way.

Supporting multiple paths may be used too, but for now just support
a single one as doing this for all BLENDER_SYSTEM variables is
non-trivial. The main use case for that would be add-ons anyway, and
those will mainly be handled through upcoming
BLENDER_SYSTEM_EXTENSIONS instead.

Ref #122512

Pull Request: https://projects.blender.org/blender/blender/pulls/122689
2024-06-06 15:28:44 +02:00
Campbell Barton
d7fdbc8eb2 Merge branch 'blender-v4.2-release' 2024-06-06 18:20:53 +10:00
Damien Picard
3b5f7b0052 I18n: Restore keyconfig after extracting messages
The translation extraction goes through each keyconfig preset file and
activates it in order to extract its messages. This change makes it
restore the original config, otherwise it would end up switching to
Industry Compatible.

Pull Request: https://projects.blender.org/blender/blender/pulls/122789
2024-06-06 09:53:01 +02:00
Campbell Barton
0f5e816a7d Merge branch 'blender-v4.2-release' 2024-06-06 11:28:06 +10: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