SCRIPT: manipulator for sun direction in sunsky node

Forums: SCRIPT: manipulator for sun direction in sunsky node
Sub forum for help and tutorials.

Moderator: JimStar

SCRIPT: manipulator for sun direction in sunsky node

Postby calus » Mon Jan 28, 2019 9:04 pm

calus Mon Jan 28, 2019 9:04 pm
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
calus
Licensed Customer
Licensed Customer
 
Posts: 1308
Joined: Sat May 22, 2010 9:31 am
Location: Paris

Re: SCRIPT: manipulator for sun direction in sunsky node

Postby Alan_M_1 » Sun May 24, 2020 12:30 pm

Alan_M_1 Sun May 24, 2020 12: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
Alan_M_1
Licensed Customer
Licensed Customer
 
Posts: 3
Joined: Sun May 19, 2019 3:30 pm

Return to Help / Tutorials


Who is online

Users browsing this forum: No registered users and 2 guests

Sat Apr 27, 2024 1:57 pm [ UTC ]