From 358290be889a148f4e7a5f1c84efe3ee15a24a8d Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Thu, 29 Feb 2024 15:41:59 +0800 Subject: [PATCH] make sure all openpype import converted to ayon_core --- .../hosts/zbrush/api/communication_server.py | 12 ++++++++++- .../hosts/zbrush/hooks/create_zmenu_script.py | 6 +++--- .../zbrush/hooks/force_startup_script.py | 12 +++++------ .../hosts/zbrush/startup/startup.txt | 20 +++++++++---------- server_addon/applications/server/version.py | 2 +- 5 files changed, 31 insertions(+), 21 deletions(-) diff --git a/client/ayon_core/hosts/zbrush/api/communication_server.py b/client/ayon_core/hosts/zbrush/api/communication_server.py index 76f1abb68f..44eecd95bf 100644 --- a/client/ayon_core/hosts/zbrush/api/communication_server.py +++ b/client/ayon_core/hosts/zbrush/api/communication_server.py @@ -230,8 +230,18 @@ class BaseZbrushRpc(JsonRpc): return await super()._handle_rpc_msg(http_request, raw_msg) def client_connected(self): - return True + # TODO This is poor check. Add check it is client from TVPaint + if self.clients: + return True + return False + def send_notification(self, client, method, params=None): + if params is None: + params = [] + asyncio.run_coroutine_threadsafe( + client.ws.send_str(encode_request(method, params=params)), + loop=self.loop + ) def send_request(self, client, method, params=None, timeout=0): if params is None: diff --git a/client/ayon_core/hosts/zbrush/hooks/create_zmenu_script.py b/client/ayon_core/hosts/zbrush/hooks/create_zmenu_script.py index aa8e7e0db9..df84006cf9 100644 --- a/client/ayon_core/hosts/zbrush/hooks/create_zmenu_script.py +++ b/client/ayon_core/hosts/zbrush/hooks/create_zmenu_script.py @@ -1,8 +1,8 @@ """Pre-launch to force zbrush startup script.""" import os -from openpype.hosts.zbrush import ZBRUSH_HOST_DIR -from openpype import AYON_SERVER_ENABLED -from openpype.lib.applications import PreLaunchHook, LaunchTypes +from ayon_core.hosts.zbrush import ZBRUSH_HOST_DIR +from ayon_core import AYON_SERVER_ENABLED +from ayon_core.lib.applications import PreLaunchHook, LaunchTypes diff --git a/client/ayon_core/hosts/zbrush/hooks/force_startup_script.py b/client/ayon_core/hosts/zbrush/hooks/force_startup_script.py index a463116af7..efeef02ccf 100644 --- a/client/ayon_core/hosts/zbrush/hooks/force_startup_script.py +++ b/client/ayon_core/hosts/zbrush/hooks/force_startup_script.py @@ -1,16 +1,16 @@ # -*- coding: utf-8 -*- """Pre-launch to force zbrush startup script.""" import os -from openpype.hosts.zbrush import ZBRUSH_HOST_DIR -from openpype.lib import get_openpype_execute_args -from openpype.lib.applications import PreLaunchHook, LaunchTypes +from ayon_core.hosts.zbrush import ZBRUSH_HOST_DIR +from ayon_core.lib import get_openpype_execute_args +from ayon_core.lib.applications import PreLaunchHook, LaunchTypes class ForceStartupScript(PreLaunchHook): - """Inject OpenPype environment to Zbrush. + """Inject AYON environment to Zbrush. Note that this works in combination whit Zbrush startup script that - is creating the environment variable for the Openpype Plugin + is creating the environment variable for the AYON Plugin Hook `GlobalHostDataHook` must be executed before this hook. """ @@ -46,6 +46,6 @@ class ForceStartupScript(PreLaunchHook): def launch_script_path(self): - from openpype.hosts.zbrush import get_launch_script_path + from ayon_core.hosts.zbrush import get_launch_script_path return get_launch_script_path() diff --git a/client/ayon_core/hosts/zbrush/startup/startup.txt b/client/ayon_core/hosts/zbrush/startup/startup.txt index cc121430af..0a16f9a15f 100644 --- a/client/ayon_core/hosts/zbrush/startup/startup.txt +++ b/client/ayon_core/hosts/zbrush/startup/startup.txt @@ -6,15 +6,15 @@ [VarSet, offset, 0] [RoutineDef, write, - [VarAdd, offset, [MemWriteString, OpenpypePlugins, + [VarAdd, offset, [MemWriteString, AYONPlugins, [StrMerge, text, crlf], offset, 0] ] , text] -[If, [MemGetSize, OpenpypePlugins], - [MemDelete, OpenpypePlugins] +[If, [MemGetSize, AYONPlugins], + [MemDelete, AYONPlugins] ] -[MemCreate, OpenpypePlugins, 1000] +[MemCreate, AYONPlugins, 1000] [RoutineCall, write, "@echo off"] [RoutineCall, write, [StrMerge, "set ", quot, "_OUT=", txt, quot]] @@ -49,21 +49,21 @@ [RoutineCall, write, ")"] [RoutineCall, write, [StrMerge, "echo %~1>> ", quot, "%_OUT%", quot]] -[MemResize, OpenpypePlugins, offset] -[If, [MemSaveToFile, OpenpypePlugins, bat, 1] < 1, +[MemResize, AYONPlugins, offset] +[If, [MemSaveToFile, AYONPlugins, bat, 1] < 1, [Note, "Error preparing ZBrush for external plugins."] , [VarDef, file, ""] [VarSet, offset, 0] - [MemDelete, OpenpypePlugins] + [MemDelete, AYONPlugins] [ShellExecute, [StrMerge, quot, bat, quot]] [FileDelete, bat] - [MemCreateFromFile, OpenpypePlugins, txt] + [MemCreateFromFile, AYONPlugins, txt] [FileDelete, txt] [Loop, 10000, - [VarSet, bytes, [MemReadString, OpenpypePlugins, file, offset, 1]] + [VarSet, bytes, [MemReadString, AYONPlugins, file, offset, 1]] [If, bytes, [VarAdd, offset, bytes] [FileNameSetNext, file] @@ -74,4 +74,4 @@ ] ] ] -[MemDelete, OpenpypePlugins] +[MemDelete, AYONPlugins] diff --git a/server_addon/applications/server/version.py b/server_addon/applications/server/version.py index 0a8da88258..f1380eede2 100644 --- a/server_addon/applications/server/version.py +++ b/server_addon/applications/server/version.py @@ -1 +1 @@ -__version__ = "0.1.6" +__version__ = "0.1.7"