// =========================================================================== // 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: // AEcacheBlendTemplate // // Description Name; // Creates the attribute editor controls for the cacheBlend Node // // Input Value: // nodeName // // Output Value: // None // proc string getCacheTrackSliderLabel(string $input) { string $name = $input; // if (nodeType($input) == "cacheFile") { // $name = `getAttr ($input+".cacheName")`; // } return $name; } global proc AEcacheBlendNew(string $cacheName) { string $buffer[]; tokenize($cacheName, ".", $buffer); string $nodeName = $buffer[0]; setUITemplate -pst attributeEditorTemplate; rowColumnLayout -numberOfColumns 2 -columnWidth 1 350 -columnWidth 2 25 -columnAlign 1 "right" -columnAlign 2 "left" ($buffer[1]+"Column"); int $i, $ct; string $inputs[] = `listConnections ($nodeName+".inCache")`; string $visited[]; $ct = 0; for ($i=0; $i < size($inputs); $i++) { string $label = getCacheTrackSliderLabel($inputs[$i]); // If the object has already been visited, just continue. int $v = 0; string $vis; for ($vis in $visited) { if ($vis == $label) { $v = 1; } } if ($v == 1) continue; $visited[size($visited)] = $label; string $name = ("input"+$ct); attrFieldSliderGrp -label $label -min 0.0 -max 1.0 -fmn 0.0 -fmx 20.0 -s 0.1 $name; symbolButton -image "navButtonConnected.png" ($name+"Cache"); $ct++; } setParent ..; setUITemplate -ppt; AEcacheBlendReplace( $cacheName ); } global proc AEcacheBlendReplace(string $cacheName) { string $buffer[]; tokenize($cacheName, ".", $buffer); string $nodeName = $buffer[0]; setUITemplate -pst attributeEditorTemplate; setParent ($buffer[1]+"Column"); $layoutName = `setParent -q`; int $oldCount = `rowColumnLayout -q -nch $layoutName`; int $i, $ct; string $inputs[] = `listConnections ($nodeName+".inCache")`; string $visited[]; $ct = 0; for ($i=0; $i < size($inputs); $i++) { string $label = getCacheTrackSliderLabel($inputs[$i]); // If the object has already been visited, just continue. int $v = 0; string $vis; for ($vis in $visited) { if ($vis == $label) { $v = 1; } } if ($v == 1) continue; $visited[size($visited)] = $label; string $name = ("input"+$ct); string $attr = ($nodeName+".cd["+$ct+"].w"); if (`attrFieldSliderGrp -ex $name`) { attrFieldSliderGrp -e -label $label -at $attr $name; button -e -c ("showEditor "+$inputs[$i]) ($name+"Cache"); } else { attrFieldSliderGrp -min 0.0 -max 1.0 -fmn 0.0 -fmx 20.0 -s 0.1 -label $label -at $attr $name; symbolButton -image "navButtonConnected.png" ($name+"Cache"); button -e -c ("showEditor "+$inputs[$i]) ($name+"Cache"); } $ct++; } for ($i=$ct; $i < $oldCount; $i++) { $sliderName = ("input"+$i); if ( `attrFieldSliderGrp -ex $sliderName` ) deleteUI $sliderName; if ( `symbolButton -ex ($sliderName+"Cache")` ) deleteUI ($sliderName+"Cache"); } setParent ..; setUITemplate -ppt; } global proc AEcacheBlendTemplate ( string $nodeName ) { editorTemplate -beginScrollLayout; editorTemplate -beginLayout (uiRes("m_AEcacheBlendTemplate.kInputWeights")) -collapse false; editorTemplate -callCustom AEcacheBlendNew AEcacheBlendReplace weight; editorTemplate -endLayout; AEdependNodeTemplate $nodeName; editorTemplate -suppress "disableAll"; editorTemplate -suppress "cacheData"; editorTemplate -suppress "track"; editorTemplate -suppress "trackState"; editorTemplate -suppress "start"; editorTemplate -suppress "end"; editorTemplate -suppress "inRange"; editorTemplate -suppress "cacheWeights"; editorTemplate -suppress "perPtWeights"; editorTemplate -addExtraControls; editorTemplate -endScrollLayout; }