SCRIPT: manipulator for sun direction in sunsky node

Sub forum for help and tutorials.

Moderator: JimStar

Post Reply
calus
Licensed Customer
Posts: 1308
Joined: Sat May 22, 2010 9:31 am
Location: Paris

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);
    }
}
Pascal ANDRE
Alan_M_1
Licensed Customer
Posts: 3
Joined: Sun May 19, 2019 3:30 pm

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
Post Reply

Return to “Help / Tutorials”