【轉】Max2013腳本工具的亂碼問題

轉自:http://www.cnblogs.com/sitt/archive/2012/11/21/2780481.htmlhtml

 

有時一些中文的腳本會在max2013中顯示爲亂碼,是由於max2013將多種語言統一在一塊兒的緣故,在開始菜單中max2013能夠用支持的各類語言的版本啓動。函數

題外插一句,可見仍是用英文比較合適,不會出現亂碼問題,哈哈。spa

要解決使用中文的腳本亂碼問題,方式以下。3d

第一種是手動code

========================================================================htm

慣例分隔線,如下是代碼改變選項的方式,美術同鞋能夠止步了,技術美術和程序請繼續blog

========================================================================get

這個選項就保存在3dsmax.ini中,能夠讀ini文件來判斷或設置it

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

固然修改ini文件會有個缺點,就是須要重啓max。若是不想重啓max,能夠用下面的函數io

複製代碼
Fn SetDefaultLanguageToChinese = 
(
    if (MaxVersion() )[1] >= 15000 do
    if "2052" != 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[5] == "Default Language:" do 
                (
                    languageLabel = tempControl
                )
                if languageLabel != undefined do
                for tempControl in childrens where 
                (
                    tempControl[2]==languageLabel[2] and \
                    tempControl[3]==languageLabel[3]  and \
                    "ComboBox" == tempControl[4] and \
                    FindItem languageNames tempControl[5] != 0
                )
                do
                (
                    UIAccessor.SendMessage tempControl[1] 0x014E 6 0
                )
                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()
相關文章
相關標籤/搜索