mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +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": [],
|
"publish": [],
|
||||||
"create": [],
|
"create": [],
|
||||||
"load": [],
|
"load": [],
|
||||||
"actions": []
|
"actions": [],
|
||||||
|
"inventory": []
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -740,15 +740,16 @@ class ModulesManager:
|
||||||
Unknown keys are logged out.
|
Unknown keys are logged out.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
dict: Output is dictionary with keys "publish", "create", "load"
|
dict: Output is dictionary with keys "publish", "create", "load",
|
||||||
and "actions" each containing list of paths.
|
"actions" and "inventory" each containing list of paths.
|
||||||
"""
|
"""
|
||||||
# Output structure
|
# Output structure
|
||||||
output = {
|
output = {
|
||||||
"publish": [],
|
"publish": [],
|
||||||
"create": [],
|
"create": [],
|
||||||
"load": [],
|
"load": [],
|
||||||
"actions": []
|
"actions": [],
|
||||||
|
"inventory": []
|
||||||
}
|
}
|
||||||
unknown_keys_by_module = {}
|
unknown_keys_by_module = {}
|
||||||
for module in self.get_enabled_modules():
|
for module in self.get_enabled_modules():
|
||||||
|
|
@ -853,6 +854,21 @@ class ModulesManager:
|
||||||
host_name
|
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):
|
def get_host_module(self, host_name):
|
||||||
"""Find host module by host name.
|
"""Find host module by host name.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,8 @@ class OpenPypeInterface:
|
||||||
class IPluginPaths(OpenPypeInterface):
|
class IPluginPaths(OpenPypeInterface):
|
||||||
"""Module has plugin paths to return.
|
"""Module has plugin paths to return.
|
||||||
|
|
||||||
Expected result is dictionary with keys "publish", "create", "load" or
|
Expected result is dictionary with keys "publish", "create", "load",
|
||||||
"actions" and values as list or string.
|
"actions" or "inventory" and values as list or string.
|
||||||
{
|
{
|
||||||
"publish": ["path/to/publish_plugins"]
|
"publish": ["path/to/publish_plugins"]
|
||||||
}
|
}
|
||||||
|
|
@ -109,6 +109,21 @@ class IPluginPaths(OpenPypeInterface):
|
||||||
|
|
||||||
return self._get_plugin_paths_by_type("publish")
|
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):
|
class ILaunchHookPaths(OpenPypeInterface):
|
||||||
"""Module has launch hook paths to return.
|
"""Module has launch hook paths to return.
|
||||||
|
|
@ -397,8 +412,8 @@ class ITrayService(ITrayModule):
|
||||||
class ISettingsChangeListener(OpenPypeInterface):
|
class ISettingsChangeListener(OpenPypeInterface):
|
||||||
"""Module has plugin paths to return.
|
"""Module has plugin paths to return.
|
||||||
|
|
||||||
Expected result is dictionary with keys "publish", "create", "load" or
|
Expected result is dictionary with keys "publish", "create", "load",
|
||||||
"actions" and values as list or string.
|
"actions" or "inventory" and values as list or string.
|
||||||
{
|
{
|
||||||
"publish": ["path/to/publish_plugins"]
|
"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:
|
for path in load_plugin_paths:
|
||||||
register_loader_plugin_path(path)
|
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:
|
if project_name is None:
|
||||||
project_name = os.environ.get("AVALON_PROJECT")
|
project_name = os.environ.get("AVALON_PROJECT")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue