解决 Maya2018 for Mac 在Sierra 下无法显示中文界面的问题
生活随笔
收集整理的這篇文章主要介紹了
解决 Maya2018 for Mac 在Sierra 下无法显示中文界面的问题
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
不知道為什么自己明明下載的中文版的Maya,在mac安裝好卻成了英文的了。
在網上找了一圈,找到了解決辦法:原貼地址
保存以下代碼到:maya.py,文件中
#encoding:utf-8import os import sys import re_CONTENTS_DIR = '/Applications/Autodesk/maya2018/Maya.app/Contents/' # _CONTENTS_DIR = os.path.dirname(os.path.abspath(sys.argv[0])) + '/Maya.app/Contents/'def replaceScripts(default_dir):exist_in_zh_count = 0for file_name in os.listdir(os.path.abspath(default_dir)):default_file_path = os.path.join(default_dir, file_name)zh_dir = _CONTENTS_DIR + 'Resources/zh_CN.lproj/scripts'zh_file_path = os.path.join(os.path.abspath(zh_dir), file_name)if os.path.exists(zh_file_path):new_default_file_path = default_file_path + '.old'new_zh_file_path = default_file_pathcmd = 'mv ' + default_file_path + ' ' + new_default_file_pathos.popen(cmd);cmd = 'cp ' + zh_file_path + ' ' + new_zh_file_pathos.popen(cmd)exist_in_zh_count += 1default_file = open(new_default_file_path, 'rU')zh_file = open(new_zh_file_path, 'r+')try:default_lines = default_file.readlines()zh_lines = zh_file.readlines()if not len(default_lines) == len(zh_lines):# print '[info]: modify ' + new_zh_file_pathfor line in default_lines:pattern = re.compile(r'displayString\s-replace\s-value')match = pattern.match(line)if not match:if not line.startswith('//'):print 'Warning: 發現不能處理語句:' + linecontinuepattern = re.compile(r'(?<="\s).*?(?=;)')match = pattern.search(line)if not match:print 'Error: 錯誤的語句'breakkey = str(match.group())exist_in_zh = Falsefor zh_line in zh_lines:pattern = re.compile(key)match = pattern.search(zh_line)if match:exist_in_zh = Truebreakif not exist_in_zh:zh_file.write(line)except Exception as e:print str(e)finally:default_file.close()zh_file.close()def replaceResource():default_file_path = _CONTENTS_DIR + 'Resources/MayaStrings'zh_file_path = _CONTENTS_DIR + 'Resources/zh_CN.lproj/MayaStrings'new_default_file_path = default_file_path + '.old'new_zh_file_path = default_file_pathcmd = 'mv ' + default_file_path + ' ' + new_default_file_pathos.popen(cmd)cmd = 'cp ' + zh_file_path + ' ' + new_zh_file_pathos.popen(cmd)default_file = open(new_default_file_path, 'rU')zh_file = open(new_zh_file_path, 'r+')try:default_lines = default_file.readlines()zh_lines = zh_file.readlines()for line in default_lines:pattern = re.compile(r'^.*?(?=\s=\s")')match = pattern.match(line)if not match:if not line.startswith('//'):print 'Warning: 發現不能處理語句:' + linecontinueexist_in_zh = Falsefor zh_line in zh_lines:if zh_line.startswith(str(match.group())):exist_in_zh = Truezh_lines.remove(zh_line)breakif not exist_in_zh:zh_file.write(line)except Exception as e:print str(e)finally:default_file.close()zh_file.close()_SCRIPTS_DIR = _CONTENTS_DIR + 'scripts/' replaceScripts(_SCRIPTS_DIR + 'startup') replaceScripts(_SCRIPTS_DIR + 'shelves') replaceScripts(_SCRIPTS_DIR + 'others') replaceScripts(_SCRIPTS_DIR + 'AETemplates')replaceResource()然后打開終端,輸入:
cd “maya.py所在位置” sudo python maya.py輸入系統登錄密碼,打開maya,成功!總結
以上是生活随笔為你收集整理的解决 Maya2018 for Mac 在Sierra 下无法显示中文界面的问题的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 51 AVR 编程器USBASP下载器驱
- 下一篇: 计算机我们一起学猫叫谱子,一起喵喵喵喵喵