mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
use new register and discover functions for load, thumbnail and actions
This commit is contained in:
parent
239f70a8f7
commit
dc9852a0d6
3 changed files with 44 additions and 56 deletions
|
|
@ -1,4 +1,11 @@
|
|||
import logging
|
||||
from openpype.pipeline.plugin_discover import (
|
||||
discover,
|
||||
register_plugin,
|
||||
register_plugin_path,
|
||||
deregister_plugin,
|
||||
deregister_plugin_path
|
||||
)
|
||||
|
||||
|
||||
class LauncherAction(object):
|
||||
|
|
@ -90,57 +97,39 @@ class InventoryAction(object):
|
|||
|
||||
# Launcher action
|
||||
def discover_launcher_actions():
|
||||
import avalon.api
|
||||
|
||||
return avalon.api.discover(LauncherAction)
|
||||
return discover(LauncherAction).plugins
|
||||
|
||||
|
||||
def register_launcher_action(plugin):
|
||||
import avalon.api
|
||||
|
||||
return avalon.api.register_plugin(LauncherAction, plugin)
|
||||
return register_plugin(LauncherAction, plugin)
|
||||
|
||||
|
||||
def register_launcher_action_path(path):
|
||||
import avalon.api
|
||||
|
||||
return avalon.api.register_plugin_path(LauncherAction, path)
|
||||
return register_plugin_path(LauncherAction, path)
|
||||
|
||||
|
||||
# Inventory action
|
||||
def discover_inventory_actions():
|
||||
import avalon.api
|
||||
|
||||
actions = avalon.api.discover(InventoryAction)
|
||||
actions = discover(InventoryAction).plugins
|
||||
filtered_actions = []
|
||||
for action in actions:
|
||||
if action is not InventoryAction:
|
||||
print("DISCOVERED", action)
|
||||
filtered_actions.append(action)
|
||||
else:
|
||||
print("GOT SOURCE")
|
||||
|
||||
return filtered_actions
|
||||
|
||||
|
||||
def register_inventory_action(plugin):
|
||||
import avalon.api
|
||||
|
||||
return avalon.api.register_plugin(InventoryAction, plugin)
|
||||
return register_plugin(InventoryAction, plugin)
|
||||
|
||||
|
||||
def deregister_inventory_action(plugin):
|
||||
import avalon.api
|
||||
|
||||
avalon.api.deregister_plugin(InventoryAction, plugin)
|
||||
deregister_plugin(InventoryAction, plugin)
|
||||
|
||||
|
||||
def register_inventory_action_path(path):
|
||||
import avalon.api
|
||||
|
||||
return avalon.api.register_plugin_path(InventoryAction, path)
|
||||
return register_plugin_path(InventoryAction, path)
|
||||
|
||||
|
||||
def deregister_inventory_action_path(path):
|
||||
import avalon.api
|
||||
|
||||
return avalon.api.deregister_plugin_path(InventoryAction, path)
|
||||
return deregister_plugin_path(InventoryAction, path)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,13 @@
|
|||
import logging
|
||||
|
||||
from openpype.lib import set_plugin_attributes_from_settings
|
||||
from openpype.pipeline.plugin_discover import (
|
||||
discover,
|
||||
register_plugin,
|
||||
register_plugin_path,
|
||||
deregister_plugin,
|
||||
deregister_plugin_path
|
||||
)
|
||||
from .utils import get_representation_path_from_context
|
||||
|
||||
|
||||
|
|
@ -102,30 +110,22 @@ class SubsetLoaderPlugin(LoaderPlugin):
|
|||
|
||||
|
||||
def discover_loader_plugins():
|
||||
import avalon.api
|
||||
|
||||
return avalon.api.discover(LoaderPlugin)
|
||||
plugins = discover(LoaderPlugin).plugins
|
||||
set_plugin_attributes_from_settings(plugins, LoaderPlugin)
|
||||
return plugins
|
||||
|
||||
|
||||
def register_loader_plugin(plugin):
|
||||
import avalon.api
|
||||
|
||||
return avalon.api.register_plugin(LoaderPlugin, plugin)
|
||||
|
||||
|
||||
def deregister_loader_plugin_path(path):
|
||||
import avalon.api
|
||||
|
||||
avalon.api.deregister_plugin_path(LoaderPlugin, path)
|
||||
|
||||
|
||||
def register_loader_plugin_path(path):
|
||||
import avalon.api
|
||||
|
||||
return avalon.api.register_plugin_path(LoaderPlugin, path)
|
||||
return register_plugin(LoaderPlugin, plugin)
|
||||
|
||||
|
||||
def deregister_loader_plugin(plugin):
|
||||
import avalon.api
|
||||
deregister_plugin(LoaderPlugin, plugin)
|
||||
|
||||
avalon.api.deregister_plugin(LoaderPlugin, plugin)
|
||||
|
||||
def deregister_loader_plugin_path(path):
|
||||
deregister_plugin_path(LoaderPlugin, path)
|
||||
|
||||
|
||||
def register_loader_plugin_path(path):
|
||||
return register_plugin_path(LoaderPlugin, path)
|
||||
|
|
|
|||
|
|
@ -2,6 +2,11 @@ import os
|
|||
import copy
|
||||
import logging
|
||||
|
||||
from .plugin_discover import (
|
||||
discover,
|
||||
register_plugin,
|
||||
register_plugin_path,
|
||||
)
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
|
@ -126,21 +131,15 @@ class BinaryThumbnail(ThumbnailResolver):
|
|||
|
||||
# Thumbnail resolvers
|
||||
def discover_thumbnail_resolvers():
|
||||
import avalon.api
|
||||
|
||||
return avalon.api.discover(ThumbnailResolver)
|
||||
return discover(ThumbnailResolver).plugins
|
||||
|
||||
|
||||
def register_thumbnail_resolver(plugin):
|
||||
import avalon.api
|
||||
|
||||
return avalon.api.register_plugin(ThumbnailResolver, plugin)
|
||||
register_plugin(ThumbnailResolver, plugin)
|
||||
|
||||
|
||||
def register_thumbnail_resolver_path(path):
|
||||
import avalon.api
|
||||
|
||||
return avalon.api.register_plugin_path(ThumbnailResolver, path)
|
||||
register_plugin_path(ThumbnailResolver, path)
|
||||
|
||||
|
||||
register_thumbnail_resolver(TemplateResolver)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue