make zscript compatible with ayon

This commit is contained in:
Kayla Man 2024-03-01 18:17:22 +08:00
parent c65dfab13b
commit 3ddcf3cb56
3 changed files with 26 additions and 14 deletions

View file

@ -83,6 +83,6 @@ async def host_tools_widget(launcher_type=None):
@cli_main.command(help="Call AYON plugins command")
@click_wrap.option("--launcher", help="Type of Launcher", default="workfile")
@click_wrap.option("--launcher", help="Type of Launcher")
def run_with_zscript(launcher):
return asyncio.run(host_tools_widget(launcher))

View file

@ -37,32 +37,44 @@ class CreateZMenuScript(PreLaunchHook):
python_exe = os.environ["AYON_ZBRUSH_CMD"]
ayon_script = ("""
[ISubPalette,"Zplugin:AYON"]
[VarSet, addon, "addon"]
[VarSet, zbrush, "zbrush"]
[VarSet, zscript, "run-with-zscript"]
[VarSet, arg, "--launcher"]
[IButton,"Zplugin:AYON:Load","Loader",
[VarSet, loader, "loader_tool"]
[VarSet, q, [StrFromAsc, 34]]
[VarSet, cmd, [StrMerge, start, " ",#q, #q, " ",#q, "{py}",#q, " ",#q, sc, #q]]
[VarSet, cmd, [StrMerge, cmd, " ", #loader, #q]]
[VarSet, cmd, [StrMerge, start, " ",#q, #q, " ",#q, "{py}", #q]]
[VarSet, cmd, [StrMerge, cmd, " ", #addon, #q]]
[VarSet, cmd, [StrMerge, cmd, #q, " ", #zbrush, #q]]
[VarSet, cmd, [StrMerge, cmd, #q, " ", #zscript, #q]]
[VarSet, cmd, [StrMerge, cmd, #q, " ", #arg, #q]]
[VarSet, cmd, [StrMerge, cmd, #q, " ", #loader, #q]]
[ShellExecute, cmd], 0, 120
]//end button
[IButton,"Zplugin:AYON:Publish","Publish Tab for Publisher",
[VarSet, publisher, "publish_tool"]
[VarSet, q, [StrFromAsc, 34]]
[VarSet, cmd, [StrMerge, start, " ",#q, #q, " ",#q, "{py}",#q, " ",#q, sc, #q]]
[VarSet, cmd, [StrMerge, cmd, " ", #publisher, #q]]
[VarSet, cmd, [StrMerge, start, " ",#q, #q, " ",#q, "{py}", #q]]
[VarSet, cmd, [StrMerge, cmd, " ", #addon, #q]]
[VarSet, cmd, [StrMerge, cmd, #q, " ", #zbrush, #q]]
[VarSet, cmd, [StrMerge, cmd, #q, " ", #zscript, #q]]
[VarSet, cmd, [StrMerge, cmd, #q, " ", #arg, #q]]
[VarSet, cmd, [StrMerge, cmd, #q, " ", #publisher, #q]]
[ShellExecute, cmd], 0, 120
]//end button
[IButton,"Zplugin:AYON:Manage","Scene Inventory Manager",
[VarSet, sceneinventory, "scene_inventory_tool"]
[VarSet, q, [StrFromAsc, 34]]
[VarSet, cmd, [StrMerge, start, " ",#q, #q, " ",#q, "$AYON_ZBRUSH_CMD",#q, " ",#q, sc, #q]]
[VarSet, cmd, [StrMerge, cmd, " ", #sceneinventory, #q]]
[VarSet, q, [StrFromAsc, 34]]
[VarSet, cmd, [StrMerge, start, " ",#q, #q, " ",#q, "{py}", #q]]
[VarSet, cmd, [StrMerge, cmd, " ", #addon, #q]]
[VarSet, cmd, [StrMerge, cmd, #q, " ", #zbrush, #q]]
[VarSet, cmd, [StrMerge, cmd, #q, " ", #zscript, #q]]
[VarSet, cmd, [StrMerge, cmd, #q, " ", #arg, #q]]
[VarSet, cmd, [StrMerge, cmd, #q, " ", #sceneinventory, #q]]
[ShellExecute, cmd], 0, 120
]//end button
[IButton,"Zplugin:AYON:Workfile","Workfile",
[VarSet, addon, "addon"]
[VarSet, zbrush, "zbrush"]
[VarSet, zscript, "run-with-zscript"]
[VarSet, arg, "--launcher"]
[VarSet, workfiles, "workfiles_tool"]
[VarSet, q, [StrFromAsc, 34]]
[VarSet, cmd, [StrMerge, start, " ",#q, #q, " ",#q, "{py}", #q]]
@ -70,6 +82,7 @@ class CreateZMenuScript(PreLaunchHook):
[VarSet, cmd, [StrMerge, cmd, #q, " ", #zbrush, #q]]
[VarSet, cmd, [StrMerge, cmd, #q, " ", #zscript, #q]]
[VarSet, cmd, [StrMerge, cmd, #q, " ", #arg, #q]]
[VarSet, cmd, [StrMerge, cmd, #q, " ", #workfiles, #q]]
[ShellExecute, cmd], 0, 120
]//end button""").format(py=python_exe)
return ayon_script

View file

@ -30,9 +30,8 @@ class ForceStartupScript(PreLaunchHook):
"run", self.launch_script_path(), executable_path
)
# Append as whole list as these areguments should not be separated
# Append as whole list as these arguments should not be separated
self.launch_context.launch_args.append(new_launch_args)
startup_args = [
os.path.join(ZBRUSH_HOST_DIR, "startup", "startup.txt"),
]