View Full Version : changing diffuse value trough a loop

08 August 2007, 11:14 AM
Hi all,

First of all I use python in maya, but I don't think python is the problem here.

What I want to do is looping trough a list generated from the materials in the hypershade. All of those materials need to have a diffusevalue of 1. But when I code this:

import maya.cmds as cmds

DefaultMaterials = cmds.itemFilter(byType='phong')
textureNodeList = cmds.lsThroughFilter(DefaultMaterials, na=True, sort='byName', rv=False)

print textureNodeList

for node in textureNodeList :
attrList = cmds.listAttr(node)

print attrList

cmds.setAttr(node.diffuse, 1)

I get the message: "
# Error: 'unicode' object has no attribute 'diffuse'
# Traceback (most recent call last):
# File "<maya console>", line 13, in ?
# AttributeError: 'unicode' object has no attribute 'diffuse' #"

When I print the attrList I get all the attributes of the nodes, one of them is the diffuse attribute...

What am I doing wrong ?

Thanks for the help.

CGTalk Moderation
08 August 2007, 11:14 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.