mirror of
https://github.com/blender/blender
synced 2026-09-28 04:04:20 +03:00
Refactor: rename .../assets/remote_library_listing to remote_library
Rename `scripts/modules/_bpy_internal/assets/remote_library_listing/` to `.../remote_library/`. The Python module started out as code for the remote listing, but now has all the asset-related code (so also downloading the assets themselves). No functional changes. Pull Request: https://projects.blender.org/blender/blender/pulls/158651
This commit is contained in:
parent
597b9e7ef6
commit
98360c3e98
24 changed files with 33 additions and 33 deletions
|
|
@ -40,7 +40,7 @@ from bpy.props import (
|
|||
# Only import submodules here when necessary for type checking.
|
||||
# At runtime, the module is imported only when it's actually used.
|
||||
if TYPE_CHECKING:
|
||||
from _bpy_internal.assets.remote_library_listing import listing_downloader
|
||||
from _bpy_internal.assets.remote_library import listing_downloader
|
||||
|
||||
type _RemoteAssetListingDownloader = listing_downloader.RemoteAssetListingDownloader
|
||||
else:
|
||||
|
|
@ -452,7 +452,7 @@ def remote_asset_library_sync(
|
|||
print(" skipping {!r}, online access is not allowed,".format(asset_library_url))
|
||||
return
|
||||
|
||||
from _bpy_internal.assets.remote_library_listing import listing_downloader
|
||||
from _bpy_internal.assets.remote_library import listing_downloader
|
||||
|
||||
# Check if the download should happen at all.
|
||||
if only_if_older_than_sec and listing_downloader.is_more_recent_than(
|
||||
|
|
@ -461,7 +461,7 @@ def remote_asset_library_sync(
|
|||
|
||||
# Only actually start downloading if no other Blender is already syncing
|
||||
# this asset library.
|
||||
from _bpy_internal.assets.remote_library_listing import sync_mutex
|
||||
from _bpy_internal.assets.remote_library import sync_mutex
|
||||
if not sync_mutex.mutex_lock(asset_library_local_path):
|
||||
print(" skipping {!r}, another Blender is already syncing this asset library,".format(asset_library_url))
|
||||
return
|
||||
|
|
@ -507,8 +507,8 @@ def _remote_asset_library_sync_done(downloader: _RemoteAssetListingDownloader) -
|
|||
or other issues can cause things to abort. In that case, this function is
|
||||
still called.
|
||||
"""
|
||||
from _bpy_internal.assets.remote_library_listing import sync_mutex
|
||||
from _bpy_internal.assets.remote_library_listing.listing_downloader import DownloadStatus
|
||||
from _bpy_internal.assets.remote_library import sync_mutex
|
||||
from _bpy_internal.assets.remote_library.listing_downloader import DownloadStatus
|
||||
from bpy.types import WindowManager
|
||||
|
||||
try:
|
||||
|
|
@ -527,7 +527,7 @@ def _remote_asset_library_sync_done(downloader: _RemoteAssetListingDownloader) -
|
|||
|
||||
|
||||
def _remote_asset_library_sync_update(downloader: _RemoteAssetListingDownloader) -> None:
|
||||
from _bpy_internal.assets.remote_library_listing.listing_downloader import DownloadStatus
|
||||
from _bpy_internal.assets.remote_library.listing_downloader import DownloadStatus
|
||||
|
||||
# Only call `asset_library_status_ping_still_loading()` if the loading is still going on.
|
||||
if downloader.status == DownloadStatus.LOADING:
|
||||
|
|
@ -948,8 +948,8 @@ def register():
|
|||
|
||||
cli_commands.append(bpy.utils.register_cli_command("extension", cli_extension))
|
||||
|
||||
from _bpy_internal.assets import remote_library_listing
|
||||
cli_commands.append(bpy.utils.register_cli_command("asset_listing", remote_library_listing.asset_listing_main))
|
||||
from _bpy_internal.assets import remote_library
|
||||
cli_commands.append(bpy.utils.register_cli_command("asset_listing", remote_library.asset_listing_main))
|
||||
|
||||
monkeypatch_install()
|
||||
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ from pathlib import Path
|
|||
import bpy
|
||||
|
||||
from _bpy_internal.http import downloader as http_dl
|
||||
from _bpy_internal.assets.remote_library_listing.listing_downloader import RemoteAssetListingLocator
|
||||
from _bpy_internal.assets.remote_library_listing import hashing
|
||||
from _bpy_internal.assets.remote_library.listing_downloader import RemoteAssetListingLocator
|
||||
from _bpy_internal.assets.remote_library import hashing
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
@ -7,7 +7,7 @@ import typing
|
|||
from pathlib import Path
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
from _bpy_internal.assets.remote_library_listing.blender_asset_library_openapi import URLWithHash as _URLWithHash
|
||||
from _bpy_internal.assets.remote_library.blender_asset_library_openapi import URLWithHash as _URLWithHash
|
||||
else:
|
||||
_URLWithHash = object
|
||||
|
||||
|
|
@ -29,12 +29,12 @@ else:
|
|||
import bpy
|
||||
|
||||
from _bpy_internal.http import downloader as http_dl
|
||||
from _bpy_internal.assets.remote_library_listing import blender_asset_library_openapi as api_models
|
||||
from _bpy_internal.assets.remote_library_listing import listing_common
|
||||
from _bpy_internal.assets.remote_library_listing import hashing
|
||||
from _bpy_internal.assets.remote_library_listing import http_metadata
|
||||
from _bpy_internal.assets.remote_library_listing import listing_asset_catalogs
|
||||
from _bpy_internal.assets.remote_library_listing import json_parsing
|
||||
from _bpy_internal.assets.remote_library import blender_asset_library_openapi as api_models
|
||||
from _bpy_internal.assets.remote_library import listing_common
|
||||
from _bpy_internal.assets.remote_library import hashing
|
||||
from _bpy_internal.assets.remote_library import http_metadata
|
||||
from _bpy_internal.assets.remote_library import listing_asset_catalogs
|
||||
from _bpy_internal.assets.remote_library import json_parsing
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
@ -179,7 +179,7 @@ static bool downloader_status_any_asset_downloading(const bContext &C)
|
|||
{
|
||||
#ifdef WITH_PYTHON
|
||||
constexpr const char *SCRIPT = R"(
|
||||
import _bpy_internal.assets.remote_library_listing.asset_downloader as asset_dl
|
||||
import _bpy_internal.assets.remote_library.asset_downloader as asset_dl
|
||||
|
||||
_result = asset_dl.any_asset_downloading()
|
||||
)";
|
||||
|
|
@ -561,7 +561,7 @@ static bool remote_library_request_asset_download_file(const bContext &C,
|
|||
* `dst_filepath` as URL, relative to the asset library URL. */
|
||||
|
||||
std::string script =
|
||||
"import _bpy_internal.assets.remote_library_listing.asset_downloader as asset_dl\n"
|
||||
"import _bpy_internal.assets.remote_library.asset_downloader as asset_dl\n"
|
||||
"from pathlib import Path\n"
|
||||
"\n"
|
||||
"asset_dl.download_asset_file(\n"
|
||||
|
|
@ -675,7 +675,7 @@ void remote_library_request_preview_download(const bContext &C,
|
|||
|
||||
{
|
||||
std::string script =
|
||||
"import _bpy_internal.assets.remote_library_listing.asset_downloader as asset_dl\n"
|
||||
"import _bpy_internal.assets.remote_library.asset_downloader as asset_dl\n"
|
||||
"from pathlib import Path\n"
|
||||
"\n"
|
||||
"asset_dl.download_preview(\n"
|
||||
|
|
@ -715,7 +715,7 @@ void remote_library_cancel_all_asset_downloads(bContext &C)
|
|||
{
|
||||
#ifdef WITH_PYTHON
|
||||
constexpr const char *SCRIPT = R"(
|
||||
import _bpy_internal.assets.remote_library_listing.asset_downloader as asset_dl
|
||||
import _bpy_internal.assets.remote_library.asset_downloader as asset_dl
|
||||
|
||||
asset_dl.cancel_download_all_assets()
|
||||
)";
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@
|
|||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
add_subdirectory(remote_library_listing)
|
||||
add_subdirectory(remote_library)
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@ import sys
|
|||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
from _bpy_internal.assets.remote_library_listing import listing_asset_catalogs
|
||||
from _bpy_internal.assets.remote_library_listing import blender_asset_library_openapi as api_models
|
||||
from _bpy_internal.assets.remote_library import listing_asset_catalogs
|
||||
from _bpy_internal.assets.remote_library import blender_asset_library_openapi as api_models
|
||||
|
||||
"""
|
||||
blender -b --factory-startup -P tests/python/assets/remote_library_listing/listing_asset_catalogs_test.py -- --outdir=/tmp
|
||||
blender -b --factory-startup -P tests/python/assets/remote_library/listing_asset_catalogs_test.py -- --outdir=/tmp
|
||||
"""
|
||||
|
||||
# CLI argument, will be set to its actual value in main() below.
|
||||
|
|
@ -6,13 +6,13 @@ import sys
|
|||
import unittest
|
||||
from pathlib import Path, PurePath, PurePosixPath, PureWindowsPath
|
||||
|
||||
from _bpy_internal.assets.remote_library_listing import json_parsing, listing_downloader
|
||||
from _bpy_internal.assets.remote_library_listing import blender_asset_library_openapi as api_models
|
||||
from _bpy_internal.assets.remote_library import json_parsing, listing_downloader
|
||||
from _bpy_internal.assets.remote_library import blender_asset_library_openapi as api_models
|
||||
|
||||
import bpy
|
||||
|
||||
"""
|
||||
blender -b --factory-startup -P tests/python/assets/remote_library_listing/listing_downloader_test.py -- --outdir=/tmp
|
||||
blender -b --factory-startup -P tests/python/assets/remote_library/listing_downloader_test.py -- --outdir=/tmp
|
||||
"""
|
||||
|
||||
# CLI argument, will be set to its actual value in main() below.
|
||||
|
|
@ -5,15 +5,15 @@
|
|||
import sys
|
||||
import unittest
|
||||
|
||||
from _bpy_internal.assets.remote_library_listing import json_parsing, hashing
|
||||
from _bpy_internal.assets.remote_library_listing import blender_asset_library_openapi as api_models
|
||||
from _bpy_internal.assets.remote_library_listing import cli_listing_generator_asset_finder as asset_finder
|
||||
from _bpy_internal.assets.remote_library import json_parsing, hashing
|
||||
from _bpy_internal.assets.remote_library import blender_asset_library_openapi as api_models
|
||||
from _bpy_internal.assets.remote_library import cli_listing_generator_asset_finder as asset_finder
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
"""
|
||||
blender -b --factory-startup --python tests/python/assets/remote_library_listing/listing_generator_test.py
|
||||
blender -b --factory-startup --python tests/python/assets/remote_library/listing_generator_test.py
|
||||
"""
|
||||
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ import time
|
|||
# the corresponding `.py`` file is automatically marked as 'generated' in
|
||||
# `.gitattributes`.
|
||||
YAML_PATHS = [
|
||||
"scripts/modules/_bpy_internal/assets/remote_library_listing/blender_asset_library_openapi.yaml",
|
||||
"scripts/modules/_bpy_internal/assets/remote_library/blender_asset_library_openapi.yaml",
|
||||
]
|
||||
|
||||
# Packages to install in the virtualenv. These are only necessary to run this
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue