【转】Max2013脚本工具的乱码问题

时间:2021-03-21 07:49:49

转自:http://www.cnblogs.com/sitt/archive/2012/11/21/2780481.html

有时一些中文的脚本会在max2013中显示为乱码,是因为max2013将多种语言统一在一起的缘故,在开始菜单中max2013可以用支持的各种语言的版本启动。

题外插一句,可见还是用英文比较合适,不会出现乱码问题,哈哈。

要解决使用中文的脚本乱码问题,方式如下。

第一种是手动

【转】Max2013脚本工具的乱码问题

========================================================================

惯例分隔线,以下是代码改变选项的方式,美术同鞋可以止步了,技术美术和程序请继续

========================================================================

这个选项就保存在3dsmax.ini中,可以读ini文件来判断或设置

if "" != GetINISetting (GetMAXIniFile()) "File Language Options" "LanguageToUseForFileIO" do
SetINISetting (GetMAXIniFile()) "File Language Options" "LanguageToUseForFileIO" ""

当然修改ini文件会有个缺点,就是需要重启max。如果不想重启max,可以用下面的函数

【转】Max2013脚本工具的乱码问题
Fn SetDefaultLanguageToChinese =
(
if (MaxVersion() )[] >= do
if "" != GetINISetting (GetMAXIniFile()) "File Language Options" "LanguageToUseForFileIO" do
(
DialogMonitorOPS.UnRegisterNotification id:#SetDefaultLanguageToChinese
Fn DialogMonitorCallBackSetDefaultLanguageToChinese =
(
currentHandle = DialogMonitorOPS.GetWindowHandle()
if "Preference Settings" == UIAccessor.GetWindowText currentHandle do
(
languageNames = #("Chinese","English","German","French","japanese","Korean","Current")
childrens = Windows.getChildrenHWND currentHandle languageLabel = undefined
for tempControl in childrens where tempControl[] == "Default Language:" do
(
languageLabel = tempControl
)
if languageLabel != undefined do
for tempControl in childrens where
(
tempControl[]==languageLabel[] and \
tempControl[]==languageLabel[] and \
"ComboBox" == tempControl[] and \
FindItem languageNames tempControl[] !=
)
do
(
UIAccessor.SendMessage tempControl[] 0x014E
)
UIAccessor.SendMessageID currentHandle #IDOK
)
true
)
DialogMonitorOPS.RegisterNotification DialogMonitorCallBackSetDefaultLanguageToChinese id:#SetDefaultLanguageToChinese
DialogMonitorOPS.Enabled = true
DialogMonitorOPS.ShowNotification()
max file preferences
DialogMonitorOPS.UnRegisterNotification id:#SetDefaultLanguageToChinese
DialogMonitorOPS.Enabled = false
)
)
SetDefaultLanguageToChinese()