From 566bfdfbb36f27c771627d9f3ca0d9d12c3b61d4 Mon Sep 17 00:00:00 2001 From: Pablo <-> Date: Sun, 29 Sep 2019 20:54:35 +0200 Subject: [PATCH] fixed window pref remove error and script info crash while streaming --- plug-ins/virtuCameraMaya/virtuCameraMaya.py | 6 ++++-- plug-ins/virtuCameraMaya/virtuCameraMayaConfig.py | 7 +++---- 2 files changed, 7 insertions(+), 6 deletions(-) mode change 100644 => 100755 plug-ins/virtuCameraMaya/virtuCameraMayaConfig.py diff --git a/plug-ins/virtuCameraMaya/virtuCameraMaya.py b/plug-ins/virtuCameraMaya/virtuCameraMaya.py index 605e2cf..7ff6980 100755 --- a/plug-ins/virtuCameraMaya/virtuCameraMaya.py +++ b/plug-ins/virtuCameraMaya/virtuCameraMaya.py @@ -197,7 +197,8 @@ def _open_config_window(self, caller=None): def _start_ui(self): # Remove size preference to force the window calculate its size windowName = 'VirtuCameraMayaWindow' - cmds.windowPref(windowName, remove=True) + if cmds.windowPref(windowName, exists=True): + cmds.windowPref(windowName, remove=True) self._window_width = self._STREAM_WIDTH + 2 self._window_height = self._STREAM_HEIGHT + 50 @@ -627,7 +628,8 @@ def _send_script_info(self, cmd): self._tcp_send_with_len(cmd, script_labels_str) def _after_save_callback(self): - self._send_script_info(self._CMD_ASK_SCRIPT_INFO) + # do it in new thread to avoid maya crash + thread.start_new_thread(self._send_script_info, (self._CMD_ASK_SCRIPT_INFO,)) def _send_server_info(self, cmd): data = struct.pack('<3H', *self._SERVER_VERSION) diff --git a/plug-ins/virtuCameraMaya/virtuCameraMayaConfig.py b/plug-ins/virtuCameraMaya/virtuCameraMayaConfig.py old mode 100644 new mode 100755 index 94e087c..00a08c7 --- a/plug-ins/virtuCameraMaya/virtuCameraMayaConfig.py +++ b/plug-ins/virtuCameraMaya/virtuCameraMayaConfig.py @@ -303,13 +303,12 @@ def _close_ui(self, caller=None): cmds.evalDeferred(self._update_ui_from_cache) cmds.evalDeferred(self._update_enable_state_ui) - def _start_ui(self): # Remove size preference to force the window calculate its size windowName = 'VirtuCameraMayaConfigWindow' - cmds.windowPref(windowName, remove=True) - - self._ui_window = cmds.window('VirtuCameraMayaConfigWindow', width=self._WINDOW_SIZE[0], height=self._WINDOW_SIZE[1], menuBarVisible=False, titleBar=True, visible=True, sizeable=True, closeCommand=self._close_ui, title='VirtuCamera Configuration') + if cmds.windowPref(windowName, exists=True): + cmds.windowPref(windowName, remove=True) + self._ui_window = cmds.window(windowName, width=self._WINDOW_SIZE[0], height=self._WINDOW_SIZE[1], menuBarVisible=False, titleBar=True, visible=True, sizeable=True, closeCommand=self._close_ui, title='VirtuCamera Configuration') form_lay = cmds.formLayout(width=505, height=300) col_lay = cmds.columnLayout(adjustableColumn=True, columnAttach=('both', 0), width=465) cmds.text(label='Custom Scripts', align='left')