From b37359979cd9f52034f77e5df250e7cefe535877 Mon Sep 17 00:00:00 2001 From: Ondrej Samohel Date: Wed, 1 Feb 2023 12:38:02 +0100 Subject: [PATCH 1/3] :recycle: force modules to sys.path --- openpype/hosts/max/startup/startup.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/openpype/hosts/max/startup/startup.py b/openpype/hosts/max/startup/startup.py index 37bcef5db1..21da115baa 100644 --- a/openpype/hosts/max/startup/startup.py +++ b/openpype/hosts/max/startup/startup.py @@ -1,6 +1,20 @@ # -*- coding: utf-8 -*- -from openpype.hosts.max.api import MaxHost -from openpype.pipeline import install_host +import os +import sys + +# this might happen in some 3dsmax version where PYTHONPATH isn't added +# to sys.path automatically +try: + from openpype.hosts.max.api import MaxHost + from openpype.pipeline import install_host +except (ImportError, ModuleNotFoundError): + + for path in os.environ["PYTHONPATH"].split(os.pathsep): + if path and path not in sys.path: + sys.path.append(path) + + from openpype.hosts.max.api import MaxHost + from openpype.pipeline import install_host host = MaxHost() install_host(host) From 8fd4c06e712c9b8ffb606de5784e4172a4b0eaf3 Mon Sep 17 00:00:00 2001 From: Ondrej Samohel Date: Wed, 1 Feb 2023 18:33:33 +0100 Subject: [PATCH 2/3] :heavy_minus_sign: pop QT_AUTO_SCREEN_SCALE_FACTOR --- openpype/hosts/max/addon.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/openpype/hosts/max/addon.py b/openpype/hosts/max/addon.py index d3245bbc7e..9d6ab5a8b3 100644 --- a/openpype/hosts/max/addon.py +++ b/openpype/hosts/max/addon.py @@ -12,6 +12,11 @@ class MaxAddon(OpenPypeModule, IHostAddon): def initialize(self, module_settings): self.enabled = True + def add_implementation_envs(self, env, _app): + # Remove auto screen scale factor for Qt + # - let 3dsmax decide it's value + env.pop("QT_AUTO_SCREEN_SCALE_FACTOR", None) + def get_workfile_extensions(self): return [".max"] From df6031d810a8d3e6c222087f5149e86cc84d4a0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Samohel?= <33513211+antirotor@users.noreply.github.com> Date: Thu, 2 Feb 2023 11:40:06 +0100 Subject: [PATCH 3/3] Update openpype/hosts/max/startup/startup.py Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> --- openpype/hosts/max/startup/startup.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/openpype/hosts/max/startup/startup.py b/openpype/hosts/max/startup/startup.py index 21da115baa..0d3135a16f 100644 --- a/openpype/hosts/max/startup/startup.py +++ b/openpype/hosts/max/startup/startup.py @@ -4,17 +4,12 @@ import sys # this might happen in some 3dsmax version where PYTHONPATH isn't added # to sys.path automatically -try: - from openpype.hosts.max.api import MaxHost - from openpype.pipeline import install_host -except (ImportError, ModuleNotFoundError): +for path in os.environ["PYTHONPATH"].split(os.pathsep): + if path and path not in sys.path: + sys.path.append(path) - for path in os.environ["PYTHONPATH"].split(os.pathsep): - if path and path not in sys.path: - sys.path.append(path) - - from openpype.hosts.max.api import MaxHost - from openpype.pipeline import install_host +from openpype.hosts.max.api import MaxHost +from openpype.pipeline import install_host host = MaxHost() install_host(host)