Message 1 of 3
Texture not showing on mesh and on render

Not applicable
08-18-2018
01:41 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey people,
version: maya 2018.3 Windows10
I am having an issue where I want to map a image sequence onto my object but somewhere it decides not to apply the actual texture. I have to do this exact action below to fix it but am wondering if I can't do that code wise.
Using python but I can work with MEL a bit.
#Search for img
imgPath = cmds.fileDialog2(fileMode=1, fileFilter="*.tif")
img = imgPath[0]
textureName = img.split('/')
textureName = textureName[len(textureName)-1]
textureName = textureName.split('.')[0]
print textureName
#create a shader
shader=cmds.shadingNode("surfaceShader",asShader=True,name="imgSequenceShader")
#a file texture node
file_node=cmds.shadingNode("file",asTexture=True ,name="imgSequence")
# a shading group
shading_group= cmds.sets(renderable=True,noSurfaceShader=True,empty=True)
#connect shader to sg surface shader
cmds.connectAttr('%s.outColor' %shader ,'%s.surfaceShader' %shading_group)
#connect file texture node to shader's color
cmds.connectAttr('%s.outColor' %file_node,'%s.outColor' %shader)
cmds.setAttr('imgSequence.useFrameExtension' ,1)
#a UV node
uv_node=cmds.shadingNode("uvChooser",asUtility =True ,name="UV")
#connect UV node to file node
cmds.connectAttr('%s.outUv' %uv_node,'%s.uvCoord' %file_node)
cmds.setAttr( '%s.fileTextureName' % file_node, img, type = "string")
If this is fixed my script is flawless so it would be a big favor you do for me!
Greetings,
Matthias Willemen