Skip to content

Commit

Permalink
Merge pull request #72 from BigRoy/master
Browse files Browse the repository at this point in the history
Add Maya 2017 (PySide2) compatibility
  • Loading branch information
mottosso authored Feb 15, 2017
2 parents e84c7ba + 08f8a98 commit 88f5fe7
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@
from maya import cmds
from maya import mel

version_info = (2, 1, 1)
try:
from PySide2 import QtGui, QtWidgets
except ImportError:
from PySide import QtGui
QtWidgets = QtGui

version_info = (2, 2, 0)

__version__ = "%s.%s.%s" % version_info
__license__ = "MIT"
Expand Down Expand Up @@ -765,19 +771,17 @@ def _image_to_clipboard(path):
if _in_standalone():
raise Exception("Cannot copy to clipboard from Maya Standalone")

import PySide.QtGui
image = PySide.QtGui.QImage(path)
clipboard = PySide.QtGui.QApplication.clipboard()
clipboard.setImage(image, mode=PySide.QtGui.QClipboard.Clipboard)
image = QtGui.QImage(path)
clipboard = QtWidgets.QApplication.clipboard()
clipboard.setImage(image, mode=QtGui.QClipboard.Clipboard)


def _get_screen_size():
"""Return available screen size without space occupied by taskbar"""
if _in_standalone():
return [0, 0]

import PySide.QtGui
rect = PySide.QtGui.QDesktopWidget().screenGeometry(-1)
rect = QtWidgets.QDesktopWidget().screenGeometry(-1)
return [rect.width(), rect.height()]


Expand All @@ -791,8 +795,8 @@ def _in_standalone():
#
# --------------------------------

version = cmds.about(version=True)
if "2016" in version:
version = mel.eval("getApplicationVersionAsFloat")
if version > 2015:
Viewport2Options.update({
"hwFogAlpha": 1.0,
"hwFogFalloff": 0,
Expand Down

0 comments on commit 88f5fe7

Please sign in to comment.