diff --git a/dsPlayblast/clientFn.py b/dsPlayblast/clientFn.py index 572a074..b79bd2b 100644 --- a/dsPlayblast/clientFn.py +++ b/dsPlayblast/clientFn.py @@ -26,6 +26,8 @@ def connect(self, port: int = -1): return True def disconnect(self): + if not self.maya_socket: + return False try: self.maya_socket.close() except BaseException: diff --git a/dsPlayblast/playblastUI.py b/dsPlayblast/playblastUI.py index d1a7647..dfcbfbd 100644 --- a/dsPlayblast/playblastUI.py +++ b/dsPlayblast/playblastUI.py @@ -59,6 +59,10 @@ def always_on_top(self, state): def closeEvent(self, event): super().closeEvent(event) self.save_settings() + try: + self.maya_client.disconnect() + except AttributeError: + pass # Settings def save_settings(self): @@ -324,7 +328,6 @@ def playblast(self) -> None: avi_result_path = self.output_path.get_path().replace(".mp4", ".avi") self.update_progress_bar() self.maya_client.send(self.playblast_command()) - self.maya_client.disconnect() self.update_progress_bar() # Conversion