Commit Graph

196 Commits

Author SHA1 Message Date
Campbell Barton
91d5a639dc Extensions: prevent install/upgrade while sync is in progress
When syncing in the background the UI could refresh immediately
before clicking making it possible for the user to install the wrong
extension. Since install also enables the extension, it meant it was
too easy to accidentally run untrusted code.

Disable install/upgrade while sync runs.

Also tweak text alignment and use round brackets for "(disabled)"
extensions.
2024-06-21 16:51:57 +10:00
Campbell Barton
72af4d0977 Cleanup: use a set to store enabled add-on module names
Was using a dictionary when the value was never used.
2024-06-21 16:03:11 +10:00
Campbell Barton
78a5ade1be Extensions: remove disabled UI logic 2024-06-21 15:42:11 +10:00
Campbell Barton
c312f20627 Extensions: add an extension menu for each extension
Use a per-extension menu so extra functionality can be accessed from
one place.

- The install/upgrade button remains top-level.
- "Uninstall" and "Visit Website" have been moved into the menu.
- Theme extensions can be set from the menu.
- Installed add-on extensions have a "View Details" menu item
  to switch to the add-ons view (useful to access preferences).

Based on design by Pablo & Dalai.

Co-authored-by: Pablo Vazquez <pablo@blender.org>
Co-authored-by: Dalai Felinto <dalai@blender.org>
2024-06-21 15:41:45 +10:00
Campbell Barton
91ba2e10ba Extensions: avoid duplicate "." for legacy add-on descriptions 2024-06-21 12:48:33 +10:00
Campbell Barton
38e25d7838 UI: tweaks to extension & addon items
- Use line separator over box instead of separate boxes.
- Format web-links with a label, then the button instead
  of positioning the buttons side-by-side.

Changes by Brecht with minor edits (see !123420).

Co-authored-by: Brecht Van Lommel <brecht@blender.org>
2024-06-21 11:34:10 +10:00
Campbell Barton
72ef03d5a1 Extensions: split add-ons & extensions into separate preferences
Add back the "Add-ons" preferences, removing add-on logic from
extensions.

- Add support for filtering add-ons by tags
  (separate from extension tags).
- Tags now respect the "Only Enabled" option.
- Remove the ability to enable/disable add-ons from extensions.
- Remove add-on preferences from extensions.
- Remove "Legacy" & "Core" prefix from add-on names.
- Remove "Show Legacy Add-ons" filtering option.

Implements design task #122735.

Details:

- Add-on names and descriptions are no longer translated,
  since it's impractical to translate text which is mostly
  maintained outside of Blender.
- Extensions names have a `[disabled]` suffix when disabled so it's
  possible to identify installed but disabled extensions.
- The add-on "type" is shown in the details,
  so it's possible to tell the difference between an extension,
  a core add-on & a legacy user add-on.
- Icons are also used to differentiate the add-on type.
- User add-on's must be uninstalled from the add-ons section
  (matching 4.1 behavior).
- Simplify logic for filtering tags, move into a function.
2024-06-21 10:42:53 +10:00
Brecht Van Lommel
5a2053a8b6 Fix: Missing description for Copy Global Transform add-on 2024-06-20 14:25:04 +02:00
Campbell Barton
1eda5bca68 Fix error with all local extensions showing as orphan
Also correct wording in install-file help text.
2024-06-20 21:56:31 +10:00
Campbell Barton
801e47f42a Extensions: support "Install from Disk" for remote repositories
When installing from disk, include remote repositories in the list.

- Works with drag & drop from file system.
- This is the only way to "downgrade" an extensions.
2024-06-20 17:10:01 +10:00
Campbell Barton
e2522e5f03 Extensions: support displaying "Orphan" extensions
Extensions in remote repositories that have no remote entries (orphans)
are now listed in the UI and the "list" sub-command.

