From 92fb8aff2b6c3103df7cdf90bc69b88725a31139 Mon Sep 17 00:00:00 2001 From: Alexandra Lefeve-Gourmelon Date: Thu, 15 Nov 2018 10:32:57 +0100 Subject: [PATCH 1/2] Don't destroy engine when current file is outside project before trying to get an environment --- python/tk_houdini/ui_generation.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/python/tk_houdini/ui_generation.py b/python/tk_houdini/ui_generation.py index ccbf9e0..b26584a 100644 --- a/python/tk_houdini/ui_generation.py +++ b/python/tk_houdini/ui_generation.py @@ -961,10 +961,15 @@ def _on_file_change_timeout(): try: tk = sgtk.tank_from_path(cur_file) except sgtk.TankError, e: - # Unable to get tk api instance from the path. won't be able to get a - # new context. if there is an engine running, destroy it. - if cur_engine: - cur_engine.destroy() + + # Unable to get tk api instance from the path. Try to get a + # new context with pick_environmet. + if cur_engine: + try: + sgtk.platform.engine.get_environment_from_context(cur_engine.sgtk, cur_context) + except sgtk.TankError, e: + # Unable to get anycontext. if there is an engine running, destroy it. + cur_engine.destroy() return # get the new context from the file From 250d9b72e1a4d42e6168ba41eae92949e8e08cdf Mon Sep 17 00:00:00 2001 From: Alexandra Lefeve-Gourmelon Date: Thu, 15 Nov 2018 16:16:48 +0100 Subject: [PATCH 2/2] Actually, just need to not destroy the engine and everything works fine --- python/tk_houdini/ui_generation.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/python/tk_houdini/ui_generation.py b/python/tk_houdini/ui_generation.py index b26584a..ca26323 100644 --- a/python/tk_houdini/ui_generation.py +++ b/python/tk_houdini/ui_generation.py @@ -961,15 +961,6 @@ def _on_file_change_timeout(): try: tk = sgtk.tank_from_path(cur_file) except sgtk.TankError, e: - - # Unable to get tk api instance from the path. Try to get a - # new context with pick_environmet. - if cur_engine: - try: - sgtk.platform.engine.get_environment_from_context(cur_engine.sgtk, cur_context) - except sgtk.TankError, e: - # Unable to get anycontext. if there is an engine running, destroy it. - cur_engine.destroy() return # get the new context from the file