// =========================================================================== // 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: // AEcacheFileTemplate // // Description Name; // Creates the attribute editor controls for the cacheFile Node // // Input Value: // nodeName // // Output Value: // None // global proc int AEassignCacheFileCB( string $cacheFileAttr, string $filename, string $fileType ) { source "currentProjectParentDir.mel"; $directoryPath = getParentDir ( $filename ); $baseName = basename ( $filename, ".xml" ); // Set the cacheFile attribute setAttr $cacheFileAttr -type "string" $baseName; // Set the cachePath attribute string $buffer[]; tokenize($cacheFileAttr, ".", $buffer); string $cachePathAttr = $buffer[0] + ".cachePath"; setAttr $cachePathAttr -type "string" $directoryPath; // This will force an update to display the effects // of the new cachefile. // currentTime `currentTime -q`; string $currentDir = `workspace -q -dir`; retainWorkingDirectory ($currentDir); return true; } global proc AEcacheFileBrowser( string $cmd, string $cacheName ) { string $buffer[]; tokenize($cacheName, ".", $buffer); string $cachePathAttr = $buffer[0] + ".cachePath"; $directoryPath = `getAttr $cachePathAttr`; global string $gDefaultFileBrowserDir; $gDefaultFileBrowserDir = $directoryPath; string $workspace = `workspace -q -fn`; setWorkingDirectory $workspace "fileCache" "cache/nCache"; fileBrowser ($cmd, (uiRes("m_AEcacheFileTemplate.kAssignCacheFile")), "xmlcache", 0); } global proc AEcachePathNew(string $cachePath) { frameLayout -label (uiRes("m_AEcacheFileTemplate.kCacheFile")) -lv true -bv true -collapsable true -collapse false cacheFileLayout; setUITemplate -pst attributeEditorTemplate; columnLayout -adj true; rowLayout -nc 3 -adj 2 cachePathLayout; text -label (uiRes("m_AEcacheFileTemplate.kBaseDirectory")) cachePathText; textField cachePathField; setParent ..; setParent ..; setParent ..; setUITemplate -ppt; setParent ..; AEcachePathReplace( $cachePath ); } global proc AEcachePathReplace(string $cachePath) { // cachePath Attribute // connectControl -fileName cachePathField $cachePath; string $buffer[]; tokenize($cachePath, ".", $buffer); string $nodeName = $buffer[0]; editorTemplate -dimControl $nodeName "originalStart" true; editorTemplate -dimControl $nodeName "originalEnd" true; } global proc AEbaseNameNew(string $baseName) { setUITemplate -pst attributeEditorTemplate; columnLayout -adj true; rowLayout -nc 3 -adj 2 baseNameLayout; text -label (uiRes("m_AEcacheFileTemplate.kBaseName")) baseNameText; textField baseNameField; symbolButton -image "navButtonBrowse.png" browser; setParent ..; setParent ..; setParent ..; setUITemplate -ppt; setParent ..; AEbaseNameReplace( $baseName ); } global proc AEbaseNameReplace(string $baseName) { string $buffer[]; tokenize($baseName, ".", $buffer); string $nodeName = $buffer[0]; // Filename Attribute // connectControl -fileName baseNameField $baseName; string $command = "AEassignCacheFileCB " + " " + $baseName; button -e -c ("AEcacheFileBrowser \"" + $command + "\" " + $nodeName ) browser; } global proc AEcacheInfoNew(string $cacheName) { frameLayout -label (uiRes("m_AEcacheFileTemplate.kCacheDescription")) -lv true -bv true -collapsable true -collapse false cacheInfoLayout; string $xmlInfo[] = `cacheFile -q -cacheInfo $cacheName`; setUITemplate -pst attributeEditorTemplate; columnLayout -adj true; text -label (uiRes("m_AEcacheFileTemplate.kCacheDescriptionInfo")); iconTextScrollList -height 80 -editable off cacheXmlInfoList; for ($item in $xmlInfo) { iconTextScrollList -e -append $item cacheXmlInfoList; } setParent ..; setParent ..; setUITemplate -ppt; setParent ..; AEcacheInfoReplace( $cacheName ); } global proc AEcacheInfoReplace(string $cacheName) { string $xmlInfo[] = `cacheFile -q -cacheInfo $cacheName`; iconTextScrollList -e -removeAll cacheXmlInfoList; for ($item in $xmlInfo) { iconTextScrollList -e -append $item cacheXmlInfoList; } } global proc AEcacheFileTemplate ( string $nodeName ) { editorTemplate -beginScrollLayout; editorTemplate -callCustom AEcachePathNew AEcachePathReplace cachePath; editorTemplate -callCustom AEbaseNameNew AEbaseNameReplace cacheName; editorTemplate -addControl "enable"; editorTemplate -addControl "startFrame"; editorTemplate -addControl "scale"; editorTemplate -addControl "hold"; editorTemplate -addControl "preCycle"; editorTemplate -addControl "postCycle"; editorTemplate -addControl "sourceStart"; editorTemplate -addControl "sourceEnd"; editorTemplate -addControl "originalStart"; editorTemplate -addControl "originalEnd"; editorTemplate -addControl "reverse"; editorTemplate -addControl "oscillate"; editorTemplate -addControl "multiThread"; editorTemplate -label (uiRes("m_AEcacheFileTemplate.kCacheQueueSize")) -addControl "memQueueSize"; editorTemplate -addControl "displayLoadProgress"; editorTemplate -addControl "format"; editorTemplate -callCustom AEcacheInfoNew AEcacheInfoReplace channel; AEdependNodeTemplate $nodeName; editorTemplate -suppress "track"; editorTemplate -suppress "trackState"; editorTemplate -suppress "start"; editorTemplate -suppress "end"; editorTemplate -suppress "cacheWeights"; editorTemplate -suppress "perPtWeights"; editorTemplate -suppress "channelName"; editorTemplate -suppress "inRange"; editorTemplate -addExtraControls; editorTemplate -endScrollLayout; }