Required for installing into remote repositories from disk (see #122302)

Details:

- Consistent ordering (local, remote) arguments.
- Use zip(..., strict=True) when sequences are expected to be aligned.
2024-06-20 15:16:05 +10:00
Campbell Barton
da3461f8eb Fix #123241: Wrong dialog shown when dropping an unsupported package
Dropping an extension URL for an incompatible package displayed the
"Unknown Repository" dialog.

Resolve by detecting the case of an unknown package being dropped from
a known repository. Noting the package may not be compatible.
2024-06-19 20:47:55 +10:00
Campbell Barton
6eb2b5f47b Fix local extension errors being shown as remote errors
Also fix error with non extension add-on display by removing
an exception for extensions which is no longer needed.
2024-06-19 15:58:45 +10:00
Campbell Barton
1ed6449c82 Extensions: better error message when already installed
Change the main error messages that happens when we drag and drop an
extension URL.

Ref !123242

Co-authored-by: Dalai Felinto <dalai@blender.org>
2024-06-18 19:49:36 +10:00
Campbell Barton
09be28794a Fix references to undefined modules/variables, remove unused import 2024-06-18 19:21:15 +10:00
Campbell Barton
f98e422e63 Extensions: support build --split-platforms, generated manifest data
- Add an option to build a separate package for each platform, this is
  useful to produce smaller packages when large wheels are included.

- Add a reserved field: "[build.generated]" to the manifest when
  splitting by platform which overrides the root-level platform
  when it exists.
2024-06-18 16:29:57 +10:00
Bastien Montagne
b143cc1885 I18N: Remove 'edit translation' features from the Blender UI.
This feature was not maintained for a long time already, and would have
required a lot of work to make it sensible and usable after 'recent'
changes (like the move to weblate translation platform).

For details see also
https://devtalk.blender.org/t/ui-translation-tools-remove-edit-translation-feature-from-blender-ui-in-4-2lts-release/34947
2024-06-17 12:17:55 +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
Campbell Barton
5b30ded989 Extensions: support enabling a repository with drag & drop
When dropping an extension onto a repository which is disabled,
show a popup that optionally enables the disabled repository.

Part of #120665.
2024-06-15 00:22:36 +10:00
Campbell Barton
a25c386c4a Extensions: remove add-on local preferences
This was only being used for a single debugging option,
additional developer reports are now used when enabling
the extensions debugging option (under experimental).
2024-06-14 15:32:07 +10:00
Campbell Barton
e93f0ee53a Extensions: add network timeout and connection limit preferences
These settings are used when running extension updates but may be
used for any operations that perform online access.
2024-06-14 15:32:07 +10:00
Campbell Barton
176864ab03 Extensions: install all updates in parallel
Run each update as a separate job, previously updates for each
repository was split into a separate job however that would only
use parallel connections with multiple online repositories which
isn't used by default. Currently the connection limit is hard-coded but
will be made into a preference.
2024-06-14 15:12:23 +10:00
Campbell Barton
04f310a19a Extensions: simplify access to manifests when refreshing the remote
The internal API call to refresh remote data wasn't returning
the resulting data, making it inconvenient to refresh & access
remote meta-data from a single repository.
2024-06-14 15:12:21 +10:00
Campbell Barton
2dd339bff3 Extensions: quiet warnings from pylint
Some warnings remain which need further investigation.
2024-06-14 15:12:19 +10:00
Campbell Barton
7952f35292 Extensions: filter out extensions by platform and blender version
Exclude extensions which aren't supported by the Blender version or
the platform (for platform dependent extensions).
2024-06-14 15:12:18 +10:00
Campbell Barton
248a5258e0 Extensions: various fixes
- Fix an unhandled exception listing a repository with no remote data.
- Exclude dot-files from being listed when generating a repository.
- Fix missing import (in an unlikely corner case) when accessing
  tags before the repository data was initialized.
- Fix refresh refreshing the remote not updating the
  internal remote meta-data.
- Suppress warnings in tests caused by default repositories
  (now removed before resting).
2024-06-14 15:12:16 +10:00
Damien Picard
f87d4e4e40 I18n: Extract and disambiguate a few messages
Extract
- Cycles denoiser enum.
- Extensions user preferences UI.
- Node operator poll message from new node function.

Improve
- Split "(Enabled|Disabled) on startup, overriding the preference."
into two messages.

Disambiguate
- "Add" when describing the action of adding something should use the
  Operator context.
- "Dimensions", in noise textures.
- "Transform" as a noun, the matrix transform type of Geometry Nodes,
  as opposed to the verb to move things in space.
- "Parent" as a noun or verb (the parent of an object, to parent an
  object to another).

Some issues reported by Satoshi Yamasaki, deathblood, and Gabriel Gazzán.

Pull Request: https://projects.blender.org/blender/blender/pulls/122969
2024-06-13 12:15:55 +02:00
Campbell Barton
c6680ce7ca Extensions: include the version by default when building packages
Use the `{manifest_id}-{version}.zip` for the generated file
unless an explicit name is given.

Exclude all *.zip files located in the package root.
2024-06-12 22:38:32 +10:00
Campbell Barton
bda9a44785 Extensions: use "v1" version for the generated repository meta-data 2024-06-12 22:38:32 +10:00
Sergey Sharybin
2cdd9c1b2c Fix: Syntax error after recent extensions change
Caused by 4d8eea1402c.
2024-06-12 12:08:59 +02:00
Campbell Barton
4d8eea1402 Extensions: convert package listings into a dictionary when loaded
Changes to the remote repository JSON format hadn't been properly
accounted for, a quick-fix was left in that converted the JSON
package listing into a dictionary as it was accessed (every redraw).

Update the behavior to perform the conversion when loading the data
from the JSON. This is also needed for multi platform & blender-version
support.
2024-06-12 16:50:08 +10:00
Campbell Barton
c99a40b286 Extensions: basic validation of remote repository data
Prevent non-compliant data in remote repositories from causing errors
in Blender's interface.

Move from a dictionary to a named-tuple which uses normalized values.
2024-06-12 15:13:04 +10:00
Campbell Barton
820fc124d4 Extensions: store repository data in a named tuple
No functional changes, adding more specific typing information helps
with further improvements.
2024-06-12 12:41:40 +10:00
Campbell Barton
cd741650d0 Fix incorrect check for the extension manifests time-stamp
The time-stamp on the directory was checked, not the manifest file.
2024-06-12 12:36:55 +10:00
Campbell Barton
43356044eb Extensions: add the ability to create a repository that doesn't exist
When dropping a URL from an unknown repository add a dialog to support
adding a new repository.
2024-06-11 22:37:29 +10:00
Campbell Barton
f7d5d6d88f Fix error canceling an extension operator before it's started 2024-06-11 22:37:29 +10:00
Damien Picard
df2ee7298c I18n: Make Node Wrangler's support level OFFICIAL
The bl_info dictionary is deprecated for most extensions, but it is
still used for core add-ons and since Node Wrangler is now built-in,
it should be marked as official.

The reason for this change is actually that it enables translation of
the Node Wrangler UI, because add-ons below official support level
were never considered for translation.

-----

The reason only OFFICIAL add-ons are translated is that they are enabled [here](4f36fb1afe/scripts/modules/bl_i18n_utils/bl_extract_messages.py (L1052)) during message extraction.

Pull Request: https://projects.blender.org/blender/blender/pulls/123043
2024-06-11 14:30:32 +02:00
Campbell Barton
12ff1ffe5b Extensions: remove add-ons which don't have a built-in upgrade opton
Previously these were shown as missing add-ons, since they have been
intentionally removed, remove them as part of versioning instead
of showing them as "Missing Add-ons". This is especially important
for X3D & STL which were enabled by default which meant any user
loading 4.1 preferences would have them shown as missing add-ons.
2024-06-11 19:53:38 +10:00
Campbell Barton
b46f6a4007 Extensions: add sub-modules that weren't being reloaded 2024-06-11 16:19:21 +10:00
Campbell Barton
a24add4a66 Extensions: support read-only system repositories
Local repositories no longer convert manifest files into a JSON file
(that matched the format of the remote repositories JSON data).
Instead the data is loaded directly from the manifest files.

This is necessary to support read-only "System" repositories.

Use a class to generalize loading from both data sources to simplify the
implementation which was previously inlined.

This fixes an error where stale data from the manifests was
sometimes used because the generated JSON was considered up to date.
2024-06-11 15:59:29 +10:00
Campbell Barton
714d5515a3 Unbreak extensions test 2024-06-11 13:38:04 +10:00
Campbell Barton
c3067dd62d Extensions: group refresh actions in the menu
- Rename "Check for Updates" to "Refresh Remote"
- Rename "Refresh All" to "Refresh Local"
2024-06-10 23:14:53 +10:00
Campbell Barton
c0754209ef Extensions: suppress warnings when repository directories don't exist
Re-calculating statistics for outdated packages printed exceptions
whenever the repository directory didn't exist.
2024-06-10 22:46:20 +10:00
Campbell Barton
554b3c5bd9 Extensions: support custom-directory for system repositories
While this is reasonably obscure, not supporting this caused the UI
to be confusing and there is no strong reason not to support this.
2024-06-10 22:22:07 +10:00
Campbell Barton
26bddd6c66 Fix error adding a repository when offline
Workaround the exception although other methods of syncing that
don't call the operator are worth investigating.
2024-06-10 21:39:19 +10:00
Campbell Barton
e0612b3c03 Fix undefined variable use when an extension repo has no remote data 2024-06-10 21:26:45 +10:00
Damien Picard
de139dd7e4 UI: Fix and improve a few messages
- "Show the result of running commands in the main interface...": add
  punctuation.
- "Re-Installed" -> "Reinstalled" seems more common.
- "increase_" and "decrease_subdivision" in the Grease Pencil
  modal...: use title case instead of snake case for label.
- "Use a automatic number..." -> "an", typo.
- "... points,{} splines": missing space.
- "End Frame is larger than Start Frame": wrong order in error message.
- "Approximate the object as sphere, which diameter is equal to
  thickness the defined...": grammar.
- "Show Seconds" -> "Use Timecode": this option is not necessarily about
  seconds. Suggested by Pablo Vasquez.
- Brightness and contrast node input descriptions: add missing spaces.
- "Gamma controls the relative intensity... full white.": remove
  trailing ".".

Pull Request: https://projects.blender.org/blender/blender/pulls/122972
2024-06-10 13:26:05 +02:00
Nathan Burnham
852d658a85 PyAPI Doc: fix formatting error
Ref: !122983
2024-06-10 17:01:00 +10:00
Campbell Barton
5fda92a44f Extension: defer loading extensions JSON/TOML meta-data until needed
Repositories JSON & manifests were being loaded at startup.
Lazily load this data to prevent unnecessary overhead.
2024-06-10 00:24:00 +10:00
Campbell Barton
ff5909e441 Extensions: restore the "Refresh" operator
The old add-ons UI had a "Refresh" operator that would re-scan
the file-system and show any changes.

Add an equivalent operator that works for both extensions and legacy
add-ons and add it to the extension menu.

This is useful for a few situations:

- Refresh based on changes to "System" repositories which are read-only
  from Blender and intended to be manipulated outside of Blender.
- Anyone managing their own "User" repository.
- For developers to create extensions, where re-starting to see changes
  to meta-data is inconvenient.
- Troubleshooting problems parsing extension meta-data as problems are
  reported to the operator.
2024-06-09 20:20:27 +10:00