make sure all openpype import converted to ayon_core

This commit is contained in:
Kayla Man 2024-02-29 15:41:59 +08:00
parent b608648cb1
commit 358290be88
5 changed files with 31 additions and 21 deletions

View file

@ -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:

View file

@ -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

View file

@ -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()

View file

@ -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]

View file

@ -1 +1 @@
__version__ = "0.1.6"
__version__ = "0.1.7"