-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
36 changed files
with
639 additions
and
347 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
client/ayon_core/hosts/fusion/hooks/pre_fusion_launch_menu_hook.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import os | ||
from ayon_core.lib import PreLaunchHook | ||
from ayon_core.hosts.fusion import FUSION_HOST_DIR | ||
|
||
|
||
class FusionLaunchMenuHook(PreLaunchHook): | ||
"""Launch AYON menu on start of Fusion""" | ||
app_groups = ["fusion"] | ||
order = 9 | ||
|
||
def execute(self): | ||
# Prelaunch hook is optional | ||
settings = self.data["project_settings"][self.host_name] | ||
if not settings["hooks"]["FusionLaunchMenuHook"]["enabled"]: | ||
return | ||
|
||
variant = self.application.name | ||
if variant.isnumeric(): | ||
version = int(variant) | ||
if version < 18: | ||
print("Skipping launch of OpenPype menu on Fusion start " | ||
"because Fusion version below 18.0 does not support " | ||
"/execute argument on launch. " | ||
f"Version detected: {version}") | ||
return | ||
else: | ||
print(f"Application variant is not numeric: {variant}. " | ||
"Validation for Fusion version 18+ for /execute " | ||
"prelaunch argument skipped.") | ||
|
||
path = os.path.join(FUSION_HOST_DIR, | ||
"deploy", | ||
"MenuScripts", | ||
"launch_menu.py").replace("\\", "/") | ||
script = f"fusion:RunScript('{path}')" | ||
self.launch_context.launch_args.extend(["/execute", script]) |
Oops, something went wrong.