From 987574b86532c7f9adc933d0a5022d6cfec4202f Mon Sep 17 00:00:00 2001 From: "georgiy.m.markelov@gmail.com" Date: Tue, 4 Apr 2023 17:27:56 +0300 Subject: [PATCH 1/4] BLEN-358: Error in console after closing Blender --- scripts/modules/bpy_hydra.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/modules/bpy_hydra.py b/scripts/modules/bpy_hydra.py index 6b2b0a3e5cd8..486fb72e332f 100644 --- a/scripts/modules/bpy_hydra.py +++ b/scripts/modules/bpy_hydra.py @@ -37,6 +37,7 @@ __all__ = ( ) import os +import traceback from pathlib import Path import bpy @@ -105,7 +106,12 @@ def export_mtlx(material): try: import materialx.utils as mx_utils - doc = mx_utils.export(material, None) + try: + doc = mx_utils.export(material, None) + except: + traceback.print_exc() + return "" + if not doc: return "" -- 2.30.2 From cc46fc1a0af0a2fbe082aa81ef577d75102b63a8 Mon Sep 17 00:00:00 2001 From: "georgiy.m.markelov@gmail.com" Date: Thu, 6 Apr 2023 12:46:38 +0300 Subject: [PATCH 2/4] fix review comments --- scripts/modules/bpy_hydra.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/scripts/modules/bpy_hydra.py b/scripts/modules/bpy_hydra.py index 486fb72e332f..151d033a4679 100644 --- a/scripts/modules/bpy_hydra.py +++ b/scripts/modules/bpy_hydra.py @@ -106,12 +106,7 @@ def export_mtlx(material): try: import materialx.utils as mx_utils - try: - doc = mx_utils.export(material, None) - except: - traceback.print_exc() - return "" - + doc = mx_utils.export(material, None) if not doc: return "" @@ -122,4 +117,10 @@ def export_mtlx(material): except ImportError: print("ERROR: no MaterialX addon available") + # This is a placeholder, this code will be moved to C part later + # This code shouldn't raise any exception due to breaking refcounts on RenderEngine + except: + traceback.print_exc() + return "" + return "" -- 2.30.2 From 60cb1d7e05aaced4baefcfb7051178be227a4f79 Mon Sep 17 00:00:00 2001 From: Georgiy Markelov Date: Thu, 6 Apr 2023 11:53:50 +0200 Subject: [PATCH 3/4] Update 'scripts/modules/bpy_hydra.py' fix review comments --- scripts/modules/bpy_hydra.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/modules/bpy_hydra.py b/scripts/modules/bpy_hydra.py index 151d033a4679..c9974162f047 100644 --- a/scripts/modules/bpy_hydra.py +++ b/scripts/modules/bpy_hydra.py @@ -117,10 +117,9 @@ def export_mtlx(material): except ImportError: print("ERROR: no MaterialX addon available") + except: # This is a placeholder, this code will be moved to C part later # This code shouldn't raise any exception due to breaking refcounts on RenderEngine - except: traceback.print_exc() - return "" return "" -- 2.30.2 From 40382f6d57c739feec67a5d711d9f0ed4382fda5 Mon Sep 17 00:00:00 2001 From: Georgiy Markelov Date: Thu, 6 Apr 2023 11:55:42 +0200 Subject: [PATCH 4/4] Update 'scripts/modules/bpy_hydra.py' fix indentation --- scripts/modules/bpy_hydra.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/modules/bpy_hydra.py b/scripts/modules/bpy_hydra.py index c9974162f047..828c568d919e 100644 --- a/scripts/modules/bpy_hydra.py +++ b/scripts/modules/bpy_hydra.py @@ -118,8 +118,8 @@ def export_mtlx(material): print("ERROR: no MaterialX addon available") except: - # This is a placeholder, this code will be moved to C part later - # This code shouldn't raise any exception due to breaking refcounts on RenderEngine + # This is a placeholder, this code will be moved to C part later + # This code shouldn't raise any exception due to breaking refcounts on RenderEngine traceback.print_exc() return "" -- 2.30.2