diff --git a/client/ayon_core/addon/base.py b/client/ayon_core/addon/base.py index a5d1db4058..56d5c46858 100644 --- a/client/ayon_core/addon/base.py +++ b/client/ayon_core/addon/base.py @@ -55,6 +55,7 @@ MOVED_ADDON_MILESTONE_VERSIONS = { "clockify": VersionInfo(0, 2, 0), "flame": VersionInfo(0, 2, 0), "max": VersionInfo(0, 2, 0), + "photoshop": VersionInfo(0, 2, 0), "traypublisher": VersionInfo(0, 2, 0), "tvpaint": VersionInfo(0, 2, 0), "maya": VersionInfo(0, 2, 0), diff --git a/client/ayon_core/hosts/photoshop/__init__.py b/server_addon/photoshop/client/ayon_photoshop/__init__.py similarity index 78% rename from client/ayon_core/hosts/photoshop/__init__.py rename to server_addon/photoshop/client/ayon_photoshop/__init__.py index cf21b7df75..e72c79c812 100644 --- a/client/ayon_core/hosts/photoshop/__init__.py +++ b/server_addon/photoshop/client/ayon_photoshop/__init__.py @@ -1,3 +1,4 @@ +from .version import __version__ from .addon import ( PHOTOSHOP_ADDON_ROOT, PhotoshopAddon, @@ -6,6 +7,8 @@ from .addon import ( __all__ = ( + "__version__", + "PHOTOSHOP_ADDON_ROOT", "PhotoshopAddon", "get_launch_script_path", diff --git a/client/ayon_core/hosts/photoshop/addon.py b/server_addon/photoshop/client/ayon_photoshop/addon.py similarity index 94% rename from client/ayon_core/hosts/photoshop/addon.py rename to server_addon/photoshop/client/ayon_photoshop/addon.py index 65fe6a7cd1..d0fe638f15 100644 --- a/client/ayon_core/hosts/photoshop/addon.py +++ b/server_addon/photoshop/client/ayon_photoshop/addon.py @@ -1,11 +1,14 @@ import os from ayon_core.addon import AYONAddon, IHostAddon +from .version import __version__ + PHOTOSHOP_ADDON_ROOT = os.path.dirname(os.path.abspath(__file__)) class PhotoshopAddon(AYONAddon, IHostAddon): name = "photoshop" + version = __version__ host_name = "photoshop" def add_implementation_envs(self, env, _app): @@ -33,4 +36,3 @@ def get_launch_script_path(): return os.path.join( PHOTOSHOP_ADDON_ROOT, "api", "launch_script.py" ) - diff --git a/client/ayon_core/hosts/photoshop/api/README.md b/server_addon/photoshop/client/ayon_photoshop/api/README.md similarity index 97% rename from client/ayon_core/hosts/photoshop/api/README.md rename to server_addon/photoshop/client/ayon_photoshop/api/README.md index b391131a42..ef458dea16 100644 --- a/client/ayon_core/hosts/photoshop/api/README.md +++ b/server_addon/photoshop/client/ayon_photoshop/api/README.md @@ -17,7 +17,7 @@ ExManCmd /install {path to addon}/api/extension.zxp The easiest way to get the server and Photoshop launch is with: ``` -python -c ^"import ayon_core.hosts.photoshop;ayon_core.hosts.photoshop.launch(""C:\Program Files\Adobe\Adobe Photoshop 2020\Photoshop.exe"")^" +python -c ^"import ayon_photoshop;ayon_photoshop.launch(""C:\Program Files\Adobe\Adobe Photoshop 2020\Photoshop.exe"")^" ``` `avalon.photoshop.launch` launches the application and server, and also closes the server when Photoshop exists. @@ -128,7 +128,7 @@ class CollectInstances(pyblish.api.ContextPlugin): import os from ayon_core.pipeline import publish -from ayon_core.hosts.photoshop import api as photoshop +from ayon_photoshop import api as photoshop class ExtractImage(publish.Extractor): diff --git a/client/ayon_core/hosts/photoshop/api/__init__.py b/server_addon/photoshop/client/ayon_photoshop/api/__init__.py similarity index 100% rename from client/ayon_core/hosts/photoshop/api/__init__.py rename to server_addon/photoshop/client/ayon_photoshop/api/__init__.py diff --git a/client/ayon_core/hosts/photoshop/api/extension.zxp b/server_addon/photoshop/client/ayon_photoshop/api/extension.zxp similarity index 100% rename from client/ayon_core/hosts/photoshop/api/extension.zxp rename to server_addon/photoshop/client/ayon_photoshop/api/extension.zxp diff --git a/client/ayon_core/hosts/photoshop/api/extension/.debug b/server_addon/photoshop/client/ayon_photoshop/api/extension/.debug similarity index 100% rename from client/ayon_core/hosts/photoshop/api/extension/.debug rename to server_addon/photoshop/client/ayon_photoshop/api/extension/.debug diff --git a/client/ayon_core/hosts/photoshop/api/extension/CSXS/manifest.xml b/server_addon/photoshop/client/ayon_photoshop/api/extension/CSXS/manifest.xml similarity index 100% rename from client/ayon_core/hosts/photoshop/api/extension/CSXS/manifest.xml rename to server_addon/photoshop/client/ayon_photoshop/api/extension/CSXS/manifest.xml diff --git a/client/ayon_core/hosts/photoshop/api/extension/client/CSInterface.js b/server_addon/photoshop/client/ayon_photoshop/api/extension/client/CSInterface.js similarity index 100% rename from client/ayon_core/hosts/photoshop/api/extension/client/CSInterface.js rename to server_addon/photoshop/client/ayon_photoshop/api/extension/client/CSInterface.js diff --git a/client/ayon_core/hosts/photoshop/api/extension/client/client.js b/server_addon/photoshop/client/ayon_photoshop/api/extension/client/client.js similarity index 100% rename from client/ayon_core/hosts/photoshop/api/extension/client/client.js rename to server_addon/photoshop/client/ayon_photoshop/api/extension/client/client.js diff --git a/client/ayon_core/hosts/photoshop/api/extension/client/loglevel.min.js b/server_addon/photoshop/client/ayon_photoshop/api/extension/client/loglevel.min.js similarity index 100% rename from client/ayon_core/hosts/photoshop/api/extension/client/loglevel.min.js rename to server_addon/photoshop/client/ayon_photoshop/api/extension/client/loglevel.min.js diff --git a/client/ayon_core/hosts/photoshop/api/extension/client/wsrpc.js b/server_addon/photoshop/client/ayon_photoshop/api/extension/client/wsrpc.js similarity index 100% rename from client/ayon_core/hosts/photoshop/api/extension/client/wsrpc.js rename to server_addon/photoshop/client/ayon_photoshop/api/extension/client/wsrpc.js diff --git a/client/ayon_core/hosts/photoshop/api/extension/client/wsrpc.min.js b/server_addon/photoshop/client/ayon_photoshop/api/extension/client/wsrpc.min.js similarity index 100% rename from client/ayon_core/hosts/photoshop/api/extension/client/wsrpc.min.js rename to server_addon/photoshop/client/ayon_photoshop/api/extension/client/wsrpc.min.js diff --git a/client/ayon_core/hosts/photoshop/api/extension/host/JSX.js b/server_addon/photoshop/client/ayon_photoshop/api/extension/host/JSX.js similarity index 100% rename from client/ayon_core/hosts/photoshop/api/extension/host/JSX.js rename to server_addon/photoshop/client/ayon_photoshop/api/extension/host/JSX.js diff --git a/client/ayon_core/hosts/photoshop/api/extension/host/index.jsx b/server_addon/photoshop/client/ayon_photoshop/api/extension/host/index.jsx similarity index 100% rename from client/ayon_core/hosts/photoshop/api/extension/host/index.jsx rename to server_addon/photoshop/client/ayon_photoshop/api/extension/host/index.jsx diff --git a/client/ayon_core/hosts/photoshop/api/extension/host/json.js b/server_addon/photoshop/client/ayon_photoshop/api/extension/host/json.js similarity index 100% rename from client/ayon_core/hosts/photoshop/api/extension/host/json.js rename to server_addon/photoshop/client/ayon_photoshop/api/extension/host/json.js diff --git a/client/ayon_core/hosts/photoshop/api/extension/icons/ayon_logo.png b/server_addon/photoshop/client/ayon_photoshop/api/extension/icons/ayon_logo.png similarity index 100% rename from client/ayon_core/hosts/photoshop/api/extension/icons/ayon_logo.png rename to server_addon/photoshop/client/ayon_photoshop/api/extension/icons/ayon_logo.png diff --git a/client/ayon_core/hosts/photoshop/api/extension/index.html b/server_addon/photoshop/client/ayon_photoshop/api/extension/index.html similarity index 100% rename from client/ayon_core/hosts/photoshop/api/extension/index.html rename to server_addon/photoshop/client/ayon_photoshop/api/extension/index.html diff --git a/client/ayon_core/hosts/photoshop/api/launch_logic.py b/server_addon/photoshop/client/ayon_photoshop/api/launch_logic.py similarity index 99% rename from client/ayon_core/hosts/photoshop/api/launch_logic.py rename to server_addon/photoshop/client/ayon_photoshop/api/launch_logic.py index c388f93044..04401a0972 100644 --- a/client/ayon_core/hosts/photoshop/api/launch_logic.py +++ b/server_addon/photoshop/client/ayon_photoshop/api/launch_logic.py @@ -22,9 +22,9 @@ from ayon_core.pipeline.workfile import ( ) from ayon_core.pipeline.template_data import get_template_data_with_names from ayon_core.tools.utils import host_tools -from ayon_core.tools.adobe_webserver.app import WebServerTool from ayon_core.pipeline.context_tools import change_current_context +from .webserver import WebServerTool from .ws_stub import PhotoshopServerStub log = Logger.get_logger(__name__) diff --git a/client/ayon_core/hosts/photoshop/api/launch_script.py b/server_addon/photoshop/client/ayon_photoshop/api/launch_script.py similarity index 97% rename from client/ayon_core/hosts/photoshop/api/launch_script.py rename to server_addon/photoshop/client/ayon_photoshop/api/launch_script.py index bb4de80086..de7fc8ba48 100644 --- a/client/ayon_core/hosts/photoshop/api/launch_script.py +++ b/server_addon/photoshop/client/ayon_photoshop/api/launch_script.py @@ -8,7 +8,7 @@ workfile or others. import os import sys -from ayon_core.hosts.photoshop.api.lib import main as host_main +from ayon_photoshop.api.lib import main as host_main # Get current file to locate start point of sys.argv CURRENT_FILE = os.path.abspath(__file__) diff --git a/client/ayon_core/hosts/photoshop/api/lib.py b/server_addon/photoshop/client/ayon_photoshop/api/lib.py similarity index 97% rename from client/ayon_core/hosts/photoshop/api/lib.py rename to server_addon/photoshop/client/ayon_photoshop/api/lib.py index af14e6d02f..fd003919ce 100644 --- a/client/ayon_core/hosts/photoshop/api/lib.py +++ b/server_addon/photoshop/client/ayon_photoshop/api/lib.py @@ -19,7 +19,7 @@ def safe_excepthook(*args): def main(*subprocess_args): - from ayon_core.hosts.photoshop.api import PhotoshopHost + from ayon_photoshop.api import PhotoshopHost host = PhotoshopHost() install_host(host) diff --git a/client/ayon_core/hosts/photoshop/api/panel.png b/server_addon/photoshop/client/ayon_photoshop/api/panel.png similarity index 100% rename from client/ayon_core/hosts/photoshop/api/panel.png rename to server_addon/photoshop/client/ayon_photoshop/api/panel.png diff --git a/client/ayon_core/hosts/photoshop/api/panel_failure.png b/server_addon/photoshop/client/ayon_photoshop/api/panel_failure.png similarity index 100% rename from client/ayon_core/hosts/photoshop/api/panel_failure.png rename to server_addon/photoshop/client/ayon_photoshop/api/panel_failure.png diff --git a/client/ayon_core/hosts/photoshop/api/pipeline.py b/server_addon/photoshop/client/ayon_photoshop/api/pipeline.py similarity index 99% rename from client/ayon_core/hosts/photoshop/api/pipeline.py rename to server_addon/photoshop/client/ayon_photoshop/api/pipeline.py index 27cfa5a7b5..d399bb25e2 100644 --- a/client/ayon_core/hosts/photoshop/api/pipeline.py +++ b/server_addon/photoshop/client/ayon_photoshop/api/pipeline.py @@ -21,8 +21,8 @@ from ayon_core.host import ( ) from ayon_core.pipeline.load import any_outdated_containers -from ayon_core.hosts.photoshop import PHOTOSHOP_ADDON_ROOT from ayon_core.tools.utils import get_ayon_qt_app +from ayon_photoshop import PHOTOSHOP_ADDON_ROOT from . import lib diff --git a/client/ayon_core/hosts/photoshop/api/plugin.py b/server_addon/photoshop/client/ayon_photoshop/api/plugin.py similarity index 100% rename from client/ayon_core/hosts/photoshop/api/plugin.py rename to server_addon/photoshop/client/ayon_photoshop/api/plugin.py diff --git a/server_addon/photoshop/client/ayon_photoshop/api/webserver.py b/server_addon/photoshop/client/ayon_photoshop/api/webserver.py new file mode 100644 index 0000000000..cd229c65ad --- /dev/null +++ b/server_addon/photoshop/client/ayon_photoshop/api/webserver.py @@ -0,0 +1,241 @@ +"""Webserver for communication with photoshop. + +Aiohttp (Asyncio) based websocket server used for communication with host +application. + +This webserver is started in spawned Python process that opens DCC during +its launch, waits for connection from DCC and handles communication going +forward. Server is closed before Python process is killed. +""" +import os +import logging +import urllib +import threading +import asyncio +import socket + +from aiohttp import web + +from wsrpc_aiohttp import WSRPCClient + +from ayon_core.pipeline import get_global_context + +log = logging.getLogger(__name__) + + +class WebServerTool: + """ + Basic POC implementation of asychronic websocket RPC server. + Uses class in external_app_1.py to mimic implementation for single + external application. + 'test_client' folder contains two test implementations of client + """ + _instance = None + + def __init__(self): + WebServerTool._instance = self + + self.client = None + self.handlers = {} + self.on_stop_callbacks = [] + + port = None + host_name = "localhost" + websocket_url = os.getenv("WEBSOCKET_URL") + if websocket_url: + parsed = urllib.parse.urlparse(websocket_url) + port = parsed.port + host_name = parsed.netloc.split(":")[0] + if not port: + port = 8098 # fallback + + self.port = port + self.host_name = host_name + + self.app = web.Application() + + # add route with multiple methods for single "external app" + self.webserver_thread = WebServerThread(self, self.port) + + def add_route(self, *args, **kwargs): + self.app.router.add_route(*args, **kwargs) + + def add_static(self, *args, **kwargs): + self.app.router.add_static(*args, **kwargs) + + def start_server(self): + if self.webserver_thread and not self.webserver_thread.is_alive(): + self.webserver_thread.start() + + def stop_server(self): + self.stop() + + async def send_context_change(self, host): + """ + Calls running webserver to inform about context change + + Used when new PS/AE should be triggered, + but one already running, without + this publish would point to old context. + """ + client = WSRPCClient(os.getenv("WEBSOCKET_URL"), + loop=asyncio.get_event_loop()) + await client.connect() + + context = get_global_context() + project_name = context["project_name"] + folder_path = context["folder_path"] + task_name = context["task_name"] + log.info("Sending context change to {}{}/{}".format( + project_name, folder_path, task_name + )) + + await client.call( + '{}.set_context'.format(host), + project=project_name, + folder=folder_path, + task=task_name + ) + await client.close() + + def port_occupied(self, host_name, port): + """ + Check if 'url' is already occupied. + + This could mean, that app is already running and we are trying open it + again. In that case, use existing running webserver. + Check here is easier than capturing exception from thread. + """ + with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as con: + result = con.connect_ex((host_name, port)) == 0 + + if result: + print(f"Port {port} is already in use") + return result + + def call(self, func): + log.debug("websocket.call {}".format(func)) + future = asyncio.run_coroutine_threadsafe( + func, + self.webserver_thread.loop + ) + result = future.result() + return result + + @staticmethod + def get_instance(): + if WebServerTool._instance is None: + WebServerTool() + return WebServerTool._instance + + @property + def is_running(self): + if not self.webserver_thread: + return False + return self.webserver_thread.is_running + + def stop(self): + if not self.is_running: + return + try: + log.debug("Stopping websocket server") + self.webserver_thread.is_running = False + self.webserver_thread.stop() + except Exception: + log.warning( + "Error has happened during Killing websocket server", + exc_info=True + ) + + def thread_stopped(self): + for callback in self.on_stop_callbacks: + callback() + + +class WebServerThread(threading.Thread): + """ Listener for websocket rpc requests. + + It would be probably better to "attach" this to main thread (as for + example Harmony needs to run something on main thread), but currently + it creates separate thread and separate asyncio event loop + """ + def __init__(self, module, port): + super(WebServerThread, self).__init__() + + self.is_running = False + self.port = port + self.module = module + self.loop = None + self.runner = None + self.site = None + self.tasks = [] + + def run(self): + self.is_running = True + + try: + log.info("Starting web server") + self.loop = asyncio.new_event_loop() # create new loop for thread + asyncio.set_event_loop(self.loop) + + self.loop.run_until_complete(self.start_server()) + + websocket_url = "ws://localhost:{}/ws".format(self.port) + + log.debug( + "Running Websocket server on URL: \"{}\"".format(websocket_url) + ) + + asyncio.ensure_future(self.check_shutdown(), loop=self.loop) + self.loop.run_forever() + except Exception: + self.is_running = False + log.warning( + "Websocket Server service has failed", exc_info=True + ) + raise + finally: + self.loop.close() # optional + + self.is_running = False + self.module.thread_stopped() + log.info("Websocket server stopped") + + async def start_server(self): + """ Starts runner and TCPsite """ + self.runner = web.AppRunner(self.module.app) + await self.runner.setup() + self.site = web.TCPSite(self.runner, 'localhost', self.port) + await self.site.start() + + def stop(self): + """Sets is_running flag to false, 'check_shutdown' shuts server down""" + self.is_running = False + + async def check_shutdown(self): + """ Future that is running and checks if server should be running + periodically. + """ + while self.is_running: + while self.tasks: + task = self.tasks.pop(0) + log.debug("waiting for task {}".format(task)) + await task + log.debug("returned value {}".format(task.result)) + + await asyncio.sleep(0.5) + + log.debug("Starting shutdown") + await self.site.stop() + log.debug("Site stopped") + await self.runner.cleanup() + log.debug("Runner stopped") + tasks = [task for task in asyncio.all_tasks() if + task is not asyncio.current_task()] + list(map(lambda task: task.cancel(), tasks)) # cancel all the tasks + results = await asyncio.gather(*tasks, return_exceptions=True) + log.debug(f'Finished awaiting cancelled tasks, results: {results}...') + await self.loop.shutdown_asyncgens() + # to really make sure everything else has time to stop + await asyncio.sleep(0.07) + self.loop.stop() diff --git a/client/ayon_core/hosts/photoshop/api/ws_stub.py b/server_addon/photoshop/client/ayon_photoshop/api/ws_stub.py similarity index 99% rename from client/ayon_core/hosts/photoshop/api/ws_stub.py rename to server_addon/photoshop/client/ayon_photoshop/api/ws_stub.py index 36fe0af2f8..3619fa4b7a 100644 --- a/client/ayon_core/hosts/photoshop/api/ws_stub.py +++ b/server_addon/photoshop/client/ayon_photoshop/api/ws_stub.py @@ -6,7 +6,7 @@ import json import attr from wsrpc_aiohttp import WebSocketAsync -from ayon_core.tools.adobe_webserver.app import WebServerTool +from .webserver import WebServerTool @attr.s diff --git a/client/ayon_core/hosts/photoshop/hooks/pre_launch_args.py b/server_addon/photoshop/client/ayon_photoshop/hooks/pre_launch_args.py similarity index 97% rename from client/ayon_core/hosts/photoshop/hooks/pre_launch_args.py rename to server_addon/photoshop/client/ayon_photoshop/hooks/pre_launch_args.py index 70f8fc730f..ff60c2f40d 100644 --- a/client/ayon_core/hosts/photoshop/hooks/pre_launch_args.py +++ b/server_addon/photoshop/client/ayon_photoshop/hooks/pre_launch_args.py @@ -7,7 +7,7 @@ from ayon_core.lib import ( is_using_ayon_console, ) from ayon_applications import PreLaunchHook, LaunchTypes -from ayon_core.hosts.photoshop import get_launch_script_path +from ayon_photoshop import get_launch_script_path def get_launch_kwargs(kwargs): diff --git a/client/ayon_core/hosts/photoshop/lib.py b/server_addon/photoshop/client/ayon_photoshop/lib.py similarity index 97% rename from client/ayon_core/hosts/photoshop/lib.py rename to server_addon/photoshop/client/ayon_photoshop/lib.py index dd227c5d81..9dc90953c5 100644 --- a/client/ayon_core/hosts/photoshop/lib.py +++ b/server_addon/photoshop/client/ayon_photoshop/lib.py @@ -2,13 +2,13 @@ import re import ayon_api -import ayon_core.hosts.photoshop.api as api from ayon_core.lib import prepare_template_data from ayon_core.pipeline import ( AutoCreator, CreatedInstance ) -from ayon_core.hosts.photoshop.api.pipeline import cache_and_get_instances +from ayon_photoshop import api +from ayon_photoshop.api.pipeline import cache_and_get_instances class PSAutoCreator(AutoCreator): diff --git a/client/ayon_core/hosts/photoshop/plugins/create/create_flatten_image.py b/server_addon/photoshop/client/ayon_photoshop/plugins/create/create_flatten_image.py similarity index 97% rename from client/ayon_core/hosts/photoshop/plugins/create/create_flatten_image.py rename to server_addon/photoshop/client/ayon_photoshop/plugins/create/create_flatten_image.py index a3bc77c640..a467a5ecaa 100644 --- a/client/ayon_core/hosts/photoshop/plugins/create/create_flatten_image.py +++ b/server_addon/photoshop/client/ayon_photoshop/plugins/create/create_flatten_image.py @@ -1,7 +1,7 @@ import ayon_api -import ayon_core.hosts.photoshop.api as api -from ayon_core.hosts.photoshop.lib import PSAutoCreator, clean_product_name +from ayon_photoshop import api +from ayon_photoshop.lib import PSAutoCreator, clean_product_name from ayon_core.lib import BoolDef, prepare_template_data from ayon_core.pipeline.create import get_product_name, CreatedInstance diff --git a/client/ayon_core/hosts/photoshop/plugins/create/create_image.py b/server_addon/photoshop/client/ayon_photoshop/plugins/create/create_image.py similarity index 98% rename from client/ayon_core/hosts/photoshop/plugins/create/create_image.py rename to server_addon/photoshop/client/ayon_photoshop/plugins/create/create_image.py index a44c3490c6..0170306301 100644 --- a/client/ayon_core/hosts/photoshop/plugins/create/create_image.py +++ b/server_addon/photoshop/client/ayon_photoshop/plugins/create/create_image.py @@ -1,6 +1,5 @@ import re -from ayon_core.hosts.photoshop import api from ayon_core.lib import BoolDef from ayon_core.pipeline import ( Creator, @@ -9,8 +8,9 @@ from ayon_core.pipeline import ( ) from ayon_core.lib import prepare_template_data from ayon_core.pipeline.create import PRODUCT_NAME_ALLOWED_SYMBOLS -from ayon_core.hosts.photoshop.api.pipeline import cache_and_get_instances -from ayon_core.hosts.photoshop.lib import clean_product_name +from ayon_photoshop import api +from ayon_photoshop.api.pipeline import cache_and_get_instances +from ayon_photoshop.lib import clean_product_name class ImageCreator(Creator): diff --git a/client/ayon_core/hosts/photoshop/plugins/create/create_review.py b/server_addon/photoshop/client/ayon_photoshop/plugins/create/create_review.py similarity index 94% rename from client/ayon_core/hosts/photoshop/plugins/create/create_review.py rename to server_addon/photoshop/client/ayon_photoshop/plugins/create/create_review.py index 229b736801..60c64b3831 100644 --- a/client/ayon_core/hosts/photoshop/plugins/create/create_review.py +++ b/server_addon/photoshop/client/ayon_photoshop/plugins/create/create_review.py @@ -1,4 +1,4 @@ -from ayon_core.hosts.photoshop.lib import PSAutoCreator +from ayon_photoshop.lib import PSAutoCreator class ReviewCreator(PSAutoCreator): diff --git a/client/ayon_core/hosts/photoshop/plugins/create/create_workfile.py b/server_addon/photoshop/client/ayon_photoshop/plugins/create/create_workfile.py similarity index 94% rename from client/ayon_core/hosts/photoshop/plugins/create/create_workfile.py rename to server_addon/photoshop/client/ayon_photoshop/plugins/create/create_workfile.py index da0c9d1d12..ce44a1ad2d 100644 --- a/client/ayon_core/hosts/photoshop/plugins/create/create_workfile.py +++ b/server_addon/photoshop/client/ayon_photoshop/plugins/create/create_workfile.py @@ -1,4 +1,4 @@ -from ayon_core.hosts.photoshop.lib import PSAutoCreator +from ayon_photoshop.lib import PSAutoCreator class WorkfileCreator(PSAutoCreator): diff --git a/client/ayon_core/hosts/photoshop/plugins/load/load_image.py b/server_addon/photoshop/client/ayon_photoshop/plugins/load/load_image.py similarity index 95% rename from client/ayon_core/hosts/photoshop/plugins/load/load_image.py rename to server_addon/photoshop/client/ayon_photoshop/plugins/load/load_image.py index d71067615e..e3d80f6957 100644 --- a/client/ayon_core/hosts/photoshop/plugins/load/load_image.py +++ b/server_addon/photoshop/client/ayon_photoshop/plugins/load/load_image.py @@ -1,8 +1,8 @@ import re from ayon_core.pipeline import get_representation_path -from ayon_core.hosts.photoshop import api as photoshop -from ayon_core.hosts.photoshop.api import get_unique_layer_name +from ayon_photoshop import api as photoshop +from ayon_photoshop.api import get_unique_layer_name class ImageLoader(photoshop.PhotoshopLoader): diff --git a/client/ayon_core/hosts/photoshop/plugins/load/load_image_from_sequence.py b/server_addon/photoshop/client/ayon_photoshop/plugins/load/load_image_from_sequence.py similarity index 95% rename from client/ayon_core/hosts/photoshop/plugins/load/load_image_from_sequence.py rename to server_addon/photoshop/client/ayon_photoshop/plugins/load/load_image_from_sequence.py index dd14543f3e..f69dce26f6 100644 --- a/client/ayon_core/hosts/photoshop/plugins/load/load_image_from_sequence.py +++ b/server_addon/photoshop/client/ayon_photoshop/plugins/load/load_image_from_sequence.py @@ -2,8 +2,8 @@ import os import qargparse -from ayon_core.hosts.photoshop import api as photoshop -from ayon_core.hosts.photoshop.api import get_unique_layer_name +from ayon_photoshop import api as photoshop +from ayon_photoshop.api import get_unique_layer_name class ImageFromSequenceLoader(photoshop.PhotoshopLoader): diff --git a/client/ayon_core/hosts/photoshop/plugins/load/load_reference.py b/server_addon/photoshop/client/ayon_photoshop/plugins/load/load_reference.py similarity index 95% rename from client/ayon_core/hosts/photoshop/plugins/load/load_reference.py rename to server_addon/photoshop/client/ayon_photoshop/plugins/load/load_reference.py index b563faff82..21076f6a4f 100644 --- a/client/ayon_core/hosts/photoshop/plugins/load/load_reference.py +++ b/server_addon/photoshop/client/ayon_photoshop/plugins/load/load_reference.py @@ -1,8 +1,8 @@ import re from ayon_core.pipeline import get_representation_path -from ayon_core.hosts.photoshop import api as photoshop -from ayon_core.hosts.photoshop.api import get_unique_layer_name +from ayon_photoshop import api as photoshop +from ayon_photoshop.api import get_unique_layer_name class ReferenceLoader(photoshop.PhotoshopLoader): diff --git a/client/ayon_core/hosts/photoshop/plugins/publish/closePS.py b/server_addon/photoshop/client/ayon_photoshop/plugins/publish/closePS.py similarity index 91% rename from client/ayon_core/hosts/photoshop/plugins/publish/closePS.py rename to server_addon/photoshop/client/ayon_photoshop/plugins/publish/closePS.py index 68c3b5b249..2cdc9fa1e8 100644 --- a/client/ayon_core/hosts/photoshop/plugins/publish/closePS.py +++ b/server_addon/photoshop/client/ayon_photoshop/plugins/publish/closePS.py @@ -2,7 +2,7 @@ """Close PS after publish. For Webpublishing only.""" import pyblish.api -from ayon_core.hosts.photoshop import api as photoshop +from ayon_photoshop import api as photoshop class ClosePS(pyblish.api.ContextPlugin): diff --git a/client/ayon_core/hosts/photoshop/plugins/publish/collect_auto_image.py b/server_addon/photoshop/client/ayon_photoshop/plugins/publish/collect_auto_image.py similarity index 98% rename from client/ayon_core/hosts/photoshop/plugins/publish/collect_auto_image.py rename to server_addon/photoshop/client/ayon_photoshop/plugins/publish/collect_auto_image.py index adbe02eb74..23a71bdf46 100644 --- a/client/ayon_core/hosts/photoshop/plugins/publish/collect_auto_image.py +++ b/server_addon/photoshop/client/ayon_photoshop/plugins/publish/collect_auto_image.py @@ -1,6 +1,6 @@ import pyblish.api -from ayon_core.hosts.photoshop import api as photoshop +from ayon_photoshop import api as photoshop from ayon_core.pipeline.create import get_product_name diff --git a/client/ayon_core/hosts/photoshop/plugins/publish/collect_auto_image_refresh.py b/server_addon/photoshop/client/ayon_photoshop/plugins/publish/collect_auto_image_refresh.py similarity index 94% rename from client/ayon_core/hosts/photoshop/plugins/publish/collect_auto_image_refresh.py rename to server_addon/photoshop/client/ayon_photoshop/plugins/publish/collect_auto_image_refresh.py index 7a5f297c89..108b65232a 100644 --- a/client/ayon_core/hosts/photoshop/plugins/publish/collect_auto_image_refresh.py +++ b/server_addon/photoshop/client/ayon_photoshop/plugins/publish/collect_auto_image_refresh.py @@ -1,6 +1,6 @@ import pyblish.api -from ayon_core.hosts.photoshop import api as photoshop +from ayon_photoshop import api as photoshop class CollectAutoImageRefresh(pyblish.api.ContextPlugin): diff --git a/client/ayon_core/hosts/photoshop/plugins/publish/collect_auto_review.py b/server_addon/photoshop/client/ayon_photoshop/plugins/publish/collect_auto_review.py similarity index 98% rename from client/ayon_core/hosts/photoshop/plugins/publish/collect_auto_review.py rename to server_addon/photoshop/client/ayon_photoshop/plugins/publish/collect_auto_review.py index d7267d253a..8b84e69309 100644 --- a/client/ayon_core/hosts/photoshop/plugins/publish/collect_auto_review.py +++ b/server_addon/photoshop/client/ayon_photoshop/plugins/publish/collect_auto_review.py @@ -7,7 +7,7 @@ Provides: """ import pyblish.api -from ayon_core.hosts.photoshop import api as photoshop +from ayon_photoshop import api as photoshop from ayon_core.pipeline.create import get_product_name diff --git a/client/ayon_core/hosts/photoshop/plugins/publish/collect_auto_workfile.py b/server_addon/photoshop/client/ayon_photoshop/plugins/publish/collect_auto_workfile.py similarity index 98% rename from client/ayon_core/hosts/photoshop/plugins/publish/collect_auto_workfile.py rename to server_addon/photoshop/client/ayon_photoshop/plugins/publish/collect_auto_workfile.py index af74c76a15..1bf7c1a600 100644 --- a/client/ayon_core/hosts/photoshop/plugins/publish/collect_auto_workfile.py +++ b/server_addon/photoshop/client/ayon_photoshop/plugins/publish/collect_auto_workfile.py @@ -1,7 +1,7 @@ import os import pyblish.api -from ayon_core.hosts.photoshop import api as photoshop +from ayon_photoshop import api as photoshop from ayon_core.pipeline.create import get_product_name diff --git a/client/ayon_core/hosts/photoshop/plugins/publish/collect_batch_data.py b/server_addon/photoshop/client/ayon_photoshop/plugins/publish/collect_batch_data.py similarity index 100% rename from client/ayon_core/hosts/photoshop/plugins/publish/collect_batch_data.py rename to server_addon/photoshop/client/ayon_photoshop/plugins/publish/collect_batch_data.py diff --git a/client/ayon_core/hosts/photoshop/plugins/publish/collect_color_coded_instances.py b/server_addon/photoshop/client/ayon_photoshop/plugins/publish/collect_color_coded_instances.py similarity index 99% rename from client/ayon_core/hosts/photoshop/plugins/publish/collect_color_coded_instances.py rename to server_addon/photoshop/client/ayon_photoshop/plugins/publish/collect_color_coded_instances.py index e8f7c7e3df..52df60dd8a 100644 --- a/client/ayon_core/hosts/photoshop/plugins/publish/collect_color_coded_instances.py +++ b/server_addon/photoshop/client/ayon_photoshop/plugins/publish/collect_color_coded_instances.py @@ -4,8 +4,8 @@ import re import pyblish.api from ayon_core.lib import prepare_template_data, is_in_tests -from ayon_core.hosts.photoshop import api as photoshop from ayon_core.settings import get_project_settings +from ayon_photoshop import api as photoshop class CollectColorCodedInstances(pyblish.api.ContextPlugin): diff --git a/client/ayon_core/hosts/photoshop/plugins/publish/collect_current_file.py b/server_addon/photoshop/client/ayon_photoshop/plugins/publish/collect_current_file.py similarity index 88% rename from client/ayon_core/hosts/photoshop/plugins/publish/collect_current_file.py rename to server_addon/photoshop/client/ayon_photoshop/plugins/publish/collect_current_file.py index 74353d452f..02f2217f75 100644 --- a/client/ayon_core/hosts/photoshop/plugins/publish/collect_current_file.py +++ b/server_addon/photoshop/client/ayon_photoshop/plugins/publish/collect_current_file.py @@ -2,7 +2,7 @@ import os import pyblish.api -from ayon_core.hosts.photoshop import api as photoshop +from ayon_photoshop import api as photoshop class CollectCurrentFile(pyblish.api.ContextPlugin): diff --git a/client/ayon_core/hosts/photoshop/plugins/publish/collect_extension_version.py b/server_addon/photoshop/client/ayon_photoshop/plugins/publish/collect_extension_version.py similarity index 97% rename from client/ayon_core/hosts/photoshop/plugins/publish/collect_extension_version.py rename to server_addon/photoshop/client/ayon_photoshop/plugins/publish/collect_extension_version.py index 2d24a8de15..90415e9245 100644 --- a/client/ayon_core/hosts/photoshop/plugins/publish/collect_extension_version.py +++ b/server_addon/photoshop/client/ayon_photoshop/plugins/publish/collect_extension_version.py @@ -2,7 +2,7 @@ import os import re import pyblish.api -from ayon_core.hosts.photoshop import api as photoshop +from ayon_photoshop import api as photoshop class CollectExtensionVersion(pyblish.api.ContextPlugin): diff --git a/client/ayon_core/hosts/photoshop/plugins/publish/collect_image.py b/server_addon/photoshop/client/ayon_photoshop/plugins/publish/collect_image.py similarity index 91% rename from client/ayon_core/hosts/photoshop/plugins/publish/collect_image.py rename to server_addon/photoshop/client/ayon_photoshop/plugins/publish/collect_image.py index bfd73bfc5f..ed6af6f7d3 100644 --- a/client/ayon_core/hosts/photoshop/plugins/publish/collect_image.py +++ b/server_addon/photoshop/client/ayon_photoshop/plugins/publish/collect_image.py @@ -1,6 +1,6 @@ import pyblish.api -from ayon_core.hosts.photoshop import api +from ayon_photoshop import api class CollectImage(pyblish.api.InstancePlugin): diff --git a/client/ayon_core/hosts/photoshop/plugins/publish/collect_published_version.py b/server_addon/photoshop/client/ayon_photoshop/plugins/publish/collect_published_version.py similarity index 100% rename from client/ayon_core/hosts/photoshop/plugins/publish/collect_published_version.py rename to server_addon/photoshop/client/ayon_photoshop/plugins/publish/collect_published_version.py diff --git a/client/ayon_core/hosts/photoshop/plugins/publish/collect_review.py b/server_addon/photoshop/client/ayon_photoshop/plugins/publish/collect_review.py similarity index 100% rename from client/ayon_core/hosts/photoshop/plugins/publish/collect_review.py rename to server_addon/photoshop/client/ayon_photoshop/plugins/publish/collect_review.py diff --git a/client/ayon_core/hosts/photoshop/plugins/publish/collect_version.py b/server_addon/photoshop/client/ayon_photoshop/plugins/publish/collect_version.py similarity index 100% rename from client/ayon_core/hosts/photoshop/plugins/publish/collect_version.py rename to server_addon/photoshop/client/ayon_photoshop/plugins/publish/collect_version.py diff --git a/client/ayon_core/hosts/photoshop/plugins/publish/collect_workfile.py b/server_addon/photoshop/client/ayon_photoshop/plugins/publish/collect_workfile.py similarity index 100% rename from client/ayon_core/hosts/photoshop/plugins/publish/collect_workfile.py rename to server_addon/photoshop/client/ayon_photoshop/plugins/publish/collect_workfile.py diff --git a/client/ayon_core/hosts/photoshop/plugins/publish/extract_image.py b/server_addon/photoshop/client/ayon_photoshop/plugins/publish/extract_image.py similarity index 98% rename from client/ayon_core/hosts/photoshop/plugins/publish/extract_image.py rename to server_addon/photoshop/client/ayon_photoshop/plugins/publish/extract_image.py index 7290a1437e..0d8824af2d 100644 --- a/client/ayon_core/hosts/photoshop/plugins/publish/extract_image.py +++ b/server_addon/photoshop/client/ayon_photoshop/plugins/publish/extract_image.py @@ -2,7 +2,7 @@ import os import pyblish.api from ayon_core.pipeline import publish -from ayon_core.hosts.photoshop import api as photoshop +from ayon_photoshop import api as photoshop class ExtractImage(pyblish.api.ContextPlugin): diff --git a/client/ayon_core/hosts/photoshop/plugins/publish/extract_review.py b/server_addon/photoshop/client/ayon_photoshop/plugins/publish/extract_review.py similarity index 99% rename from client/ayon_core/hosts/photoshop/plugins/publish/extract_review.py rename to server_addon/photoshop/client/ayon_photoshop/plugins/publish/extract_review.py index 3497e7ad75..11bb47a886 100644 --- a/client/ayon_core/hosts/photoshop/plugins/publish/extract_review.py +++ b/server_addon/photoshop/client/ayon_photoshop/plugins/publish/extract_review.py @@ -7,7 +7,7 @@ from ayon_core.lib import ( get_ffmpeg_tool_args, ) from ayon_core.pipeline import publish -from ayon_core.hosts.photoshop import api as photoshop +from ayon_photoshop import api as photoshop class ExtractReview(publish.Extractor): diff --git a/client/ayon_core/hosts/photoshop/plugins/publish/extract_save_scene.py b/server_addon/photoshop/client/ayon_photoshop/plugins/publish/extract_save_scene.py similarity index 85% rename from client/ayon_core/hosts/photoshop/plugins/publish/extract_save_scene.py rename to server_addon/photoshop/client/ayon_photoshop/plugins/publish/extract_save_scene.py index 962c0722db..22ebbb739d 100644 --- a/client/ayon_core/hosts/photoshop/plugins/publish/extract_save_scene.py +++ b/server_addon/photoshop/client/ayon_photoshop/plugins/publish/extract_save_scene.py @@ -1,5 +1,5 @@ from ayon_core.pipeline import publish -from ayon_core.hosts.photoshop import api as photoshop +from ayon_photoshop import api as photoshop class ExtractSaveScene(publish.Extractor): diff --git a/client/ayon_core/hosts/photoshop/plugins/publish/help/validate_instance_asset.xml b/server_addon/photoshop/client/ayon_photoshop/plugins/publish/help/validate_instance_asset.xml similarity index 100% rename from client/ayon_core/hosts/photoshop/plugins/publish/help/validate_instance_asset.xml rename to server_addon/photoshop/client/ayon_photoshop/plugins/publish/help/validate_instance_asset.xml diff --git a/client/ayon_core/hosts/photoshop/plugins/publish/help/validate_naming.xml b/server_addon/photoshop/client/ayon_photoshop/plugins/publish/help/validate_naming.xml similarity index 100% rename from client/ayon_core/hosts/photoshop/plugins/publish/help/validate_naming.xml rename to server_addon/photoshop/client/ayon_photoshop/plugins/publish/help/validate_naming.xml diff --git a/client/ayon_core/hosts/photoshop/plugins/publish/increment_workfile.py b/server_addon/photoshop/client/ayon_photoshop/plugins/publish/increment_workfile.py similarity index 94% rename from client/ayon_core/hosts/photoshop/plugins/publish/increment_workfile.py rename to server_addon/photoshop/client/ayon_photoshop/plugins/publish/increment_workfile.py index 9b25a35ef5..b10645813a 100644 --- a/client/ayon_core/hosts/photoshop/plugins/publish/increment_workfile.py +++ b/server_addon/photoshop/client/ayon_photoshop/plugins/publish/increment_workfile.py @@ -3,7 +3,7 @@ import pyblish.api from ayon_core.pipeline.publish import get_errored_plugins_from_context from ayon_core.lib import version_up -from ayon_core.hosts.photoshop import api as photoshop +from ayon_photoshop import api as photoshop class IncrementWorkfile(pyblish.api.InstancePlugin): diff --git a/client/ayon_core/hosts/photoshop/plugins/publish/validate_instance_asset.py b/server_addon/photoshop/client/ayon_photoshop/plugins/publish/validate_instance_asset.py similarity index 97% rename from client/ayon_core/hosts/photoshop/plugins/publish/validate_instance_asset.py rename to server_addon/photoshop/client/ayon_photoshop/plugins/publish/validate_instance_asset.py index c3a6822f32..36ba621dc2 100644 --- a/client/ayon_core/hosts/photoshop/plugins/publish/validate_instance_asset.py +++ b/server_addon/photoshop/client/ayon_photoshop/plugins/publish/validate_instance_asset.py @@ -6,7 +6,7 @@ from ayon_core.pipeline.publish import ( PublishXmlValidationError, OptionalPyblishPluginMixin ) -from ayon_core.hosts.photoshop import api as photoshop +from ayon_photoshop import api as photoshop class ValidateInstanceFolderRepair(pyblish.api.Action): diff --git a/client/ayon_core/hosts/photoshop/plugins/publish/validate_naming.py b/server_addon/photoshop/client/ayon_photoshop/plugins/publish/validate_naming.py similarity index 98% rename from client/ayon_core/hosts/photoshop/plugins/publish/validate_naming.py rename to server_addon/photoshop/client/ayon_photoshop/plugins/publish/validate_naming.py index 13c6a54fd2..2b5492d878 100644 --- a/client/ayon_core/hosts/photoshop/plugins/publish/validate_naming.py +++ b/server_addon/photoshop/client/ayon_photoshop/plugins/publish/validate_naming.py @@ -2,7 +2,7 @@ import re import pyblish.api -from ayon_core.hosts.photoshop import api as photoshop +from ayon_photoshop import api as photoshop from ayon_core.pipeline.create import PRODUCT_NAME_ALLOWED_SYMBOLS from ayon_core.pipeline.publish import ( ValidateContentsOrder, diff --git a/client/ayon_core/hosts/photoshop/resources/template.psd b/server_addon/photoshop/client/ayon_photoshop/resources/template.psd similarity index 100% rename from client/ayon_core/hosts/photoshop/resources/template.psd rename to server_addon/photoshop/client/ayon_photoshop/resources/template.psd diff --git a/server_addon/photoshop/client/ayon_photoshop/version.py b/server_addon/photoshop/client/ayon_photoshop/version.py new file mode 100644 index 0000000000..f04558d6c6 --- /dev/null +++ b/server_addon/photoshop/client/ayon_photoshop/version.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- +"""Package declaring AYON addon 'photoshop' version.""" +__version__ = "0.2.0" diff --git a/server_addon/photoshop/client/pyproject.toml b/server_addon/photoshop/client/pyproject.toml new file mode 100644 index 0000000000..3beb76ba74 --- /dev/null +++ b/server_addon/photoshop/client/pyproject.toml @@ -0,0 +1,6 @@ +[project] +name="photoshop" +description="AYON Phostoshop addon." + +[ayon.runtimeDependencies] +wsrpc_aiohttp = "^3.1.1" # websocket server diff --git a/server_addon/photoshop/package.py b/server_addon/photoshop/package.py index 22043f951c..3c57a9c79e 100644 --- a/server_addon/photoshop/package.py +++ b/server_addon/photoshop/package.py @@ -1,3 +1,10 @@ name = "photoshop" title = "Photoshop" -version = "0.1.3" +version = "0.2.0" + +client_dir = "ayon_photoshop" + +ayon_required_addons = { + "core": ">0.3.2", +} +ayon_compatible_addons = {}