From 0dd54b0a5c767a02bcb998e6740b235695f996c6 Mon Sep 17 00:00:00 2001 From: Toke Stuart Jepsen Date: Mon, 9 Jan 2023 15:40:50 +0000 Subject: [PATCH] Validate workfile has been saved. --- openpype/hosts/maya/plugins/load/load_xgen.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/openpype/hosts/maya/plugins/load/load_xgen.py b/openpype/hosts/maya/plugins/load/load_xgen.py index 23a22127e9..565d1306b4 100644 --- a/openpype/hosts/maya/plugins/load/load_xgen.py +++ b/openpype/hosts/maya/plugins/load/load_xgen.py @@ -4,6 +4,8 @@ import shutil import maya.cmds as cmds import xgenm +from Qt import QtWidgets + import openpype.hosts.maya.api.plugin from openpype.hosts.maya.api.lib import ( maintained_selection, get_container_members, attribute_values @@ -71,6 +73,15 @@ class XgenLoader(openpype.hosts.maya.api.plugin.ReferenceLoader): return destination def process_reference(self, context, name, namespace, options): + # Validate workfile has a path. + if current_file() is None: + QtWidgets.QMessageBox.warning( + None, + "", + "Current workfile has not been saved." + ) + return + maya_filepath = self.prepare_root_value( self.fname, context["project"]["name"] )