"你明明也xxoo,憑什麼批評我的ooxx?!"
的想法前,應該事先要對自己坦承:我就是一個ooxx的人~
還是坦然點會過的比較舒服
-------------嘰哩呱啦吱吱咂咂--------------
這篇只是小小介紹如何在RMS中使用RibArchive的功能。跟RMS的Ensemble跟RAT不同,沒有RIBBox這種東西可以接,因為RMS將其整合進Maya裡(RMS就是為了跟Maya有更好的結合才誕生的)。而且不只RibArchive,很多RenderMan的功能都要透過在Maya裡,新增以及設定一些attribute來達成。
首先...建置一個簡單的場景如下:(cube給它一個紅色的材質球)

然後在Attribute視窗,切換到pCubeShape1的tab,按Attributes->RenderMan->Manage Attributes,會跳出下面這個視窗

在Optional Attributes裡選"Pre Shape MEL",然後按下Add,即可發現在pCubeShape1最下面出現一個新的attribute:Pre Shape MEL。這個欄位就等同於RAT的RIBBox欄位。

對旁邊那個locator也是相同的作法。然後在這個欄位輸入RiReadArchive "/oox/ooxx/Archive_test.rib";
也就是在RiReadArchive後面接RibArchive的路徑,render後可以看到類似下圖:紅色的teapot是由於有給他一顆材質球,所以它會去讀材質球上的資訊。另一個是只單純讀*.rib裡的geometry資訊。(註:在RMS1.0中,並不能對locator做這樣的動作,而在RMS2.0中,有將這個bug修掉)
可以在文字編輯器裡,先打好所要輸入的code,再複製貼上,不然那欄位那麼小,直接在裏面輸入會搞到眼睛脫窗@@

這裡有順手寫了一個小小的script,先選取object,然後在maya裡執行(環境要為linux),可選取要被讀取的文字檔,並將此文字檔的內容輸入到Pre Shape MEL裡:
from pymel import *
import pymel as pm
from commands import *
import maya.mel as mel
def getFile():
zenFile = getoutput('zenity --title="search file" --file-selection --filename=""')
tmpPath = zenFile.split('failed')
filePath = tmpPath[1].split('\n')
fileCont = open(filePath[1], 'r')
return fileCont.read()
def addArch():
objShap = pm.ls(sl=1, dag=True, g=True)
testName = objShap[0]
mel.eval(' rmanAddAttr '+objShap[0]+' rman__torattr___preShapeScript "" ')
archCont = getFile()
print archCont
setAttr(objShap[0]+".rman__torattr___preShapeScript" , archCont)
addArch()
沒有留言:
張貼留言