// =========================================================================== // 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. // =========================================================================== // // // // // // doPublishNode(int $version, string $args[]) // // // None // // // Publish or unpublish the selected node to its container (asset). // Publishing is done so that the node will appear in the UI and be // selectable even when the asset is black boxed. // // // int $version: script version, indicates how to interpret the $args array // string $args[]: for $version == 1, $args[0] = whether or not to bind // // // // publish the selected node // doPublishNode(1,{1}); // // global proc doPublishNode( int $version, string $args[] ) { int $publish = $args[0]; string $sel[] = `ls -sl`; int $numSel = size($sel); if ( $numSel > 1 ){ error( (uiRes("m_doPublishNode.kTooManyNodes"))); } else if ($numSel == 0) { error( (uiRes("m_doPublishNode.kSelectNode"))); } string $node = $sel[0]; string $container = `container -q -fc $node`; if( $container == "" ){ // A node was selected, but it's not in a container // error( (uiRes("m_doPublishNode.kNotInAsset")) ); } if ($publish) { if ( !`exists publishNodeNamePrompt`) { eval("source \"AEcontainerMain.mel\""); } publishNodeNamePrompt($container); } else { if ( !`exists doNodePublish`) { eval("source \"AEcontainerMain.mel\""); } string $bound[] = `containerPublish -q -bindNode $container`; int $bsize = size($bound); int $foundIt = 0; for ($ii = 0; $ii < $bsize; $ii++) { if ($bound[$ii+1] == $sel[0]) { doNodePublish($bound[$ii],$container,0); $foundIt = 1; break; } } if ($foundIt == 0) { print((uiRes("m_doPublishNode.kNotPublished"))); } } }