mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 21:32:15 +01:00
Merge pull request #128 from aardschok/PLN-112
Add warning dialog for import
This commit is contained in:
commit
fccae0aeee
1 changed files with 26 additions and 0 deletions
|
|
@ -101,6 +101,10 @@ class ImportMayaLoader(api.Loader):
|
|||
from avalon import maya
|
||||
from avalon.maya import lib
|
||||
|
||||
choice = self.display_warning()
|
||||
if choice is False:
|
||||
return
|
||||
|
||||
asset = context['asset']
|
||||
|
||||
namespace = namespace or lib.unique_namespace(
|
||||
|
|
@ -119,3 +123,25 @@ class ImportMayaLoader(api.Loader):
|
|||
|
||||
# We do not containerize imported content, it remains unmanaged
|
||||
return
|
||||
|
||||
def display_warning(self):
|
||||
"""Show warning to ensure the user can't import models by accident
|
||||
|
||||
Returns:
|
||||
bool
|
||||
|
||||
"""
|
||||
|
||||
from avalon.vendor.Qt import QtWidgets
|
||||
|
||||
accept = QtWidgets.QMessageBox.Ok
|
||||
buttons = accept | QtWidgets.QMessageBox.Cancel
|
||||
|
||||
message = "Are you sure you want import this"
|
||||
state = QtWidgets.QMessageBox.warning(None,
|
||||
"Are you sure?",
|
||||
message,
|
||||
buttons=buttons,
|
||||
defaultButton=accept)
|
||||
|
||||
return state == accept
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue