什么是mel script ?
melscript 即內(nèi)含maya embedded language指令'處理程序化,或兩者皆有.一般來(lái)說(shuō),就是使用mel script去執(zhí)行一連串的指令.
您可以使用文字編輯器纂寫mel script,之后將其儲(chǔ)存于硬碟中,melscript的附檔名為mel,mel并非scenes的一部分,你可在不同的project中重復(fù)使用mel script,每當(dāng)你要重覆該動(dòng)作時(shí),你必須執(zhí)行script.
讀取script內(nèi)容
在安裝及使用script前,研讀其前頭(title)的資訊,敘述著有關(guān)該script的目地及使用方式,你可用文字編輯器瀏覽.
所有assitant內(nèi)的script都包括這些資訊 .
一般script皆有不同的執(zhí)行需求,閱讀前頭資訊,將使你知道script之間的相關(guān)性,相關(guān)的script必須是在同一個(gè)script目錄下.
1.將script置于script的目錄:
基本上mel scripts路徑是位于 maya/scripts 下,如果你將script置于此處,你將可容易的執(zhí)行所屬script head 所指示的執(zhí)行程序,并在command line下執(zhí)行,maya 將搜尋該script path ,找尋同名之melscript之指令,并宣告所有g(shù)lobal mel procedures,之后同名之global procedure即如指令執(zhí)行之.
2.使用script editor:
你可用script editor去建立,改變或使用mel script,script editor可從window->generaleditors->scripteditor或maya 視窗的右下角打開它,script editor打開后,你可從file->openscript開啟script,此時(shí)在inputsection將顯示script的內(nèi)容,你可按enter執(zhí)行或file->execute.
注意:copy及paste到scripteditor內(nèi)亦是同樣的操作.
source a script
經(jīng)由scripteditor的file->source script 將一script打開.sourceing mel script即執(zhí)行script中所有的mel指令及宣告所有g(shù)lobal procedure,就像是openscript并執(zhí)行它,只是不會(huì)在scripteditor中看到.記住,open及source只是將script置于memory中直到你執(zhí)行它方有作用.
結(jié)論:
現(xiàn)在你可以開始試試手上的script,漸漸的在你將熟悉mel的語(yǔ)法及功能后,此時(shí)你就可以建立你自己的script.
|
新聞熱點(diǎn)
疑難解答
圖片精選