// =========================================================================== // 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. // =========================================================================== // // Description: // This script provides high level operations used by // various forms of baking using various renderers. // global proc string getBakeSetOfNode( string $node, int $skipInitialSets ) { string $initialBakeSet; string $bakeSetType; if( `optionVar -query v_mrBakeTo` == "Texture" ) { $initialBakeSet = "initialTextureBakeSet"; $bakeSetType = "textureBakeSet"; } else { $initialBakeSet = "initialVertexBakeSet"; $bakeSetType = "vertexBakeSet"; } string $sets[] = `listSets -ets -o $node`; int $numSets = size( $sets ); if( $numSets > 0 ) { string $set; for( $set in $sets ) { if( `nodeType $set` == $bakeSetType ) { // An object can be in an initialBakeSet either // explicitly or implicitly (by not being a member // of any bake set). This is the explicit case. if( ($set == $initialBakeSet) && $skipInitialSets ) continue; return $set; } } } // If we're here, it means the object is not explicitly // in any bake set of the relevant kind. if( ! $skipInitialSets ) { // An object can be in an initialBakeSet either // explicitly or implicitly (by not being a member // of any bake set). This is the implicit case. // // The relationship becomes explicit immediately, // so that the user can see and navigate the // relationship in the UI. string $shapes[] = `ls -dag -objectsOnly -geometry $node`; sets -add $initialBakeSet $shapes; return $initialBakeSet; } return ""; } global proc string getBakeSetFileFormatSuffix( string $bakeSet ) { int $formatNum = `getAttr ($bakeSet + ".fileFormat")`; if ($formatNum == 1) return "tif"; else if ($formatNum == 2) return "iff"; else if ($formatNum == 3) return "jpg"; else if ($formatNum == 4) return "rgb"; else if ($formatNum == 5) return "rla"; else if ($formatNum == 6) return "tga"; else if ($formatNum == 7) return "bmp"; else if ($formatNum == 8) return "als"; else if ($formatNum == 9) return "gif"; else if ($formatNum == 10) return "pic"; else if ($formatNum == 11) return "sgi"; else if ($formatNum == 12) return "png"; else if ($formatNum == 13) return "psd"; // Photoshop else if ($formatNum == 14) return "pntg"; // MacPaint // Some file formats are still suported but are now unavailable // in the UI. Quantel is no longer supported. (BUG 163640) return "iff"; }