SimpleDan
SimpleDan

Reputation: 13

Maya python 'tuple' is not callable error after specific steps

First off, pretty new to Python, so I apologize for any shortcomings here. I'm trying to build a lookDev script in Maya, basically a window for new hires to have access to shaders, textures, all the useful stuff. My problem arises here:

def CreateRemapValue():
   selNodes = mc.ls(sl = True, type = "file")
   if selNodes:  
       for selNode in selNodes: 
           newRemapV = mc.shadingNode('remapValue', name = selNode + "_RemapValue", asUtility = True)
        mc.setAttr = (selNode + ".alphaIsLuminance", 1)
        mc.connectAttr(selNode + '.outAlpha', newRemapV + '.inputValue')
   else: 
    newRemapV = mc.shadingNode('remapValue', asUtility = True, name = "RemapValue")    

Pretty straightforward, but what happens is something me nor my more experienced Python friend can figure out.

If I have a file node selected and run this, it creates a RemapValue no problem. If I THEN run this WITHOUT any file nodes selected, it creates a RemapValue no problem. Then, nothing in the entire script works afterward. No shader, no texture, no lights. Nothing. It all gives me the 'tuple' object is not callable error. Makes the script completely unusable.

The lines it gives me errors on are all similar to the following. I did the 2 steps, got the error when I tried to create a basic wood shader:

        mc.setAttr(RoughWoodA_TileableTX + ".fileTextureName", "T:/06_Image_Lib/Texture_Library/TILEABLE/RoughWood_Tileable_01.tif", type = "string")

The error given to me is:

# Error: TypeError: file <maya console> line 329: 'tuple' object is not callable

Any help or guidance would be GREATLY appreciated. Thank you :)

Upvotes: 1

Views: 386

Answers (1)

Morgan Thrapp
Morgan Thrapp

Reputation: 9986

Your issue is the line mc.setAttr = (selNode + ".alphaIsLuminance", 1). You're trying to assign a tuple to a function and then later in the code trying to call that function.

The fix should be to call mc.setAttr instead of assigning to it, like this:

mc.setAttr(selNode + ".alphaIsLuminance", 1)

Upvotes: 1

Related Questions