Skip to content

Commit

Permalink
Improve settings sync and default value handling; clean up imports
Browse files Browse the repository at this point in the history
  • Loading branch information
justinfx committed Sep 23, 2021
1 parent 7526198 commit eaf8727
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions MayaSublime.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
# ST2/ST3 compat
from __future__ import print_function

import os
import re
import sys
import time
import uuid
import errno
import socket
import os.path
import textwrap
import threading
import traceback
Expand Down Expand Up @@ -92,11 +89,9 @@ def run(self, edit):
print('No Maya-Recognized Language Found')
return

isPython = (lang=='python')

# Apparently ST3 doesn't always sync up its latest
# plugin settings?
if _settings['host'] is None:
if not _settings['host']:
sync_settings()

# Check the current selection size to determine
Expand Down Expand Up @@ -183,7 +178,7 @@ def _send_to_maya(cmd, lang='python', wrap=True, quiet=False):
"""
Send stringified Python code to Maya, to be executed.
"""
if _settings['host'] is None:
if not _settings['host']:
sync_settings()

host = _settings['host']
Expand Down Expand Up @@ -250,14 +245,14 @@ def sync_settings():
def _sync_settings():
so = settings_obj()

_settings['host'] = so.get('maya_hostname')
_settings['py_port'] = so.get('python_command_port')
_settings['mel_port'] = so.get('mel_command_port')
_settings['strip_comments'] = so.get('strip_sending_comments')
_settings['no_collisions'] = so.get('no_collisions')
_settings['maya_output'] = so.get('receive_maya_output')
_settings['undo'] = so.get('create_undo')

_settings['host'] = so.get('maya_hostname', _settings['host'])
_settings['py_port'] = so.get('python_command_port', _settings['py_port'])
_settings['mel_port'] = so.get('mel_command_port', _settings['mel_port'] )
_settings['strip_comments'] = so.get('strip_sending_comments', _settings['strip_comments'])
_settings['no_collisions'] = so.get('no_collisions', _settings['no_collisions'])
_settings['maya_output'] = so.get('receive_maya_output', _settings['maya_output'])
_settings['undo'] = so.get('create_undo', _settings['undo'] )
MayaReader._st2_remove_reader()

if _settings['maya_output'] is not None:
Expand Down

0 comments on commit eaf8727

Please sign in to comment.