293 Commits

Author SHA1 Message Date
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
Campbell Barton
744819cf9b Addons: only ever check "addons_core" for bundled add-ons
Avoid checking every scripts directory for add-ons core,
as creating this directory would cause "addons" to be ignored.
2024-05-16 15:06:10 +10:00
Campbell Barton
ecec9de4e6 Cleanup: remove internal argument to override the support level
This was only ever used for addons_contrib which has been removed.
2024-05-16 09:03:16 +10:00
Campbell Barton
c4a0bbb1f4 Extensions: Support online extensions and move add-ons outside Blender
The extensions system allows to extend Blender with connectivity to the internet. Right now it means Blender can
discover and install add-ons and themes directly from the internet, and notify users about their updates.

By default this is disabled (opt-in), and users can enable it the first time they try to install an extension or visit
the Prefences > Extensions tab. If this is enabled, Blender will automatically check for updates for
extensions.blender.org upon startup.

When will Blender access the remote repositories:

* Every time you open the Preferences → Extensions: ALL the enabled repositories get checked for the latest info (json)
* Every time you try to install by dragging: ALL the enabled repositories get checked for the latest info (json).
* Every time you start Blender: selected repositories get checked for the latest info (json).

------------------

From the Blender code point of view, this means that most of the add-ons and themes originally bundled with Blender
will now be available from the online platform, instead of bundled with Blender. The exception are add-ons which are
deemed core functionality which just happened to be written as Python add-ons.

Links:
* Original Extenesions Platform Announcement: https://code.blender.org/2022/10/blender-extensions-platform/
* Extensions website: https://extensions.blender.org/
* User Manual: https://docs.blender.org/manual/en/4.2/extensions/index.html#extensions-index
* Technical specifications: https://developer.blender.org/docs/features/extensions/
* Changes on add-ons bundling: https://devtalk.blender.org/t/changes-to-add-on-bundling-4-2-onwards/34593

------------------

This PR does the following:

* Move extensions out of experimental.
* No longer install `scripts/addons` & `scripts/addons_contrib`.
* Add `scripts/addons_core` to blender's repository.

These add-ons will still be bundled with Blender and will be always enabled in the future, with their preferences
moved to be more closely integrated with the rest of Blender. This will happen during the remaining bcon2 period.
For more details, see #121830

From scripts/addons:

* copy_global_transform.py
* hydra_storm
* io_anim_bvh
* io_curve_svg
* io_mesh_uv_layout
* io_scene_fbx
* io_scene_gltf2
* pose_library
* ui_translate
* viewport_vr_preview

Extra: bl_pkg (scripts/addons_contrib)

Note: The STL (legacy) add-on is going to be moved to the extensions platform. There is already a C++ version on core
which is enabled by default.

All the other add-ons are already available at extensions.blender.org. To use them you need to:

* Go to User Preferences > Extensions
* You will be greated with an "Online Extensions" message, click on "Enable Repository".
* Search the add-on you are looking for (e.g, Import Images as Planes).
* Click on Install

Over time their maintaince will be transferred over to the community so their development can carry on. If you used to
help maintain a bundled add-on please read: https://devtalk.blender.org/t/changes-to-add-on-bundling-4-2-onwards/34593

Ref: !121825
2024-05-15 19:26:29 +02:00
Lukas Tönne
7a3cd753ba GPv3: Fill tool to generate strokes in empty areas
Implementation of the GPv2 Fill tool in Grease Pencil 3.

This tool creates new strokes where the user clicks, by rendering
strokes into an image and then performing flood-fill and boundary
search operations.

This is a minimal first part, several features of the GPv2 tool are
still missing (gap filling methods, smoothing, dilate/erode).

Co-authored-by: Falk David <falk@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/120693
2024-05-15 13:36:06 +02:00
Bastien Montagne
b8febd87e1 Fix #121712: outdated mapping between UI translations and Doc languages.
Both lists got heavily out of sync over the years.

Some day would be nice to have this managed in a single place.
2024-05-14 16:53:00 +02:00
Campbell Barton
2c47937a96 Extensions: add Preferences.extensions
Accessing extensions options in preferences.filepaths didn't make so
much sense.
2024-05-15 00:52:23 +10:00
YimingWu
c324c19765 Fix #121021: Avoid size change of addon_modules during iteration
Copy modules before filtering `addon_modules` to avoid
change of dictionnary size during iterations. Otherwise errors
can be triggerd when running `python -m pytest test.py` since
it may modify the module dict.

