Commit Graph

334 Commits

Author SHA1 Message Date
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
Julian Eisel
a6ed013baa Refactor: Get asset data via asset representation, not file
The "active_file" context member as a way to get the active asset should be
avoided, in favor of "asset". This moves us away from the file browser backend
as basis of the asset system,
2024-06-05 13:46:33 +02:00
Bastien Montagne
1e5d1c0d04 Fix (unreported) I18N error when generating messages for an add-on.
Would error when a language is not selected in the translation UI, and
new messages are generated by the update.
2024-06-04 18:42:17 +02:00
Bastien Montagne
b179378766 Fix (unreported) crash in I18N messages extraction script.
Using `bpy.types.OperatorProperties.__subclasses__()` has become utterly
unreliable now, to the point that it keeps references to freed (aka
unregistered) operators now, leading to crash when accessing them.

This commit refactors quite seriously the `dump_rna_messages` code, by
first listing all 'valid' classes, and then processing them all at once
in a flat iteration.

RNA classes are still generated from class hierarchy rooted on the
'virtual' `rna_struct` one, except for operators. These are now
generated by introspecting `bpy.ops` instead.
2024-06-04 18:42:17 +02:00
Brecht Van Lommel
5ce58d63b7 Fix: bl_info version from extension is string instead of int tuple
The extensions spec says this should use semantic version,
so it should always start with X.Y.Z numbers.

Co-authored-by: Campbell Barton <campbell@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/122687
2024-06-04 16:21:25 +02:00
Jeroen Bakker
c7807a425a EEVEE: Alias/remove legacy RNA material attributes
- `bpy.types.Material.blend_method` aliases `bpy.types.Material.surface_render_method`.
  'Opaque' and 'Alpha Clip' maps to deferred.
- Renamed `show_transparent_back` to `use_transparency_overlap`
- Renamed `use_screen_refraction` to `use_raytrace_refraction`
- Deprecate `use_sss_translucency` and `use_sss_translucency`

Related to: #113976

**NOTE**
The light probe changes will be done in a different patch.
Both patches should land just before we remove EEVEE Legacy
from the code-base.

Pull Request: https://projects.blender.org/blender/blender/pulls/122297
2024-06-04 14:48:40 +02:00
Campbell Barton
d002703484 PyAPI: fixes for defining operator macros
- Support passing in operator ID's using Python dot syntax.
- Support define operators that haven't yet been registered
  matching Blender's own behavior.

Also add doc-string for bpy.types.Macro.define.
2024-06-01 16:17:02 +10:00
Campbell Barton
90d513f7d3 Cleanup: improve checks for function types for RNA introspection
Function checks were too ambiguous making debugging difficult.
2024-06-01 16:08:56 +10:00
Brecht Van Lommel
d568abea62 Extensions: Install From Disk operator handling both legacy and new
When a user has downloaded an add-on as a zip file, it's not clear in
advance if this is a legacy add-on or a new extension. So they would
have to use trial and error, or inspect the zip file contents.

This uses a simple heuristic to check if the file is a legacy add-on,
and if so automatically calls the legacy operator instead.

The operator now show both extension and legacy add-on properties,
with the latter in a default collapsed subpanel.

Pull Request: https://projects.blender.org/blender/blender/pulls/121926
2024-05-31 16:22:08 +02:00
Campbell Barton
7b8cfc862f Cleanup: correct typo in variable name 2024-05-31 10:32:00 +10:00
Campbell Barton
ca9b105e6c Cleanup: spelling in comments 2024-05-28 13:47:43 +10:00
Damien Picard
b37d121e0a I18n: extract and disambiguate a few messages
Extract
- Add to Quick Favorites tooltip.
- "Mask", the name of a newly created mask (DATA_).
- "New" in the context of the new mask ID button.
- A few strings using BLI_STR_UTF8_ defines were not extracted.
  Take the special characters out of the translation macros.
- "External" menu items from the filebrowser's Files context
  menu (right-click on a file). These items were already extracted,
  but not translated.

Improve
- Separate formatted error message "%s is not compatible with
  ["the specified", "any"] 'refresh' options" into two messages.

Disambiguate
- Use Action context for new F-modifiers' names. This is already used
  for the "type" operator prop.
- Translate ImportHelper's default confirmation text using the
  Operator context, as it uses the operator name which is extracted
  with this context.
- "Scale" can be a noun, the scale of something, or a verb, to scale
  something. The latter mostly uses the Operator context, so apply
  this context to verbs, and the default contexts to nouns.
- "Scale Influence" can mean "Influence on Scale" (tracking
  stabilization) and "to Scale the Influence" (dynamic paint canvas).
- "Object Line Art" as type of Line Art to add, as opposed to the
  active object's Line Art settings.
- Float to Integer node: use NodeTree context for the node label, as
  this is already extracted and used for the enum.

Do not translate
- Sequencer labels containing only a string formatting field.

Some issues reported by Gabriel Gazzán and Ye Gui.

