// =========================================================================== // 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: // updateFileNodeSwatch // // Description: // Cause swatch refresh on file nodes // global proc updateFileNodeSwatch(string $nodeName) { string $nodeList[] = stringArrayCatenate( {$nodeName}, `hyperShade -listUpstreamNodes $nodeName`); // updateFileNodeSwatch is a bit misleading now since we can also force update // other swatches. However, to keep backward compability we leave this procedure name unchanged. renderThumbnailUpdate -forceUpdate $nodeName; for ($node in $nodeList) { string $type = `nodeType $node`; if ($type == "file" || $type == "psdFileTex") { // flag swatch as requiring regeneration setAttr ($node + ".forceSwatchGen") true; // force refresh of swatch up to material and shading engine, being // careful not clobber the file name pattern string $currName = `getAttr ($node + ".fileTextureName")`; string $currPattern = `getAttr ($node + ".fileTextureNamePattern")`; if ($currName == $currPattern || size($currPattern) == 0) { setAttr -type "string" ($node + ".fileTextureName") $currName; } else { setAttr -type "string" ($node + ".fileTextureNamePattern") $currPattern; } } } }