1

我目前有一个字符串列表,我需要在其中转换为命令。

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
4

1 回答 1

0

Specifically with the layeredTexture Node the inputs attribute is actually a pymel method so it returns the input nodes of said node. In order to achieve the desired result you have to declare "layeredTexture1.inputs[1].alpha" as an attribute explicitly via pymel's Attribute() class or pass it through a pretty handy command pymel has to offer called PyNode(), which does kind of what you wanted. This should give you everything you should need to know about PyNodes. Some examples of all this would be:

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

Using PyNode is prefered but you can play around with both.

于 2013-07-15T03:15:36.730 回答