// =========================================================================== // Copyright 2018 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // =========================================================================== // // Procedure Name: // AEspotLightEffects // // Description: // Creates custom attribute editor controls for the spotLight Node // // Input Value: // nodeName // // Output Value: // None // // // Procedure Name: // AEdecayRegionNew // // global proc AEdecayRegionNew(string $intensity) // // Description: // Setup up button that makes decay regions. // { setUITemplate -pst attributeEditorTemplate; rowLayout -nc 3; text -label (uiRes("m_AEspotLightEffects.kIntensityCurve")) ; button -label (uiRes("m_AEspotLightEffects.kCreate")) -c ("AEmakeDecayRegion " + $intensity) dr; symbolButton -i "inArrow.png" -c ("AEintensityCurvePointer " + $intensity) intensityPointer; setParent ..; setUITemplate -ppt; } // // Procedure Name: // AEdecayRegionReplace // // global proc AEdecayRegionReplace(string $intensity) // // Description: // Replace the button with the command to create // decay regions for the new light. // { button -e -c ("AEmakeDecayRegion " + $intensity) dr; button -e -c ("AEintensityCurvePointer " + $intensity) intensityPointer; } // // Procedure Name: // AEmakeCurve // // global proc string AEmakeCurve(string $curveName) { // create the param curve. string $newCurve = `createNode animCurveUU -n $curveName`; // set a few keyframes for the curve. setKeyframe -f 0 -v 1 $newCurve; setKeyframe -f 10 -v 0 $newCurve; setKeyframe -f 20 -v 1 $newCurve; setKeyframe -f 30 -v 0 $newCurve; setKeyframe -f 40 -v 1 $newCurve; setKeyframe -f 50 -v 0 $newCurve; setKeyframe -f 60 -v 1 $newCurve; setKeyframe -f 100 -v 0 $newCurve; return $newCurve; } // // Procedure Name: // AEmakeDecayRegion // // global proc AEmakeDecayRegion(string $intensity) // // Description: // Make a decay region for this light. // { // get the name of the light. string $lightName[]; tokenize($intensity, ".", $lightName); string $newCurve = AEmakeCurve("IntensityCurve"); string $attr = $newCurve + ".output"; // connect the param curve to the intensity connectAttr $attr $intensity; // create a lightInfo node. string $lightInfoNode = `createNode lightInfo -n lightInfo`; // connect the light to the lightInfo node. $attr = $lightName[0] + ".worldMatrix"; $attr2 = $lightInfoNode + ".worldMatrix"; connectAttr $attr $attr2; // connect the lightInfoNode to the curve. $attr = $lightInfoNode + ".sampleDistance"; $attr2= $newCurve + ".input"; connectAttr $attr $attr2; } // // Procedure Name: // AEintensityCurvePointer // // global proc AEintensityCurvePointer (string $name) { string $intensityCurve[] = `listConnections $name`; select $intensityCurve[0]; editSelected; } // // Procedure Name: // AEcolorRegionNew // // global proc AEcolorRegionNew (string $colorR,string $colorG,string $colorB) // // Description: // Setup up button that makes colour regions. // { setUITemplate -pst attributeEditorTemplate; rowLayout -nc 2; text -label (uiRes("m_AEspotLightEffects.kColorCurves")) ; button -label (uiRes("m_AEspotLightEffects.kCreate2")) -c ("AEmakeColorRegion " + $colorR + " " + $colorG + " " + $colorB ) colorRegion; setParent ..; setUITemplate -ppt; } // // Procedure Name: // AEcolorRegionReplace // // global proc AEcolorRegionReplace (string $colorR, string $colorG, string $colorB) // // Description: // Replace the button with the command to create // colour regions for the new light. // { button -e -c ("AEmakeColorRegion " + $colorR + " " + $colorG + " " + $colorB ) colorRegion; } // // Procedure Name: // AEmakeColorRegion // // global proc AEmakeColorRegion(string $colorR,string $colorG,string $colorB) // // Description: // Make a color region for this light. // { // get the name of the light. string $lightName[]; tokenize($colorR, ".", $lightName); string $newCurveR = AEmakeCurve("RedCurve"); string $attrR = $newCurveR + ".output"; string $newCurveG = AEmakeCurve("GreenCurve"); string $attrG = $newCurveG + ".output"; string $newCurveB = AEmakeCurve("BlueCurve"); string $attrB = $newCurveB + ".output"; // connect the param curve to the colour connectAttr $attrR $colorR; connectAttr $attrG $colorG; connectAttr $attrB $colorB; // create a lightInfo node. string $lightInfoNode = `createNode lightInfo -n lightInfo`; // connect the light to the lightInfo node. $attrR = $lightName[0] + ".worldMatrix"; $attrG = $lightInfoNode + ".worldMatrix"; connectAttr $attrR $attrG; // connect the lightInfoNode to the curve. string $outDistance = $lightInfoNode + ".sampleDistance"; $attrR = $newCurveR + ".input"; $attrG = $newCurveG + ".input"; $attrB = $newCurveB + ".input"; connectAttr $outDistance $attrR; connectAttr $outDistance $attrG; connectAttr $outDistance $attrB; } // // Procedure Name: // AEspotLightGlowNew // // global proc AEspotLightGlowNew (string $lightGlow) { setUITemplate -pst attributeEditorTemplate; attrNavigationControlGrp -label (uiRes("m_AEspotLightEffects.kLightGlow")) -at $lightGlow -ignoreNotSupported lightGlowControl; setUITemplate -ppt; } // // Procedure Name: // AEspotLightGlowReplace // // global proc AEspotLightGlowReplace (string $lightGlow) { attrNavigationControlGrp -edit -at $lightGlow -ignoreNotSupported lightGlowControl; } // // Procedure Name: // AEspotLightEffects // // global proc AEspotLightEffects ( string $nodeName ) { // Spot Light Glow Effects editorTemplate -callCustom "AEspotLightGlowNew" "AEspotLightGlowReplace" "lightGlow"; // decay Region Effect editorTemplate -callCustom "AEdecayRegionNew" "AEdecayRegionReplace" "intensity"; // Color Region Effect editorTemplate -callCustom "AEcolorRegionNew" "AEcolorRegionReplace" "colorR" "colorG" "colorB"; }