PDA

View Full Version : python assign image to texture


misterwolfy
10-18-2010, 05:07 AM
Mel feedback shows that the AEassignTextureCB command is used when we assign an image to a file texture in Maya.

Trying to convert this to Python gives an error: # AttributeError: 'module' object has no attribute 'AEassignTextureCB' #

I also tried: mc.setAttr( (myTex +'.fileTextureName'), 'path/image.00000.tif'), this gave me another error: # RuntimeError: 'file8.fileTextureName' is not a simple numeric attribute. Its values must be set with a -type flag. #

Any idea how to work this? I was not able to figure it out.

Thanks for reading!

rahulsg2901
10-18-2010, 05:57 AM
This is code


import maya.cmds as cmds

file = (path + filename + extension)

cmds.setAttr( 'file1.fileTextureName', file, type = "string")

misterwolfy
10-18-2010, 06:07 AM
perfect, thanks!

CGTalk Moderation
10-18-2010, 06:07 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.