1

I currently have a list of strings in which I need to convert into a command.

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

Is there a command that will convert a string into a command for pymel?

I need this so I can connect two shaders together.

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

                   needs to be 

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

1 Answers1

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.

Argiri Kotsaris
  • 492
  • 3
  • 7