add rr warning dialog

This commit is contained in:
Ondrej Samohel 2021-10-29 18:37:32 +02:00 committed by Ondřej Samohel
parent 96a6fb9d4a
commit 3c11fdedc9
No known key found for this signature in database
GPG key ID: 02376E18990A97C6
3 changed files with 711 additions and 497 deletions

View file

@ -0,0 +1,5 @@
## OpenPype RoyalRender integration plugins
### Installation
Copy content of this folder to your `RR_ROOT` (place where RoyalRender studio wide installation is).

View file

@ -11,6 +11,8 @@ import subprocess
import os
import glob
import platform
import tempfile
import json
class OpenPypeContextSelector:
@ -91,8 +93,33 @@ class OpenPypeContextSelector:
"""
op_exec = "openpype_gui"
if platform.system().lower() == "windows":
op_exec = "openpype_gui.exe"
subprocess.check_output([self.openpype_root])
op_exec = "{}.exe".format(op_exec)
with tempfile.TemporaryFile() as tf:
args = list(self.openpype_root)
args.append("context_selector")
args.append(tf)
subprocess.check_output(args)
self.context = json.load(tf)
if not self.context or \
not self.context.project or \
not self.context.asset or \
not self.context.task:
self._show_rr_warning("Context selection failed.")
return
@staticmethod
def _show_rr_warning(text):
warning_dialog = rrGlobal.getGenericUI()
warning_dialog.addItem(rrGlobal.genUIType.label, "infoLabel", "")
warning_dialog.setText("infoLabel", text)
warning_dialog.addItem(
rrGlobal.genUIType.layoutH, "btnLayout", "")
warning_dialog.addItem(
rrGlobal.genUIType.closeButton, "Ok", "btnLayout")
warning_dialog.execute()
del warning_dialog
selector = OpenPypeContextSelector()

1172
poetry.lock generated

File diff suppressed because it is too large Load diff