This reverts commit 90b85d5d17.
While this feature was properly implemented, and "built to spec", the
decision to have it was bit rushed (by me).
For now we will not have this feature in 5.3. In the future we can
support this while adding more guardrails when users click on a link
that sends them to a non blender.org url.
I talked to Guillermo about it.
Fix two issues in the asset listing downloader CLI command:
- Add missing argument for the `RemoteAssetListingDownloader()`
constructor (issue introduced in a9e061dc90).
- Gracefully handle the case where the `__main__` module has no
`__file__` attribute.
Pull Request: https://projects.blender.org/blender/blender/pulls/163742
This adds the `UILayout::property_split_factor` property which contains
the split factor used in the layout system, and avoids to use the this
as raw value all over the place.
Pull Request: https://projects.blender.org/blender/blender/pulls/163393
This PR moves the controls of "Use Unified xxx" (such as Use Unified
Size) from the scene / mode level to the brush level, meaning each brush
can have this option toggled on and off separately. It used to be that
every brush shares the same toggle state.
I moved the `UNIFIED_xxx` flags from `UnifiedPaintSettings` to `Brush`.
Ialso added relevant RNA properties and hooked them up to Python
scripts.
Resolves#138469
Pull Request: https://projects.blender.org/blender/blender/pulls/159382
Many key maps were missing from the preferences,
expose them based on updated tests (see !162440).
Also ensure "Generic" tool keymaps use an "EMPTY" space type,
since they are shared between spaces.
Ref !162440
Many UI messages are extracted from the OpenColorIO config, including
color spaces and families, displays, views, view transforms, and
looks.
The risk of a translation collision between these data and other
messages is quite high, especially if using an OCIO config other than
the built-in one.
This commit changes extraction and translation so that all these
strings are translated with the new "Color Management" translation
context. It does not reuse the existing "Color" context, in the
unlikely event of a collision with other color-related stuff in the
UI.
Suggested by Bastien Montagne while reviewing !160883.
Pull Request: https://projects.blender.org/blender/blender/pulls/161053
Removed check for pointer return types, so pointer return types
use `T | None` unless `PROP_NEVER_NULL` is set.
This corrects the return type for UILayout.panel_prop(),
although many functions will now be documented as `T | None`,
requiring `PROP_NEVER_NULL` to be set to correct generated docs.
Ref !162390
Legacy add-ons have a support level property, which can be Official,
Community, or Testing. This was used prior to 4.2 to filter add-ons,
but is no longer exposed in the UI.
The Testing level may or may not be available, depending on the stage
in the development cycle. This makes it appear and disappear
frequently from the translation files, which causes unneeded work for
translators.
This commit removes the Testing level entirely, making the property
items static. This should not be an issue because no built-in add-on
uses the Testing level anyway since the contrib repository was
archived.
Pull Request: https://projects.blender.org/blender/blender/pulls/162235
This introduces access tokens to Asset Libraries.
* The access tokens use the same Bearer Authentication as used by
extensions.
* This reset the token if "use_auth_token" is disabled. Actually it set
it to random values and then set it to null, to avoid it lingering in
memory. This could also be implemented for extensions repository.
Pull Request: https://projects.blender.org/blender/blender/pulls/162163
Own regression [0] broke extensions that depend on core
extensions to have already been loaded.
Note that prior to 5.2, toggling a core add-on would re-order it
last - so depending on the load order wasn't reliable.
Nevertheless, order core add-ons first matching the default order in 5.1
and prior to account for extensions that depended on this load order.
[0]: 274e52fad2
This commit makes fairly extensive changes to how the code parses and
handles formatting tokens (both 'printf' and 'format' syntaxes), and the
escaping of LTR sequences in RTL languages pre-processing. It should also
be noticiably more performant.
* Factorize formatting tokens parsing into a new utils (`FormatToken` in
`utils_format.py`). Improve its parsing logic by skipping blocks of
text until the next potential token, and using a cheaper logic to find
this potential token starting index.
* Implement same 'skipping' logic in RTL escape code
(`protect_format_seq` in `utils_rtl.py`).
* Use this new FormatToken API both in code validating translated
messages (`I18nMessages::check`) and handling RTL languages
(`I18nMessages::rtl_process`).
Note: A WIP version of these changes was used to fix#161681 in Blender
5.2 (see !162050).
Add support for setting the minimal/until Blender versions for assets
with markers in the filename. This makes it possible to replace assets
for newer versions of Blender, while keeping the older versions around
for backward compatibility.
The minimal required version of Blender can be encoded in the filename
by using a `@bX_Y` marker, for example `filename@b5_3.blend` if the
assets in that file require Blender 5.3 or newer. This also has an
effect on the file `filename.blend` if it exists, as assets from that
file will get their 'until' field set to 5.3 as well.
A concrete example with three files:
- `filename.blend`: used on Blender versions older than 5.3.
- `filename@b5_3.blend`: used from 5.3 until 6.0 (exclusive).
- `filename@b6_0.blend`: used from 6.0 onward.
This naming scheme has the advantage that the `filename.blend` file
itself does not have to change (and thus does not need re-downloading)
when a successor is added to the library. The only thing that changes is
its asset listing.
Finer granularity than major & minor versions is not possible, so this
does not work to replace an asset between versions 5.3.0 and 5.3.1.
Blender 5.2 already supports the `min` and `until` fields that this
mechanism sets. This PR just adds the functionality to the listing
generator, so that Blender 5.3's generator can be used in a way that
hides incompatible assets from Blender 5.2.
The `min` field is set to the maximum of the marker and the version of
Blender that was used to write the file. So when a file
`filename@b5_3.blend` was written with Blender 5.4, it will still
require Blender 5.4. The generator will log a warning when this occurs.
In this example, the assets in `filename.blend` will be used until 5.3,
as per the marker in the filename.
Pull Request: https://projects.blender.org/blender/blender/pulls/161998
Download 5 previews in parallel, so that if one request hangs, only
that thumbnail takes a long time (or times out) while others can still
download. This should have a significant effect on download speed of
the previews when on a not-so-fast or not-so-reliable connection.
Asset downloads are still serialized. This can easily be adjusted if
need be, by changing `num_parallel_downloads=1` to the desired number
in `download_asset_file()`.
This introduces multi-threaded downloading to the
`BackgroundDownloader` in `_bpy_internal.http.downloader`.
Download deduplication is now handled by the background process, as
that knows exactly what's still queued and what's already downloading.
It's a necessity to do this there, because the bg process manages the
download threads, and thus has the source of truth of what downloads
and cancellations are in flight.
Futhermore, some busy-waiting loops were removed, and inter-thread
signalling improved, as their impact will be significantly greater
with multiple download threads running.
No Python threads were added to the Blender process. All the threaded
work happens in the background process.
Pull Request: https://projects.blender.org/blender/blender/pulls/161913
Failure to download an asset thumbnail, such that Blender would not get
an HTTP response, would cause a failed assertion and cause Blender's
bookkeeping to go out of sync.
This commit fixes that, and now the thumbnail's "loading" indicator is
replaced with the generic icon of its ID type. On asset browser refresh,
another download is attempted.
Pull Request: https://projects.blender.org/blender/blender/pulls/162040
Fix race condition between main & background process when cancelling
and re-queueing downloads. This could make the downloader skip
downloads, as a re-queue of the same download would be cancelled along
with the original.
The main process keeps track of pending cancellations, so that
re-queued downloads are handled properly even when the previous
cancellation still has to be handled by the background process.
The background process now also emits 'was cancelled' reports for
queued-but-not-yet-started downloads, which means that any download
request sent to the background either gets completed or gets an error
reported. Before this PR, cancellation of queued-but-not-started
downloads would be silent. This guaranteed messaging of cancellations
is what makes the main process' bookkeeping work.
One minor API change: when queued downloads are cancelled,
`BackgroundDownloader.all_downloads_done` now flips at cancel time
rather than when the report round-trips via the background process. So
even when there is still a pending download (that is scheduled for
cancellation), the `BackgroundDownloader` will say that they're all
'done'. In a sense it's still true, and shutting down the downloader
at that time will simply cancel those about-to-be-canceled-anyway
downloads.
`BackgroundDownloader._num_pending_downloads` is no longer explicitly
tracked, but rather derived from the number of 'on done' callbacks.
This reduces the bookkeeping to one source of truth.
Pull Request: https://projects.blender.org/blender/blender/pulls/161977
When browsing online assets, download the last-requested preview
first. This ensures that, when scrolling through the assets, the
previews that are scrolled into view get priority over previews that
are scrolled out of view.
This introduces an optional keyword-only parameter to
`http.BackgroundDownloader.queue_download(queue_side=QueueSide)`,
where `QueueSide` is an enum with values `FRONT` and `BACK`.
The asset downloader always uses `BACK` for FIFO behaviour, and the
preview downloader always uses `FRONT` for LIFO behaviour.
This causes preview images in the asset browser to be downloaded
bottom-to-top (speaking visually here). This can be adjusted in
Blender's C++ code by requesting the thumbnails in the opposite order.
As an alternative implementation, a priority queue was discussed.
Previews that are scrolled out of view could then get a lower
priority. This means that Blender would have to track which previews
are requested for download, as well as track how many windows are
showing certain previews (because "scrolled out of view in one asset
browser" doesn't always mean "no longer visible"). Simply downloading
the previews in LIFO order was considerably simpler, and likely
sufficient.
Pull Request: https://projects.blender.org/blender/blender/pulls/161897
Keymap items drawn under any "... (Global)" subsection
are misaligned from keymap items under other subsections of a keymap.
This was caused by the indented layout getting passed to later
recursive calls of `draw_km`, which makes the indentation get
doubled the deeper it goes.
This patch tweaks the drawing code so that those are now aligned,
and indentation behaves more predictably.
Pull Request: https://projects.blender.org/blender/blender/pulls/157129
This fixes two related issues:
1. System files could be replaced when downloading assets. A malicious
asset listing could be constructed that overwrites its own files when
specific assets are downloaded. This was dangerous, because the
listing downloader performs various safety checks while the asset
downloader doesn't (because it's not made for downloading the
listing). The asset downloader now refuses to download any file when
that would potentially overwrite a 'system file' (listing file, file
hash database, those kind of files).
2. Converting asset paths from the listing to a relative path, so they
can safely be concatenated to the local asset cache path, is now more
thorough. It now also properly handles Windows paths that are
drive-relative; these were considered 'relative' by Python's
PureWindowsPath.is_absolute(), but still can cause the downloaded
file to escape the path it is meant to be saved to.
Pull Request: https://projects.blender.org/blender/blender/pulls/161198
When downloading the asset library listing, the downloader was waiting
for all pages (`_v1/assets-xxxxx.json`) to be downloaded. When there are
no such files at all, because the library is empty, it would wait
forever.
This is now fixed by doing a "shutdown if done" check after the
downloading of the `_v1/asset-index.json` file as well.
Pull Request: https://projects.blender.org/blender/blender/pulls/161149
Instead of reusing `ERROR` for both warnings and errors, and the Info
Editor icon for "info" label comments, use the new icons from !161002.
* Use `STATUS_WARNING` when the code refers to simple warnings, the
feature might still work.
* Use `STATUS_ERROR` when the code refers to incompatibility, broken
functionality, general errors.
* Use `STATUS_INFO` for every info label. Keep `INFO` for the editor.
* Sometimes `WARNING_LARGE` was used, that should only be used for
dialogs. Use the regular warning instead, it looks almost the same.
* When extra contrast is needed, the filled version is used.
Mostly no big visual changes, other than warnings that were meant as
actual errors using the proper icon now.
See !161038 for details and screenshots.
Pull Request: https://projects.blender.org/blender/blender/pulls/161038
OpenColorIO configs include view transforms in addition to views. They
are redundant in some cases but not always, in particular descriptions
missing from views.
This commit adds translation for them.
Issue found while looking at !160883.
Pull Request: https://projects.blender.org/blender/blender/pulls/160922
Color space UI was changed in Blender 5.2. Since then menus and
submenus are no longer translated, though the labels and descriptions
are still extracted from the OpenColorIO config.
This commit adds translation for color space names and descriptions
(menu entries), as well as families (submenus).
Families need to be extracted from the OCIO config, and translated
when showing menus, but they may be composed of multiple path
components representing submenus, so each component is extracted and
translated independently.
Reported by Ye Gui in #43295.
Pull Request: https://projects.blender.org/blender/blender/pulls/160883
Change `required: [from]` to `required: [min]`, as `min` is the actual
field name.
Some history: I wanted to use `from`+`until`, but then realized that
`from` is a Python keyword, and so the code generated from the spec
would have to be mangled (it would become `from_` I think). Since
leading/trailing underscores are often used to denote private fields, I
didn't want to go there, and changed it to `min` instead. I just forgot
to update the `required` list.
As for using `max` (instead of `until`, to match it with `min`), I
intentionally chose not to use that, as to me it reads as "the maximum
version of Blender that is still compatible". Since the field has the
first version of Blender that is NOT compatible, I used `until` instead.
Pull Request: https://projects.blender.org/blender/blender/pulls/160151
The function to let the Blender asset system know that the file download
request was handled was missing a parameter. So it would fail and the
asset potentially not be recognized as "available".