changed installation of hosts

This commit is contained in:
Jakub Trllo 2022-04-01 19:40:23 +02:00
parent eabe2fe569
commit 729131738a
27 changed files with 74 additions and 105 deletions

View file

@ -6,6 +6,7 @@ import logging
from Qt import QtWidgets
from openpype.pipeline import install_host
from openpype.lib.remote_publish import headless_publish
from openpype.tools.utils import host_tools
@ -22,10 +23,9 @@ def safe_excepthook(*args):
def main(*subprocess_args):
sys.excepthook = safe_excepthook
import avalon.api
from openpype.hosts.aftereffects import api
avalon.api.install(api)
install_host(api)
os.environ["OPENPYPE_LOG_NO_COLORS"] = "False"
app = QtWidgets.QApplication([])

View file

@ -19,6 +19,7 @@ from openpype.pipeline import (
deregister_loader_plugin_path,
deregister_creator_plugin_path,
AVALON_CONTAINER_ID,
uninstall_host,
)
from openpype.api import Logger
from openpype.lib import (
@ -209,11 +210,10 @@ def reload_pipeline(*args):
"""
avalon.api.uninstall()
uninstall_host()
for module in (
"avalon.io",
"avalon.lib",
"avalon.pipeline",
"avalon.api",
):

View file

@ -1,4 +1,4 @@
from avalon import pipeline
from openpype.pipeline import install_host
from openpype.hosts.blender import api
pipeline.install(api)
install_host(api)

View file

@ -3,8 +3,6 @@ import sys
import copy
import argparse
from avalon import io
import pyblish.api
import pyblish.util
@ -13,6 +11,8 @@ import openpype
import openpype.hosts.celaction
from openpype.hosts.celaction import api as celaction
from openpype.tools.utils import host_tools
from openpype.pipeline.process_context import install_openpype_plugins
log = Logger().get_logger("Celaction_cli_publisher")
@ -21,9 +21,6 @@ publish_host = "celaction"
HOST_DIR = os.path.dirname(os.path.abspath(openpype.hosts.celaction.__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 cli():
@ -74,7 +71,8 @@ def main():
_prepare_publish_environments()
# Registers pype's Global pyblish plugins
openpype.install()
# - use fake host
install_openpype_plugins()
if os.path.exists(PUBLISH_PATH):
log.info(f"Registering path: {PUBLISH_PATH}")

View file

@ -3,16 +3,16 @@ import sys
from Qt import QtWidgets
from pprint import pformat
import atexit
import openpype
import avalon
import openpype.hosts.flame.api as opfapi
from openpype.pipeline import install_host
def openpype_install():
"""Registering OpenPype in context
"""
openpype.install()
avalon.api.install(opfapi)
install_host(opfapi)
print("Avalon registered hosts: {}".format(
avalon.api.registered_host()))

View file

@ -7,6 +7,10 @@ import logging
import avalon.api
from avalon import io
from openpype.pipeline import (
install_host,
registered_host,
)
from openpype.lib import version_up
from openpype.hosts.fusion import api
from openpype.hosts.fusion.api import lib
@ -218,7 +222,7 @@ def switch(asset_name, filepath=None, new=True):
assert current_comp is not None, (
"Fusion could not load '{}'").format(filepath)
host = avalon.api.registered_host()
host = registered_host()
containers = list(host.ls())
assert containers, "Nothing to update"
@ -279,7 +283,7 @@ if __name__ == '__main__':
args, unknown = parser.parse_args()
avalon.api.install(api)
install_host(api)
switch(args.asset_name, args.file_path)
sys.exit(0)

View file

@ -1,24 +1,23 @@
import os
import sys
import openpype
from openpype.api import Logger
from openpype.pipeline import (
install_host,
registered_host,
)
log = Logger().get_logger(__name__)
def main(env):
import avalon.api
from openpype.hosts.fusion import api
from openpype.hosts.fusion.api import menu
# Registers pype's Global pyblish plugins
openpype.install()
# activate resolve from pype
avalon.api.install(api)
install_host(api)
log.info(f"Avalon registered hosts: {avalon.api.registered_host()}")
log.info(f"Avalon registered hosts: {registered_host()}")
menu.launch_openpype_menu()

View file

@ -1,14 +1,15 @@
import os
import sys
import glob
import logging
from Qt import QtWidgets, QtCore
import avalon.api
from avalon import io
import qtawesome as qta
from openpype import style
from openpype.pipeline import install_host
from openpype.hosts.fusion import api
from openpype.lib.avalon_context import get_workdir_from_session
@ -181,8 +182,7 @@ class App(QtWidgets.QWidget):
if __name__ == '__main__':
import sys
avalon.api.install(api)
install_host(api)
app = QtWidgets.QApplication(sys.argv)
window = App()

View file

@ -183,10 +183,10 @@ def launch(application_path, *args):
application_path (str): Path to Harmony.
"""
from avalon import api
from openpype.pipeline import install_host
from openpype.hosts.harmony import api as harmony
api.install(harmony)
install_host(harmony)
ProcessContext.port = random.randrange(49152, 65535)
os.environ["AVALON_HARMONY_PORT"] = str(ProcessContext.port)

View file

@ -34,14 +34,7 @@ AVALON_CONTAINERS = ":AVALON_CONTAINERS"
def install():
"""
Installing Hiero integration for avalon
Args:
config (obj): avalon config module `pype` in our case, it is not
used but required by avalon.api.install()
"""
"""Installing Hiero integration."""
# adding all events
events.register_events()

View file

@ -1,9 +1,9 @@
import traceback
# activate hiero from pype
import avalon.api
from openpype.pipeline import install_host
import openpype.hosts.hiero.api as phiero
avalon.api.install(phiero)
install_host(phiero)
try:
__import__("openpype.hosts.hiero.api")

View file

@ -1,10 +1,10 @@
import avalon.api
from openpype.pipeline import install_host
from openpype.hosts.houdini import api
def main():
print("Installing OpenPype ...")
avalon.api.install(api)
install_host(api)
main()

View file

@ -1,10 +1,10 @@
import avalon.api
from openpype.pipeline import install_host
from openpype.hosts.houdini import api
def main():
print("Installing OpenPype ...")
avalon.api.install(api)
install_host(api)
main()

View file

@ -1,11 +1,10 @@
import os
import avalon.api
from openpype.api import get_project_settings
from openpype.pipeline import install_host
from openpype.hosts.maya import api
import openpype.hosts.maya.api.lib as mlib
from maya import cmds
avalon.api.install(api)
install_host(api)
print("starting OpenPype usersetup")

View file

@ -1,7 +1,7 @@
import nuke
import avalon.api
from openpype.api import Logger
from openpype.pipeline import install_host
from openpype.hosts.nuke import api
from openpype.hosts.nuke.api.lib import (
on_script_load,
@ -13,7 +13,7 @@ from openpype.hosts.nuke.api.lib import (
log = Logger.get_logger(__name__)
avalon.api.install(api)
install_host(api)
# fix ffmpeg settings on script
nuke.addOnScriptLoad(on_script_load)

View file

@ -5,9 +5,8 @@ import traceback
from Qt import QtWidgets
import avalon.api
from openpype.api import Logger
from openpype.pipeline import install_host
from openpype.tools.utils import host_tools
from openpype.lib.remote_publish import headless_publish
from openpype.lib import env_value_to_bool
@ -24,7 +23,7 @@ def safe_excepthook(*args):
def main(*subprocess_args):
from openpype.hosts.photoshop import api
avalon.api.install(api)
install_host(api)
sys.excepthook = safe_excepthook
# coloring in StdOutBroker

View file

@ -1,13 +1,14 @@
#!/usr/bin/env python
import os
import sys
import openpype
from openpype.pipeline import install_host
def main(env):
import openpype.hosts.resolve as bmdvr
# Registers openpype's Global pyblish plugins
openpype.install()
install_host(bmdvr)
bmdvr.setup(env)

View file

@ -1,8 +1,7 @@
import os
import sys
import avalon.api as avalon
import openpype
from openpype.pipeline import install_host
from openpype.api import Logger
log = Logger().get_logger(__name__)
@ -10,13 +9,9 @@ log = Logger().get_logger(__name__)
def main(env):
import openpype.hosts.resolve as bmdvr
# Registers openpype's Global pyblish plugins
openpype.install()
# activate resolve from openpype
avalon.install(bmdvr)
log.info(f"Avalon registered hosts: {avalon.registered_host()}")
install_host(bmdvr)
bmdvr.launch_pype_menu()

View file

@ -1,9 +1,11 @@
#! python3
import os
import sys
import avalon.api as avalon
import openpype
import opentimelineio as otio
from openpype.pipeline import install_host
from openpype.hosts.resolve import TestGUI
import openpype.hosts.resolve as bmdvr
from openpype.hosts.resolve.otio import davinci_export as otio_export
@ -14,10 +16,8 @@ class ThisTestGUI(TestGUI):
def __init__(self):
super(ThisTestGUI, self).__init__()
# Registers openpype's Global pyblish plugins
openpype.install()
# activate resolve from openpype
avalon.install(bmdvr)
install_host(bmdvr)
def _open_dir_button_pressed(self, event):
# selected_path = self.fu.RequestFile(os.path.expanduser("~"))

View file

@ -1,8 +1,8 @@
#! python3
import os
import sys
import avalon.api as avalon
import openpype
from openpype.pipeline import install_host
from openpype.hosts.resolve import TestGUI
import openpype.hosts.resolve as bmdvr
import clique
@ -13,10 +13,8 @@ class ThisTestGUI(TestGUI):
def __init__(self):
super(ThisTestGUI, self).__init__()
# Registers openpype's Global pyblish plugins
openpype.install()
# activate resolve from openpype
avalon.install(bmdvr)
install_host(bmdvr)
def _open_dir_button_pressed(self, event):
# selected_path = self.fu.RequestFile(os.path.expanduser("~"))

View file

@ -1,6 +1,5 @@
#! python3
import avalon.api as avalon
import openpype
from openpype.pipeline import install_host
import openpype.hosts.resolve as bmdvr
@ -15,8 +14,7 @@ def file_processing(fpath):
if __name__ == "__main__":
path = "C:/CODE/__openpype_projects/jtest03dev/shots/sq01/mainsq01sh030/publish/plate/plateMain/v006/jt3d_mainsq01sh030_plateMain_v006.0996.exr"
openpype.install()
# activate resolve from openpype
avalon.install(bmdvr)
install_host(bmdvr)
file_processing(path)
file_processing(path)

View file

@ -8,8 +8,8 @@ import logging
from Qt import QtWidgets, QtCore, QtGui
from avalon import api
from openpype import style
from openpype.pipeline import install_host
from openpype.hosts.tvpaint.api.communication_server import (
CommunicationWrapper
)
@ -31,7 +31,7 @@ def main(launch_args):
qt_app = QtWidgets.QApplication([])
# Execute pipeline installation
api.install(tvpaint_host)
install_host(tvpaint_host)
# Create Communicator object and trigger launch
# - this must be done before anything is processed

View file

@ -67,11 +67,8 @@ instances=2
def install():
"""Install Maya-specific functionality of avalon-core.
"""Install TVPaint-specific functionality."""
This function is called automatically on calling `api.install(maya)`.
"""
log.info("OpenPype - Installing TVPaint integration")
io.install()
@ -96,11 +93,11 @@ def install():
def uninstall():
"""Uninstall TVPaint-specific functionality of avalon-core.
This function is called automatically on calling `api.uninstall()`.
"""Uninstall TVPaint-specific functionality.
This function is called automatically on calling `uninstall_host()`.
"""
log.info("OpenPype - Uninstalling TVPaint integration")
pyblish.api.deregister_host("tvpaint")
pyblish.api.deregister_plugin_path(PUBLISH_PATH)

View file

@ -2,13 +2,7 @@ import unreal
openpype_detected = True
try:
from avalon import api
except ImportError as exc:
api = None
openpype_detected = False
unreal.log_error("Avalon: cannot load Avalon [ {} ]".format(exc))
try:
from openpype.pipeline import install_host
from openpype.hosts.unreal import api as openpype_host
except ImportError as exc:
openpype_host = None
@ -16,7 +10,7 @@ except ImportError as exc:
unreal.log_error("OpenPype: cannot load OpenPype [ {} ]".format(exc))
if openpype_detected:
api.install(openpype_host)
install_host(openpype_host)
@unreal.uclass()

View file

@ -1,7 +1,6 @@
import os
import logging
from avalon import api as avalon
from avalon import io
from pyblish import api as pyblish
import openpype.hosts.webpublisher

View file

@ -1,13 +1,12 @@
import os
from datetime import datetime
import sys
from bson.objectid import ObjectId
import collections
from bson.objectid import ObjectId
import pyblish.util
import pyblish.api
from openpype import uninstall
from openpype.lib.mongo import OpenPypeMongoConnection
from openpype.lib.plugin_tools import parse_json
@ -81,7 +80,6 @@ def publish(log, close_plugin_name=None):
if result["error"]:
log.error(error_format.format(**result))
uninstall()
if close_plugin: # close host app explicitly after error
context = pyblish.api.Context()
close_plugin().process(context)
@ -118,7 +116,6 @@ def publish_and_log(dbcon, _id, log, close_plugin_name=None, batch_id=None):
if result["error"]:
log.error(error_format.format(**result))
uninstall()
log_lines = [error_format.format(**result)] + log_lines
dbcon.update_one(
{"_id": _id},

View file

@ -1,6 +1,5 @@
import avalon.api as api
import openpype
from openpype.pipeline import (
install_host,
LegacyCreator,
register_creator_plugin,
discover_creator_plugins,
@ -23,15 +22,14 @@ class Test:
__name__ = "test"
ls = len
def __call__(self):
pass
@staticmethod
def install():
register_creator_plugin(MyTestCreator)
def test_avalon_plugin_presets(monkeypatch, printer):
install_host(Test)
openpype.install()
api.register_host(Test())
register_creator_plugin(MyTestCreator)
plugins = discover_creator_plugins()
printer("Test if we got our test plugin")
assert MyTestCreator in plugins