Merge pull request #2685 from pypeclub/bugfix/maya_fps_validation_popup_bug

Maya: fix fps validation popup
This commit is contained in:
Jakub Trllo 2022-02-09 17:46:08 +01:00 committed by GitHub
commit f278b89616
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 26 deletions

View file

@ -2440,34 +2440,27 @@ def validate_fps():
# rounding, we have to round those numbers coming from Maya.
current_fps = float_round(mel.eval('currentTimeUnitToFPS()'), 2)
if current_fps != fps:
fps_match = current_fps == fps
if not fps_match and not IS_HEADLESS:
from openpype.widgets import popup
from Qt import QtWidgets
from ...widgets import popup
parent = get_main_window()
# Find maya main window
top_level_widgets = {w.objectName(): w for w in
QtWidgets.QApplication.topLevelWidgets()}
dialog = popup.Popup2(parent=parent)
dialog.setModal(True)
dialog.setWindowTitle("Maya scene not in line with project")
dialog.setMessage("The FPS is out of sync, please fix")
parent = top_level_widgets.get("MayaWindow", None)
if parent is None:
pass
else:
dialog = popup.Popup2(parent=parent)
dialog.setModal(True)
dialog.setWindowTitle("Maya scene not in line with project")
dialog.setMessage("The FPS is out of sync, please fix")
# Set new text for button (add optional argument for the popup?)
toggle = dialog.widgets["toggle"]
update = toggle.isChecked()
dialog.on_show.connect(lambda: set_scene_fps(fps, update))
# Set new text for button (add optional argument for the popup?)
toggle = dialog.widgets["toggle"]
update = toggle.isChecked()
dialog.on_show.connect(lambda: set_scene_fps(fps, update))
dialog.show()
dialog.show()
return False
return False
return True
return fps_match
def bake(nodes,

View file

@ -132,12 +132,12 @@ class Popup2(Popup):
"""
parent_widget = self.parent()
app = QtWidgets.QApplication.instance()
desktop = QtWidgets.QApplication.desktop()
if parent_widget:
screen = app.desktop().screenNumber(parent_widget)
screen = desktop.screenNumber(parent_widget)
else:
screen = app.desktop().screenNumber(app.desktop().cursor().pos())
center_point = app.desktop().screenGeometry(screen).center()
screen = desktop.screenNumber(desktop.cursor().pos())
center_point = desktop.screenGeometry(screen).center()
frame_geo = self.frameGeometry()
frame_geo.moveCenter(center_point)