Co-authored-by: Alexis-19 <alexis-19@noreply.localhost>
Pull Request: https://projects.blender.org/blender/blender/pulls/121100
2024-05-11 08:58:20 +02:00
Christoph Lendenfeld
eee32726c7 Fix #121349: Baking adds keys on custom properties that are non-keyable
When keying custom properties that are defined by an addon,
you can't use square brackets. The GUI buttons already reflect that.
The baking code and the keyframe insertion code didn't respect
that and so were able to key properties that are defined as non-keyable.

## Solutions
I've solved the issue on the C++ side by resolving
the path twice, once without and in case that didn't work the
second time with brackets. While that does solve the issue
this feels really dirty and I feel like I am misusing the system here.
**However it is absolutely needed**.
When resolving a path with brackets to a property defined
by an addon, you get an `IDProperty` disguised as a `PropertyRNA`
which will not have the correct flags set.

By checking if a property `is_animatable` in python, all that do not have that can be skipped.
Also making sure the path is passed without brackets in the correct cases.

Pull Request: https://projects.blender.org/blender/blender/pulls/121520
2024-05-10 17:03:52 +02:00
Sergey Sharybin
149e547de6 Compositor: Remove quality setting from DNA and UI
It was meant to be included into the previous commit in the area,
but was forgotten due to some technicalities.

Also remove the DisplaceSimpleOperation, which is now not used.

Pull Request: https://projects.blender.org/blender/blender/pulls/121580
2024-05-08 16:56:32 +02:00
Sergey Sharybin
6db8091f45 Compositor: Remove Two Pass option
There are few issues with the logic and implementation of this option:

- While the first pass is faster in the terms of a wall-clock time, it
  is often not giving usable results to artists, as the final look of
  the result is so much different from what it is expected to be.

- It is not supported by the GPU compositor.

- It is based on some static rules based on the node type, rather than
  on the apparent computational complexity.

The performance settings are planned to be moved to the RenderData, and
it is unideal to carry on such limited functionality to more places. There
are better approaches to quickly provide approximated results, which we can
look into later.

Pull Request: https://projects.blender.org/blender/blender/pulls/121558
2024-05-08 14:34:11 +02:00
Campbell Barton
3d84a1170f Extensions: ensure extensions "site-packages" precede Python's
Ensure extensions modules aren't overridden to the systems modules.
Without this, installing a system module could break an extension.
2024-05-08 21:32:16 +10:00
Campbell Barton
95fcffed4a Cleanup: remove debug print 2024-05-03 23:23:35 +10:00
Campbell Barton
f6b7464b4c Cleanup: spelling in comments 2024-05-02 16:44:10 +10:00
Campbell Barton
0a17f4a711 Extensions: add an extensions-local site-packages
This will be used as the destination location for wheels.
Currently this is only added to the `sys.path` if it already exists.
2024-05-02 12:49:02 +10:00
Sergey Sharybin
ad8cb0cff3 Use the redirect.b.o website for bug reports
There should be no functional changes on user level, just allows
to more easily do tweaks to the bug report template without worrying
about compatibility with Blender.

With this change it is only GPU, OS, and such are passed to the URL,
without actual text.

Ref infrastructure/blender-projects-platform#78

Pull Request: https://projects.blender.org/blender/blender/pulls/121215
2024-04-30 14:56:33 +02:00
Campbell Barton
0c4117f24a Linux: only allow registering file association for portable builds
Disable registering file associations on Linux for system-installations
and snap packages, details in code-comments.
2024-04-30 15:48:46 +10:00
Campbell Barton
5088b0154d Cleanup: replace %-formatting with str.format in scripts/modules/
The "bl_i18n_utils" module has been excluded I'm not sure how best
to run it with reasonable code coverage.
2024-04-27 16:06:51 +10:00
Campbell Barton
dd864603f1 Cleanup: minor change to string formatting & __file__
Use __repr__ for formatting file instead of __str__ because non-standard
characters will be escaped and the string will be properly quoted.

Also, a modules __file__ is not *guaranteed* to be a string
(although it almost always is), nevertheless, __repr__ generally
results more more humanly readable results.

Note that __repr__ was already used to format __file__ in most places.
2024-04-27 11:58:02 +10:00
Sietse Brouwer
4fbef3dc6b GPv3: Cutter tool
This PR implements the Cutter Tool for GPv3. The Cutter tool deletes
points in between intersecting strokes. New points are created at the
exact intersection points, so as a result the cutted strokes will fit
perfectly.

