// =========================================================================== // 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: // AEscriptTemplate // // Description: // Controls for script nodes. // // Input Value: // nodeName // // Output Value: // None // global proc AEbeforeScriptFieldNew(string $attrName) { global int $gTextColumnWidthIndex; setUITemplate -pst attributeEditorTemplate; formLayout beforeScriptForm; text -label (uiRes("m_AEscriptTemplate.kBefore")) beforeScriptText; textField -ed 0 beforeScriptField; setParent ..; formLayout -e -aof beforeScriptText right (5 - $gTextColumnWidthIndex) -af beforeScriptText top 0 -af beforeScriptText bottom 0 -an beforeScriptText left -af beforeScriptField top 0 -af beforeScriptField bottom 0 -af beforeScriptField right 0 -ac beforeScriptField left 5 beforeScriptText beforeScriptForm; setUITemplate -ppt; AEbeforeScriptFieldReplace($attrName); } global proc AEafterScriptFieldNew(string $attrName) { global int $gTextColumnWidthIndex; setUITemplate -pst attributeEditorTemplate; formLayout afterScriptForm; text -label (uiRes("m_AEscriptTemplate.kAfter")) afterScriptText; textField -ed 0 afterScriptField; setParent ..; formLayout -e -aof afterScriptText right (5 - $gTextColumnWidthIndex) -af afterScriptText top 0 -af afterScriptText bottom 0 -an afterScriptText left -af afterScriptField top 0 -af afterScriptField bottom 0 -af afterScriptField right 0 -ac afterScriptField left 5 afterScriptText afterScriptForm; setUITemplate -ppt; AEafterScriptFieldReplace($attrName); } global proc AEbeforeScriptFieldReplace(string $attrName) { scriptJob -rp -p beforeScriptField -attributeChange $attrName ("AEbeforeScriptFieldUpdate " + $attrName); AEbeforeScriptFieldUpdate $attrName; } global proc AEafterScriptFieldReplace(string $attrName) { scriptJob -rp -p afterScriptField -attributeChange $attrName ("AEafterScriptFieldUpdate " + $attrName); AEafterScriptFieldUpdate $attrName; } global proc AEbeforeScriptFieldUpdate(string $attrName) { string $script = `getAttr $attrName`; textField -e -tx $script beforeScriptField; } global proc AEafterScriptFieldUpdate(string $attrName) { string $script = `getAttr $attrName`; textField -e -tx $script afterScriptField; } global proc AEscriptTemplate(string $nodeName) { editorTemplate -beginScrollLayout; editorTemplate -beginLayout (uiRes("m_AEscriptTemplate.kScriptAttributes")) -collapse 0; editorTemplate -addControl "scriptType"; editorTemplate -callCustom "AEbeforeScriptFieldNew" "AEbeforeScriptFieldReplace" "before"; editorTemplate -callCustom "AEafterScriptFieldNew" "AEafterScriptFieldReplace" "after"; editorTemplate -addControl "sourceType"; editorTemplate -endLayout; AEdependNodeTemplate $nodeName; editorTemplate -addExtraControls; editorTemplate -endLayout; editorTemplate -endScrollLayout; }