Page 1 of 1

SCRIPT: manipulator for sun direction in sunsky node

Posted: Mon Jan 28, 2019 9:04 pm
by calus
This script creates a directionnal light driving the sun direction of the selected sunSky node,
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);
    }
}

Re: SCRIPT: manipulator for sun direction in sunsky node

Posted: Sun May 24, 2020 12:30 pm
by Alan_M_1
Thank you so much for this!!!
I can't figure out for the life of me why it doesn't come with a manipulator like this from the get go!!!
Thanks!
Alan