can be handy to adjust Sky or Planetary Environment.
- Code: Select all
{
//This script creates a directionnal light connected to the sun direction in the selected sunSky node
string $env[] = ls("-sl","-typ","octaneSunSky");
if (size($env)>0){
string $sunSh = createNode("directionalLight","-n","sunShape#","-p",createNode("transform","-n","sun#"));
string $vecNode = createNode("vectorProduct");
setAttr($vecNode+".input1Z",1);
setAttr($vecNode+".operation",3);
setAttr($vecNode+".normalizeOutput",1);
connectAttr("-f",$sunSh+".worldMatrix[0]",$vecNode+".matrix");
connectAttr("-f",$vecNode+".output",$env[0]+".SunDir");
print ($env[0]+" is now connected to "+$sunSh);
}
}