Max2013腳本工具的亂碼問題


有時一些中文的腳本會在max2013中顯示為亂碼,是因為max2013將多種語言統一在一起的緣故,在開始菜單中max2013可以用支持的各種語言的版本啟動。

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

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

第一種是手動

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

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

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

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

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

當然修改ini文件會有個缺點,就是需要重啟max。如果不想重啟max,可以用下面的函數

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()

如果是2010的中文亂碼,移步這里http://www.cnblogs.com/sitt/archive/2012/03/09/2387581.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM