Skip to content

Commit

Permalink
fixed window pref remove error and script info crash while streaming
Browse files Browse the repository at this point in the history
  • Loading branch information
Pablo committed Sep 29, 2019
1 parent 816c4af commit 566bfdf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 4 additions & 2 deletions plug-ins/virtuCameraMaya/virtuCameraMaya.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
7 changes: 3 additions & 4 deletions plug-ins/virtuCameraMaya/virtuCameraMayaConfig.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 566bfdf

Please sign in to comment.