// =========================================================================== // 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 procedure will set the right values and bind it to the right attribute // // Input Arguments: // The UI control name that will be used // The name of the plug for the attribute // The changed command to use // global proc AEreplaceBool( string $controlName, string $plugName, string $changedCommand ) { int $index = 2; string $node = `plugNode $plugName`; string $buffer[]; tokenize($plugName, ".",$buffer); int $bufferSize = `size($buffer)`; if( $bufferSize > 1 ) { string $attr = $buffer[size($buffer) - 1]; clear($buffer); tokenize($attr, "[",$buffer); if( $bufferSize > 1 ) $attr = $buffer[0]; if(`attributeQuery -node $node -multi $attr`) { $index = 1; } } connectControl -in $index $controlName $plugName; if ($changedCommand != "") { // create a new scriptJob for this attribute string $cmd = $changedCommand + " \"" + $node + "\""; scriptJob -p $controlName -rp -ac $plugName $cmd; } }