changed imports of moved plugins/actions

This commit is contained in:
Jakub Trllo 2022-03-18 13:17:19 +01:00
parent d16f8f1384
commit 0710540aa4
14 changed files with 50 additions and 35 deletions

View file

@ -78,6 +78,7 @@ def install():
from openpype.pipeline import (
LegacyCreator,
register_loader_plugin_path,
register_inventory_action,
)
from avalon import pipeline
@ -124,7 +125,7 @@ def install():
pyblish.register_plugin_path(path)
register_loader_plugin_path(path)
avalon.register_plugin_path(LegacyCreator, path)
avalon.register_plugin_path(avalon.InventoryAction, path)
register_inventory_action(path)
# apply monkey patched discover to original one
log.info("Patching discovery")

View file

@ -15,6 +15,8 @@ from openpype.pipeline import (
LegacyCreator,
register_loader_plugin_path,
deregister_loader_plugin_path,
register_inventory_action_path,
deregister_inventory_action_path,
)
import openpype.hosts.fusion
@ -69,7 +71,7 @@ def install():
register_loader_plugin_path(LOAD_PATH)
avalon.api.register_plugin_path(LegacyCreator, CREATE_PATH)
avalon.api.register_plugin_path(avalon.api.InventoryAction, INVENTORY_PATH)
register_inventory_action_path(INVENTORY_PATH)
pyblish.api.register_callback(
"instanceToggled", on_pyblish_instance_toggled
@ -93,9 +95,7 @@ def uninstall():
deregister_loader_plugin_path(LOAD_PATH)
avalon.api.deregister_plugin_path(LegacyCreator, CREATE_PATH)
avalon.api.deregister_plugin_path(
avalon.api.InventoryAction, INVENTORY_PATH
)
deregister_inventory_action_path(INVENTORY_PATH)
pyblish.api.deregister_callback(
"instanceToggled", on_pyblish_instance_toggled

View file

@ -1,7 +1,7 @@
from avalon import api
from openpype.pipeline import InventoryAction
class FusionSelectContainers(api.InventoryAction):
class FusionSelectContainers(InventoryAction):
label = "Select Containers"
icon = "mouse-pointer"

View file

@ -1,6 +1,6 @@
from avalon import api
from Qt import QtGui, QtWidgets
from openpype.pipeline import InventoryAction
from openpype import style
from openpype.hosts.fusion.api import (
get_current_comp,
@ -8,7 +8,7 @@ from openpype.hosts.fusion.api import (
)
class FusionSetToolColor(api.InventoryAction):
class FusionSetToolColor(InventoryAction):
"""Update the color of the selected tools"""
label = "Set Tool Color"

View file

@ -23,7 +23,9 @@ from openpype.lib.path_tools import HostDirmap
from openpype.pipeline import (
LegacyCreator,
register_loader_plugin_path,
register_inventory_action_path,
deregister_loader_plugin_path,
deregister_inventory_action_path,
)
from openpype.hosts.maya.lib import copy_workspace_mel
from . import menu, lib
@ -59,7 +61,7 @@ def install():
register_loader_plugin_path(LOAD_PATH)
avalon.api.register_plugin_path(LegacyCreator, CREATE_PATH)
avalon.api.register_plugin_path(avalon.api.InventoryAction, INVENTORY_PATH)
register_inventory_action_path(INVENTORY_PATH)
log.info(PUBLISH_PATH)
log.info("Installing callbacks ... ")
@ -188,9 +190,7 @@ def uninstall():
deregister_loader_plugin_path(LOAD_PATH)
avalon.api.deregister_plugin_path(LegacyCreator, CREATE_PATH)
avalon.api.deregister_plugin_path(
avalon.api.InventoryAction, INVENTORY_PATH
)
deregister_inventory_action_path(INVENTORY_PATH)
menu.uninstall()

View file

@ -1,6 +1,8 @@
import json
from avalon import api, io
from avalon import io
from openpype.pipeline import (
InventoryAction,
get_representation_context,
get_representation_path_from_context,
)
@ -10,7 +12,7 @@ from openpype.hosts.maya.api.lib import (
)
class ImportModelRender(api.InventoryAction):
class ImportModelRender(InventoryAction):
label = "Import Model Render Sets"
icon = "industry"

View file

@ -1,11 +1,10 @@
from maya import cmds
from avalon import api
from openpype.pipeline import InventoryAction
from openpype.hosts.maya.api.plugin import get_reference_node
class ImportReference(api.InventoryAction):
class ImportReference(InventoryAction):
"""Imports selected reference to inside of the file."""
label = "Import Reference"

View file

@ -18,7 +18,9 @@ from openpype.lib import register_event_callback
from openpype.pipeline import (
LegacyCreator,
register_loader_plugin_path,
register_inventory_action_path,
deregister_loader_plugin_path,
deregister_inventory_action_path,
)
from openpype.tools.utils import host_tools
@ -105,7 +107,7 @@ def install():
pyblish.api.register_plugin_path(PUBLISH_PATH)
register_loader_plugin_path(LOAD_PATH)
avalon.api.register_plugin_path(LegacyCreator, CREATE_PATH)
avalon.api.register_plugin_path(avalon.api.InventoryAction, INVENTORY_PATH)
register_inventory_action_path(INVENTORY_PATH)
# Register Avalon event for workfiles loading.
register_event_callback("workio.open_file", check_inventory_versions)
@ -131,6 +133,7 @@ def uninstall():
pyblish.api.deregister_plugin_path(PUBLISH_PATH)
deregister_loader_plugin_path(LOAD_PATH)
avalon.api.deregister_plugin_path(LegacyCreator, CREATE_PATH)
deregister_inventory_action_path(INVENTORY_PATH)
pyblish.api.deregister_callback(
"instanceToggled", on_pyblish_instance_toggled)

View file

@ -1,9 +1,9 @@
from avalon import api
from openpype.api import Logger
from openpype.pipeline import InventoryAction
from openpype.hosts.nuke.api.lib import set_avalon_knob_data
class RepairOldLoaders(api.InventoryAction):
class RepairOldLoaders(InventoryAction):
label = "Repair Old Loaders"
icon = "gears"

View file

@ -1,8 +1,8 @@
from avalon import api
from openpype.pipeline import InventoryAction
from openpype.hosts.nuke.api.commands import viewer_update_and_undo_stop
class SelectContainers(api.InventoryAction):
class SelectContainers(InventoryAction):
label = "Select Containers"
icon = "mouse-pointer"

View file

@ -1,6 +1,7 @@
import os
from avalon import api
from Qt import QtWidgets, QtGui
from openpype import PLUGINS_DIR
from openpype import style
from openpype.api import Logger, resources
@ -8,7 +9,10 @@ from openpype.lib import (
ApplictionExecutableNotFound,
ApplicationLaunchFailed
)
from Qt import QtWidgets, QtGui
from openpype.pipeline import (
LauncherAction,
register_launcher_action_path,
)
def register_actions_from_paths(paths):
@ -29,14 +33,15 @@ def register_actions_from_paths(paths):
print("Path was not found: {}".format(path))
continue
api.register_plugin_path(api.Action, path)
register_launcher_action_path(path)
def register_config_actions():
"""Register actions from the configuration for Launcher"""
actions_dir = os.path.join(PLUGINS_DIR, "actions")
register_actions_from_paths([actions_dir])
if os.path.exists(actions_dir):
register_actions_from_paths([actions_dir])
def register_environment_actions():
@ -46,7 +51,9 @@ def register_environment_actions():
register_actions_from_paths(paths_str.split(os.pathsep))
class ApplicationAction(api.Action):
# TODO move to 'openpype.pipeline.actions'
# - remove Qt related stuff and implement exceptions to show error in launcher
class ApplicationAction(LauncherAction):
"""Pype's application launcher
Application action based on pype's ApplicationManager system.
@ -74,7 +81,7 @@ class ApplicationAction(api.Action):
@property
def log(self):
if self._log is None:
self._log = Logger().get_logger(self.__class__.__name__)
self._log = Logger.get_logger(self.__class__.__name__)
return self._log
def is_compatible(self, session):

View file

@ -8,12 +8,13 @@ import time
import appdirs
from Qt import QtCore, QtGui
import qtawesome
from avalon import api
from openpype.lib import JSONSettingRegistry
from openpype.lib.applications import (
CUSTOM_LAUNCH_APP_GROUPS,
ApplicationManager
)
from openpype.pipeline import discover_launcher_actions
from openpype.tools.utils.lib import (
DynamicQThread,
get_project_icon,
@ -68,7 +69,7 @@ class ActionModel(QtGui.QStandardItemModel):
def discover(self):
"""Set up Actions cache. Run this for each new project."""
# Discover all registered actions
actions = api.discover(api.Action)
actions = discover_launcher_actions()
# Get available project actions and the application actions
app_actions = self.get_application_actions()

View file

@ -7,9 +7,10 @@ import collections
from Qt import QtWidgets, QtCore, QtGui
from avalon import api, pipeline
from avalon import api
from openpype.pipeline import HeroVersionType
from openpype.pipeline.thumbnails import get_thumbnail_binary
from openpype.pipeline.load import (
discover_loader_plugins,
SubsetLoaderPlugin,
@ -863,7 +864,7 @@ class ThumbnailWidget(QtWidgets.QLabel):
if not thumbnail_ent:
return
thumbnail_bin = pipeline.get_thumbnail_binary(
thumbnail_bin = get_thumbnail_binary(
thumbnail_ent, "thumbnail", self.dbcon
)
if not thumbnail_bin:

View file

@ -5,13 +5,14 @@ from functools import partial
from Qt import QtWidgets, QtCore
import qtawesome
from avalon import io, api
from avalon import io
from openpype import style
from openpype.pipeline import (
HeroVersionType,
update_container,
remove_container,
discover_inventory_actions,
)
from openpype.modules import ModulesManager
from openpype.tools.utils.lib import (
@ -487,7 +488,7 @@ class SceneInventoryView(QtWidgets.QTreeView):
containers = containers or [dict()]
# Check which action will be available in the menu
Plugins = api.discover(api.InventoryAction)
Plugins = discover_inventory_actions()
compatible = [p() for p in Plugins if
any(p.is_compatible(c) for c in containers)]