From 38e00773bc7d142023f0be5eea0a84cea86fdf6e Mon Sep 17 00:00:00 2001 From: wijnand Date: Thu, 5 Jul 2018 18:01:48 +0200 Subject: [PATCH 1/3] changed method name --- colorbleed/plugins/maya/load/actions.py | 29 +++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/colorbleed/plugins/maya/load/actions.py b/colorbleed/plugins/maya/load/actions.py index 12a3dfe248..53aa426aa3 100644 --- a/colorbleed/plugins/maya/load/actions.py +++ b/colorbleed/plugins/maya/load/actions.py @@ -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,28 @@ 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) + + if state != accept: + return False + + return True From 7af4debad5e4410795b855bb212b1aa0dfd134bc Mon Sep 17 00:00:00 2001 From: wijnand Date: Fri, 6 Jul 2018 11:58:38 +0200 Subject: [PATCH 2/3] simplified method --- colorbleed/plugins/maya/load/actions.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/colorbleed/plugins/maya/load/actions.py b/colorbleed/plugins/maya/load/actions.py index 53aa426aa3..f255a2fe9f 100644 --- a/colorbleed/plugins/maya/load/actions.py +++ b/colorbleed/plugins/maya/load/actions.py @@ -144,7 +144,4 @@ class ImportMayaLoader(api.Loader): buttons=buttons, defaultButton=accept) - if state != accept: - return False - - return True + return state == accept \ No newline at end of file From 4738aa1eea84bb415a12570934f7f6ce62f3d720 Mon Sep 17 00:00:00 2001 From: wijnand Date: Fri, 6 Jul 2018 11:59:08 +0200 Subject: [PATCH 3/3] end of file --- colorbleed/plugins/maya/load/actions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/colorbleed/plugins/maya/load/actions.py b/colorbleed/plugins/maya/load/actions.py index f255a2fe9f..440fabf124 100644 --- a/colorbleed/plugins/maya/load/actions.py +++ b/colorbleed/plugins/maya/load/actions.py @@ -144,4 +144,4 @@ class ImportMayaLoader(api.Loader): buttons=buttons, defaultButton=accept) - return state == accept \ No newline at end of file + return state == accept