// =========================================================================== // 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. // =========================================================================== global proc jasperSelectInfluence(string $jasperCommand, string $influence) // // Find all the selected skinCluster (not just the active one) // nodes that are influenced by $influence and connect the message // attribute from the $influence transform to the .ptt attribute of the // skinCluster node. // { global string $CurrentSkinPaintInfluence; if (`treeView -q -exists skinClusterInflList`) { string $ann = `treeView -q -ann skinClusterInflList`; if ($ann == "shortNames") { $influence = influenceNameFromShortName($influence); } } string $connections[]; string $connection; string $buffer[]; string $cmd = ($jasperCommand + " -q -dns `currentCtx`"); int $size = `eval $cmd`; if ($size != 0) { // If selection mode is set to dependency node // $cmd = ($jasperCommand + " -q -dnn `currentCtx`"); string $name = `eval $cmd`; tokenize( $name, "|", $buffer); } $CurrentSkinPaintInfluence = $influence; // print("Setting current influence to " + $influence + "\n"); for( $i = 0; $i < $size; $i++ ) { string $skinClusterName; $skinClusterName = $buffer[$i]; if (size($skinClusterName) == 0) continue; // find if the skinCluster node is connected to the given // influence // int $foundConnection = false; $connections = `listConnections ($skinClusterName+".matrix")`; for ($connection in $connections) if ($connection == $influence) { $foundConnection = true; break; } // Delete any existing connection to the .ptt attribute of the // skinCluster // $connections = `listConnections $skinClusterName`; for( $connection in $connections ) if ($connection != "") { if (isConnected(($connection+".message"),($skinClusterName+".ptt"))) { disconnectAttr(($connection+".message"), ($skinClusterName+".ptt")); hilite -u $connection; } } // Connect $influence to the skinCluster node // if ($foundConnection && size($influence) != 0) { connectAttr ($influence+".message") ($skinClusterName+".ptt"); hilite $influence; // print("Connecting node : "+$skinClusterName+ " to " + $influence+"\n"); } } }