From e3c5e79b00e70eaa225e746ad317f603df837049 Mon Sep 17 00:00:00 2001 From: Bohdon Sayre Date: Thu, 24 Nov 2022 12:49:36 -0500 Subject: [PATCH] avoid pymel import issue by using cmds for getPanel --- README.md | 4 ---- src/workflowtools/scripts/quickmenus/core.py | 9 +++++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index c443a44..25901e3 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,3 @@ Once installed, the result should look like this: - [Quick Menus](/src/workflowtools/scripts/quickmenus/README.md) - [Resetter](/src/workflowtools/scripts/resetter/README.md) - [RMB Menu Hook](/src/workflowtools/scripts/rmbmenuhook/README.md) - -## Known Issues - -PyMel contains a bug that prevents using some commands in Python 3 due to old-style dynamic imports. This will cause issues when trying to run some functionality in the workflowtools. [This pull request](https://github.com/LumaPictures/pymel/pull/445) fixes issues, and is a fix you can make to the installed version of PyMel. diff --git a/src/workflowtools/scripts/quickmenus/core.py b/src/workflowtools/scripts/quickmenus/core.py index 44e7bab..7c2fa86 100644 --- a/src/workflowtools/scripts/quickmenus/core.py +++ b/src/workflowtools/scripts/quickmenus/core.py @@ -1,6 +1,7 @@ import logging +from maya import cmds import pymel.core as pm import rmbmenuhook @@ -317,9 +318,9 @@ def __init__(self): # variable to keep track of if this menu ever showed self.wasInvoked = False # the panel that the popup menu will be attached to - self.panel = pm.getPanel(underPointer=True) + self.panel = cmds.getPanel(underPointer=True) # the panel type, can be used when building to determine the menu's contents - self.panelType = pm.getPanel(typeOf=self.panel) + self.panelType = cmds.getPanel(typeOf=self.panel) LOG.debug("Panel: " + self.panel + ", Panel Type: " + self.panelType) # the unique id for this popup menu, must be overridden in subclasses @@ -390,9 +391,9 @@ class RMBMarkingMenu(rmbmenuhook.Menu): def __init__(self, menu, obj=None): rmbmenuhook.Menu.__init__(self, menu, obj) # the panel that the popup menu will be attached to - self.panel = pm.getPanel(up=True) + self.panel = cmds.getPanel(underPointer=True) # the panel type, can be used when building to determine the menu's contents - self.panelType = pm.getPanel(typeOf=self.panel) + self.panelType = cmds.getPanel(typeOf=self.panel) def build(self): """