Skip to content

Commit 05724fb

Browse files
committed
Fixed engine initialization.
1 parent 2a2882d commit 05724fb

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

engine.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ def pre_app_init(self):
101101

102102
# Load the tk_unreal module (the Shotgun engine wrapper for Unreal)
103103
self.tk_unreal = self.import_module("tk_unreal")
104+
self.unreal_sg_engine = self.tk_unreal.config.wrapper_instance
105+
106+
unreal.log("UnrealEditorEngine.pre_app_init: unreal_sg_engine {}".format(self.unreal_sg_engine))
104107

105108
def init_engine(self):
106109
"""

python/tk_unreal/config.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# This file is based on templates provided and copyrighted by Autodesk, Inc.
2+
# This file has been modified by Epic Games, Inc. and is subject to the license
3+
# file included in this repository.
4+
5+
wrapper_instance = None

python/tk_unreal/unreal_sg_engine.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import unreal
66
import sgtk.platform
7+
import config
78

89
unreal.log("Loading Shotgun Engine for Unreal from {}".format(__file__))
910

@@ -14,10 +15,7 @@ def _post_init(self):
1415
"""
1516
Equivalent to __init__ but will also be called from C++
1617
"""
17-
engine = sgtk.platform.current_engine()
18-
engine.unreal_sg_engine = self
19-
20-
unreal.log("ShotgunEngineWrapper._post_init: unreal_sg_engine {} with tk-unreal {}".format(self, engine))
18+
config.wrapper_instance = self
2119

2220
@unreal.ufunction(override=True)
2321
def get_shotgun_menu_items(self):

0 commit comments

Comments
 (0)