Skip to content

Commit a82984d

Browse files
[ueGear] Object Path validation for 5.5+
1 parent 89f1d40 commit a82984d

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

release/scripts/mgear/uegear/bridge.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,25 @@ def __init__(self, port=30010, host_address="127.0.0.1"):
4848
"Accept": "text/plain",
4949
}
5050

51+
self.pre_run()
52+
53+
def pre_run(self):
54+
"""
55+
A pre run check that will try to retrieve the Engine version, if it fails it will change the object path.
56+
57+
This is due to UE 5.5 handling python packages differently.
58+
"""
59+
result = self.execute("get_unreal_version").get("ReturnValue", "")
60+
if result:
61+
print(f"[UEGear Remote Session] {result}")
62+
else:
63+
print(f"[UEGear Remote Session] Pre run failed, changing Object Path to 5.5+ structure")
64+
self._commands_object_path = "/ueGear/Python/ueGear/commands_PY.Default__PyUeGearCommands"
65+
66+
result = self.execute("get_unreal_version").get("ReturnValue", "")
67+
if result:
68+
print(f"[UEGear Remote Session] {result}")
69+
5170
# =================================================================================================================
5271
# PROPERTIES
5372
# =================================================================================================================

release/scripts/mgear/uegear/commands.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@
3232

3333
logger = log.uegear_logger
3434

35+
def get_unreal_version():
36+
"""Gets the Unreal version for the active session"""
37+
print("[mGear] Retrieving Unreal Engine Version.")
38+
39+
uegear_bridge = bridge.UeGearBridge()
40+
41+
result = uegear_bridge.execute(
42+
"get_unreal_version"
43+
).get("ReturnValue", "")
44+
45+
return result
3546

3647
def content_project_directory():
3748
"""

0 commit comments

Comments
 (0)