View Full Version : Scripted shading network not working in High Quality view

01 January 2011, 06:28 PM
I apologise if this is in the wrong place. It could be a scripting problem, it could be a maya problem.

I am scripting a simple shading network. It basically multiplies two textures together using a layered texture utility node. When I make this manually I can apply the finished shader to my object and it works fine in High Quality view (which I need it to). However when I use this script it doesn't work in High Quality, I just see black. I can't figure out what is created or happens when I do it manually that I am not creating or connecting or setting in my script.


p.s - sorry for the long dull linear code!

import maya.cmds as cmds cmds.shadingNode ("file", asTexture=True, name="amb")
cmds.shadingNode ("place2dTexture", asUtility=True, name="ambPlace2d")
cmds.connectAttr ("ambPlace2d.coverage", "amb.coverage", force=True)
cmds.shadingNode ("file", asTexture=True, name="diff")
cmds.shadingNode ("place2dTexture", asUtility=True, name="diffPlace2d")
cmds.connectAttr ("diffPlace2d.coverage", "diff.coverage", force=True)
cmds.shadingNode ("layeredTexture", asTexture=True, name="mult1")
cmds.shadingNode ("surfaceShader", asShader=True, name="comp")
cmds.shadingNode ("place2dTexture", asUtility=True, name="compPlace2d")
cmds.sets (renderable=True, noSurfaceShader=True, empty=True, name="compSG")
cmds.connectAttr ("comp.outColor", "compSG.surfaceShader", force=True)
cmds.connectAttr ("amb.outColor", "mult1.inputs[0].color", force=True)
cmds.connectAttr ("diff.outColor", "mult1.inputs[1].color", force=True)
cmds.connectAttr ("mult1.outColor", "comp.outColor", force=True)
cmds.setAttr ("amb.fileTextureName", "C:/Users/Sim/Documents/Uni Year 3/Innovations/Testing/testShaders/test_Amb.jpeg", type="string" );
cmds.setAttr ("diff.fileTextureName", "C:/Users/Sim/Documents/Uni Year 3/Innovations/Testing/testShaders/test_noAmb.jpeg", type="string" );
cmds.setAttr ("mult1.inputs[0].blendMode", 6)
cmds.defaultNavigation (source="comp", destination="pPlaneShape1.instObjGroups[0]", connectToExisting=True);

CGTalk Moderation
01 January 2011, 06:28 PM
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.