Pixero
11-15-2006, 09:26 PM
Can someone see whats wrong with this? :shrug:
global proc js_objDepth()
{
// Create the shading nodes
//string $surfShade = `shadingNode -as surfaceShader`;
string $surfShade = `shadingNode -asShader surfaceShader`;
string $sg = `sets -renderable true -noSurfaceShader true -empty -name ($surfShade + "SG") `;
// Connect the material to the shading group
//defaultNavigation -connectToExisting -source $surfShade -destination $sg;
connectAttr -f ($surfShade + ".outColor") ($surfShade + "SG" + ".surfaceShader");
string $bwRamp = `shadingNode -at ramp`;
string $sInfo = `shadingNode -au samplerInfo`;
string $sRange = `shadingNode -au setRange`;
// Set the ramp colors
setAttr ($bwRamp + ".colorEntryList[0].position") 0;
setAttr ($bwRamp + ".colorEntryList[1].position") 1;
setAttr ($bwRamp + ".colorEntryList[0].color") 0 0 0;
setAttr ($bwRamp + ".colorEntryList[1].color") 1 1 1;
// Make the connections
connectAttr -f ($sInfo + ".pointObjY") ($sRange + ".valueY");
connectAttr -f ($sRange + ".outValueY") ($bwRamp + ".vCoord");
connectAttr -f ($bwRamp + ".outColor") ($surfShade + ".outColor");
//connectAttr -f ($surfShade + ".outColor") ($surfShade + "SG.surfaceShader");
// Connect the selected object. Just one object.
string $selectedObjects[] = `ls -sl`;
for( $obj in $selectedObjects)
{
connectAttr ($obj+ ".boundingBoxMinY") ($sRange + ".oldMinY");
connectAttr ($obj + ".boundingBoxMaxY") ($sRange + ".oldMaxY");
// Apply Shader to selected object. ------ I've tried all these.
// defaultNavigation -source $surfShade -destination |$obj|($obj + "Shape" + ".instObjGroups[0]") -connectToExisting;
// sets -e -forceElement $sg;
//hyperShade -assign $surfShade;
}
}
global proc js_objDepth()
{
// Create the shading nodes
//string $surfShade = `shadingNode -as surfaceShader`;
string $surfShade = `shadingNode -asShader surfaceShader`;
string $sg = `sets -renderable true -noSurfaceShader true -empty -name ($surfShade + "SG") `;
// Connect the material to the shading group
//defaultNavigation -connectToExisting -source $surfShade -destination $sg;
connectAttr -f ($surfShade + ".outColor") ($surfShade + "SG" + ".surfaceShader");
string $bwRamp = `shadingNode -at ramp`;
string $sInfo = `shadingNode -au samplerInfo`;
string $sRange = `shadingNode -au setRange`;
// Set the ramp colors
setAttr ($bwRamp + ".colorEntryList[0].position") 0;
setAttr ($bwRamp + ".colorEntryList[1].position") 1;
setAttr ($bwRamp + ".colorEntryList[0].color") 0 0 0;
setAttr ($bwRamp + ".colorEntryList[1].color") 1 1 1;
// Make the connections
connectAttr -f ($sInfo + ".pointObjY") ($sRange + ".valueY");
connectAttr -f ($sRange + ".outValueY") ($bwRamp + ".vCoord");
connectAttr -f ($bwRamp + ".outColor") ($surfShade + ".outColor");
//connectAttr -f ($surfShade + ".outColor") ($surfShade + "SG.surfaceShader");
// Connect the selected object. Just one object.
string $selectedObjects[] = `ls -sl`;
for( $obj in $selectedObjects)
{
connectAttr ($obj+ ".boundingBoxMinY") ($sRange + ".oldMinY");
connectAttr ($obj + ".boundingBoxMaxY") ($sRange + ".oldMaxY");
// Apply Shader to selected object. ------ I've tried all these.
// defaultNavigation -source $surfShade -destination |$obj|($obj + "Shape" + ".instObjGroups[0]") -connectToExisting;
// sets -e -forceElement $sg;
//hyperShade -assign $surfShade;
}
}
