Update
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
# Copyright 2020 by Kurt Rathjen. All Rights Reserved.
|
||||
#
|
||||
# This library is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version. This library is distributed in the
|
||||
# hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU Lesser General Public License for more details.
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from studiovendor.Qt import QtCore
|
||||
from studiovendor.Qt import QtCompat
|
||||
from studiovendor.Qt import QtWidgets
|
||||
|
||||
try:
|
||||
import maya.OpenMayaUI as omui
|
||||
except ImportError as error:
|
||||
print(error)
|
||||
|
||||
from .framerangemenu import FrameRangeMenu
|
||||
from .framerangemenu import showFrameRangeMenu
|
||||
from .modelpanelwidget import ModelPanelWidget
|
||||
from .thumbnailcapturedialog import *
|
||||
from .thumbnailcapturemenu import ThumbnailCaptureMenu
|
||||
|
||||
|
||||
def mayaWindow():
|
||||
"""
|
||||
Return the Maya main window as a QMainWindow object.
|
||||
|
||||
:rtype: QMainWindow
|
||||
"""
|
||||
mainWindowPtr = omui.MQtUtil.mainWindow()
|
||||
return QtCompat.wrapInstance(mainWindowPtr, QtWidgets.QMainWindow)
|
||||
|
||||
|
||||
def makeMayaStandaloneWindow(w):
|
||||
"""
|
||||
Make a standalone window, though parented under Maya's mainWindow.
|
||||
|
||||
The parenting under Maya's mainWindow is done so that the QWidget will
|
||||
not auto-destroy itself when the instance variable goes out of scope.
|
||||
"""
|
||||
# Parent under the main Maya window
|
||||
w.setParent(mayaWindow())
|
||||
|
||||
# Make this widget appear as a standalone window
|
||||
w.setWindowFlags(QtCore.Qt.Window)
|
||||
w.raise_()
|
||||
w.show()
|
||||
@@ -0,0 +1,67 @@
|
||||
# Copyright 2020 by Kurt Rathjen. All Rights Reserved.
|
||||
#
|
||||
# This library is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version. This library is distributed in the
|
||||
# hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU Lesser General Public License for more details.
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from studiovendor.Qt import QtGui
|
||||
from studiovendor.Qt import QtWidgets
|
||||
|
||||
import mutils
|
||||
|
||||
|
||||
__all__ = ["FrameRangeMenu", "showFrameRangeMenu"]
|
||||
|
||||
|
||||
class FrameRangeAction(QtWidgets.QAction):
|
||||
def __init__(self, *args):
|
||||
super(FrameRangeAction, self).__init__(*args)
|
||||
|
||||
self._frameRange = (0, 100)
|
||||
|
||||
def frameRange(self):
|
||||
return self._frameRange
|
||||
|
||||
def setFrameRange(self, frameRange):
|
||||
self._frameRange = frameRange
|
||||
|
||||
|
||||
class FrameRangeMenu(QtWidgets.QMenu):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super(FrameRangeMenu, self).__init__(parent)
|
||||
|
||||
action = FrameRangeAction("From Timeline", self)
|
||||
action.setFrameRange(mutils.playbackFrameRange())
|
||||
self.addAction(action)
|
||||
|
||||
action = FrameRangeAction("From Selected Timeline", self)
|
||||
action.setFrameRange(mutils.selectedFrameRange())
|
||||
self.addAction(action)
|
||||
|
||||
action = FrameRangeAction("From Selected Objects", self)
|
||||
action.setFrameRange(mutils.selectedObjectsFrameRange())
|
||||
self.addAction(action)
|
||||
|
||||
|
||||
def showFrameRangeMenu():
|
||||
"""
|
||||
Show the frame range menu at the current cursor position.
|
||||
|
||||
:rtype: QtWidgets.QAction
|
||||
"""
|
||||
menu = FrameRangeMenu()
|
||||
position = QtGui.QCursor().pos()
|
||||
action = menu.exec_(position)
|
||||
return action
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
action = showFrameRangeMenu()
|
||||
print(action.frameRange())
|
||||
@@ -0,0 +1,100 @@
|
||||
# Copyright 2020 by Kurt Rathjen. All Rights Reserved.
|
||||
#
|
||||
# This library is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version. This library is distributed in the
|
||||
# hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU Lesser General Public License for more details.
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import mutils
|
||||
import mutils.gui
|
||||
|
||||
from studiovendor.Qt import QtCore
|
||||
from studiovendor.Qt import QtWidgets
|
||||
|
||||
try:
|
||||
import maya.cmds
|
||||
import maya.OpenMayaUI as mui
|
||||
isMaya = True
|
||||
except ImportError:
|
||||
isMaya = False
|
||||
|
||||
|
||||
__all__ = ["ModelPanelWidget"]
|
||||
|
||||
|
||||
class ModelPanelWidget(QtWidgets.QWidget):
|
||||
|
||||
def __init__(self, parent, name="capturedModelPanel", **kwargs):
|
||||
super(ModelPanelWidget, self).__init__(parent, **kwargs)
|
||||
|
||||
uniqueName = name + str(id(self))
|
||||
self.setObjectName(uniqueName + 'Widget')
|
||||
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
layout.setContentsMargins(0, 0, 0, 0)
|
||||
layout.setObjectName(uniqueName + "Layout")
|
||||
self.setLayout(layout)
|
||||
|
||||
maya.cmds.setParent(layout.objectName())
|
||||
self._modelPanel = maya.cmds.modelPanel(uniqueName, label="ModelPanel")
|
||||
self.setModelPanelOptions()
|
||||
|
||||
def setModelPanelOptions(self):
|
||||
|
||||
modelPanel = self.name()
|
||||
|
||||
maya.cmds.modelEditor(modelPanel, edit=True, allObjects=False)
|
||||
maya.cmds.modelEditor(modelPanel, edit=True, grid=False)
|
||||
maya.cmds.modelEditor(modelPanel, edit=True, dynamics=False)
|
||||
maya.cmds.modelEditor(modelPanel, edit=True, activeOnly=False)
|
||||
maya.cmds.modelEditor(modelPanel, edit=True, manipulators=False)
|
||||
maya.cmds.modelEditor(modelPanel, edit=True, headsUpDisplay=False)
|
||||
maya.cmds.modelEditor(modelPanel, edit=True, selectionHiliteDisplay=False)
|
||||
|
||||
maya.cmds.modelEditor(modelPanel, edit=True, polymeshes=True)
|
||||
maya.cmds.modelEditor(modelPanel, edit=True, nurbsSurfaces=True)
|
||||
maya.cmds.modelEditor(modelPanel, edit=True, subdivSurfaces=True)
|
||||
maya.cmds.modelEditor(modelPanel, edit=True, displayTextures=True)
|
||||
maya.cmds.modelEditor(modelPanel, edit=True, displayAppearance="smoothShaded")
|
||||
|
||||
currentModelPanel = mutils.currentModelPanel()
|
||||
|
||||
if currentModelPanel:
|
||||
camera = maya.cmds.modelEditor(currentModelPanel, query=True, camera=True)
|
||||
displayLights = maya.cmds.modelEditor(currentModelPanel, query=True, displayLights=True)
|
||||
displayTextures = maya.cmds.modelEditor(currentModelPanel, query=True, displayTextures=True)
|
||||
|
||||
maya.cmds.modelEditor(modelPanel, edit=True, camera=camera)
|
||||
maya.cmds.modelEditor(modelPanel, edit=True, displayLights=displayLights)
|
||||
maya.cmds.modelEditor(modelPanel, edit=True, displayTextures=displayTextures)
|
||||
|
||||
def name(self):
|
||||
return self._modelPanel
|
||||
|
||||
def modelPanel(self):
|
||||
ptr = mui.MQtUtil.findControl(self._modelPanel)
|
||||
return mutils.gui.wrapInstance(ptr, QtWidgets.QWidget)
|
||||
|
||||
def barLayout(self):
|
||||
name = maya.cmds.modelPanel(self._modelPanel, query=True, barLayout=True)
|
||||
ptr = mui.MQtUtil.findControl(name)
|
||||
return mutils.gui.wrapInstance(ptr, QtCore.QObject)
|
||||
|
||||
def hideBarLayout(self):
|
||||
self.barLayout().hide()
|
||||
|
||||
def hideMenuBar(self):
|
||||
maya.cmds.modelPanel(self._modelPanel, edit=True, menuBarVisible=False)
|
||||
|
||||
def setCamera(self, name):
|
||||
maya.cmds.modelPanel(self._modelPanel, edit=True, cam=name)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
widget = ModelPanelWidget(None, "modelPanel")
|
||||
widget.show()
|
||||
@@ -0,0 +1,290 @@
|
||||
# Copyright 2020 by Kurt Rathjen. All Rights Reserved.
|
||||
#
|
||||
# This library is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version. This library is distributed in the
|
||||
# hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU Lesser General Public License for more details.
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""
|
||||
The capture dialog is used for creating thumbnails and thumbnail playblasts.
|
||||
|
||||
import mutils.gui
|
||||
print mutils.gui.capture("c:/temp/test.jpg", startFrame=1, endFrame=100)
|
||||
# c:/temp/test.0001.jpg
|
||||
"""
|
||||
|
||||
import os
|
||||
import shutil
|
||||
|
||||
from studiovendor.Qt import QtGui
|
||||
from studiovendor.Qt import QtCore
|
||||
from studiovendor.Qt import QtWidgets
|
||||
|
||||
try:
|
||||
import maya.cmds
|
||||
except Exception:
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
|
||||
import studioqt
|
||||
|
||||
import mutils.gui
|
||||
import mutils.gui.modelpanelwidget
|
||||
|
||||
|
||||
__all__ = [
|
||||
"thumbnailCapture",
|
||||
"ThumbnailCaptureDialog",
|
||||
]
|
||||
|
||||
|
||||
_instance = None
|
||||
|
||||
|
||||
def thumbnailCapture(
|
||||
path,
|
||||
startFrame=None,
|
||||
endFrame=None,
|
||||
step=1,
|
||||
clearCache=False,
|
||||
captured=None,
|
||||
show=False,
|
||||
modifier=True,
|
||||
):
|
||||
"""
|
||||
Capture a playblast and save it to the given path.
|
||||
|
||||
:type path: str
|
||||
:type startFrame: int or None
|
||||
:type endFrame: int or None
|
||||
:type step: int
|
||||
:type clearCache: bool
|
||||
:type captured: func or None
|
||||
:rtype: ThumbnailCaptureDialog
|
||||
"""
|
||||
|
||||
global _instance
|
||||
|
||||
def _clearCache():
|
||||
dirname = os.path.dirname(path)
|
||||
if os.path.exists(dirname):
|
||||
shutil.rmtree(dirname)
|
||||
|
||||
if _instance:
|
||||
_instance.close()
|
||||
|
||||
d = mutils.gui.ThumbnailCaptureDialog(
|
||||
path=path,
|
||||
startFrame=startFrame,
|
||||
endFrame=endFrame,
|
||||
step=step,
|
||||
)
|
||||
|
||||
if captured:
|
||||
d.captured.connect(captured)
|
||||
|
||||
if clearCache:
|
||||
d.capturing.connect(_clearCache)
|
||||
|
||||
d.show()
|
||||
|
||||
if not show and not (modifier and studioqt.isControlModifier()):
|
||||
d.capture()
|
||||
d.close()
|
||||
|
||||
_instance = d
|
||||
|
||||
return _instance
|
||||
|
||||
|
||||
class ThumbnailCaptureDialog(QtWidgets.QDialog):
|
||||
|
||||
DEFAULT_WIDTH = 250
|
||||
DEFAULT_HEIGHT = 250
|
||||
|
||||
captured = QtCore.Signal(str)
|
||||
capturing = QtCore.Signal(str)
|
||||
|
||||
def __init__(self, path="", parent=None, startFrame=None, endFrame=None, step=1):
|
||||
"""
|
||||
:type path: str
|
||||
:type parent: QtWidgets.QWidget
|
||||
:type startFrame: int
|
||||
:type endFrame: int
|
||||
:type step: int
|
||||
"""
|
||||
parent = parent or mutils.gui.mayaWindow()
|
||||
|
||||
QtWidgets.QDialog.__init__(self, parent)
|
||||
|
||||
self._path = path
|
||||
self._step = step
|
||||
self._endFrame = None
|
||||
self._startFrame = None
|
||||
self._capturedPath = None
|
||||
|
||||
if endFrame is None:
|
||||
endFrame = int(maya.cmds.currentTime(query=True))
|
||||
|
||||
if startFrame is None:
|
||||
startFrame = int(maya.cmds.currentTime(query=True))
|
||||
|
||||
self.setEndFrame(endFrame)
|
||||
self.setStartFrame(startFrame)
|
||||
|
||||
self.setObjectName("CaptureWindow")
|
||||
self.setWindowTitle("Capture Window")
|
||||
|
||||
self._captureButton = QtWidgets.QPushButton("Capture")
|
||||
self._captureButton.clicked.connect(self.capture)
|
||||
|
||||
self._modelPanelWidget = mutils.gui.modelpanelwidget.ModelPanelWidget(self)
|
||||
|
||||
vbox = QtWidgets.QVBoxLayout()
|
||||
vbox.setObjectName(self.objectName() + "Layout")
|
||||
vbox.addWidget(self._modelPanelWidget)
|
||||
vbox.addWidget(self._captureButton)
|
||||
|
||||
self.setLayout(vbox)
|
||||
|
||||
width = (self.DEFAULT_WIDTH * 1.5)
|
||||
height = (self.DEFAULT_HEIGHT * 1.5) + 50
|
||||
|
||||
self.setWidthHeight(width, height)
|
||||
self.centerWindow()
|
||||
|
||||
def path(self):
|
||||
"""
|
||||
Return the destination path.
|
||||
|
||||
:rtype: str
|
||||
"""
|
||||
return self._path
|
||||
|
||||
def setPath(self, path):
|
||||
"""
|
||||
Set the destination path.
|
||||
|
||||
:type path: str
|
||||
"""
|
||||
self._path = path
|
||||
|
||||
def endFrame(self):
|
||||
"""
|
||||
Return the end frame of the playblast.
|
||||
|
||||
:rtype: int
|
||||
"""
|
||||
return self._endFrame
|
||||
|
||||
def setEndFrame(self, endFrame):
|
||||
"""
|
||||
Specify the end frame of the playblast.
|
||||
|
||||
:type endFrame: int
|
||||
"""
|
||||
self._endFrame = int(endFrame)
|
||||
|
||||
def startFrame(self):
|
||||
"""
|
||||
Return the start frame of the playblast.
|
||||
|
||||
:rtype: int
|
||||
"""
|
||||
return self._startFrame
|
||||
|
||||
def setStartFrame(self, startFrame):
|
||||
"""
|
||||
Specify the start frame of the playblast.
|
||||
|
||||
:type startFrame: int
|
||||
"""
|
||||
self._startFrame = int(startFrame)
|
||||
|
||||
def step(self):
|
||||
"""
|
||||
Return the step amount of the playblast.
|
||||
|
||||
Example:
|
||||
if step is set to 2 it will playblast every second frame.
|
||||
|
||||
:rtype: int
|
||||
"""
|
||||
return self._step
|
||||
|
||||
def setStep(self, step):
|
||||
"""
|
||||
Set the step amount of the playblast.
|
||||
|
||||
:type step: int
|
||||
"""
|
||||
self._step = step
|
||||
|
||||
def setWidthHeight(self, width, height):
|
||||
"""
|
||||
Set the width and height of the window.
|
||||
|
||||
:type width: int
|
||||
:type height: int
|
||||
:rtype: None
|
||||
"""
|
||||
x = self.geometry().x()
|
||||
y = self.geometry().y()
|
||||
self.setGeometry(x, y, width, height)
|
||||
|
||||
def centerWindow(self):
|
||||
"""
|
||||
Center the widget to the center of the desktop.
|
||||
|
||||
:rtype: None
|
||||
"""
|
||||
geometry = self.frameGeometry()
|
||||
pos = QtGui.QCursor.pos()
|
||||
screen = QtWidgets.QApplication.screenAt(pos)
|
||||
centerPoint = screen.availableGeometry().center()
|
||||
geometry.moveCenter(centerPoint)
|
||||
self.move(geometry.topLeft())
|
||||
|
||||
def capturedPath(self):
|
||||
"""
|
||||
Return the location of the captured playblast.
|
||||
|
||||
:rtype:
|
||||
"""
|
||||
return self._capturedPath
|
||||
|
||||
def capture(self):
|
||||
"""
|
||||
Capture a playblast and save it to the given path.
|
||||
|
||||
:rtype: None
|
||||
"""
|
||||
path = self.path()
|
||||
|
||||
self.capturing.emit(path)
|
||||
|
||||
modelPanel = self._modelPanelWidget.name()
|
||||
startFrame = self.startFrame()
|
||||
endFrame = self.endFrame()
|
||||
step = self.step()
|
||||
width = self.DEFAULT_WIDTH
|
||||
height = self.DEFAULT_HEIGHT
|
||||
|
||||
self._capturedPath = mutils.playblast.playblast(
|
||||
path,
|
||||
modelPanel,
|
||||
startFrame,
|
||||
endFrame,
|
||||
width,
|
||||
height,
|
||||
step=step,
|
||||
)
|
||||
|
||||
self.accept()
|
||||
|
||||
self.captured.emit(self._capturedPath)
|
||||
return self._capturedPath
|
||||
@@ -0,0 +1,149 @@
|
||||
# Copyright 2020 by Kurt Rathjen. All Rights Reserved.
|
||||
#
|
||||
# This library is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version. This library is distributed in the
|
||||
# hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU Lesser General Public License for more details.
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import logging
|
||||
|
||||
from studiovendor.Qt import QtGui
|
||||
from studiovendor.Qt import QtCore
|
||||
from studiovendor.Qt import QtWidgets
|
||||
|
||||
import mutils.gui
|
||||
|
||||
import studiolibrary.widgets
|
||||
|
||||
|
||||
__all__ = [
|
||||
"ThumbnailCaptureMenu",
|
||||
"testThumbnailCaptureMenu"
|
||||
]
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ThumbnailCaptureMenu(QtWidgets.QMenu):
|
||||
|
||||
captured = QtCore.Signal(str)
|
||||
|
||||
def __init__(self, path, force=False, parent=None):
|
||||
"""
|
||||
Thumbnail capture menu.
|
||||
|
||||
:type path: str
|
||||
:type force: bool
|
||||
:type parent: None or QtWidgets.QWidget
|
||||
"""
|
||||
QtWidgets.QMenu.__init__(self, parent)
|
||||
|
||||
self._path = path
|
||||
self._force = force
|
||||
|
||||
changeImageAction = QtWidgets.QAction('Capture new image', self)
|
||||
changeImageAction.triggered.connect(self.capture)
|
||||
self.addAction(changeImageAction)
|
||||
|
||||
changeImageAction = QtWidgets.QAction('Show Capture window', self)
|
||||
changeImageAction.triggered.connect(self.showCaptureWindow)
|
||||
self.addAction(changeImageAction)
|
||||
|
||||
loadImageAction = QtWidgets.QAction('Load image from disk', self)
|
||||
loadImageAction.triggered.connect(self.showLoadImageDialog)
|
||||
self.addAction(loadImageAction)
|
||||
|
||||
def path(self):
|
||||
"""
|
||||
Return the thumbnail path on disc.
|
||||
|
||||
:rtype: str
|
||||
"""
|
||||
return self._path
|
||||
|
||||
def showWarningDialog(self):
|
||||
"""Show a warning dialog for overriding the previous thumbnail."""
|
||||
title = "Override Thumbnail"
|
||||
|
||||
text = u"This action will delete the previous thumbnail. The " \
|
||||
u"previous image cannot be backed up. Do you want to " \
|
||||
u"confirm the action to take a new image and delete " \
|
||||
u"the previous one?"
|
||||
|
||||
clickedButton = studiolibrary.widgets.MessageBox.warning(
|
||||
self.parent(),
|
||||
title=title,
|
||||
text=text,
|
||||
enableDontShowCheckBox=True,
|
||||
)
|
||||
|
||||
if clickedButton != QtWidgets.QDialogButtonBox.StandardButton.Yes:
|
||||
raise Exception("Dialog was canceled!")
|
||||
|
||||
def showCaptureWindow(self):
|
||||
"""Show the capture window for framing."""
|
||||
self.capture(show=True)
|
||||
|
||||
def capture(self, show=False):
|
||||
"""
|
||||
Capture an image from the Maya viewport.
|
||||
|
||||
:type show: bool
|
||||
"""
|
||||
if not self._force and os.path.exists(self.path()):
|
||||
self.showWarningDialog()
|
||||
|
||||
mutils.gui.thumbnailCapture(
|
||||
show=show,
|
||||
path=self.path(),
|
||||
captured=self.captured.emit
|
||||
)
|
||||
|
||||
def showLoadImageDialog(self):
|
||||
"""Show a file dialog for choosing an image from disc."""
|
||||
if not self._force and os.path.exists(self.path()):
|
||||
self.showWarningDialog()
|
||||
|
||||
fileDialog = QtWidgets.QFileDialog(
|
||||
self,
|
||||
caption="Open Image",
|
||||
filter="Image Files (*.png *.jpg *.bmp)"
|
||||
)
|
||||
|
||||
fileDialog.fileSelected.connect(self._fileSelected)
|
||||
fileDialog.exec_()
|
||||
|
||||
def _fileSelected(self, path):
|
||||
"""
|
||||
Triggered when the file dialog is accepted.
|
||||
|
||||
:type path: str
|
||||
"""
|
||||
shutil.copy(path, self.path())
|
||||
self.captured.emit(self.path())
|
||||
|
||||
|
||||
def testThumbnailCaptureMenu():
|
||||
"""A method for testing the thumbnail capture menu in Maya."""
|
||||
|
||||
def capturedCallback(path):
|
||||
"""
|
||||
Triggered when the captured menu has been accepted.
|
||||
|
||||
:type path: str
|
||||
"""
|
||||
print("Captured thumbnail to:", path)
|
||||
|
||||
path = "c:/tmp/test.png"
|
||||
|
||||
menu = ThumbnailCaptureMenu(path, True)
|
||||
menu.captured.connect(capturedCallback)
|
||||
menu.exec_(QtGui.QCursor.pos())
|
||||
Reference in New Issue
Block a user