2013-07-04 33 views
1

我目前有一個需要轉換爲命令的字符串列表。使用Pymel將字符串轉換爲命令

IE: 
"checkerText.outAlpha" needs to be checkerText.outAlpha 

是否有命令將字符串轉換爲pymel命令?

我需要這個,所以我可以連接兩個着色器。

IE: 
'checkerText.outAlpha' >> 'layText.inputs[0].alpha' 

        needs to be 

checkerText.outAlpha >> layText.inputs[0].alpha 

回答

0
具體地說

與layeredTexture節點的inputs屬性實際上是一個pymel方法,因此返回所述節點的輸入節點。爲了達到理想的結果,你必須通過pymel的Attribute()類明確聲明「layeredTexture1.inputs [1] .alpha」作爲屬性,或者通過pymel提供的一個非常方便的命令來傳遞它,稱爲PyNode(),它確實是你的一種通緝。 This應該給你所有你需要了解PyNodes的知識。所有這些的一些例子將是:

PyNode("checker1").outAlpha >> PyNode("layeredTexture1.inputs[1].alpha") # The whole attr needs to be in the string because of the above explenation. 

Attribute("checker1.outAlpha") >> Attribute("layeredTexture1.inputs[1].alpha") 

使用PyNode是首選,但你可以玩兩種。