From 6ba00852f36fee41baffa0f4d2f0d3ba3119ef84 Mon Sep 17 00:00:00 2001 From: David Cattermole Date: Sat, 19 Oct 2024 12:51:59 +1100 Subject: [PATCH] Disable UI Docking for Maya 2025 Due to GitHub issue #267, here I had a hack BaseMayaWindow to disable the Docking feature for all UIs in Maya 2025+ The only UI in mmSolver that actually uses docking (because it's disabled by default) is the Solver window. GitHub issue #251 and #267. --- python/mmSolver/ui/base_maya_window.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/python/mmSolver/ui/base_maya_window.py b/python/mmSolver/ui/base_maya_window.py index 8cbe7910..721db1a8 100644 --- a/python/mmSolver/ui/base_maya_window.py +++ b/python/mmSolver/ui/base_maya_window.py @@ -49,7 +49,30 @@ def apply(self): import os import os.path -from maya.app.general.mayaMixin import MayaQWidgetDockableMixin +import maya.cmds + +# In Maya 2025 the +# 'maya.app.general.mayaMixin.MayaQWidgetDockableMixin' class is +# creating an error with mmSolver UIs (because they all inherit from +# BaseMayaWindow). This conditional is used to disable the use of +# 'MayaQWidgetDockableMixin' and avoid the problem while also avoiding +# code changes. +# +# See https://github.com/david-cattermole/mayaMatchMoveSolver/issues/267 +# +_USE_MAYA_MIX_IN = maya.cmds.about(apiVersion=True) < 20250000 +if _USE_MAYA_MIX_IN is True: + from maya.app.general.mayaMixin import MayaQWidgetDockableMixin +else: + + # Stub class for compatibility only. + class MayaQWidgetDockableMixin(object): + def __init__(self, parent=None, *args, **kwargs): + super(MayaQWidgetDockableMixin, self).__init__() + + def setDockableParameters(self, *args, **kwargs): + pass + import mmSolver.ui.qtpyutils as qtpyutils