Check if the Unreal app name follows the right format

This commit is contained in:
Simone Barbieri 2023-05-31 11:59:21 +01:00
parent 4a81b5a87a
commit c2b753326f

View file

@ -1,5 +1,7 @@
import os
import re
from openpype.modules import IHostAddon, OpenPypeModule
from openpype.widgets.message_window import Window
UNREAL_ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
@ -19,6 +21,18 @@ class UnrealAddon(OpenPypeModule, IHostAddon):
from .lib import get_compatible_integration
pattern = re.compile(r'^\d+-\d+$')
if not pattern.match(app.name):
Window(
parent=None,
title="Unreal application name format",
message="Unreal application name must be in format '5-0' or '5-1'",
level="critical")
raise ValueError(
"Unreal application name must be in format '5-0' or '5-1'"
)
ue_version = app.name.replace("-", ".")
unreal_plugin_path = os.path.join(
UNREAL_ROOT_DIR, "integration", "UE_{}".format(ue_version), "Ayon"