Pull Request: https://projects.blender.org/blender/blender/pulls/122283
2024-05-27 19:33:35 +02:00
Damien Picard
f5c4372531 Extensions: expose extension tagline to bl_info
An extension's optional "tagline" field is equivalent to a legacy
add-on's "description". This allows exposing the tagline as a
description in `bl_info`.

The main goal of this change is to expose extension taglines to the
translations, since the legacy description was already extracted.

Pull Request: https://projects.blender.org/blender/blender/pulls/122327
2024-05-27 19:30:14 +02:00
Damien Picard
8b8d58a7e5 I18n: extract UILayout headings with context
Some UI elements (row and column) can define a heading text.
Optionally, this text can use a custom translation context specified
through `heading_text`. This changes allows extraction of those
headings using the appropriate context instead of the default one.

Pull Request: https://projects.blender.org/blender/blender/pulls/122326
2024-05-27 19:28:23 +02:00
Bastien Montagne
a367cf664e Fix (unreported) I18N extraction tooling fully broken by some new strings in code.
Strings built by concatenating literals and pre-processor-defined
strings would lock the code extracting them for i18n forever.

This commit 'fixes' the issue by adding some support for these cases in
the `inbetween` regex snippet part of the 'extract string' complex regex
system, to avoid the lock.

The code has no way currently to extract the value of these defines
though, so they should not be used in translated strings.

NOTE: PR !122283 should do a propoer fix to these issues, by refactoring
the string building such that only actual strings pieces get processed
by the translation code.
2024-05-27 14:48:09 +02:00
Damien Picard
446a653cb7 I18n: improve add-on translation tooling
- Allow versions from bl_info to be strings
  Versions are now allowed to be strings in extensions using
  blender_manifest.toml, so this commit prevents them from being badly
  formatted on extraction to add-on translations.

- Do not export Blender copyright text to add-on translations
  This text is only relevant for Blender and maybe core add-ons, not
  for the general case.

- Copy comment lines from add-on .po files to .py translations
  Without this comments added by translators could be lost since they
  were not copied over to the Python files.

- Fix indentation in add-on translations
  Some lines in the translation dict were off by a few spaces. This
  resulted in linting tools complaining about the indentation.

- Do not escape messages in add-on translations multiple times
  When extracting add-on messages, they would get escaped multiple
  times, resulting in invalid strings when they contained quotes for
  example.

  This happened because on updating the messages from the ref
  ones (those actually extracted from Blender), each ref I18nMessage
  would be assigned to the corresponding language I18nMessage, without
  copy. When this message was escaped, it happened once for every
  language since they were actually the same object.

  To avoid this, I18nMessage objects are copied when merging.

-----

Example tuple before PR:
```python
translations_tuple = (
    (("*", ""),
     ((), ()),
     ("fr_FR", "Project-Id-Version: AnimAll 0...1.1...0 (0)\nReport-Msgid-Bugs-To: \nPOT-Creation-Date: 2024-05-26 17:10+0000\nPO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\nLast-Translator: FULL NAME <EMAIL@ADDRESS>\nLanguage-Team: LANGUAGE <LL@li.org>\nLanguage: __POT__\nMIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit",
               (False,
                ("Blender's translation file (po format).",
                 "Copyright (C) 2024 The Blender Authors.",
                 "This file is distributed under the same license as the Blender package.",
                 "FIRST AUTHOR <EMAIL@ADDRESS>, YEAR."))),
    ),
    (("*", "\\"Location\\" and \\"Shape Key\\" are redundant?"),
     (("extensions/user_default/animall/__init__.py:250",),
      ()),
     ("fr_FR", "",
               (False, ())),
    ),
    ...
```

After:
```python
translations_tuple = (
    (("*", ""),
     ((), ()),
     ("fr_FR", "Project-Id-Version: AnimAll 0.11.0 (0)\nReport-Msgid-Bugs-To: \nPOT-Creation-Date: 2024-05-26 17:06+0000\nPO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\nLast-Translator: FULL NAME <EMAIL@ADDRESS>\nLanguage-Team: LANGUAGE <LL@li.org>\nLanguage: __POT__\nMIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit",
      (False, ("FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.",))),
     ),
    (("*", "\"Location\" and \"Shape Key\" are redundant?"),
     (("extensions/user_default/animall/__init__.py:250",),
      ()),
     ("fr_FR", "",
      (False, ())),
     ),
    ...
```

Pull Request: https://projects.blender.org/blender/blender/pulls/122273
2024-05-27 13:33:49 +02:00
Campbell Barton
774f59dd07 Cleanup: remove unnecessary check left in last commit
Should have been removed in 236c0f61b1e1686f1b053a290c8b8a526f94721f.
2024-05-22 20:22:47 +10:00
Campbell Barton
236c0f61b1 Cleanup: avoid duplicate attribute access in scripts 2024-05-22 20:20:47 +10:00
Campbell Barton
096eed9d7f Cleanup: spelling in comments 2024-05-20 10:23:54 +10:00
Campbell Barton
6e6ce17e34 Addons: include addons_core/modules in sys.path when found
Renaming "addons" to "addons_core" should have included this change.
2024-05-16 15:18:42 +10:00