mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Passed returned container from load as keyword
Could be appended on position 0 on args, but this feels safer.
This commit is contained in:
parent
276eff0097
commit
118796a325
1 changed files with 7 additions and 6 deletions
|
|
@ -264,7 +264,7 @@ class PrePostLoaderHookPlugin:
|
|||
def is_compatible(cls, Loader: LoaderPlugin) -> bool:
|
||||
pass
|
||||
|
||||
def pre_process(
|
||||
def pre_load(
|
||||
self,
|
||||
context: dict,
|
||||
name: str | None = None,
|
||||
|
|
@ -273,13 +273,13 @@ class PrePostLoaderHookPlugin:
|
|||
):
|
||||
pass
|
||||
|
||||
def post_process(
|
||||
def post_load(
|
||||
self,
|
||||
container: dict, # (ayon:container-3.0)
|
||||
context: dict,
|
||||
name: str | None = None,
|
||||
namespace: str | None = None,
|
||||
options: dict | None = None
|
||||
options: dict | None = None,
|
||||
container: dict | None = None, # (ayon:container-3.0)
|
||||
):
|
||||
pass
|
||||
|
||||
|
|
@ -329,11 +329,12 @@ def hook_loader_load(
|
|||
for hook in loader_class._load_hooks:
|
||||
hook.pre_load(*args, **kwargs)
|
||||
# Call original load
|
||||
result = original_load(self, *args, **kwargs)
|
||||
container = original_load(self, *args, **kwargs)
|
||||
kwargs["container"] = container
|
||||
# Call post_load on all hooks
|
||||
for hook in loader_class._load_hooks:
|
||||
hook.post_load(*args, **kwargs)
|
||||
return result
|
||||
return container
|
||||
|
||||
loader_class.load = wrapped_load
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue