// =========================================================================== // 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: // AEspotLightTemplate // // Description: // Creates the attribute editor controls for the spotLight Node // // Input Value: // nodeName // // Output Value: // None // // // Procedure Name: // AEspotLightPreviewPortNew // // global proc AEspotLightPreviewPortNew (string $nodeName, string $coneAngle) { global int $gAENameTextFieldIndex; string $nodeType = `objectType $nodeName`; string $swatchDisplayForm = "swatchDisplayForm_" + $nodeType; setParent $swatchDisplayForm; string $lightName[]; tokenize($coneAngle, ".", $lightName); text -label (uiRes("m_AEspotLightTemplate.kLightShape")) lightEffectText; spotLightPreviewPort -wh 64 64 -sl $lightName[0] spotLightPreviewPort1; formLayout -e -aoc lightEffectText right (-$gAENameTextFieldIndex) swatchLabel -af lightEffectText top 0 -af lightEffectText bottom 0 -an lightEffectText left -ac spotLightPreviewPort1 left 5 lightEffectText -af spotLightPreviewPort1 top 0 -af spotLightPreviewPort1 bottom 0 -an spotLightPreviewPort1 right $swatchDisplayForm; } // // Procedure Name: // AEspotLightPreviewPortReplace // // global proc AEspotLightPreviewPortReplace (string $nodeName, string $coneAngle) { string $lightName[]; tokenize($coneAngle, ".", $lightName); spotLightPreviewPort -edit -sl $lightName[0] spotLightPreviewPort1; } // // Procedure Name: // AEspotLightFogNew // // global proc AEspotLightFogNew (string $fogGeometry) // // Description: // Setup up button that makes fog. // { setUITemplate -pst attributeEditorTemplate; attrNavigationControlGrp -label (uiRes("m_AEspotLightTemplate.kLightFog")) -at $fogGeometry -ignoreNotSupported lightFogControl; setUITemplate -ppt; } // // Procedure Name: // AEspotLightFogReplace // // global proc AEspotLightFogReplace (string $fogGeometry) // // Description: // Replace the button with the command to create fog // for the new light. // { attrNavigationControlGrp -edit -at $fogGeometry -ignoreNotSupported lightFogControl; } // // Procedure Name: // AEdecayRegionNew // // global proc AEdecayRegionNew (string $intensity) // // Description: // Setup up button that makes decay regions. // { setUITemplate -pst attributeEditorTemplate; rowLayout -nc 2; text -label (uiRes("m_AEspotLightTemplate.kCreateIntensityCurve")); button -label (uiRes("m_AEspotLightTemplate.kCreate")) -c ("AEmakeDecayRegion " + $intensity) dr; 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; } // // 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 = makeCurve("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: // checkUseDecayRegions // global proc checkUseDecayRegions ( string $nodeName ) { string $nodeAttr = $nodeName + ".useDecayRegions"; int $value = `getAttr $nodeAttr`; if ( $value == 1 ) { editorTemplate -dimControl $nodeName "startDistance1" false; editorTemplate -dimControl $nodeName "endDistance1" false; editorTemplate -dimControl $nodeName "startDistance2" false; editorTemplate -dimControl $nodeName "endDistance2" false; editorTemplate -dimControl $nodeName "startDistance3" false; editorTemplate -dimControl $nodeName "endDistance3" false; } else { editorTemplate -dimControl $nodeName "startDistance1" true; editorTemplate -dimControl $nodeName "endDistance1" true; editorTemplate -dimControl $nodeName "startDistance2" true; editorTemplate -dimControl $nodeName "endDistance2" true; editorTemplate -dimControl $nodeName "startDistance3" true; editorTemplate -dimControl $nodeName "endDistance3" true; } } // // Procedure Name: // checkBarnDoors // global proc checkBarnDoors ( string $nodeName ) { string $nodeAttr = $nodeName + ".barnDoors"; int $value = `getAttr $nodeAttr`; if ( $value == 1 ) { editorTemplate -dimControl $nodeName "leftBarnDoor" false; editorTemplate -dimControl $nodeName "rightBarnDoor" false; editorTemplate -dimControl $nodeName "topBarnDoor" false; editorTemplate -dimControl $nodeName "bottomBarnDoor" false; } else { editorTemplate -dimControl $nodeName "leftBarnDoor" true; editorTemplate -dimControl $nodeName "rightBarnDoor" true; editorTemplate -dimControl $nodeName "topBarnDoor" true; editorTemplate -dimControl $nodeName "bottomBarnDoor" true; } } // // Procedure Name: // AEspotLightTemplate // // global proc AEspotLightTemplate ( string $nodeName ) { AEswatchDisplay $nodeName; editorTemplate -callCustom ("AEspotLightPreviewPortNew " + $nodeName ) ("AEspotLightPreviewPortReplace " + $nodeName ) "coneAngle"; editorTemplate -beginScrollLayout; editorTemplate -beginLayout (uiRes("m_AEspotLightTemplate.kSpotLightAttr")) -collapse 0; AElightCommon $nodeName; AEnonAmbientLightShapeNodeDecay $nodeName; editorTemplate -addControl "coneAngle"; editorTemplate -addControl "penumbraAngle"; editorTemplate -addControl "dropoff"; editorTemplate -endLayout; editorTemplate -beginLayout (uiRes("m_AEspotLightTemplate.kLightEffects")); editorTemplate -callCustom "AEspotLightFogNew" "AEspotLightFogReplace" "fogGeometry"; editorTemplate -addControl "fogSpread"; editorTemplate -addControl "fogIntensity"; editorTemplate -addSeparator; AEspotLightEffects $nodeName; editorTemplate -addSeparator; editorTemplate -addControl "barnDoors" "checkBarnDoors"; editorTemplate -addControl "leftBarnDoor"; editorTemplate -addControl "rightBarnDoor"; editorTemplate -addControl "topBarnDoor"; editorTemplate -addControl "bottomBarnDoor"; editorTemplate -beginLayout (uiRes("m_AEspotLightTemplate.kDecayRegions")); editorTemplate -addControl "useDecayRegions" "checkUseDecayRegions"; editorTemplate -beginLayout (uiRes("m_AEspotLightTemplate.kRegionOne")); editorTemplate -addControl "startDistance1"; editorTemplate -addControl "endDistance1"; editorTemplate -endLayout; editorTemplate -beginLayout (uiRes("m_AEspotLightTemplate.kRegionTwo")); editorTemplate -addControl "startDistance2"; editorTemplate -addControl "endDistance2"; editorTemplate -endLayout; editorTemplate -beginLayout (uiRes("m_AEspotLightTemplate.kRegionThree")); editorTemplate -addControl "startDistance3"; editorTemplate -addControl "endDistance3"; editorTemplate -endLayout; editorTemplate -endLayout; editorTemplate -endLayout; editorTemplate -beginLayout (uiRes("m_AEspotLightTemplate.kShadows")); editorTemplate -addControl "shadowColor"; // include the depth part of the nonExtendedLightShapeNode AEnonExtendedLightShapeDepthMapAttr $nodeName; AElightCommonShadow1 $nodeName; // include the first part of the nonExtendedLightShapeNode AEnonExtendedLightShapeShadowAttr $nodeName; // include the last part of the lightNode AElightCommonShadow2 $nodeName; editorTemplate -endLayout; // include all other inherited attrs AEshapeTemplate $nodeName; //suppressed attributes editorTemplate -suppress "objectType"; editorTemplate -suppress "pointWorld"; editorTemplate -suppress "farPointWorld"; editorTemplate -suppress "rayDirection"; editorTemplate -suppress "lightGlow"; editorTemplate -suppress "lightGlow"; editorTemplate -suppress "psIllumSamples"; editorTemplate -suppress "receiveShadows"; editorTemplate -addExtraControls; editorTemplate -endScrollLayout; }