If Expression

PHOTO EMBED

Tue Jul 02 2024 00:39:37 GMT+0000 (Coordinated Universal Time)

Saved by @nouhad #mel

global proc ifExpression()
{
	polyGear -sides 16 -radius 1 -internalRadius 0.3 -height 1 -heightDivisions 10 -gearSpacing 0.6 -gearOffset 0.2 -gearTip 0.5 -gearMiddle 1.2 -twist 0 -taper 1;
	string $gear[] = `ls -sl`;


	string $mat = `shadingNode -asShader blinn`;
	string $sg = `sets -renderable true -noSurfaceShader true -empty -name ($mat+"SG")`;
	connectAttr -f ($mat+".outColor") ($sg+".surfaceShader");

	select -r $gear[0] ;
	sets -e -forceElement $sg;

	expression -s ($gear[0]+".translateY = noise(time*4)*8;\n\nif ("+$gear[0]+".translateY <0)\n{\n\t"+$mat+".colorR = 0.644999;\n\t"+$mat+".colorG = 1;\n\t"+$mat+".colorB = 0.077;\n}\nelse\n{\n\t"+$mat+".colorR = 0.729425;\n\t"+$mat+".colorG = 0.0427638;\n\t"+$mat+".colorB = 0.668304;\n}") -ae 1 -uc all ;

}
content_copyCOPY