From 00a212832a82c07ea9a2e61f46150511bb8b4244 Mon Sep 17 00:00:00 2001 From: Bernard Kwok Date: Tue, 22 Jul 2025 10:27:25 -0400 Subject: [PATCH 1/2] Delay loading Qt modules as they appear to clash with USD imports. --- sample_plugins/materialxjson/plugin.py | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/sample_plugins/materialxjson/plugin.py b/sample_plugins/materialxjson/plugin.py index 9ed7106..8f22416 100644 --- a/sample_plugins/materialxjson/plugin.py +++ b/sample_plugins/materialxjson/plugin.py @@ -3,6 +3,8 @@ import logging import os +logger = logging.getLogger(__name__) + # Optional syntax highlighting if pygments is installed have_highliting = True try: @@ -14,21 +16,28 @@ from typing import TYPE_CHECKING -from qtpy import QtCore # type: ignore -from qtpy.QtWidgets import ( # type: ignore - QAction, - QTextEdit, -) + +def load_qt_modules(): + global QtCore, QAction, QTextEdit + try: + from qtpy import QtCore # type: ignore + from qtpy.QtWidgets import QAction, QTextEdit # type: ignore + logger.info("qtpy modules loaded successfully") + except ImportError as e: + logger.error(f"Failed to import qtpy modules: {e}") + raise + from QuiltiX import constants, qx_plugin -logger = logging.getLogger(__name__) has_materialxjsoncore = True try: + #from materialxjson import core as jsoncore import materialxjson.core as jsoncore + logger.info("materialxjson.core module loaded successfully") except ImportError: has_materialxjsoncore = False - logger.error("materialxjson.core module not found") + logger.error("materialxjson.core module failed to load.") if TYPE_CHECKING: from QuiltiX import quiltix @@ -194,6 +203,7 @@ def show_text_box(self, text, title=""): @qx_plugin.hookimpl def after_ui_init(editor: "quiltix.QuiltiXWindow"): + load_qt_modules() editor.json_serializer = QuiltiX_JSON_serializer(editor, constants.ROOT) From 1e1577f781f70b986309425587179dc0d273ebaa Mon Sep 17 00:00:00 2001 From: Bernard Kwok Date: Tue, 22 Jul 2025 10:32:46 -0400 Subject: [PATCH 2/2] Cleanup. --- sample_plugins/materialxjson/plugin.py | 1 - 1 file changed, 1 deletion(-) diff --git a/sample_plugins/materialxjson/plugin.py b/sample_plugins/materialxjson/plugin.py index 8f22416..4b53d19 100644 --- a/sample_plugins/materialxjson/plugin.py +++ b/sample_plugins/materialxjson/plugin.py @@ -32,7 +32,6 @@ def load_qt_modules(): has_materialxjsoncore = True try: - #from materialxjson import core as jsoncore import materialxjson.core as jsoncore logger.info("materialxjson.core module loaded successfully") except ImportError: