Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jookyboi/6786964 to your computer and use it in GitHub Desktop.
Save jookyboi/6786964 to your computer and use it in GitHub Desktop.
//Here is a small script to automate the creation of a point light. It creates a point light with a connected Physical Light. Alternatively it connects a physical Light to the selected Lights.
proc string create_Physical_Light(int $interior){
string $sel_lights[] = `ls -sl -dag -leaf -lights`;
string $phyLight = `mrCreateCustomNode -asUtility "" physical_light`;
string $blackbody;
if ($interior) {
$blackbody = `mrCreateCustomNode -asUtility "" mib_blackbody`;
} else {
$blackbody = `mrCreateCustomNode -asUtility "" mib_cie_d`;
}
setAttr ($blackbody+".intensity") 1000;
connectAttr -force ($blackbody+".outValue") ($phyLight+".color");
if (0 == size ($sel_lights) ){
$sel_lights[0] = `pointLight`;
}
for ($light in $sel_lights){
connectAttr -force ($phyLight+".message") ($light+".miLightShader");
}
return $phyLight;
}
create_Physical_Light(false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment