move install/uninstall to pipeline

This commit is contained in:
Ondrej Samohel 2022-03-01 15:43:55 +01:00
parent 32963fb56d
commit 306eddd549
No known key found for this signature in database
GPG key ID: 02376E18990A97C6
2 changed files with 48 additions and 57 deletions

View file

@ -1,9 +1,6 @@
import os
import logging
# -*- coding: utf-8 -*-
"""Unreal Editor OpenPype host API."""
from avalon import api as avalon
from pyblish import api as pyblish
import openpype.hosts.unreal
from .plugin import (
Loader,
Creator
@ -24,17 +21,6 @@ from .pipeline import (
instantiate,
)
logger = logging.getLogger("openpype.hosts.unreal")
HOST_DIR = os.path.dirname(os.path.abspath(openpype.hosts.unreal.__file__))
PLUGINS_DIR = os.path.join(HOST_DIR, "plugins")
PUBLISH_PATH = os.path.join(PLUGINS_DIR, "publish")
LOAD_PATH = os.path.join(PLUGINS_DIR, "load")
CREATE_PATH = os.path.join(PLUGINS_DIR, "create")
INVENTORY_PATH = os.path.join(PLUGINS_DIR, "inventory")
__all__ = [
"install",
"uninstall",
@ -52,34 +38,3 @@ __all__ = [
"show_tools_popup",
"instantiate"
]
def install():
"""Install Unreal configuration for OpenPype."""
print("-=" * 40)
logo = '''.
.
____________
/ \\ __ \\
\\ \\ \\/_\\ \\
\\ \\ _____/ ______
\\ \\ \\___// \\ \\
\\ \\____\\ \\ \\_____\\
\\/_____/ \\/______/ PYPE Club .
.
'''
print(logo)
print("installing OpenPype for Unreal ...")
print("-=" * 40)
logger.info("installing OpenPype for Unreal")
pyblish.register_plugin_path(str(PUBLISH_PATH))
avalon.register_plugin_path(avalon.Loader, str(LOAD_PATH))
avalon.register_plugin_path(avalon.Creator, str(CREATE_PATH))
def uninstall():
"""Uninstall Unreal configuration for Avalon."""
pyblish.deregister_plugin_path(str(PUBLISH_PATH))
avalon.deregister_plugin_path(avalon.Loader, str(LOAD_PATH))
avalon.deregister_plugin_path(avalon.Creator, str(CREATE_PATH))

View file

@ -1,22 +1,62 @@
# -*- coding: utf-8 -*-
import pyblish.api
from avalon.pipeline import AVALON_CONTAINER_ID
import unreal # noqa
import os
import logging
from typing import List
from openpype.tools.utils import host_tools
import pyblish.api
import avalon
from avalon.pipeline import AVALON_CONTAINER_ID
from avalon import api
from openpype.tools.utils import host_tools
import openpype.hosts.unreal
import unreal # noqa
logger = logging.getLogger("openpype.hosts.unreal")
OPENPYPE_CONTAINERS = "OpenPypeContainers"
HOST_DIR = os.path.dirname(os.path.abspath(openpype.hosts.unreal.__file__))
PLUGINS_DIR = os.path.join(HOST_DIR, "plugins")
PUBLISH_PATH = os.path.join(PLUGINS_DIR, "publish")
LOAD_PATH = os.path.join(PLUGINS_DIR, "load")
CREATE_PATH = os.path.join(PLUGINS_DIR, "create")
INVENTORY_PATH = os.path.join(PLUGINS_DIR, "inventory")
def install():
pyblish.api.register_host("unreal")
"""Install Unreal configuration for OpenPype."""
print("-=" * 40)
logo = '''.
.
____________
/ \\ __ \\
\\ \\ \\/_\\ \\
\\ \\ _____/ ______
\\ \\ \\___// \\ \\
\\ \\____\\ \\ \\_____\\
\\/_____/ \\/______/ PYPE Club .
.
'''
print(logo)
print("installing OpenPype for Unreal ...")
print("-=" * 40)
logger.info("installing OpenPype for Unreal")
pyblish.api.register_plugin_path(str(PUBLISH_PATH))
api.register_plugin_path(api.Loader, str(LOAD_PATH))
api.register_plugin_path(api.Creator, str(CREATE_PATH))
_register_callbacks()
_register_events()
def uninstall():
"""Uninstall Unreal configuration for Avalon."""
pyblish.api.deregister_plugin_path(str(PUBLISH_PATH))
api.deregister_plugin_path(api.Loader, str(LOAD_PATH))
api.deregister_plugin_path(api.Creator, str(CREATE_PATH))
def _register_callbacks():
"""
TODO: Implement callbacks if supported by UE4
@ -31,10 +71,6 @@ def _register_events():
pass
def uninstall():
pyblish.api.deregister_host("unreal")
class Creator(api.Creator):
hosts = ["unreal"]
asset_types = []