Skip to content

Commit

Permalink
avoid pymel import issue by using cmds for getPanel
Browse files Browse the repository at this point in the history
  • Loading branch information
bohdon committed Nov 24, 2022
1 parent 2872c4d commit e3c5e79
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
9 changes: 5 additions & 4 deletions src/workflowtools/scripts/quickmenus/core.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

import logging

from maya import cmds
import pymel.core as pm
import rmbmenuhook

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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):
"""
Expand Down

0 comments on commit e3c5e79

Please sign in to comment.