mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Draft to allow "inventory" actions to be supplied by a Module or Addon.
This commit is contained in:
parent
6f0c5083d3
commit
359d685644
4 changed files with 45 additions and 8 deletions
|
|
@ -138,7 +138,8 @@ class ClockifyModule(
|
|||
"publish": [],
|
||||
"create": [],
|
||||
"load": [],
|
||||
"actions": []
|
||||
"actions": [],
|
||||
"inventory": []
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -740,15 +740,16 @@ class ModulesManager:
|
|||
Unknown keys are logged out.
|
||||
|
||||
Returns:
|
||||
dict: Output is dictionary with keys "publish", "create", "load"
|
||||
and "actions" each containing list of paths.
|
||||
dict: Output is dictionary with keys "publish", "create", "load",
|
||||
"actions" and "inventory" each containing list of paths.
|
||||
"""
|
||||
# Output structure
|
||||
output = {
|
||||
"publish": [],
|
||||
"create": [],
|
||||
"load": [],
|
||||
"actions": []
|
||||
"actions": [],
|
||||
"inventory": []
|
||||
}
|
||||
unknown_keys_by_module = {}
|
||||
for module in self.get_enabled_modules():
|
||||
|
|
@ -853,6 +854,21 @@ class ModulesManager:
|
|||
host_name
|
||||
)
|
||||
|
||||
def collect_inventory_action_paths(self, host_name):
|
||||
"""Helper to collect load plugin paths from modules.
|
||||
|
||||
Args:
|
||||
host_name (str): For which host are load plugins meant.
|
||||
|
||||
Returns:
|
||||
list: List of pyblish plugin paths.
|
||||
"""
|
||||
|
||||
return self._collect_plugin_paths(
|
||||
"get_inventory_action_paths",
|
||||
host_name
|
||||
)
|
||||
|
||||
def get_host_module(self, host_name):
|
||||
"""Find host module by host name.
|
||||
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ class OpenPypeInterface:
|
|||
class IPluginPaths(OpenPypeInterface):
|
||||
"""Module has plugin paths to return.
|
||||
|
||||
Expected result is dictionary with keys "publish", "create", "load" or
|
||||
"actions" and values as list or string.
|
||||
Expected result is dictionary with keys "publish", "create", "load",
|
||||
"actions" or "inventory" and values as list or string.
|
||||
{
|
||||
"publish": ["path/to/publish_plugins"]
|
||||
}
|
||||
|
|
@ -109,6 +109,21 @@ class IPluginPaths(OpenPypeInterface):
|
|||
|
||||
return self._get_plugin_paths_by_type("publish")
|
||||
|
||||
def get_inventory_action_paths(self, host_name):
|
||||
"""Receive inventory action paths.
|
||||
|
||||
Give addons ability to add inventory action plugin paths.
|
||||
|
||||
Notes:
|
||||
Default implementation uses 'get_plugin_paths' and always return
|
||||
all publish plugin paths.
|
||||
|
||||
Args:
|
||||
host_name (str): For which host are the plugins meant.
|
||||
"""
|
||||
|
||||
return self._get_plugin_paths_by_type("inventory")
|
||||
|
||||
|
||||
class ILaunchHookPaths(OpenPypeInterface):
|
||||
"""Module has launch hook paths to return.
|
||||
|
|
@ -397,8 +412,8 @@ class ITrayService(ITrayModule):
|
|||
class ISettingsChangeListener(OpenPypeInterface):
|
||||
"""Module has plugin paths to return.
|
||||
|
||||
Expected result is dictionary with keys "publish", "create", "load" or
|
||||
"actions" and values as list or string.
|
||||
Expected result is dictionary with keys "publish", "create", "load",
|
||||
"actions" or "inventory" and values as list or string.
|
||||
{
|
||||
"publish": ["path/to/publish_plugins"]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -181,6 +181,11 @@ def install_openpype_plugins(project_name=None, host_name=None):
|
|||
for path in load_plugin_paths:
|
||||
register_loader_plugin_path(path)
|
||||
|
||||
inventory_action_paths = modules_manager.collect_inventory_action_paths(
|
||||
host_name)
|
||||
for path in inventory_action_paths:
|
||||
register_inventory_action_path(path)
|
||||
|
||||
if project_name is None:
|
||||
project_name = os.environ.get("AVALON_PROJECT")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue