maxon.AssetDataBasesInterface¶
Description¶
This interface provides helper functions to register asset repositories.
Methods Signature¶
Deletes the cache. |
|
|
Returns the
maxon.url of a asset repository. |
GetAssetDatabaseCachePath returns the path to the cache folder. |
|
GetAssetDatabaseCacheSize returns the size of the cached files. |
|
|
Returns all repositories added by the user. |
ReloadDatabases reloads the asset repositories from disk. |
|
|
SetAssetDatabaseCachePath sets a new cache path to store temporary downloaded objects. |
|
Set the new user repositories. |
Waits for the execution of the database loading. |
|
Writes the gml file with the dependencies of the given asset repository. |
Methods Definition¶
-
static
AssetDataBasesInterface.
ClearAssetDatabaseCache
()¶ Deletes the cache.
-
static
AssetDataBasesInterface.
FindRepository
(repository)¶ - Returns the
maxon.url
of a asset repository.Whenrepository
is of typemaxon.Url
, the result must be cast to a repositoryreference to provide meaningful access to the found repository.url: maxon.Url = maxon.Url(r"/Volumes/database") obj: maxon.ObjectRef = maxon.AssetDataBasesInterface.FindRepository(url) if obj.IsNullValue(): raise RuntimeError(f"Could not establish repository for: {url}.") # Cast #obj to an AssetRepositoryRef. What #obj must be cast to depends on the repository #url # is representing. But all repositories are of type AssetRepositoryInterface, so a ref for that # will give access to all common asset repository methods. repo: maxon.AssetRepositoryRef = maxon.Cast(maxon.AssetRepositoryRef, obj) if repo.IsNullValue(): raise RuntimeError(f"Could not establish repository for: {url}.")
- Parameters
repository (Union[
maxon.Url
,maxon.AssetRepositoryRef
]) – Repository to find.- Return type
Union[
maxon.Url
,maxon.ObjectRef
]- Returns
On success the repository reference or url of repository, depending on the type of repository.
-
static
AssetDataBasesInterface.
GetAssetDatabaseCachePath
()¶ GetAssetDatabaseCachePath returns the path to the cache folder.
- Returns
The path to the cache folder.
- Return type
-
static
AssetDataBasesInterface.
GetAssetDatabaseCacheSize
()¶ GetAssetDatabaseCacheSize returns the size of the cached files.
- Returns
The size of the cached files.
- Return type
int
-
static
AssetDataBasesInterface.
GetDatabases
(entry=None)¶ Returns all repositories added by the user.
- Parameters
entry (Optional[Union[list, Callable[[maxon.AssetDatabaseStruct], bool]]]) – ValueReceiver to receive the entries.
- Returns
If callback is None or a list then a list of
maxon.AssetDatabaseStruct
otherwise False if callback cancelled further evaluation, True otherwise.- Return type
Union[list[
maxon.AssetDatabaseStruct
], bool]
-
static
AssetDataBasesInterface.
ReloadAssetRepositories
()¶ ReloadDatabases reloads the asset repositories from disk.
-
static
AssetDataBasesInterface.
SetAssetDatabaseCachePath
(*args)¶ SetAssetDatabaseCachePath sets a new cache path to store temporary downloaded objects.
- Parameters
cachePath (
maxon.Url
) – Path to set.
-
static
AssetDataBasesInterface.
SetDatabases
(newDataBases)¶ Set the new user repositories.
- Parameters
newDataBases (Union[
maxon.AssetDatabaseStruct
, list[maxon.AssetDatabaseStruct
],maxon.Block
[maxon.AssetDatabaseStruct
]]) – Block with tuples of the new urls and activation states.
-
static
AssetDataBasesInterface.
WaitForDatabaseLoading
()¶ Waits for the execution of the database loading.
Since this is async now during the startup and modification of database lists it gives the developer a chance to wait for that end.
- Returns
True if loading is finished. False if canceled.
- Return type
bool
-
static
AssetDataBasesInterface.
WriteGmlDependencies
()¶ Writes the gml file with the dependencies of the given asset repository.