For feature parity, the tool follows the GPv2 behavior:

- The cutter tool works on all editable layers.
- Intersections are only detected for curves on the same layer,
so intersection of curves on _seperate_ layers are not handled.

Technical notes
The implementation uses the `compute_topology_change` function
created for the Hard Eraser. So at intersection points, point
attributes will be interpolated.

Pull Request: https://projects.blender.org/blender/blender/pulls/113953
2024-04-22 14:05:22 +02:00
Jeroen Bakker
0c2085a316 GPU: Remove GPU_compute_shader_support
Compute shaders are required since 4.0. There was one occasion where
an older AMD driver failed and support was turned off. This driver
is now marked unsupported.

This PR includes:
- removing the check in viewport compositing
- remove properties from system info
- always construct draw manager.
- remove unused pass logic in draw hair/curves
- add deprecation warning when accessed from python

Pull Request: https://projects.blender.org/blender/blender/pulls/120909
2024-04-22 13:28:10 +02:00
casey bianco-davis
2df13ce4a3 GPv3: Primitive Tools: Line, Polyline, Arc, Curve, Box and Circle Tool
Adds the primitive tools in draw mode to GPv3.

This also adds rotation and scale sub-operators with `r` and `s` keybinds.
Also all control points are editable after extruding.

Pull Request: https://projects.blender.org/blender/blender/pulls/119039
2024-04-22 10:48:03 +02:00
Campbell Barton
06adfcaf38 Cleanup: unused imports 2024-04-19 16:09:30 +10:00
Campbell Barton
4e8b24f1d1 Cleanup: spelling in comments & punctuation 2024-04-19 15:57:06 +10:00
Campbell Barton
9cb3a17352 Linux: freedesktop support for file type association
Support freedesktop file association on Linux/Unix via the command line
arguments: `--register{-allusers}` `--unregister{-allusers}` as well
registration actions from the user preferences.

Once registered, the "Blender" application is available from launchers
and `*.blend` files are assoisated with the blender binary used for
registration.

The following operations are performed:

- Setup the desktop file.
- Setup the file association & make it default.
- Copy the icon.
- Setup the thumbnailer (`--register-allusers` only).

Notes:

- Registering/unregistering for all users manipulates files under
  `/usr/local` and requires running Blender as root.
  From the command line this can be done using `sudo`, e.g.
  `sudo ./blender --register-allusers`.
  From the GUI, the `pkexec` command is used.

- Recent versions of GNOME execute the thumbnailer in a restricted
  environment (`bwrap`) requiring `blender-thumbnailer` to be copied
  into `/usr/local/bin` (synlinks don't work).
  So thumbnailing copies the binary rather than linking and only works
  when registering for all users.

Ref !120283
2024-04-18 11:19:00 +10:00
Damien Picard
c306677119 I18n: extract and disambiguate a few messages
Extract
- Statuses for the external text editor
- Newly created enum node item
- Newly created plane track data
- Newly created custom orientation data
- Operator names in drag and drop menu (need to use operator's
  translation context)
- GN attribute statistic node inputs

Disambiguate
- Single-letter colors: A and B can mean Alpha and Blue, or simply A
  and B as in two operands in an operation
- Dissolve: issue reported by Tamar Mebonia in #43295
- Translate in the User Preferences. This introduces a new
  BLT_I18NCONTEXT_EDITOR_PREFERENCES ("Preferences") translation
  context
- Planar (reported by deathblood)
  This one is incomplete, because there is currently no way to
  disambiguate presets or GN fields. I don't see how either could be
  achieved cleanly.
  The former would need to define the context inside the preset and
  evaluate the file prior to showing it in the presets menu, which
  sound bad.
  The latter would need to introduce an additional string inside
  `FieldInput`s, which would be controversial given how little it
  would be used.

Remove
- Unused translation `iface_("%s")` in toolbar
- Remove obsolete N_() tags in a few node descriptions.

Pull Request: https://projects.blender.org/blender/blender/pulls/119065
2024-04-15 12:02:17 +02:00
Campbell Barton
d5f837a8ee Cleanup: remove redundant string formatting 2024-04-12 10:04:07 +10:00
Julian Eisel
335d379667 UI: Indicate type of search in keymap search button
Shows either "Search by Name" or "Search by Key-Binding" as placeholder text in
the search button. This makes it more clear what's expected to be entered here.

Personally I often did/do the mistake of searching for the wrong thing in this
button, because I forgot that I changed it earlier. The placeholder text can
avoid this mistake.

Pull Request: https://projects.blender.org/blender/blender/pulls/113681
2024-04-10 16:36:58 +02:00
Jesse Yurkovich
509a7870c3 Collection Exporters: Enable file exporters to be specified on Collections
This implements the ability to have file exporters added and configured on Collections.

Exporting is reachable from several locations:
- Individually on each exporter configuration: The `Export` button in each panel header
- For all exporters on the collection: The `Export All` button in the main panel interface
- For all exporters on all collections in the scene: The `File`->`Export All Collections` button

Visibility of which collections currently have exporters configured is done by ways of an icon added to the Collection row in the Outliner.

Adding multiple exporters for the same file type is permitted. The user is free to setup several exports of the same format but with different file locations or settings etc.

Notes:
Only USD and Wavefront OBJ are enabled for the initial commit. Additional formats, including those implemented in Python will be added as separate commits after this.

Ref #115690
Pull Request: https://projects.blender.org/blender/blender/pulls/116646
2024-04-08 22:10:39 +02:00
Campbell Barton
ae950451ea Cleanup: remove redundant f-string use 2024-04-01 16:51:32 +11:00
Hans Goudey
e6808cd558 Cleanup: Make format 2024-03-28 20:55:23 -04:00
Jesse Yurkovich
af7a34dee7 ImportHelper: Common methods for FileHandler drag and drop support
Provide common implementations for two operations that all Python
FileHandlers will typically use.

- `poll_file_object_drop` To be used inside the FileHandler `poll_drop`
   callback
- `invoke_popup` To be used inside the Operator `invoke` callback

The above code closely mirrors what is currently done inside the
existing Blender c++ FileHandlers.

Pull Request: https://projects.blender.org/blender/blender/pulls/119774
2024-03-29 01:22:51 +01:00
Campbell Barton
44defbd2c7 Extensions: add BLENDER_USER_EXTENSIONS user directory
Replace: `{BLENDER_RESOURCE_PATH_USER}/extensions`
With:    `{BLENDER_USER_EXTENSIONS}`

This follows BLENDER_USER_CONFIG & BLENDER_USER_SCRIPTS conventions.
Reading the environment variable and accessible via
`bpy.utils.user_resource('SCRIPTS')`
2024-03-22 16:08:25 +11:00
Campbell Barton
6bfc8612bf Cleanup: remove BLENDER_USER_AUTOSAVE
This was only used on WIN32 when the temporary directory didn't exist.
When the check was added [0] this made some sense because it relied on
`U.tempdir` existing, since then additional checks have been added to
ensure a temporary directory can be used. Further, this fall-back
location isn't documented in the user manual.

[0]: 615db01b01c4ad96d8e712aa5469d9eb3ada0d07
2024-03-22 16:08:25 +11:00
Aaron Carlisle
02578117cd Merge branch 'blender-v4.1-release' 2024-03-21 23:48:14 -04:00
Aaron Carlisle
365f5f8823 Docs: Update rna manual references 2024-03-21 23:47:15 -04:00
Campbell Barton
429959e268 UI: always report to the user when an add-ons fail to load
Failure to import the module would print a message but not show
any feedback to the user - failing silently.
2024-03-21 16:57:31 +11:00
Campbell Barton
3cb687c32c addon_utils: show a useful error when loading a module without a file
When loading an add-on without a __file__ set the "cause" was empty.

Now the modules __path__ is included (when available) which points
to the path that failed to load to help with troubleshooting.
2024-03-21 16:54:15 +11:00
Campbell Barton
16919ea5f2 Fix addon_utils.enable() error when the module has no __file__
Although this error isn't specific to extensions, extensions containing
a blender_manifest.toml but no __init__.py would import a module
with the __file__ set to None.
While there is logic to handle this case, it didn't account for modules
already in sys.modules with __file__ set to None.

From a user perspective enabling the extension silently failed raising
an error on the second attempt to enable.
2024-03-21 16:54:15 +11:00
Campbell Barton
98fed4f50c System Info: correct title in background mode 2024-03-21 14:11:30 +11:00
Campbell Barton
0b13d1f31a Extensions: suppress noisy "bl_info" prints unless --debug-python is set
Ref !119521
2024-03-20 15:43:40 +11:00
Campbell Barton
4ed06c648d Fix #119664: Persistent state not set when disabling add-ons
The wrong persistent attribute was set when disabling an add-on,
also correct the message when disabling an already disabled add-on.
2024-03-20 11:56:25 +11:00